Lysa  0.0
Lysa 3D Engine
DeviceMemoryArray Class Reference

Detailed Description

Device-only GPU memory array

+ Inheritance diagram for DeviceMemoryArray:

Public Member Functions

 DeviceMemoryArray (const std::shared_ptr< vireo::Vireo > &vireo, size_t instanceSize, size_t instanceCount, size_t stagingInstanceCount, vireo::BufferType, const std::string &name)
 
void write (const MemoryBlock &destination, const void *source) override
 
void flush (const vireo::CommandList &commandList)
 
void postBarrier (const vireo::CommandList &commandList) const
 
 ~DeviceMemoryArray () override
 
- Public Member Functions inherited from MemoryArray
MemoryBlock alloc (size_t instanceCount)
 
void free (const MemoryBlock &bloc)
 
void copyTo (const vireo::CommandList &commandList, const MemoryArray &destination)
 
auto getBuffer () const
 
virtual ~MemoryArray ()
 
 MemoryArray (MemoryArray &) = delete
 
MemoryArray & operator= (MemoryArray &) = delete
 

Additional Inherited Members

- Protected Member Functions inherited from MemoryArray
 MemoryArray (const std::shared_ptr< vireo::Vireo > &vireo, size_t instanceSize, size_t instanceCount, vireo::BufferType bufferType, const std::string &name)
 
- Protected Attributes inherited from MemoryArray
const std::string name
 
const size_t instanceSize
 
std::shared_ptr< vireo::Buffer > buffer
 
std::list< MemoryBlockfreeBlocs
 
std::mutex mutex
 

Constructor & Destructor Documentation

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

Creates a device only GPU memory array

Parameters
vireoVireo instance
instanceSizeSize in bytes of the resources stored in the array
instanceCountMaximum number of resources stored in the array
stagingInstanceCountMaximum number of temporary resources used for staging temporary data before transfer
nameName of the GPU buffer for GPU-side debug
~DeviceMemoryArray ( )
override

Member Function Documentation

void flush ( const vireo::CommandList &  commandList)

Transfer pending writes from the staging buffer into the array

void postBarrier ( const vireo::CommandList &  commandList) const

Put the GPU buffer in SHADER_READ state

void write ( const MemoryBlock destination,
const void *  source 
)
overridevirtual

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

Implements lysa::MemoryArray::write()