HDK
|
#include <fullscreenShader.h>
This class is a utility for rendering deep raytracer or aov output (color/depth) to a hgi texture. This lets callers composite results into existing scenes.
Definition at line 55 of file fullscreenShader.h.
HDX_API HdxFullscreenShader::HdxFullscreenShader | ( | Hgi * | hgi, |
const std::string & | debugName | ||
) |
Create a new fullscreen shader object. 'debugName' is assigned to the fullscreen pass as gpu debug group that is helpful when inspecting the frame on a gpu debugger.
|
override |
Destroy the fullscreen shader object, releasing GPU resources.
HDX_API void HdxFullscreenShader::BindBuffers | ( | HgiBufferHandleVector const & | buffers | ) |
Bind (externally managed) buffers to the shader program. This function can be used to bind buffers to a custom shader program. The lifetime of buffers is managed by the caller. HdxFullscreenShader does not take ownership. To update values in the buffer, the client can use a blitCmds to copy new data into their buffer. Buffers will be bound at the indices corresponding to their position in the provided vector.
HDX_API void HdxFullscreenShader::BindTextures | ( | HgiTextureHandleVector const & | textures | ) |
Bind (externally managed) textures to the shader program. This function can be used to bind textures to a custom shader program. The lifetime of textures is managed by the caller. HdxFullscreenShader does not take ownership. Textures will be bound at the indices corresponding to their position in the provided vector.
HDX_API void HdxFullscreenShader::Draw | ( | HgiTextureHandle const & | colorDst, |
HgiTextureHandle const & | depthDst | ||
) |
Draw the internal textures to the provided destination textures. depth
is optional.
HDX_API void HdxFullscreenShader::Draw | ( | HgiTextureHandle const & | colorDst, |
HgiTextureHandle const & | colorResolveDst, | ||
HgiTextureHandle const & | depthDst, | ||
HgiTextureHandle const & | depthResolveDst, | ||
GfVec4i const & | viewport | ||
) |
HDX_API void HdxFullscreenShader::SetAttachmentLoadStoreOp | ( | HgiAttachmentLoadOp | attachmentLoadOp, |
HgiAttachmentStoreOp | attachmentStoreOp | ||
) |
By default HdxFullscreenShader uses LoadOpDontCare and StoreOpStore. This function allows you to override the attachment load and store op.
HDX_API void HdxFullscreenShader::SetBlendState | ( | bool | enableBlending, |
HgiBlendFactor | srcColorBlendFactor, | ||
HgiBlendFactor | dstColorBlendFactor, | ||
HgiBlendOp | colorBlendOp, | ||
HgiBlendFactor | srcAlphaBlendFactor, | ||
HgiBlendFactor | dstAlphaBlendFactor, | ||
HgiBlendOp | alphaBlendOp | ||
) |
By default HdxFullscreenShader uses no blending (opaque). This function allows you to override blend state (e.g. alpha blending)
HDX_API void HdxFullscreenShader::SetDepthState | ( | HgiDepthStencilState const & | state | ) |
By default HdxFullscreenShader creates a pipeline object that enables depth testing and enables depth write if there is a depth texture. This function allows you to override the depth and stencil state.
HDX_API void HdxFullscreenShader::SetProgram | ( | const TfToken & | glslfxPath, |
const TfToken & | shaderName, | ||
HgiShaderFunctionDesc & | fragDesc | ||
) |
Set the program for the class to use for its fragment shader. The vertex shader is always hdx/shaders/fullscreen.glslfx, "FullScreenVertex", which draws a full-screen triangle. The fragment shader should expect an interpolated input parameter with the name "uvOut", and whatever textures, constants, or buffers it requires.
glslfxPath | The path to the glslfx file where the fragment shader is located. |
shaderName | The (technique) name of the fragment shader. |
fragDesc | Describes inputs, outputs and stage of fragment shader. |
HDX_API void HdxFullscreenShader::SetProgram | ( | const HgiShaderFunctionDesc & | fragDesc | ) |
Bypasses any cache checking or HioGlslfx processing and just re-creates the shader program using the "FullScreenVertex" shader and the provided fragment shader description.
Provide the shader constant values (uniforms). The data values are copied, so you do not have to set them each frame if they do not change in value.