|
CeresEngine 0.2.0
A game development framework
|
A template class that automatically manages a uniform buffer pool. More...
#include <CeresEngine/RenderAPI/GPUBufferObject.hpp>
Public Types | |
| using | BufferType = B< UInt8 > |
| The buffer type. | |
Public Member Functions | |
| TGPUBufferPool (GPUDevice &device) | |
Creates a new TBufferPool object. | |
| void | reserve (const size_t length) |
| Reserves space in the pool. | |
| T & | operator[] (const size_t index) |
Gets a reference to the Uniform Buffer block stored at index. | |
| void | flush (const GPUBufferSize offset=0, const GPUBufferSize size=GPUBuffer::whole) |
Flushes the cached memory data starting at offset with size bytes. | |
| void | invalidate (const GPUBufferSize offset=0, const GPUBufferSize size=GPUBuffer::whole) |
Invalidates the cached memory data starting at offset with size bytes. | |
Private Member Functions | |
| void | allocateBuffers (const size_t length) |
Private Attributes | |
| GPUDevicePtr | device |
| The device to be used when allocating memory. | |
| Vector< BufferType > | buffers |
| A vector of allocated buffers. | |
| const size_t | baseAllocationSize = 4 * 1024 * 1024 |
| The base allocation size used by the pool. | |
| size_t | mLength = 0 |
Static Private Attributes | |
| static constexpr size_t | alignment = ((sizeof(T) + 256 - 1) / 256) * 256 |
| The alignment to be used for each object in pool. | |
A template class that automatically manages a uniform buffer pool.
This class will compute the required alignment (required by the GPU) and return references for objects of type T.
| T | the object type stored inside the uniform buffer |
|
inlineexplicit |
Creates a new TBufferPool object.
| device | The device to be used when allocating memory. |
|
inline |
Flushes the cached memory data starting at offset with size bytes.
| offset | The starting offset to be flushed |
| size | The amount of bytes to be flushed |
|
inline |
Invalidates the cached memory data starting at offset with size bytes.
| offset | The starting offset to be flushed |
| size | The amount of bytes to be flushed |
|
inline |
Gets a reference to the Uniform Buffer block stored at index.
| index | The uniform buffer index to fetch |
Reserves space in the pool.
| length | The number of uniform objects to fit in the buffer |
|
staticconstexprprivate |
The alignment to be used for each object in pool.
|
private |
The base allocation size used by the pool.
|
private |
A vector of allocated buffers.
Each buffer has mBaseAllocationSize bytes.
|
private |
The device to be used when allocating memory.
|
private |