24 #ifndef PXR_IMAGING_HDX_FULLSCREENSHADER_H 25 #define PXR_IMAGING_HDX_FULLSCREENSHADER_H 29 #include "pxr/imaging/hdx/api.h" 30 #include "pxr/imaging/hd/types.h" 32 #include "pxr/imaging/hgi/buffer.h" 33 #include "pxr/imaging/hgi/graphicsPipeline.h" 34 #include "pxr/imaging/hgi/resourceBindings.h" 35 #include "pxr/imaging/hgi/shaderProgram.h" 36 #include "pxr/imaging/hgi/texture.h" 41 PXR_NAMESPACE_OPEN_SCOPE
99 HgiTextureHandleVector
const& textures);
112 HgiBlendFactor srcColorBlendFactor,
113 HgiBlendFactor dstColorBlendFactor,
114 HgiBlendOp colorBlendOp,
115 HgiBlendFactor srcAlphaBlendFactor,
116 HgiBlendFactor dstAlphaBlendFactor,
117 HgiBlendOp alphaBlendOp);
130 void Draw(HgiTextureHandle
const& colorDst,
131 HgiTextureHandle
const& depthDst);
134 void Draw(HgiTextureHandle
const& colorDst,
135 HgiTextureHandle
const& colorResolveDst,
136 HgiTextureHandle
const& depthDst,
137 HgiTextureHandle
const& depthResolveDst,
143 using TextureMap = std::map<TfToken, HgiTextureHandle>;
144 using BufferMap = std::map<uint32_t, HgiBufferHandle>;
147 void _CreateBufferResources();
150 void _DestroyShaderProgram();
153 bool _CreateResourceBindings(TextureMap
const& textures);
156 void _CreateVertexBufferDescriptor();
159 bool _CreatePipeline(
160 HgiTextureHandle
const& colorDst,
161 HgiTextureHandle
const& depthDst,
165 bool _CreateSampler();
169 TextureMap
const& textures,
170 HgiTextureHandle
const& colorDst,
171 HgiTextureHandle
const& colorResolveDst,
172 HgiTextureHandle
const& depthDst,
173 HgiTextureHandle
const& depthResolveDst,
180 void _PrintCompileErrors();
184 std::string _debugName;
186 TextureMap _textures;
202 bool _blendingEnabled;
203 HgiBlendFactor _srcColorBlendFactor;
204 HgiBlendFactor _dstColorBlendFactor;
205 HgiBlendOp _colorBlendOp;
206 HgiBlendFactor _srcAlphaBlendFactor;
207 HgiBlendFactor _dstAlphaBlendFactor;
208 HgiBlendOp _alphaBlendOp;
213 std::vector<uint8_t> _constantsData;
216 PXR_NAMESPACE_CLOSE_SCOPE
218 #endif // PXR_IMAGING_HDX_FULLSCREENSHADER_H Basic type for a vector of 4 int components.
HDX_API void Draw(HgiTextureHandle const &colorDst, HgiTextureHandle const &depthDst)
Draw the internal textures to the provided destination textures.
Describes the properties of a framebuffer attachment.
HDX_API ~HdxFullscreenShader()
Destroy the fullscreen shader object, releasing GPU resources.
Token for efficient comparison, assignment, and hashing of known strings.
std::vector< TfToken > TfTokenVector
Convenience types.
HDX_API void BindTextures(TfTokenVector const &names, HgiTextureHandleVector const &textures)
Bind (externally managed) textures to the shader program.
HDX_API void BindBuffer(HgiBufferHandle const &buffer, uint32_t bindingIndex)
Bind a (externally managed) buffer to the shader program.
Hydra Graphics Interface.
HDX_API void SetShaderConstants(uint32_t byteSize, const void *data)
Provide the shader constant values (uniforms).
This class is a utility for rendering deep raytracer or aov output (color/depth) to a hgi texture.
HDX_API void SetDepthState(HgiDepthStencilState const &state)
By default HdxFullscreenShader creates a pipeline object that enables depth testing and enables depth...
Properties to configure depth and stencil test.
Describes the attributes of a vertex buffer.
Describes the properties needed to create a GPU shader function.
HDX_API void SetProgram(TfToken const &glslfx, TfToken const &shaderName, HgiShaderFunctionDesc &fragDesc, HgiShaderFunctionDesc vertDesc=GetFullScreenVertexDesc())
Set the program for the class to use for its fragment shader.
HDX_API void SetBlendState(bool enableBlending, HgiBlendFactor srcColorBlendFactor, HgiBlendFactor dstColorBlendFactor, HgiBlendOp colorBlendOp, HgiBlendFactor srcAlphaBlendFactor, HgiBlendFactor dstAlphaBlendFactor, HgiBlendOp alphaBlendOp)
By default HdxFullscreenShader uses no blending (opaque).