24 #ifndef HDST_SURFACESHADER_H
25 #define HDST_SURFACESHADER_H
28 #include "pxr/imaging/hdSt/api.h"
29 #include "pxr/imaging/hd/version.h"
30 #include "pxr/imaging/hdSt/shaderCode.h"
31 #include "pxr/imaging/hd/bufferSource.h"
33 #include "pxr/imaging/garch/gl.h"
35 #include "pxr/usd/sdf/path.h"
37 #include "pxr/base/vt/value.h"
38 #include "pxr/base/tf/token.h"
40 #include <boost/shared_ptr.hpp>
44 PXR_NAMESPACE_OPEN_SCOPE
49 typedef boost::shared_ptr<class HdBufferArrayRange> HdBufferArrayRangeSharedPtr;
50 typedef boost::shared_ptr<class HdStSurfaceShader> HdStSurfaceShaderSharedPtr;
51 typedef boost::shared_ptr<class HdResourceRegistry> HdResourceRegistrySharedPtr;
66 virtual ~HdStSurfaceShader();
75 virtual HdMaterialParamVector
const&
GetParams()
const override;
77 virtual HdBufferArrayRangeSharedPtr
const&
GetShaderData()
const override;
79 virtual TextureDescriptorVector GetTextures()
const override;
81 virtual void BindResources(HdSt_ResourceBinder
const &binder,
int program)
84 virtual void UnbindResources(HdSt_ResourceBinder
const &binder,
int program)
87 virtual void AddBindings(HdBindingRequestVector *customBindings)
override;
99 void SetGeometrySource(
const std::string &source);
101 void SetParams(
const HdMaterialParamVector ¶ms);
103 void SetTextureDescriptors(
const TextureDescriptorVector &texDesc);
105 void SetBufferSources(HdBufferSourceVector &bufferSources,
106 HdResourceRegistrySharedPtr
const &resourceRegistry);
109 void SetMaterialTag(
TfToken const &materialTag);
117 void _SetSource(
TfToken const &shaderStageKey, std::string
const &source);
120 std::string _fragmentSource;
121 std::string _geometrySource;
124 HdMaterialParamVector _params;
125 HdBufferSpecVector _paramSpec;
126 HdBufferArrayRangeSharedPtr _paramArray;
128 TextureDescriptorVector _textureDescriptors;
133 HdStSurfaceShader(
const HdStSurfaceShader &) =
delete;
134 HdStSurfaceShader &operator =(
const HdStSurfaceShader &) =
delete;
138 PXR_NAMESPACE_CLOSE_SCOPE
140 #endif //HDST_SURFACESHADER_H
virtual HDST_API std::string GetSource(TfToken const &shaderStageKey) const override
Returns the shader source provided by this shader for shaderStageKey.
virtual HDST_API HdBufferArrayRangeSharedPtr const & GetShaderData() const override
Returns a buffer which stores parameter fallback values and texture handles.
virtual HDST_API void AddBindings(HdBindingRequestVector *customBindings) override
Add custom bindings (used by codegen)
virtual HDST_API void Reload()
If the prim is based on asset, reload that asset.
Token for efficient comparison, assignment, and hashing of known strings.
virtual 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 prim...
Adapter class providing data exchange with the client scene graph.
virtual HDST_API HdMaterialParamVector const & GetParams() const override
Returns the shader parameters for this shader.
A scene-based SurfaceShader object.
A base class representing the implementation (code) of a shader, used in conjunction with HdRenderPas...
HDST_API void SetFragmentSource(const std::string &source)
Setter method for prim.
virtual HDST_API void BindResources(HdSt_ResourceBinder const &binder, int program) override
Binds shader-specific resources to program XXX: this interface is meant to be used for bridging the G...
virtual HDST_API void UnbindResources(HdSt_ResourceBinder const &binder, int program) override
Unbinds shader-specific resources.
virtual HDST_API ID ComputeHash() const override
Returns the hash value of this shader.