PaletteTexturePool Type
Pools Texture2D bone-palette textures (SurfaceFormat.Vector4) keyed by (width, height). Acquired textures stay checked out until PaletteTexturePool.ReleaseAll — called once per frame, mirroring RenderTargetPool3D's lifetime.
The per-frame lifetime is a correctness requirement, not just an allocation optimization:
palette textures are re-uploaded via SetData once per chunk within a single frame,
and on the native DX12 backend uploads execute immediately while draws execute at end of
frame — reusing one texture across chunks would make every draw read the LAST chunk's
palettes (the same hazard DynamicVertexBuffer solves for instance vertex buffers).
A fresh-from-pool texture per chunk keeps each draw's palette data intact.
Constructors
| Constructor |
Description
|
Full Usage:
PaletteTexturePool(?maxIdlePerSize)
Parameters:
int
Returns: PaletteTexturePool
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.Acquire
Parameters:
GraphicsDevice
width : int
height : int
Returns: Texture2D
|
Acquires a palette texture of the given size, reusing a released one when
available. The texture stays checked out until the next
|
Full Usage:
this.ReleaseAll
|
Returns all checked-out textures to the pool. Call once per frame, before the frame's first skinned-instanced draw (the previous frame's draws were already submitted). Idle textures kept per size track this frame's demand (floor: the cap); extras are disposed. |
Mibo