class
render::TransientGpuBufferPool
Pool allocator for GPU buffer suballocations.
Allocates suballocations transiently - each allocation is valid for one frame and automatically recycled after all in-flight frames complete (typically 3).
Public
Constructors
TransientGpuBufferPool
TransientGpuBufferPool
Constructs and immediately initializes the pool.
See Initialize().
Methods
~TransientGpuBufferPool
Initialize
Initializes the pool.
Must be called before use.
- device
- GPU device for querying capabilities.
- createInfo
- Buffer creation info (size is per-suballocation).
- suballocationsPerBuffer
- Number of suballocations per GpuBuffer.
- initialBufferCount
- Initial number of buffers, each with suballocations.
Allocate
Allocates a suballocation for the current frame.
The suballocation is valid until AdvanceFrame() is called N times, where N is the number of frames in-flight (typically 3).
If no free suballocations are available, the pool automatically grows by allocating a new GpuBuffer.
Returns: Suballocation handle (always valid)
AdvanceFrame
Advances to the next frame and recycles old suballocations.
Call once per frame after submitting all command buffers.
This marks all current allocations as not in-use for the next frame, and rebuilds the free-list to include suballocations from frame N-3 that are now safe to reuse.
GetSuballocationSize
Gets the size per suballocation (aligned).
May be larger than the requested size due to GPU alignment requirements (typically 256 bytes for uniform buffers).
GetBufferCount
Gets the number of currently allocated buffers.
GetTotalSuballocationCount
Gets the total number of suballocations (used + free).
Destroy
Releases all GPU resources held by this pool.
All allocations must be released before calling this method. Call before destroying the GPU device. After this call, the pool is empty and cannot be used until Initialize() is called again.