Loading...
Searching...
No Matches
HgiGLShaderProgram Class Referencefinal

OpenGL implementation of HgiShaderProgram. More...

#include <shaderProgram.h>

+ Inheritance diagram for HgiGLShaderProgram:

Public Member Functions

HGIGL_API bool IsValid () const override
 Returns false if any shader compile errors occured.
 
HGIGL_API std::string const & GetCompileErrors () override
 Returns shader compile errors.
 
HGIGL_API HgiShaderFunctionHandleVector const & GetShaderFunctions () const override
 Returns the shader functions that are part of this program.
 
HGIGL_API size_t GetByteSizeOfResource () const override
 Returns the byte size of the GPU shader program.
 
HGIGL_API uint64_t GetRawResource () const override
 This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.
 
HGIGL_API uint32_t GetProgramId () const
 Returns the gl resource id of the program.
 
HGIGL_API uint32_t GetUniformBuffer (size_t sizeHint)
 Returns the gl resource for the uniform block of this shader program.
 
- Public Member Functions inherited from HgiShaderProgram
HGI_API HgiShaderProgramDesc const & GetDescriptor () const
 The descriptor describes the object.
 
virtual HGI_API bool IsValid () const =0
 Returns false if any shader compile errors occured.
 
virtual HGI_API std::string const & GetCompileErrors ()=0
 Returns shader compile errors.
 
virtual HGI_API HgiShaderFunctionHandleVector const & GetShaderFunctions () const =0
 Returns the shader functions that are part of this program.
 
virtual HGI_API size_t GetByteSizeOfResource () const =0
 Returns the byte size of the GPU shader program.
 
virtual HGI_API uint64_t GetRawResource () const =0
 This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.
 

Protected Member Functions

HGIGL_API HgiGLShaderProgram (HgiShaderProgramDesc const &desc)
 
- Protected Member Functions inherited from HgiShaderProgram
HGI_API HgiShaderProgram (HgiShaderProgramDesc const &desc)
 

Friends

class HgiGL
 

Additional Inherited Members

- Protected Attributes inherited from HgiShaderProgram
HgiShaderProgramDesc _descriptor
 

Detailed Description

OpenGL implementation of HgiShaderProgram.

Definition at line 42 of file shaderProgram.h.

Member Function Documentation

◆ GetByteSizeOfResource()

HGIGL_API size_t GetByteSizeOfResource ( ) const
overridevirtual

Returns the byte size of the GPU shader program.

APIs that do not have programs can return the combined byte size of the shader functions used by the program. This can be helpful if the application wishes to tally up memory usage.

Implements HgiShaderProgram.

◆ GetCompileErrors()

HGIGL_API std::string const & GetCompileErrors ( )
overridevirtual

Returns shader compile errors.

Implements HgiShaderProgram.

◆ GetProgramId()

HGIGL_API uint32_t GetProgramId ( ) const

Returns the gl resource id of the program.

◆ GetRawResource()

HGIGL_API uint64_t GetRawResource ( ) const
overridevirtual

This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.

Clients should avoid using this function and instead use Hgi base classes so that client code works with any Hgi platform. For transitioning code to Hgi, it can however we useful to directly access a platform's internal resource handles. There is no safety provided in using this. If you by accident pass a HgiMetal resource into an OpenGL call, bad things may happen. In OpenGL this returns the GLuint resource name. In Metal, Vulkan this returns 0.

Implements HgiShaderProgram.

◆ GetShaderFunctions()

HGIGL_API HgiShaderFunctionHandleVector const & GetShaderFunctions ( ) const
overridevirtual

Returns the shader functions that are part of this program.

Implements HgiShaderProgram.

◆ GetUniformBuffer()

HGIGL_API uint32_t GetUniformBuffer ( size_t  sizeHint)

Returns the gl resource for the uniform block of this shader program.

This uniform block is used to store some per-shader values, such as indices or offsets into other buffers. See also Hgi::SetConstantValues. 'sizeHint' is used to store the byte size of the uniform buffer, but this fn does not actually allocate the data storage for the buffer.

◆ IsValid()

HGIGL_API bool IsValid ( ) const
overridevirtual

Returns false if any shader compile errors occured.

Implements HgiShaderProgram.

Friends And Related Function Documentation

◆ HgiGL

friend class HgiGL
friend

Definition at line 77 of file shaderProgram.h.


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