Uniform buffer exposed to all shader stages, that can be updated at varying frequencies. Multiple instances of the GPU data will be maintained internally.
More...
#include <Buffer.hpp>
|
const size_t | _baseSize |
| The uniform buffer size (ie the size of one instance).
|
|
size_t | _alignment = 0 |
| The alignment constraint to respect between successive instances.
|
|
size_t | _offset = 0 |
| The current offset in bytes in the array of instances.
|
|
bool | _wrapAround = true |
| Should the buffer attempt to reuse the same memory once full.
|
|
Uniform buffer exposed to all shader stages, that can be updated at varying frequencies. Multiple instances of the GPU data will be maintained internally.
Using a base allows the class to be template-free (to avoid exposing GPU/GPUObjects details in headers), while preserving the "pass general Object to GPU for setup/upload &
GPUObject only stores GPU handle and settings" approach followed by Texture and Mesh. In practice you will want to use UniformBuffer<T> to benefit from CPU storage and simplified upload.
Inherits Buffer.
Inherited by UniformBuffer< ForwardLight::GPULight >, UniformBuffer< ForwardProbe::GPUProbe >, UniformBuffer< IslandApp::GerstnerWave >, UniformBuffer< glm::vec4 >, and UniformBuffer< T >.
◆ UniformBufferBase() [1/3]
UniformBufferBase::UniformBufferBase |
( |
size_t |
sizeInBytes, |
|
|
UniformFrequency |
use, |
|
|
const std::string & |
name |
|
) |
| |
Constructor.
- Parameters
-
sizeInBytes | size of the uniform buffer |
use | the update frequency |
name | the buffer identifier |
◆ UniformBufferBase() [2/3]
Copy constructor (disabled).
◆ UniformBufferBase() [3/3]
◆ ~UniformBufferBase()
UniformBufferBase::~UniformBufferBase |
( |
| ) |
|
|
virtual |
◆ baseSize()
size_t UniformBufferBase::baseSize |
( |
| ) |
const |
|
inline |
- Returns
- the size of one instance of the buffer
◆ clean()
void UniformBufferBase::clean |
( |
| ) |
|
◆ currentOffset()
size_t UniformBufferBase::currentOffset |
( |
| ) |
const |
|
inline |
- Returns
- the current offset in bytes in the internal GPU buffer.
◆ operator=() [1/2]
Copy assignment operator (disabled).
- Returns
- a reference to the object assigned to
◆ operator=() [2/2]
Move assignment operator .
- Returns
- a reference to the object assigned to
◆ upload()
bool UniformBufferBase::upload |
( |
unsigned char * |
data | ) |
|
Upload data. The buffer will internally copy the data (using the internal size) to a region of mapped GPU memory. Buffering will be handled based on the update frequency.
- Parameters
-
- Returns
- true if a new GPU buffer was allocated internally
The documentation for this class was generated from the following files:
- src/engine/resources/Buffer.hpp
- src/engine/resources/Buffer.cpp