Berserk
Public Member Functions | List of all members
GLShader Class Referencefinal

GL Shader (compiled and linked) native program. More...

#include <GLShader.hpp>

Inheritance diagram for GLShader:
Inheritance graph
[legend]
Collaboration diagram for GLShader:
Collaboration graph
[legend]

Public Member Functions

BRK_API GLShader (const RHIShaderDesc &desc)
 
BRK_API ~GLShader () override
 
BRK_API Status GetCompilationStatus () const override
 
BRK_API String GetCompilerMessage () const override
 
BRK_API Ref< const RHIShaderMetaGetShaderMeta () const override
 
BRK_API void Initialize ()
 
BRK_API bool ValidateStages () const
 
BRK_API void InitializeMeta ()
 
BRK_API void BindUniformBlock (uint32 binding) const
 
BRK_API void Use () const
 
GLuint GetHandle () const
 
- Public Member Functions inherited from RHIShader
BRK_API ~RHIShader () override=default
 
const StringNameGetShaderName () const
 
RHIShaderLanguage GetLanguage () const
 
const std::vector< RHIShaderStageDesc > & GetStages () const
 
- Public Member Functions inherited from RHIResource
BRK_API ~RHIResource () override=default
 
- Public Member Functions inherited from RefCnt
virtual ~RefCnt ()
 
bool IsUnique () const
 
std::int32_t GetRefs () const
 
std::int32_t AddRef () const
 
std::int32_t RelRef () const
 

Additional Inherited Members

- Public Types inherited from RHIShader
enum class  Status : uint32 { PendingCompilation = 0 , Compiled = 1 , FailedCompile = 2 }
 Program may have different status (incorrect shaders mush not crash the application) More...
 
- Protected Member Functions inherited from RHIResource
void Destroy () const override
 
- Protected Attributes inherited from RHIShader
StringName mName
 
RHIShaderLanguage mLanguage
 
std::vector< RHIShaderStageDescmStages
 

Detailed Description

GL Shader (compiled and linked) native program.

Constructor & Destructor Documentation

◆ GLShader()

BRK_NS_BEGIN GLShader::GLShader ( const RHIShaderDesc desc)
explicit

◆ ~GLShader()

GLShader::~GLShader ( )
override

Member Function Documentation

◆ BindUniformBlock()

void GLShader::BindUniformBlock ( uint32  binding) const

◆ GetCompilationStatus()

RHIShader::Status GLShader::GetCompilationStatus ( ) const
overridevirtual

Check program status: whether the program was compiled and all stages linked by RHI.

Note
An attempt to bind not-compiled program will cause abort in debug mode.
It is safe to call this function from any thread.
Returns
Compilation status of the program

Implements RHIShader.

◆ GetCompilerMessage()

String GLShader::GetCompilerMessage ( ) const
overridevirtual

Get compiler message about this program compilation. If compilation finished with an error returns error description, otherwise nothing.

Note
It is safe to call this function from any thread.
Returns
Error message about this program compilation

Implements RHIShader.

◆ GetHandle()

GLuint GLShader::GetHandle ( ) const
inline

◆ GetShaderMeta()

Ref< const RHIShaderMeta > GLShader::GetShaderMeta ( ) const
overridevirtual

Get compiled program meta information for params & buffers communication.

Note
For PendingCompilation or FailedCompile is not valid function call.
It is safe to call this function from any thread.
Returns
Reference to program meta info if present

Implements RHIShader.

◆ Initialize()

void GLShader::Initialize ( )

◆ InitializeMeta()

void GLShader::InitializeMeta ( )

Meta name is the same as program has

◆ Use()

void GLShader::Use ( ) const

◆ ValidateStages()

bool GLShader::ValidateStages ( ) const

The documentation for this class was generated from the following files: