ezEngine Release 25.08
Loading...
Searching...
No Matches
ezBindGroupBuilder Class Reference

Creates ezGALBindGroupCreationDescription that can be passed into ezGALCommandEncoder. More...

#include <BindGroupBuilder.h>

Public Member Functions

void ResetBoundResources (const ezGALDevice *pDevice)
 Must be called before the builder can be used. This should be called at the start of each frame to make sure no stale resources are referenced inside the builder.
 
bool IsModified () const
 Returns whether a Bind* call modified in internal state since the last CreateBindGroup call.
 
void BindSampler (ezTempHashedString sSlotName, ezGALSamplerStateHandle hSampler)
 
void BindBuffer (ezTempHashedString sSlotName, ezGALBufferHandle hBuffer, ezGALBufferRange bufferRange={}, ezEnum< ezGALResourceFormat > overrideTexelBufferFormat=ezGALResourceFormat::Invalid)
 
void BindTexture (ezTempHashedString sSlotName, ezGALTextureHandle hTexture, ezGALTextureRange textureRange={}, ezEnum< ezGALResourceFormat > overrideViewFormat=ezGALResourceFormat::Invalid)
 
void BindTexture (ezTempHashedString sSlotName, const ezTexture2DResourceHandle &hTexture, ezResourceAcquireMode acquireMode=ezResourceAcquireMode::AllowLoadingFallback, ezGALTextureRange textureRange={}, ezEnum< ezGALResourceFormat > overrideViewFormat=ezGALResourceFormat::Invalid)
 
void BindTexture (ezTempHashedString sSlotName, const ezTexture3DResourceHandle &hTexture, ezResourceAcquireMode acquireMode=ezResourceAcquireMode::AllowLoadingFallback, ezGALTextureRange textureRange={}, ezEnum< ezGALResourceFormat > overrideViewFormat=ezGALResourceFormat::Invalid)
 
void BindTexture (ezTempHashedString sSlotName, const ezTextureCubeResourceHandle &hTexture, ezResourceAcquireMode acquireMode=ezResourceAcquireMode::AllowLoadingFallback, ezGALTextureRange textureRange={}, ezEnum< ezGALResourceFormat > overrideViewFormat=ezGALResourceFormat::Invalid)
 
void BindBuffer (ezTempHashedString sSlotName, ezConstantBufferStorageHandle hBuffer, ezGALBufferRange bufferRange={}, ezGALResourceFormat::Enum overrideTexelBufferFormat=ezGALResourceFormat::Invalid)
 
void CreateBindGroup (ezGALBindGroupLayoutHandle hBindGroupLayout, ezGALBindGroupCreationDescription &out_bindGroup)
 

Static Public Attributes

static ezUInt32 s_uiWrites = 0
 Number of modifications of the hash tables each frame. Used for stats.
 
static ezUInt32 s_uiReads = 0
 Number of reads of the hash tables each frame. Used for stats.
 

Detailed Description

Creates ezGALBindGroupCreationDescription that can be passed into ezGALCommandEncoder.

This class is usually not created manually but instead retrieved via ezRenderContext::GetBindGroup. By calling the various Bind* methods resources can be bound to a shader. The evaluation is deferred until the CreateBindGroup call which matches the bound items to the bind group layout's ezShaderResourceBinding. Any binding that can't find a matching item will be filled with a fallback resource via ezGALRendererFallbackResources. These bind group items will be marked with the flag ezGALBindGroupItemFlags::Fallback.

Member Function Documentation

◆ BindBuffer()

void ezBindGroupBuilder::BindBuffer ( ezTempHashedString  sSlotName,
ezGALBufferHandle  hBuffer,
ezGALBufferRange  bufferRange = {},
ezEnum< ezGALResourceFormat overrideTexelBufferFormat = ezGALResourceFormat::Invalid 
)

Binds a buffer to this bind group

Parameters
sSlotNameThe slot under which the buffer is to be bound.
hBufferIf valid, it will be bound. If not, bind group item under this slot will be removed and replaced with a fallback resource if required.
bufferRangeWhat part of the buffer should be bound. Default is entire buffer.
overrideTexelBufferFormatSets the format of the texel buffer. If invalid, default format of the buffer will be used.

◆ BindSampler()

void ezBindGroupBuilder::BindSampler ( ezTempHashedString  sSlotName,
ezGALSamplerStateHandle  hSampler 
)

Binds a sampler to this bind group

Parameters
sSlotNameThe slot under which the sampler is to be bound.
hSamplerIf valid, it will be bound. If not, bind group item under this slot will be removed and replaced with a fallback resource if required.

◆ BindTexture()

void ezBindGroupBuilder::BindTexture ( ezTempHashedString  sSlotName,
ezGALTextureHandle  hTexture,
ezGALTextureRange  textureRange = {},
ezEnum< ezGALResourceFormat overrideViewFormat = ezGALResourceFormat::Invalid 
)

Binds a texture to this bind group

Parameters
sSlotNameThe slot under which the texture is to be bound.
hTextureIf valid, it will be bound. If not, bind group item under this slot will be removed and replaced with a fallback resource if required.
textureRangeWhat part of the texture should be bound. Default is entire texture. Or as much as the target ezShaderResourceBinding allows for.
overrideViewFormatIf set, re-interprets the format of the texture. This can cause performance penalties. Only use it to e.g. read linear vs gamma space or other formats of same type and width.

◆ CreateBindGroup()

void ezBindGroupBuilder::CreateBindGroup ( ezGALBindGroupLayoutHandle  hBindGroupLayout,
ezGALBindGroupCreationDescription out_bindGroup 
)

Create a new bind group for the given layout.

Parameters
hBindGroupLayoutThe bind group layout for which to create the bind group.
out_bindGroupThe resulting bind group. Will be undefined if EZ_FAILURE is returned.

◆ ResetBoundResources()

void ezBindGroupBuilder::ResetBoundResources ( const ezGALDevice pDevice)

Must be called before the builder can be used. This should be called at the start of each frame to make sure no stale resources are referenced inside the builder.

Parameters
pDeviceThe device used to validate resources in bind calls.

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