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

A base class representing the implementation (code) of a shader, used in conjunction with HdRenderPass. More...

+ Inheritance diagram for HdStShaderCode:

Public Types

typedef size_t ID
 
typedef std::vector
< TextureDescriptor > 
TextureDescriptorVector
 

Public Member Functions

virtual ID ComputeHash () const =0
 Returns the hash value of this shader. More...
 
virtual std::string GetSource (TfToken const &shaderStageKey) const =0
 Returns the shader source provided by this shader for shaderStageKey. More...
 
virtual HDST_API
HdMaterialParamVector const & 
GetParams () const
 Returns the shader parameters for this shader. More...
 
virtual HDST_API bool IsEnabledPrimvarFiltering () const
 Returns whether primvar filtering is enabled for this shader. More...
 
virtual HDST_API TfTokenVector
const & 
GetPrimvarNames () const
 Returns the names of primvar that are used by this shader. More...
 
virtual HDST_API
TextureDescriptorVector 
GetTextures () const
 
virtual HDST_API
HdBufferArrayRangeSharedPtr
const & 
GetShaderData () const
 Returns a buffer which stores parameter fallback values and texture handles. More...
 
virtual void BindResources (int program, HdSt_ResourceBinder const &binder, HdRenderPassState const &state)=0
 Binds shader-specific resources to program XXX: this interface is meant to be used for bridging the GlfSimpleLightingContext mechanism, and not for generic use-cases. More...
 
virtual void UnbindResources (int program, HdSt_ResourceBinder const &binder, HdRenderPassState const &state)=0
 Unbinds shader-specific resources. More...
 
virtual void AddBindings (HdBindingRequestVector *customBindings)=0
 Add custom bindings (used by codegen) More...
 
virtual HDST_API TfToken GetMaterialTag () const
 Material tags can be set in the meta-data of a glslfx file to control what rprim collection that prims using this shader should go into. More...
 

Static Public Member Functions

static HDST_API ID ComputeHash (HdStShaderCodeSharedPtrVector const &shaders)
 Returns the combined hash values of multiple shaders. More...
 

Detailed Description

A base class representing the implementation (code) of a shader, used in conjunction with HdRenderPass.

This interface provides a simple way for clients to affect the composition of shading programs used for a render pass.

Definition at line 61 of file shaderCode.h.

Member Function Documentation

virtual void AddBindings ( HdBindingRequestVector *  customBindings)
pure virtual

Add custom bindings (used by codegen)

Implemented in HdStSurfaceShader, HdStComputeShader, HdxSimpleLightingShader, and HdStRenderPassShader.

virtual void BindResources ( int  program,
HdSt_ResourceBinder const &  binder,
HdRenderPassState const &  state 
)
pure virtual

Binds shader-specific resources to program XXX: this interface is meant to be used for bridging the GlfSimpleLightingContext mechanism, and not for generic use-cases.

Implemented in HdStSurfaceShader, HdStComputeShader, HdxSimpleLightingShader, and HdStRenderPassShader.

virtual ID ComputeHash ( ) const
pure virtual

Returns the hash value of this shader.

Implemented in HdStSurfaceShader, HdStComputeShader, HdxSimpleLightingShader, and HdStRenderPassShader.

static HDST_API ID ComputeHash ( HdStShaderCodeSharedPtrVector const &  shaders)
static

Returns the combined hash values of multiple shaders.

virtual HDST_API TfToken GetMaterialTag ( ) const
virtual

Material tags can be set in the meta-data of a glslfx file to control what rprim collection that prims using this shader should go into.

E.g. We can use it to split opaque and translucent prims into different collections. When no material tags are specified in the shader, a empty token is returned.

Reimplemented in HdStSurfaceShader.

virtual HDST_API HdMaterialParamVector const& GetParams ( ) const
virtual

Returns the shader parameters for this shader.

Reimplemented in HdxSimpleLightingShader, HdStSurfaceShader, HdStRenderPassShader, and HdStComputeShader.

virtual HDST_API TfTokenVector const& GetPrimvarNames ( ) const
virtual

Returns the names of primvar that are used by this shader.

Reimplemented in HdStSurfaceShader.

virtual HDST_API HdBufferArrayRangeSharedPtr const& GetShaderData ( ) const
virtual

Returns a buffer which stores parameter fallback values and texture handles.

Reimplemented in HdStSurfaceShader, and HdStComputeShader.

virtual std::string GetSource ( TfToken const &  shaderStageKey) const
pure virtual

Returns the shader source provided by this shader for shaderStageKey.

Implemented in HdStSurfaceShader, HdxSimpleLightingShader, HdStComputeShader, and HdStRenderPassShader.

virtual HDST_API bool IsEnabledPrimvarFiltering ( ) const
virtual

Returns whether primvar filtering is enabled for this shader.

Reimplemented in HdStSurfaceShader.

virtual void UnbindResources ( int  program,
HdSt_ResourceBinder const &  binder,
HdRenderPassState const &  state 
)
pure virtual

Unbinds shader-specific resources.

Implemented in HdStSurfaceShader, HdStComputeShader, HdxSimpleLightingShader, and HdStRenderPassShader.


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