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

#include <RadientTesseraMaterialCache.hpp>

Public Member Functions

RadientTesseraMaterialResolveResult Resolve (IThreadPool &ThreadPool, IRadientMaterialAsset *pMaterial)
RADIENT_STATUS PrepareMaterialBuffer (IRenderDevice *pDevice, IDeviceContext *pContext)
RADIENT_STATUS Prepare (Uint32 TextureVersion, const ResolveTextureSRVCallbackType &ResolveTextureSRV, const CreateSRBCallbackType &CreateSRB)
RADIENT_STATUS Prepare (Uint32 TextureVersion, Uint32 MaterialBufferVersion, Uint64 MaterialBufferGeneration, const ResolveTextureSRVCallbackType &ResolveTextureSRV, const CreateSRBCallbackType &CreateSRB)
Uint64 GetRenderStateRevision () const noexcept

Detailed Description

Cache of Tessera material binding data. Resolve() schedules at most one processing task for each material and texture-flag configuration. The cache owns the logical SRB entries and prepares their GPU SRBs on the render thread.

Member Function Documentation

◆ GetRenderStateRevision()

Uint64 Diligent::RadientTesseraMaterialCache::GetRenderStateRevision ( ) const
inlinenoexcept

Changes when preparation updates a cached surface mode or double-sided flag. Shader-only edits do not advance this render-thread revision.

◆ Prepare() [1/2]

RADIENT_STATUS Diligent::RadientTesseraMaterialCache::Prepare ( Uint32 TextureVersion,
const ResolveTextureSRVCallbackType & ResolveTextureSRV,
const CreateSRBCallbackType & CreateSRB )

Creates pending material SRBs and refreshes existing SRBs after texture resources change. This method uses the material buffer snapshot owned by this cache and must only be called from the render thread.

◆ Prepare() [2/2]

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

Testing-only overload that supplies a synthetic material buffer snapshot. Production code must use the overload above so the snapshot always comes from the cache-owned material buffer.

◆ PrepareMaterialBuffer()

RADIENT_STATUS Diligent::RadientTesseraMaterialCache::PrepareMaterialBuffer ( IRenderDevice * pDevice,
IDeviceContext * pContext )

Refreshes changed material shader data and surface state, creates or grows the shared material buffer, and uploads pending records. Existing allocations and bindings are preserved. This method must be called from the render thread.

◆ Resolve()

RadientTesseraMaterialResolveResult Diligent::RadientTesseraMaterialCache::Resolve ( IThreadPool & ThreadPool,
IRadientMaterialAsset * pMaterial )

Returns or schedules Tessera data for the material. On the first call, the material and its selected texture GPU resources must report OK. This method obtains the immutable render data from the asset and must be called from the render thread. Material PSO flags are derived by the worker task.