Kanzi  3.9.7
Kanzi Engine API
kanzi::Mesh::MappedBuffer Class Reference

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 (Mesh *mesh, GPUBuffer *buffer, size_t size)
 Constructor with buffer handle. More...
 
 MappedBuffer (MappedBuffer &&other)
 Move constructor. More...
 
MappedBufferoperator= (MappedBuffer &&other)
 Move assignment operator. More...
 
template<typename T >
void write (const T *data, size_t startElement, size_t elements)
 Write data to mapped buffer. More...
 
 ~MappedBuffer ()
 Destructor that takes care that the GPU data matches the CPU data after it has been run. More...
 

Detailed Description

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 & Destructor Documentation

kanzi::Mesh::MappedBuffer::MappedBuffer ( Mesh mesh,
GPUBuffer buffer,
size_t  size 
)
explicit

Constructor with buffer handle.

Maps the buffer with the given handle. Unmapping happens in destructor.

Parameters
meshMesh whose buffers are mapped.
bufferBuffer that is mapped, must belong to the mesh mentioned above.
sizeSize of the mapped memory region in bytes.
kanzi::Mesh::MappedBuffer::MappedBuffer ( MappedBuffer &&  other)
inline

Move constructor.

kanzi::Mesh::MappedBuffer::~MappedBuffer ( )

Destructor that takes care that the GPU data matches the CPU data after it has been run.

Member Function Documentation

MappedBuffer& kanzi::Mesh::MappedBuffer::operator= ( MappedBuffer &&  other)
inline

Move assignment operator.

template<typename T >
void kanzi::Mesh::MappedBuffer::write ( const T data,
size_t  startElement,
size_t  elements 
)
inline

Write data to mapped buffer.

The data will be updated to the GPU in the destructor.

Parameters
dataData to write to the mapped memory.
startElementElement number from which start writing the data.
elementsNumber of element to write.

The documentation for this class was generated from the following file: