NvSimpleUBOAllocator Class Reference

A simple, start to end allocator of UBO memory for multiple UBOs from a single memory allocation Does not support deletion - designed for allocations that last the lifetime of the app A simple method of implementing suballocation. More...

#include <NvSimpleUBO.h>

List of all members.

Public Member Functions

bool Initialize (NvVkContext &vk, uint32_t size)
 Initialize the allocator with the desired size.
NvVkBufferbuffer ()
 Return the parent buffer used for all allocations.
bool Alloc (uint32_t size, uint32_t &offset, void **mapped=NULL)
 Allocate a block of memory from the buffer, return its location in the buffer and a mapping if needed.

Protected Attributes

NvVkBuffer m_buffer
uint32_t m_size
uint32_t m_offset
void * m_mapped


Detailed Description

A simple, start to end allocator of UBO memory for multiple UBOs from a single memory allocation Does not support deletion - designed for allocations that last the lifetime of the app A simple method of implementing suballocation.

Member Function Documentation

bool NvSimpleUBOAllocator::Alloc ( uint32_t  size,
uint32_t &  offset,
void **  mapped = NULL 
) [inline]

Allocate a block of memory from the buffer, return its location in the buffer and a mapping if needed.

Parameters:
[in] size thew size of the block to allocate, in bytes
[out] offset the offset into the buffer object of the resulting allocation
[in,out] mapped if non-NULL, a pointer to a void* into which the CPU mapped address of the block should be written
Returns:
true on success and false on failure

bool NvSimpleUBOAllocator::Initialize ( NvVkContext vk,
uint32_t  size 
) [inline]

Initialize the allocator with the desired size.

Parameters:
[in] vk the queue/device to use
[in] the size of the entire allocation pool in bytes
Returns:
true on success and false on failure


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