All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HgiShaderFunction Class Referenceabstract

#include <shaderFunction.h>

+ Inheritance diagram for HgiShaderFunction:

Public Member Functions

virtual HGI_API ~HgiShaderFunction ()
HGI_API HgiShaderFunctionDesc
GetDescriptor () const
 The descriptor describes the object. More...
virtual HGI_API bool IsValid () const =0
 Returns false if any shader compile errors occured. More...
virtual HGI_API std::string constGetCompileErrors ()=0
 Returns shader compile errors. More...
virtual HGI_API size_t GetByteSizeOfResource () const =0
virtual HGI_API uint64_t GetRawResource () const =0

Protected Member Functions

HGI_API HgiShaderFunction (HgiShaderFunctionDesc const &desc)

Protected Attributes

HgiShaderFunctionDesc _descriptor

Detailed Description

Represents one shader stage function (code snippet).

ShaderFunctions are usually passed to a ShaderProgram, however be careful not to destroy the ShaderFunction after giving it to the program. While this may be safe for OpenGL after the program is created, it does not apply to other graphics backends, such as Vulkan, where the shader functions are used during rendering.

Definition at line 47 of file shaderFunction.h.

Constructor & Destructor Documentation

virtual HGI_API HgiShaderFunction::~HgiShaderFunction ( )
HGI_API HgiShaderFunction::HgiShaderFunction ( HgiShaderFunctionDesc const desc)

Member Function Documentation

virtual HGI_API size_t HgiShaderFunction::GetByteSizeOfResource ( ) const
pure virtual

Returns the byte size of the GPU shader function. This can be helpful if the application wishes to tally up memory usage.

Implemented in HgiGLShaderFunction.

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

Returns shader compile errors.

Implemented in HgiGLShaderFunction.

HGI_API HgiShaderFunctionDesc const& HgiShaderFunction::GetDescriptor ( ) const

The descriptor describes the object.

virtual HGI_API uint64_t HgiShaderFunction::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 this returns the id<MTLFunction> as uint64_t. In Vulkan this returns the VkShaderModule as uint64_t. In DX12 this returns the ID3D12Resource pointer as uint64_t.

Implemented in HgiGLShaderFunction.

virtual HGI_API bool HgiShaderFunction::IsValid ( ) const
pure virtual

Returns false if any shader compile errors occured.

Implemented in HgiGLShaderFunction.

Member Data Documentation

HgiShaderFunctionDesc HgiShaderFunction::_descriptor

Definition at line 88 of file shaderFunction.h.

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