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);
123 HgiAttachmentLoadOp attachmentLoadOp,
124 HgiAttachmentStoreOp attachmentStoreOp);
137 void Draw(HgiTextureHandle
const& colorDst,
138 HgiTextureHandle
const& depthDst);
141 void Draw(HgiTextureHandle
const& colorDst,
142 HgiTextureHandle
const& colorResolveDst,
143 HgiTextureHandle
const& depthDst,
144 HgiTextureHandle
const& depthResolveDst,
150 using TextureMap = std::map<TfToken, HgiTextureHandle>;
151 using BufferMap = std::map<uint32_t, HgiBufferHandle>;
154 void _CreateBufferResources();
157 void _DestroyShaderProgram();
160 bool _CreateResourceBindings(TextureMap
const& textures);
163 void _CreateVertexBufferDescriptor();
166 bool _CreatePipeline(
167 HgiTextureHandle
const& colorDst,
168 HgiTextureHandle
const& depthDst,
172 bool _CreateSampler();
176 TextureMap
const& textures,
177 HgiTextureHandle
const& colorDst,
178 HgiTextureHandle
const& colorResolveDst,
179 HgiTextureHandle
const& depthDst,
180 HgiTextureHandle
const& depthResolveDst,
187 void _PrintCompileErrors();
191 std::string _debugName;
193 TextureMap _textures;
209 bool _blendingEnabled;
210 HgiBlendFactor _srcColorBlendFactor;
211 HgiBlendFactor _dstColorBlendFactor;
212 HgiBlendOp _colorBlendOp;
213 HgiBlendFactor _srcAlphaBlendFactor;
214 HgiBlendFactor _dstAlphaBlendFactor;
215 HgiBlendOp _alphaBlendOp;
217 HgiAttachmentLoadOp _attachmentLoadOp;
218 HgiAttachmentStoreOp _attachmentStoreOp;
223 std::vector<uint8_t> _constantsData;
226 PXR_NAMESPACE_CLOSE_SCOPE
228 #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 SetAttachmentLoadStoreOp(HgiAttachmentLoadOp attachmentLoadOp, HgiAttachmentStoreOp attachmentStoreOp)
By default HdxFullscreenShader uses LoadOpDontCare and StoreOpStore.
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).