Loading...
Searching...
No Matches
HgiShaderProgram Class Referenceabstract

Represents a collection of shader functions. More...

#include <shaderProgram.h>

+ Inheritance diagram for HgiShaderProgram:

Public Member Functions

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

HGI_API HgiShaderProgram (HgiShaderProgramDesc const &desc)
 

Protected Attributes

HgiShaderProgramDesc _descriptor
 

Detailed Description

Represents a collection of shader functions.

This object does not take ownership of the shader functions and does not destroy them automatically. The client must destroy the shader functions when the program is detroyed, because only the client knows if the shader functions are used by other shader programs.

Definition at line 80 of file shaderProgram.h.

Member Function Documentation

◆ GetByteSizeOfResource()

virtual HGI_API size_t GetByteSizeOfResource ( ) const
pure virtual

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.

Implemented in HgiGLShaderProgram.

◆ GetCompileErrors()

virtual HGI_API std::string const & GetCompileErrors ( )
pure virtual

Returns shader compile errors.

Implemented in HgiGLShaderProgram.

◆ GetDescriptor()

HGI_API HgiShaderProgramDesc const & GetDescriptor ( ) const

The descriptor describes the object.

◆ GetRawResource()

virtual HGI_API uint64_t GetRawResource ( ) const
pure virtual

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.

Implemented in HgiGLShaderProgram.

◆ GetShaderFunctions()

virtual HGI_API HgiShaderFunctionHandleVector const & GetShaderFunctions ( ) const
pure virtual

Returns the shader functions that are part of this program.

Implemented in HgiGLShaderProgram.

◆ IsValid()

virtual HGI_API bool IsValid ( ) const
pure virtual

Returns false if any shader compile errors occured.

Implemented in HgiGLShaderProgram.

Member Data Documentation

◆ _descriptor

HgiShaderProgramDesc _descriptor
protected

Definition at line 125 of file shaderProgram.h.


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