Refactor material palette system with GPU indirection
Major overhaul of material palette management: - Added two-buffer indirection (PaletteOffsetBuffer, MaterialIndexBuffer) for GPU material lookup, with incremental upload and resizing. - MaterialPaletteStore now tracks dirty ranges, supports deferred slot reclamation, and exposes CPU-side arrays for upload. - ResourceManager manages persistent GPU buffers and uploads only dirty subranges per frame. - Updated HLSL and C# structs to use palette indices. - Refactored systems/components to use new palette index and release logic. - Added RenderContext.UploadBufferRange for partial uploads. Minor: Fixed StbIApi interop signatures, updated test namespaces, and performed code cleanups.
This commit is contained in:
@@ -29,6 +29,8 @@ struct FrameData
|
||||
{
|
||||
BYTE_ADDRESS_BUFFER instanceBuffer;
|
||||
BYTE_ADDRESS_BUFFER userBuffer;
|
||||
BYTE_ADDRESS_BUFFER paletteOffsetBuffer; // global PaletteOffsetBuffer
|
||||
BYTE_ADDRESS_BUFFER materialIndexBuffer; // global MaterialIndexBuffer
|
||||
};
|
||||
|
||||
struct ViewData
|
||||
@@ -46,7 +48,7 @@ struct InstanceData
|
||||
{
|
||||
float4x4 localToWorld;
|
||||
BYTE_ADDRESS_BUFFER meshBuffer;
|
||||
BYTE_ADDRESS_BUFFER materialBuffer;
|
||||
uint materialPaletteIndex; // index into PaletteOffsetBuffer
|
||||
};
|
||||
|
||||
struct MeshData
|
||||
@@ -59,6 +61,7 @@ struct MeshData
|
||||
BYTE_ADDRESS_BUFFER meshletBuffer;
|
||||
BYTE_ADDRESS_BUFFER meshletVerticesBuffer;
|
||||
BYTE_ADDRESS_BUFFER meshletTrianglesBuffer;
|
||||
uint materialSlotCount;
|
||||
};
|
||||
|
||||
#if defined(__GRAPHICS__)
|
||||
|
||||
Reference in New Issue
Block a user