Logo Mibo

InstanceWorldCache Type

Per-frame cache of staged per-instance world rows (VertexInstanceWorldPalette: world matrix + chunk-local palette row) for skinned + instanced draws, SHARED by the shadow pass and the forward PBR pass on the palette-texture backends (DX11/Vulkan). Both passes stage the same rows every frame — the chunk plan is already shared via PaletteChunkCache, so chunk-local offsets match and one staging pass can serve both passes' vertex-buffer uploads (each pass still uploads into its OWN DynamicVertexBuffer — the two passes never share a buffer, preserving the no-race DX12 upload-ordering design).

Memo validity is per frame, same as PaletteChunkCache: the buffer copies caller transforms into per-frame rented arrays at record time, so each command's array is stable for the duration of the render flush, and ReleaseAll — called once per frame alongside the palette cache's — drops every memo. Keyed by array reference + count. The DX12 grouped path does NOT use this cache: its forward/depth group budgets differ (PaletteGroup.MaxMatrices vs MaxMatricesDepth), so chunk-local offsets differ per pass and staging stays per pass there.

Constructors

Constructor Description

InstanceWorldCache()

Full Usage: InstanceWorldCache()

Returns: InstanceWorldCache

Instance members

Instance member Description

this.Obtain

Full Usage: this.Obtain

Parameters:
    transforms : Matrix[]
    count : int
    chunks : (int * int * 'T)[]
    chunkTotal : int

Returns: VertexInstanceWorldPalette[]
Type parameters: 'T

Returns the staged rows covering count instances under the given chunk plan ((chunkStart, chunkCount, _) triples), staging them on first request this frame. Row j of a chunk carries PaletteOffset j — chunk-local, matching the palette texture that holds only that chunk.

transforms : Matrix[]
count : int
chunks : (int * int * 'T)[]
chunkTotal : int
Returns: VertexInstanceWorldPalette[]

this.ReleaseAll

Full Usage: this.ReleaseAll

Drops every memo (per-frame lifetime); pool arrays are kept (grow-only).

Type something to start searching.