ezEngine Release 26.3
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, ezBitflags< ezGALBindGroupItemFlags > metaFlags={})
 
void BindBuffer (ezTempHashedString sSlotName, ezGALBufferHandle hBuffer, ezGALBufferRange bufferRange={}, ezEnum< ezGALResourceFormat > overrideTexelBufferFormat=ezGALResourceFormat::Invalid, ezBitflags< ezGALBindGroupItemFlags > metaFlags={})
 
void BindTexture (ezTempHashedString sSlotName, ezGALTextureHandle hTexture, ezGALTextureRange textureRange={}, ezEnum< ezGALResourceFormat > overrideViewFormat=ezGALResourceFormat::Invalid, ezBitflags< ezGALBindGroupItemFlags > metaFlags={})
 
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, ezBitflags< ezGALBindGroupItemFlags > &out_metaFlags)
 

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,
ezBitflags< ezGALBindGroupItemFlags metaFlags = {} 
)

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.
metaFlagsOptional subset of ezGALBindGroupItemFlags::MetaFlags to be added to the binding.

◆ BindSampler()

void ezBindGroupBuilder::BindSampler ( ezTempHashedString  sSlotName,
ezGALSamplerStateHandle  hSampler,
ezBitflags< ezGALBindGroupItemFlags metaFlags = {} 
)

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.
metaFlagsOptional subset of ezGALBindGroupItemFlags::MetaFlags to be added to the binding.

◆ BindTexture()

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

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.
metaFlagsOptional subset of ezGALBindGroupItemFlags::MetaFlags to be added to the binding.

◆ CreateBindGroup()

void ezBindGroupBuilder::CreateBindGroup ( ezGALBindGroupLayoutHandle  hBindGroupLayout,
ezGALBindGroupCreationDescription out_bindGroup,
ezBitflags< ezGALBindGroupItemFlags > &  out_metaFlags 
)

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.
out_metaFlagsUnion of all meta flags across the bindings in the bind group. I.e. a bit will be set here if it is set for any binding.

◆ 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: