Mapped buffer is a container for GPU memory that is mapped into CPU memory. More...
#include <kanzi/core.ui/platform/graphics_backend/gl/mesh.hpp>
Public Member Functions | |
MappedBuffer (MappedBuffer &&other) | |
Move constructor. | |
MappedBuffer (Mesh *mesh, GPUBuffer *buffer, size_t size) | |
Constructor with buffer handle. | |
MappedBuffer & | operator= (MappedBuffer &&other) |
Move assignment operator. | |
template<typename T > | |
void | write (const T *data, size_t startElement, size_t elements) |
Write data to mapped buffer. | |
~MappedBuffer () | |
Destructor that takes care that the GPU data matches the CPU data after it has been run. | |
Mapped buffer is a container for GPU memory that is mapped into CPU memory.
This is a RAII-style object that automatically updates the data to the GPU in the destructor.
Constructor with buffer handle.
Maps the buffer with the given handle. Unmapping happens in destructor.
mesh | Mesh whose buffers are mapped. |
buffer | Buffer that is mapped, must belong to the mesh mentioned above. |
size | Size of the mapped memory region in bytes. |
|
inline |
Move constructor.
kanzi::Mesh::MappedBuffer::~MappedBuffer | ( | ) |
Destructor that takes care that the GPU data matches the CPU data after it has been run.
|
inline |
Move assignment operator.
|
inline |
Write data to mapped buffer.
The data will be updated to the GPU in the destructor.
data | Data to write to the mapped memory. |
startElement | Element number from which start writing the data. |
elements | Number of element to write. |