A scene-based SurfaceShader object. More...
HdShader Virtual Interface // | |
HDST_API std::string | GetSource (TfToken const &shaderStageKey) const override |
Returns the shader source provided by this shader for shaderStageKey. More... | |
HDST_API HdSt_MaterialParamVector const & | GetParams () const override |
Returns the shader parameters for this shader. More... | |
HDST_API void | SetEnabledPrimvarFiltering (bool enabled) |
HDST_API bool | IsEnabledPrimvarFiltering () const override |
Returns whether primvar filtering is enabled for this shader. More... | |
HDST_API TfTokenVector const & | GetPrimvarNames () const override |
Returns the names of primvar that are used by this shader. More... | |
HDST_API HdBufferArrayRangeSharedPtr const & | GetShaderData () const override |
Returns a buffer which stores parameter fallback values and texture handles. More... | |
HDST_API NamedTextureHandleVector const & | GetNamedTextureHandles () const override |
Textures that need to be bound for this shader. More... | |
HDST_API void | BindResources (int program, HdSt_ResourceBinder const &binder, HdRenderPassState const &state) override |
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... | |
HDST_API void | UnbindResources (int program, HdSt_ResourceBinder const &binder, HdRenderPassState const &state) override |
Unbinds shader-specific resources. More... | |
HDST_API void | AddBindings (HdBindingRequestVector *customBindings) override |
Add custom bindings (used by codegen) More... | |
HDST_API ID | ComputeHash () const override |
Returns the hash value of the shader code and configuration. More... | |
HDST_API ID | ComputeTextureSourceHash () const override |
Returns the hash value of the paths of the texture prims consumed by this shader. More... | |
HDST_API TfToken | GetMaterialTag () const override |
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... | |
HDST_API void | SetFragmentSource (const std::string &source) |
Setter method for prim. More... | |
HDST_API void | SetGeometrySource (const std::string &source) |
HDST_API void | SetParams (const HdSt_MaterialParamVector ¶ms) |
HDST_API void | SetNamedTextureHandles (const NamedTextureHandleVector &) |
HDST_API void | SetBufferSources (HdBufferSpecVector const &bufferSpecs, HdBufferSourceSharedPtrVector &&bufferSources, HdStResourceRegistrySharedPtr const &resourceRegistry) |
HDST_API void | AddResourcesFromTextures (ResourceContext &ctx) const override |
Called after textures have been committed. More... | |
HDST_API void | SetMaterialTag (TfToken const &materialTag) |
virtual HDST_API void | Reload () |
If the prim is based on asset, reload that asset. More... | |
static HDST_API bool | CanAggregate (HdStShaderCodeSharedPtr const &shaderA, HdStShaderCodeSharedPtr const &shaderB) |
Returns if the two shaders can be aggregated into the same draw batch. More... | |
static HDST_API void | AddFallbackValueToSpecsAndSources (const HdSt_MaterialParam ¶m, HdBufferSpecVector *const specs, HdBufferSourceSharedPtrVector *const sources) |
Adds the fallback value of the given material param to buffer specs and sources using the param's name. More... | |
HDST_API void | _SetSource (TfToken const &shaderStageKey, std::string const &source) |
HDST_API ID | _ComputeHash () const |
HDST_API ID | _ComputeTextureSourceHash () const |
Additional Inherited Members | |
Public Types inherited from HdStShaderCode | |
typedef size_t | ID |
using | NamedTextureHandleVector = std::vector< NamedTextureHandle > |
Public Member Functions inherited from HdStShaderCode | |
Static Public Member Functions inherited from HdStShaderCode | |
static HDST_API ID | ComputeHash (HdStShaderCodeSharedPtrVector const &shaders) |
Returns the combined hash values of multiple shaders. More... | |
A scene-based SurfaceShader object.
When surface shaders are expresed in the scene graph, the HdSceneDelegate can use this object to express these surface shaders in Storm. In addition to the shader itself, a binding from the Rprim to the SurfaceShader must be expressed as well.
Definition at line 61 of file surfaceShader.h.
|
overridevirtual |
Add custom bindings (used by codegen)
Implements HdStShaderCode.
|
static |
Adds the fallback value of the given material param to buffer specs and sources using the param's name.
|
overridevirtual |
Called after textures have been committed.
Shader can return buffer sources for different BARs (most likely, the shader bar) that require texture metadata such as the bindless texture handle which is only available after the commit.
Reimplemented from HdStShaderCode.
|
overridevirtual |
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.
Implements HdStShaderCode.
|
static |
Returns if the two shaders can be aggregated into the same draw batch.
|
overridevirtual |
Returns the hash value of the shader code and configuration.
It is computed from the the GLSL code as well as the resource signature of the shader (as determined from its parameters). If two shaders have the same hash, the GLSL code as expanded by codegen should also be the same.
Implements HdStShaderCode.
|
overridevirtual |
Returns the hash value of the paths of the texture prims consumed by this shader.
Unless textures are bindless, shaders using different textures cannot be used in the same draw batch. Since textures can be animated, it can happen that two texture prims use the same texture at some time but different textures at other times. To avoid re-computing the draw batches over time, we use the this hash when grouping the draw batches.
Reimplemented from HdStShaderCode.
|
overridevirtual |
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 from HdStShaderCode.
|
overridevirtual |
Textures that need to be bound for this shader.
Reimplemented from HdStShaderCode.
|
overridevirtual |
Returns the shader parameters for this shader.
Reimplemented from HdStShaderCode.
|
overridevirtual |
Returns the names of primvar that are used by this shader.
Reimplemented from HdStShaderCode.
|
overridevirtual |
Returns a buffer which stores parameter fallback values and texture handles.
Reimplemented from HdStShaderCode.
|
overridevirtual |
Returns the shader source provided by this shader for shaderStageKey.
Implements HdStShaderCode.
|
overridevirtual |
Returns whether primvar filtering is enabled for this shader.
Reimplemented from HdStShaderCode.
|
virtual |
If the prim is based on asset, reload that asset.
HDST_API void SetFragmentSource | ( | const std::string & | source | ) |
Setter method for prim.
|
overridevirtual |
Unbinds shader-specific resources.
Implements HdStShaderCode.