ezEngine Release 25.08
Loading...
Searching...
No Matches
ezGALRenderingSetup Struct Reference

This class sets up the render targets for a graphics pipeline, used by ezRenderContext::BeginRendering or ezGALCommandEncoder::BeginRendering. More...

#include <RenderTargetSetup.h>

Inheritance diagram for ezGALRenderingSetup:

Public Member Functions

void Reset ()
 Same as creating a new instance.
 
void DestroyAllAttachedViews ()
 Same as Reset, but destroys all attached views first.
 
Setup render targets
ezGALRenderingSetupSetColorTarget (ezUInt8 uiIndex, ezGALRenderTargetViewHandle hRenderTarget, ezEnum< ezGALRenderTargetLoadOp > loadOp={}, ezEnum< ezGALRenderTargetStoreOp > storeOp={})
 Sets the color render target at the given index. Note that you must set index 0 before you can call this with index 1 and so fourth. You can call the function for an already set index again as long as the format / size matches. If not set, the load and store operations default to 'Load' and 'Store' respectively.
 
ezGALRenderingSetupSetDepthStencilTarget (ezGALRenderTargetViewHandle hDSTarget, ezEnum< ezGALRenderTargetLoadOp > depthLoadOp={}, ezEnum< ezGALRenderTargetStoreOp > depthStoreOp={}, ezEnum< ezGALRenderTargetLoadOp > stencilLoadOp={}, ezEnum< ezGALRenderTargetStoreOp > stencilStoreOp={})
 Sets the depth / stencil render target. If not set, the load and store operations default to 'Load' and 'Store' respectively for both depth and stencil.
 
ezGALRenderingSetupSetClearColor (ezUInt8 uiIndex, const ezColor &color=ezColor(0, 0, 0, 0))
 Sets the clear color of the given render target and switches the load op to clear. Note that you first must have called SetColorTarget with the same uiIndex to be able to set the clear color.
 
ezGALRenderingSetupSetClearDepth (float fDepthClear=1.0f)
 Sets the clear depth value. Note that you first must have called SetDepthStencilTarget to be able to set the clear depth value.
 
ezGALRenderingSetupSetClearStencil (ezUInt8 uiStencilClear=0)
 Sets the clear depth value. Note that you first must have called SetDepthStencilTarget to be able to set the clear depth value.
 
Accessors
ezUInt8 GetColorTargetCount () const
 
const ezColorGetClearColor (ezUInt8 uiIndex) const
 Returns the clear color of the render target at the given index. Note that uiIndex must be less than GetColorTargetCount().
 
bool HasDepthStencilTarget () const
 
float GetClearDepth () const
 Returns the depth clear value. This call is only valid if HasDepthStencilTarget() returns true.
 
ezUInt8 GetClearStencil () const
 Returns the stencil clear value. This call is only valid if HasDepthStencilTarget() returns true.
 
const ezGALRenderPassDescriptorGetRenderPass () const
 Returns the render pass description. Used to create a render pass or feed into the creation of a graphics pipeline state object.
 
const ezGALFrameBufferDescriptorGetFrameBuffer () const
 Returns the frame buffer description. Used by the renderer to setup render targets.
 
- Public Member Functions inherited from ezHashableStruct< ezGALRenderingSetup >
 ezHashableStruct (const ezHashableStruct< ezGALRenderingSetup > &other)
 
void operator= (const ezHashableStruct< ezGALRenderingSetup > &other)
 
bool operator== (const ezHashableStruct< ezGALRenderingSetup > &other) const
 
bool operator!= (const ezHashableStruct< ezGALRenderingSetup > &other) const
 
bool operator< (const ezHashableStruct< ezGALRenderingSetup > &other) const
 
ezUInt32 CalculateHash () const
 Calculates the 32 bit hash of the struct and returns it.
 

Protected Attributes

ezUInt8 m_uiClearStencil = 0
 
float m_fClearDepth = 1.0f
 
ezColor m_ClearColor [EZ_GAL_MAX_RENDERTARGET_COUNT] = {ezColor(0, 0, 0, 0)}
 
ezGALRenderPassDescriptor m_RenderPass
 
ezGALFrameBufferDescriptor m_FrameBuffer
 

Detailed Description

This class sets up the render targets for a graphics pipeline, used by ezRenderContext::BeginRendering or ezGALCommandEncoder::BeginRendering.

The usage pattern is very strict to prevent creating invalid render target configs: SetColorTarget must be called starting at uiIndex 0 before you can call it with index 1 and so fourth. To call any of the SetClear* functions, you first must have called the corresponding SetColorTarget or SetDepthStencilTarget functions. All clear methods have reasonable default values (color: black, depth: 1.0, stencil: 0). SetColorTarget and SetDepthStencilTarget can be called multiple times as long as the format of the view remains identical to the previously assigned one. Thus, while not very expensive, it is still a good idea to cache these objects and only swap out the textures when they are not fixed, e.g. when using the ezGPUResourcePool. The class produces a ezGALRenderPassDescriptor and a ezGALFrameBufferDescriptor that can be retrieved via GetRenderPass and GetFrameBuffer respectively.

Example usage:

renderTargetSetup.SetColorTarget(0, hRT)).SetClearColor(0, ezColor::White)
renderTargetSetup.SetDepthStencilTarget(hDepth)).SetClearDepth().SetClearStencil();
static const ezColor White
#FFFFFF
Definition Color.h:194
ezGALRenderingSetup & SetClearDepth(float fDepthClear=1.0f)
Sets the clear depth value. Note that you first must have called SetDepthStencilTarget to be able to ...
Definition RenderTargetSetup.cpp:126
ezGALRenderingSetup & SetClearStencil(ezUInt8 uiStencilClear=0)
Sets the clear depth value. Note that you first must have called SetDepthStencilTarget to be able to ...
Definition RenderTargetSetup.cpp:134
ezGALRenderingSetup & SetClearColor(ezUInt8 uiIndex, const ezColor &color=ezColor(0, 0, 0, 0))
Sets the clear color of the given render target and switches the load op to clear....
Definition RenderTargetSetup.cpp:118
ezGALRenderingSetup & SetDepthStencilTarget(ezGALRenderTargetViewHandle hDSTarget, ezEnum< ezGALRenderTargetLoadOp > depthLoadOp={}, ezEnum< ezGALRenderTargetStoreOp > depthStoreOp={}, ezEnum< ezGALRenderTargetLoadOp > stencilLoadOp={}, ezEnum< ezGALRenderTargetStoreOp > stencilStoreOp={})
Sets the depth / stencil render target. If not set, the load and store operations default to 'Load' a...
Definition RenderTargetSetup.cpp:82
See also
ezGALRenderPassDescriptor, ezGALFrameBufferDescriptor, ezRenderContext::BeginRendering, ezGALCommandEncoder::BeginRendering

The documentation for this struct was generated from the following files: