![]() |
XII Release 0.1.0
|
A templated vertex buffer pool that manages dynamic vertex allocations. This divides its memory into one or more chunks to minimize reallocation and supports thread-safe allocation, update, and tracking of vertex usage. More...
#include <VertexBufferPool.h>
Classes | |
struct | AllocationHandle |
A handle for a vertex allocation. More... | |
struct | UsageStatistics |
Aggregated usage statistics for the pool. More... | |
Public Member Functions | |
xiiGALVertexBufferPool (xiiStringView sName={}, xiiAllocatorBase *pAllocator=AllocatorWrapper::GetAllocator(), xiiUInt32 uiInitialChunkSize=1024, xiiUInt32 uiExpansionFactor=2U) | |
Constructs the vertex buffer pool. | |
AllocationHandle | Allocate (xiiUInt32 uiCount) |
Allocates a block of vertices from the pool. | |
void | Update (const AllocationHandle &handle, xiiArrayPtr< const VertexType > pData, xiiSharedPtr< xiiGALCommandList > pCommandList) |
Updates the data stored in a given allocation. | |
xiiArrayPtr< const VertexType > | GetAllocationPointer (const AllocationHandle &handle) const |
Returns a read-only pointer to the allocated vertex data. | |
xiiSharedPtr< xiiGALBuffer > | GetGPUBuffer (const AllocationHandle &handle) const |
void | Reset () |
xiiGALVertexBufferPool::UsageStatistics | GetUsageStatistics () const |
A templated vertex buffer pool that manages dynamic vertex allocations. This divides its memory into one or more chunks to minimize reallocation and supports thread-safe allocation, update, and tracking of vertex usage.
XII_ALWAYS_INLINE xiiGALVertexBufferPool< VertexType, MutexType, AllocatorWrapper >::xiiGALVertexBufferPool | ( | xiiStringView | sName = {}, |
xiiAllocatorBase * | pAllocator = AllocatorWrapper::GetAllocator(), | ||
xiiUInt32 | uiInitialChunkSize = 1024, | ||
xiiUInt32 | uiExpansionFactor = 2U ) |
Constructs the vertex buffer pool.
uiInitialChunkSize | - The number of vertices in the first (and minimum) chunk. |
uiExpansionFactor | - Determines the size of new chunks (e.g. 2 means double the previous chunk). |
AllocationHandle xiiGALVertexBufferPool< VertexType, MutexType, AllocatorWrapper >::Allocate | ( | xiiUInt32 | uiCount | ) |
Allocates a block of vertices from the pool.
uiCount | - The number of vertices requested. |
XII_ALWAYS_INLINE xiiArrayPtr< const VertexType > xiiGALVertexBufferPool< VertexType, MutexType, AllocatorWrapper >::GetAllocationPointer | ( | const AllocationHandle & | handle | ) | const |
Returns a read-only pointer to the allocated vertex data.
XII_ALWAYS_INLINE void xiiGALVertexBufferPool< VertexType, MutexType, AllocatorWrapper >::Update | ( | const AllocationHandle & | handle, |
xiiArrayPtr< const VertexType > | pData, | ||
xiiSharedPtr< xiiGALCommandList > | pCommandList ) |
Updates the data stored in a given allocation.
handle | - The allocation handle previously returned by Allocate(). |
pData | - An array containing the new vertex data. |