HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HdxFullscreenShader Class Reference

#include <fullscreenShader.h>

Public Member Functions

HDX_API HdxFullscreenShader (Hgi *hgi, std::string const &debugName)
 
HDX_API ~HdxFullscreenShader ()
 Destroy the fullscreen shader object, releasing GPU resources. More...
 
HDX_API void SetProgram (TfToken const &glslfx, TfToken const &technique)
 
HDX_API void BindBuffer (HgiBufferHandle const &buffer, uint32_t bindingIndex)
 
HDX_API void BindTextures (TfTokenVector const &names, HgiTextureHandleVector const &textures)
 
HDX_API void SetDepthState (HgiDepthStencilState const &state)
 
HDX_API void SetBlendState (bool enableBlending, HgiBlendFactor srcColorBlendFactor, HgiBlendFactor dstColorBlendFactor, HgiBlendOp colorBlendOp, HgiBlendFactor srcAlphaBlendFactor, HgiBlendFactor dstAlphaBlendFactor, HgiBlendOp alphaBlendOp)
 
HDX_API void Draw (HgiTextureHandle const &colorDst, HgiTextureHandle const &depthDst)
 

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 49 of file fullscreenShader.h.

Constructor & Destructor Documentation

HDX_API HdxFullscreenShader::HdxFullscreenShader ( Hgi hgi,
std::string const 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.

HDX_API HdxFullscreenShader::~HdxFullscreenShader ( )

Destroy the fullscreen shader object, releasing GPU resources.

Member Function Documentation

HDX_API void HdxFullscreenShader::BindBuffer ( HgiBufferHandle const buffer,
uint32_t  bindingIndex 
)

Bind a (externally managed) buffer to the shader program. This function can be used to bind buffers to a custom shader program. The lifetime of the buffer 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. If an invalid 'buffer' is passed, the binding will be cleared.

HDX_API void HdxFullscreenShader::BindTextures ( TfTokenVector const names,
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. If an invalid 'texture' is passed, the binding will be cleared.

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::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 ( TfToken const glslfx,
TfToken const technique 
)

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 a varying called "uv", and whatever textures or uniforms have been passed in by the caller.

Parameters
glslfxThe name of the glslfx file where the fragment shader is located.
techniqueThe technique name of the fragment shader.

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