Lysa  0.0
Lysa 3D Engine
MemoryArray Class Referenceabstract

Detailed Description

Base class for all GPU memory arrays

+ Inheritance diagram for MemoryArray:

Public Member Functions

MemoryBlock alloc (size_t instanceCount)
 
void free (const MemoryBlock &bloc)
 
virtual void write (const MemoryBlock &destination, const void *source) = 0
 
void copyTo (const vireo::CommandList &commandList, const MemoryArray &destination)
 
auto getBuffer () const
 
virtual ~MemoryArray ()
 
 MemoryArray (MemoryArray &) = delete
 
MemoryArray & operator= (MemoryArray &) = delete
 

Protected Member Functions

 MemoryArray (const std::shared_ptr< vireo::Vireo > &vireo, size_t instanceSize, size_t instanceCount, vireo::BufferType bufferType, const std::string &name)
 

Protected Attributes

const std::string name
 
const size_t instanceSize
 
std::shared_ptr< vireo::Buffer > buffer
 
std::list< MemoryBlockfreeBlocs
 
std::mutex mutex
 

Constructor & Destructor Documentation

virtual ~MemoryArray ( )
virtual
MemoryArray ( MemoryArray &  )
delete
MemoryArray ( const std::shared_ptr< vireo::Vireo > &  vireo,
size_t  instanceSize,
size_t  instanceCount,
vireo::BufferType  bufferType,
const std::string &  name 
)
protected

Member Function Documentation

MemoryBlock alloc ( size_t  instanceCount)

Allocate a new GPU memory block

Parameters
instanceCountNumber of resources instances stored in this memory block
Returns
void copyTo ( const vireo::CommandList &  commandList,
const MemoryArray &  destination 
)

Copy the entire content of this memory array to another GPU memory array

Parameters
commandListCommand list used for the copy operation
destinationDestination GPU memory array
void free ( const MemoryBlock bloc)

Free a previously allocated GPU memory block

Parameters
blocAllocated memory block
auto getBuffer ( ) const
inline

Returns the GPU memory buffer allocated for the entire array

MemoryArray& operator= ( MemoryArray &  )
delete
virtual void write ( const MemoryBlock destination,
const void *  source 
)
pure virtual

Schedule a data transfert from the CPU to the GPU. Data will be temporarily written into a staging buffer.

Parameters
destinationDestination memory block
sourceSource address of CPU memory

Implemented in lysa::HostVisibleMemoryArray::write(), lysa::DeviceMemoryArray::write()

Member Data Documentation

std::shared_ptr<vireo::Buffer> buffer
protected
std::list<MemoryBlock> freeBlocs
protected
const size_t instanceSize
protected
std::mutex mutex
protected
const std::string name
protected