24 #ifndef PXR_IMAGING_HD_ST_SHADER_CODE_H 25 #define PXR_IMAGING_HD_ST_SHADER_CODE_H 28 #include "pxr/imaging/hdSt/api.h" 29 #include "pxr/imaging/hdSt/resourceRegistry.h" 30 #include "pxr/imaging/hd/version.h" 31 #include "pxr/imaging/hd/enums.h" 33 #include "pxr/usd/sdf/path.h" 41 PXR_NAMESPACE_OPEN_SCOPE
44 using HdBindingRequestVector = std::vector<class HdBindingRequest>;
46 using HdStShaderCodeSharedPtr =
47 std::shared_ptr<class HdStShaderCode>;
48 using HdStShaderCodeSharedPtrVector =
49 std::vector<HdStShaderCodeSharedPtr>;
51 using HdSt_MaterialParamVector =
52 std::vector<class HdSt_MaterialParam>;
53 using HdBufferSourceSharedPtr =
54 std::shared_ptr<class HdBufferSource>;
55 using HdBufferSourceSharedPtrVector =
56 std::vector<HdBufferSourceSharedPtr>;
57 using HdBufferArrayRangeSharedPtr =
58 std::shared_ptr<class HdBufferArrayRange>;
59 using HdStTextureHandleSharedPtr =
60 std::shared_ptr<class HdStTextureHandle>;
61 using HdComputationSharedPtr =
62 std::shared_ptr<class HdComputation>;
65 class HdSt_ResourceBinder;
96 static ID
ComputeHash(HdStShaderCodeSharedPtrVector
const &shaders);
123 virtual HdSt_MaterialParamVector
const&
GetParams()
const;
160 using NamedTextureHandleVector = std::vector<NamedTextureHandle>;
173 virtual HdBufferArrayRangeSharedPtr
const&
GetShaderData()
const;
179 HdSt_ResourceBinder
const &binder) = 0;
183 HdSt_ResourceBinder
const &binder) = 0;
186 virtual void AddBindings(HdBindingRequestVector* customBindings) = 0;
203 void AddSource(HdBufferArrayRangeSharedPtr
const &range,
204 HdBufferSourceSharedPtr
const &source);
207 void AddSources(HdBufferArrayRangeSharedPtr
const &range,
208 HdBufferSourceSharedPtrVector &&sources);
211 void AddComputation(HdBufferArrayRangeSharedPtr
const &range,
212 HdComputationSharedPtr
const &computation,
213 HdStComputeQueue
const queue);
243 virtual HioGlslfx const * _GetGlslfx()
const;
247 PXR_NAMESPACE_CLOSE_SCOPE
249 #endif //HDST_SHADER_H virtual HDST_API HdSt_MaterialParamVector const & GetParams() const
Returns the shader parameters for this shader.
Information necessary to bind textures and create accessor for the texture.
virtual HDST_API void AddResourcesFromTextures(ResourceContext &ctx) const
This function is called after textures have been allocated and loaded to add buffer sources and compu...
A map with string keys and VtValue values.
virtual HDST_API HdBufferArrayRangeSharedPtr const & GetShaderData() const
Returns a buffer which stores parameter fallback values and texture handles.
virtual std::string GetSource(TfToken const &shaderStageKey) const =0
Returns the shader source provided by this shader for shaderStageKey.
HDST_API VtDictionary GetLayout(TfTokenVector const &shaderStageKeys) const
Returns the resource layout for the shader stages specified by shaderStageKeys.
HdTextureType type
Equal to handle->GetTextureObject()->GetTextureType().
virtual void AddBindings(HdBindingRequestVector *customBindings)=0
Add custom bindings (used by codegen)
TfToken name
Name by which the texture will be accessed, i.e., the name of the accesor for thexture will be HdGet_...
virtual HDST_API NamedTextureHandleVector const & GetNamedTextureHandles() const
Textures that need to be bound for this shader.
virtual void BindResources(int program, HdSt_ResourceBinder const &binder)=0
Binds shader-specific resources to program XXX: this interface is meant to be used for bridging the G...
virtual HDST_API TfTokenVector const & GetPrimvarNames() const
Returns the names of primvar that are used by this shader.
Token for efficient comparison, assignment, and hashing of known strings.
virtual ID ComputeTextureSourceHash() const
Returns the hash value of the paths of the texture prims consumed by this shader.
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 prim...
A central registry of all GPU resources.
std::vector< TfToken > TfTokenVector
Convenience types.
A base class representing the implementation (code) of a shader, used in conjunction with HdRenderPas...
A class representing the config and shader source of a glslfx file.
virtual HDST_API bool IsEnabledPrimvarFiltering() const
Returns whether primvar filtering is enabled for this shader.
virtual ID ComputeHash() const =0
Returns the hash value of the shader code and configuration.
The context available in implementations of AddResourcesFromTextures.
HdStTextureHandleSharedPtr handle
The texture.
virtual void UnbindResources(int program, HdSt_ResourceBinder const &binder)=0
Unbinds shader-specific resources.
size_t hash
A hash unique to the corresponding asset; used to split draw batches when not using bindless textures...
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...