Loading...
Searching...
No Matches
HdxFullscreenShader Class Reference

This class is a utility for rendering deep raytracer or aov output (color/depth) to a hgi texture. More...

#include <fullscreenShader.h>

+ Inheritance diagram for HdxFullscreenShader:

Public Member Functions

HDX_API HdxFullscreenShader (Hgi *hgi, const std::string &debugName)
 Create a new fullscreen shader object.
 
HDX_API ~HdxFullscreenShader () override
 Destroy the fullscreen shader object, releasing GPU resources.
 
HDX_API void SetProgram (const TfToken &glslfxPath, const TfToken &shaderName, HgiShaderFunctionDesc &fragDesc)
 Set the program for the class to use for its fragment shader.
 
HDX_API void 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.
 
HDX_API void BindBuffers (HgiBufferHandleVector const &buffers)
 Bind (externally managed) buffers to the shader program.
 
HDX_API void BindTextures (HgiTextureHandleVector const &textures)
 Bind (externally managed) textures to the shader program.
 
HDX_API void 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.
 
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).
 
HDX_API void SetAttachmentLoadStoreOp (HgiAttachmentLoadOp attachmentLoadOp, HgiAttachmentStoreOp attachmentStoreOp)
 By default HdxFullscreenShader uses LoadOpDontCare and StoreOpStore.
 
HDX_API void SetShaderConstants (uint32_t byteSize, const void *data)
 Provide the shader constant values (uniforms).
 
HDX_API void Draw (HgiTextureHandle const &colorDst, HgiTextureHandle const &depthDst)
 Draw the internal textures to the provided destination textures.
 
HDX_API void Draw (HgiTextureHandle const &colorDst, HgiTextureHandle const &colorResolveDst, HgiTextureHandle const &depthDst, HgiTextureHandle const &depthResolveDst, GfVec4i const &viewport)
 

Additional Inherited Members

- Static Public Member Functions inherited from HdxEffectsShader
static void PrintCompileErrors (const HgiShaderFunctionHandle &shaderFn)
 
static void PrintCompileErrors (const HgiShaderProgramHandle &shaderProgram)
 
- Protected Member Functions inherited from HdxEffectsShader
 HdxEffectsShader (const HdxEffectsShader &)=delete
 
HdxEffectsShaderoperator= (const HdxEffectsShader &)=delete
 
HDX_API HdxEffectsShader (Hgi *hgi, const std::string &debugName)
 Create a new shader object.
 
HDX_API void _SetColorAttachments (const HgiAttachmentDescVector &colorAttachmentDescs)
 
HDX_API void _SetDepthAttachment (const HgiAttachmentDesc &depthAttachmentDesc)
 
HDX_API void _SetPrimitiveType (HgiPrimitiveType primitiveType)
 
HDX_API void _SetShaderProgram (const HgiShaderProgramHandle &shaderProgram)
 
HDX_API void _SetVertexBufferDescs (const HgiVertexBufferDescVector &vertexBufferDescs)
 
HDX_API void _SetDepthStencilState (const HgiDepthStencilState &depthStencilState)
 
HDX_API void _SetMultiSampleState (const HgiMultiSampleState &multiSampleState)
 
HDX_API void _SetRasterizationState (const HgiRasterizationState &rasterizationState)
 
HDX_API void _SetShaderConstants (uint32_t byteSize, const void *data, HgiShaderStage stageUsage)
 
HDX_API void _SetTextureBindings (const HgiTextureBindDescVector &textures)
 
HDX_API void _SetBufferBindings (const HgiBufferBindDescVector &buffers)
 
HDX_API void _CreateAndSubmitGraphicsCmds (const HgiTextureHandleVector &colorTextures, const HgiTextureHandleVector &colorResolveTextures, const HgiTextureHandle &depthTexture, const HgiTextureHandle &depthResolveTexture, const GfVec4i &viewport)
 
virtual HDX_API void _RecordDrawCmds ()=0
 
HDX_API void _DrawNonIndexed (const HgiBufferHandle &vertexBuffer, uint32_t vertexCount, uint32_t baseVertex, uint32_t instanceCount, uint32_t baseInstance)
 
HDX_API void _DrawIndexed (const HgiBufferHandle &vertexBuffer, const HgiBufferHandle &indexBuffer, uint32_t indexCount, uint32_t indexBufferByteOffset, uint32_t baseVertex, uint32_t instanceCount, uint32_t baseInstance)
 
HDX_API Hgi_GetHgi () const
 
HDX_API void _DestroyShaderProgram (HgiShaderProgramHandle *shaderProgram)
 
HDX_API const std::string & _GetDebugName () const
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ HdxFullscreenShader()

HDX_API 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.

◆ ~HdxFullscreenShader()

HDX_API ~HdxFullscreenShader ( )
override

Destroy the fullscreen shader object, releasing GPU resources.

Member Function Documentation

◆ BindBuffers()

HDX_API void 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.

◆ BindTextures()

HDX_API void 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.

◆ Draw()

HDX_API void Draw ( HgiTextureHandle const &  colorDst,
HgiTextureHandle const &  depthDst 
)

Draw the internal textures to the provided destination textures.

depth is optional.

◆ SetAttachmentLoadStoreOp()

HDX_API void SetAttachmentLoadStoreOp ( HgiAttachmentLoadOp  attachmentLoadOp,
HgiAttachmentStoreOp  attachmentStoreOp 
)

By default HdxFullscreenShader uses LoadOpDontCare and StoreOpStore.

This function allows you to override the attachment load and store op.

◆ SetBlendState()

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).

This function allows you to override blend state (e.g. alpha blending)

◆ SetDepthState()

HDX_API void 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.

◆ SetProgram() [1/2]

HDX_API void 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.

◆ SetProgram() [2/2]

HDX_API void 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.

Parameters
glslfxPathThe path to the glslfx file where the fragment shader is located.
shaderNameThe (technique) name of the fragment shader.
fragDescDescribes inputs, outputs and stage of fragment shader.

◆ SetShaderConstants()

HDX_API void SetShaderConstants ( uint32_t  byteSize,
const void *  data 
)

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.


The documentation for this class was generated from the following file: