Kanzi 4.0.0-beta2
kanzi::Mesh::MappedBuffer Class Reference

Mapped buffer is a container for GPU memory that is mapped into CPU memory. More...

#include <kanzi/core.ui/graphics3d/mesh.hpp>

Public Member Functions

 MappedBuffer (const MappedBuffer &)=delete
 Deleted copy constructor.
 
 MappedBuffer (GPUBuffer *buffer, size_t size)
 Constructor with buffer handle.
 
 MappedBuffer (MappedBuffer &&other) noexcept
 Move constructor.
 
MappedBufferoperator= (const MappedBuffer &)=delete
 Deleted move operator.
 
MappedBufferoperator= (MappedBuffer &&other) noexcept
 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.
 

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/3]

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

Constructor with buffer handle.

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

Parameters
bufferBuffer that is mapped, must belong to the mesh mentioned above.
sizeSize of the mapped memory region in bytes.
Since
Kanzi 4.0.0 removed the mesh parameter.

◆ MappedBuffer() [2/3]

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

Move constructor.

Parameters
otherSource object.

◆ ~MappedBuffer()

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

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

◆ MappedBuffer() [3/3]

kanzi::Mesh::MappedBuffer::MappedBuffer ( const MappedBuffer & )
delete

Deleted copy constructor.

Member Function Documentation

◆ operator=() [1/2]

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

Move assignment operator.

Parameters
otherSource object.
Returns
This object.

◆ operator=() [2/2]

MappedBuffer & kanzi::Mesh::MappedBuffer::operator= ( const MappedBuffer & )
delete

Deleted move 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: