Vireo  0.0
Vireo 3D Rendering Hardware Interface
Buffer Class Referenceabstract

Detailed Description

A buffer object. Buffers represent linear arrays of data which are used for various purposes by binding them to a graphics or compute pipeline via descriptor sets or certain commands, or by directly specifying them as parameters to certain commands.

Manual page : Memory buffers

Public Member Functions

auto getSize () const
 
auto getType () const
 
auto getInstanceSize () const
 
auto getInstanceSizeAligned () const
 
auto getInstanceCount () const
 
auto getMappedAddress () const
 
virtual void map () = 0
 
virtual void unmap () = 0
 
void write (const void *data, size_t size=WHOLE_SIZE, size_t offset=0) const
 
virtual ~Buffer () = default
 
 Buffer (const Buffer &) = delete
 
Buffer & operator= (const Buffer &) = delete
 

Static Public Member Functions

static auto getMemoryAllocations ()
 

Static Public Attributes

static constexpr size_t WHOLE_SIZE = ~0ULL
 

Protected Member Functions

 Buffer (const BufferType type)
 

Protected Attributes

size_t bufferSize {0}
 
uint32_t instanceSize {0}
 
uint32_t instanceCount {0}
 
uint32_t instanceSizeAligned {0}
 
void * mappedAddress {nullptr}
 

Static Protected Attributes

static std::mutex memoryAllocationsMutex
 
static std::list< VideoMemoryAllocationDescmemoryAllocations
 

Constructor & Destructor Documentation

virtual ~Buffer ( )
virtualdefault
Buffer ( const Buffer &  )
delete
Buffer ( const BufferType  type)
inlineprotected

Member Function Documentation

auto getInstanceCount ( ) const
inline

Returns the number of data instances

auto getInstanceSize ( ) const
inline

Returns the size of a data instance, in bytes

auto getInstanceSizeAligned ( ) const
inline

Returns the aligned size of a data instance, in bytes

auto getMappedAddress ( ) const
inline

Returns a host virtual memory address. Valid only after a map() call.

static auto getMemoryAllocations ( )
inlinestatic

Returns the currently allocated buffers. Only available if isMemoryUsageEnabled() is true

auto getSize ( ) const
inline

Returns the total buffer size in bytes

auto getType ( ) const
inline

Returns the type of the buffer

virtual void map ( )
pure virtual

Maps the device memory associated with the buffer into a host adress sapce

Buffer& operator= ( const Buffer &  )
delete
virtual void unmap ( )
pure virtual

Unmap a previously mapped buffer

void write ( const void *  data,
size_t  size = WHOLE_SIZE,
size_t  offset = 0 
) const

Writes data into the host mapped memory associated. Buffer must be mapped before.

Parameters
dataSource data address in the host address space
sizeSize of the data in bytes
offsetDestination offset in bytes

Member Data Documentation

size_t bufferSize {0}
protected
uint32_t instanceCount {0}
protected
uint32_t instanceSize {0}
protected
uint32_t instanceSizeAligned {0}
protected
void* mappedAddress {nullptr}
protected
std::list<VideoMemoryAllocationDesc> memoryAllocations
staticprotected
std::mutex memoryAllocationsMutex
staticprotected
constexpr size_t WHOLE_SIZE = ~0ULL
staticconstexpr