Kanzi  3.9.5
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

◆ MappedBuffer() [1/2]

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.

◆ MappedBuffer() [2/2]

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

Move constructor.

◆ ~MappedBuffer()

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

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

Member Function Documentation

◆ operator=()

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

Move assignment operator.

◆ write()

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: