Diligent Engine
Loading...
Searching...
No Matches
Diligent::RadientMaterialSRBTable Class Referencefinal

#include <RadientMaterialSRBTable.hpp>

Public Member Functions

RADIENT_STATUS Acquire (const RadientMaterialTextureSRBSlotArray &MaterialTextures, PBR_Renderer::PSO_FLAGS PSOFlags, Uint32 MaxTextureSlots, const RadientMaterialDefaultTextureBindings &DefaultTextures, RadientMaterialSRBLease &Lease, PBR_Renderer::StaticShaderTextureIdsArrayType &ShaderTextureIds)
RadientMaterialSRBLease Acquire (const RadientMaterialTextureSRBSlot *const *ppSlots, Uint32 SlotCount)
RADIENT_STATUS Prepare (Uint32 TextureVersion, Uint32 MaterialBufferVersion, Uint64 MaterialBufferGeneration, const ResolveTextureSRVCallbackType &ResolveTextureSRV, const CreateSRBCallbackType &CreateSRB)
size_t GetSize () const noexcept

Detailed Description

Cache of material SRBs indexed by their ordered logical texture slots. Acquire() is thread-safe and only reserves logical entries; Prepare() and SRB access are render-thread-only. Entries are owned by RadientMaterialSRBLease instances, and unused records are removed by Prepare().

Member Function Documentation

◆ Acquire() [1/2]

RadientMaterialSRBLease Diligent::RadientMaterialSRBTable::Acquire ( const RadientMaterialTextureSRBSlot *const * ppSlots,
Uint32 SlotCount )

Thread-safely reuses or reserves an entry for a complete ordered slot recipe without retaining the supplied texture references on a cache hit.

◆ Acquire() [2/2]

RADIENT_STATUS Diligent::RadientMaterialSRBTable::Acquire ( const RadientMaterialTextureSRBSlotArray & MaterialTextures,
PBR_Renderer::PSO_FLAGS PSOFlags,
Uint32 MaxTextureSlots,
const RadientMaterialDefaultTextureBindings & DefaultTextures,
RadientMaterialSRBLease & Lease,
PBR_Renderer::StaticShaderTextureIdsArrayType & ShaderTextureIds )

Thread-safely builds the material texture mapping and reuses or reserves the matching SRB entry without creating GPU objects. Slot texture references are only retained when a new entry is inserted.

◆ GetSize()

size_t Diligent::RadientMaterialSRBTable::GetSize ( ) const
noexcept

Returns the number of retained table records. Expired weak entries may remain included until the next Prepare() call removes them.

◆ Prepare()

RADIENT_STATUS Diligent::RadientMaterialSRBTable::Prepare ( Uint32 TextureVersion,
Uint32 MaterialBufferVersion,
Uint64 MaterialBufferGeneration,
const ResolveTextureSRVCallbackType & ResolveTextureSRV,
const CreateSRBCallbackType & CreateSRB )

Creates new SRBs and recreates existing SRBs when the texture resources or shared material buffer change. Pending texture resolutions are skipped and retried by the next call. Texture-resolution failures are retained on the affected entry and do not fail table preparation. Failed recipes are not retried; their texture selection is immutable. Shared SRB creation/signature failures still fail preparation. When resources and upload generation are unchanged and no entries were released, only new and unresolved entries are processed. If no entries were added or released and no retries remain, the call returns without locking or scanning the table.