gpu_buffer_manager.hpp File Reference

Classes

class  kanzi::Buffer
 GPU memory buffer, for vertex or index data. More...
 
struct  KzcGPUBufferManagerStatistics
 Statistics of GPU buffer manager usage. More...
 

Namespaces

 kanzi
 

Functions

kzsError kzcGPUBufferManagerCreate (const KzcMemoryManager *memoryManager, kanzi::Renderer *renderer, unsigned int vertexBufferPoolSize, unsigned int indexBufferPoolSize, KzcGPUBufferManager **out_bufferManager)
 Creates a new buffer manager. More...
 
kzsError kzcGPUBufferManagerDelete (KzcGPUBufferManager *bufferManager)
 Deletes buffer manager. More...
 
kzsError kzcGPUBufferManagerInvalidateGPUMemory (KzcGPUBufferManager *bufferManager)
 Invalidates GPU memory manager by this manager. All pools will be removed and handles to this manager will became invalid. More...
 
kzsError kzcGPUBufferManagerUploadData (KzcGPUBufferManager *bufferManager, kanzi::Buffer::BufferType bufferType, const void *data, unsigned int size, const KzcGPUBufferMemoryHandle **out_handle)
 Uploads vertex data to VBO. More...
 
kzsError kzcGPUBufferManagerFreeData (const KzcGPUBufferManager *bufferManager, const KzcGPUBufferMemoryHandle *handle)
 Frees vertex data in VBO. More...
 
kanzi::Buffer::BufferType kzcGPUBufferMemoryHandleGetBufferType (const KzcGPUBufferMemoryHandle *handle)
 Gets type of buffer object referenced by specified handle. More...
 
unsigned int kzcGPUBufferMemoryHandleGetBufferHandle (const KzcGPUBufferMemoryHandle *handle)
 Gets handle of buffer object referenced by specified handle. More...
 
unsigned int kzcGPUBufferMemoryHandleGetDataOffset (const KzcGPUBufferMemoryHandle *handle)
 Gets offset in bytes in buffer object for the memory referenced by specified handle. More...
 
void kzcGPUBufferManagerGetStatistics (const KzcGPUBufferManager *bufferManager, kanzi::Buffer::BufferType bufferType, KzcGPUBufferManagerStatistics *statistics)
 Returns statistics for GPU buffer manager. More...
 
void kzcGPUBufferManagerDumpStatistics (const KzcGPUBufferManager *bufferManager, kzBool dumpPoolBlocks)
 Prints out statistics for GPU buffer manager. More...
 

Function Documentation

kzsError kzcGPUBufferManagerCreate ( const KzcMemoryManager memoryManager,
kanzi::Renderer renderer,
unsigned int  vertexBufferPoolSize,
unsigned int  indexBufferPoolSize,
KzcGPUBufferManager **  out_bufferManager 
)

Creates a new buffer manager.

Parameters
vertexBufferPoolSize- default size of vertex buffer pool (== VBO). If equal to 0, the no default buffer will be created, and new pool will be created for each uploaded data.
indexBufferPoolSize- default size of index buffer pool (== IBO). If equal to 0, the no default buffer will be created, and new pool will be created for each uploaded data.
kzsError kzcGPUBufferManagerDelete ( KzcGPUBufferManager *  bufferManager)

Deletes buffer manager.

kzsError kzcGPUBufferManagerInvalidateGPUMemory ( KzcGPUBufferManager *  bufferManager)

Invalidates GPU memory manager by this manager. All pools will be removed and handles to this manager will became invalid.

kzsError kzcGPUBufferManagerUploadData ( KzcGPUBufferManager *  bufferManager,
kanzi::Buffer::BufferType  bufferType,
const void *  data,
unsigned int  size,
const KzcGPUBufferMemoryHandle **  out_handle 
)

Uploads vertex data to VBO.

If there is no available memory left in existing VBO's, the new one will be created.

Parameters
handleto uploaded vertex data (owned by GPU buffer manager so user should not delete it).
kzsError kzcGPUBufferManagerFreeData ( const KzcGPUBufferManager *  bufferManager,
const KzcGPUBufferMemoryHandle *  handle 
)

Frees vertex data in VBO.

Parameters
handleto uploaded vertex data. The handle will be deleted by GPU buffer manager and should not be used after calling this function.
kanzi::Buffer::BufferType kzcGPUBufferMemoryHandleGetBufferType ( const KzcGPUBufferMemoryHandle *  handle)

Gets type of buffer object referenced by specified handle.

unsigned int kzcGPUBufferMemoryHandleGetBufferHandle ( const KzcGPUBufferMemoryHandle *  handle)

Gets handle of buffer object referenced by specified handle.

unsigned int kzcGPUBufferMemoryHandleGetDataOffset ( const KzcGPUBufferMemoryHandle *  handle)

Gets offset in bytes in buffer object for the memory referenced by specified handle.

void kzcGPUBufferManagerGetStatistics ( const KzcGPUBufferManager *  bufferManager,
kanzi::Buffer::BufferType  bufferType,
KzcGPUBufferManagerStatistics statistics 
)

Returns statistics for GPU buffer manager.

User is responsible for deleting returned struct instance.

Parameters
statistics- pointer to KzcGpuBufferManagerStatistics struct instance which will be filled with statistics data.
void kzcGPUBufferManagerDumpStatistics ( const KzcGPUBufferManager *  bufferManager,
kzBool  dumpPoolBlocks 
)

Prints out statistics for GPU buffer manager.