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"
40 PXR_NAMESPACE_OPEN_SCOPE
98 HgiTextureHandleVector
const& textures);
111 HgiBlendFactor srcColorBlendFactor,
112 HgiBlendFactor dstColorBlendFactor,
113 HgiBlendOp colorBlendOp,
114 HgiBlendFactor srcAlphaBlendFactor,
115 HgiBlendFactor dstAlphaBlendFactor,
116 HgiBlendOp alphaBlendOp);
129 void Draw(HgiTextureHandle
const& colorDst,
130 HgiTextureHandle
const& depthDst);
133 HdxFullscreenShader() =
delete;
135 using TextureMap = std::map<TfToken, HgiTextureHandle>;
136 using BufferMap = std::map<uint32_t, HgiBufferHandle>;
139 void _CreateBufferResources();
142 void _DestroyShaderProgram();
145 bool _CreateResourceBindings(TextureMap
const& textures);
148 void _CreateVertexBufferDescriptor();
151 bool _CreatePipeline(
152 HgiTextureHandle
const& colorDst,
153 HgiTextureHandle
const& depthDst,
157 bool _CreateSampler();
160 void _Draw(TextureMap
const& textures,
161 HgiTextureHandle
const& colorDst,
162 HgiTextureHandle
const& depthDst,
168 void _PrintCompileErrors();
172 std::string _debugName;
174 TextureMap _textures;
190 bool _blendingEnabled;
191 HgiBlendFactor _srcColorBlendFactor;
192 HgiBlendFactor _dstColorBlendFactor;
193 HgiBlendOp _colorBlendOp;
194 HgiBlendFactor _srcAlphaBlendFactor;
195 HgiBlendFactor _dstAlphaBlendFactor;
196 HgiBlendOp _alphaBlendOp;
201 std::vector<uint8_t> _constantsData;
204 PXR_NAMESPACE_CLOSE_SCOPE
206 #endif // PXR_IMAGING_HDX_FULLSCREENSHADER_H
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).