![]() |
Lysa
0.0
Lysa 3D Engine
|
Device-only GPU memory array.
Inheritance diagram for DeviceMemoryArray:Public Typedefs | |
| using | WriteSession = uint64 |
| Opaque handle returned by beginWrites() and consumed by flush(). More... | |
Public Member Functions | |
| DeviceMemoryArray (const std::shared_ptr< vireo::Vireo > &vireo, size_t instanceSize, size_t instanceCount, vireo::BufferType bufferType, const std::string &name) | |
| void | enableGrowth (vireo::ResourceState readState) |
| void | reserveAllocations (std::span< const size_t > counts) |
| size_t | releaseUnusedMemory (const vireo::CommandList &commandList, size_t minimumCount) |
| WriteSession | beginWrites () |
| void | write (WriteSession session, const MemoryBlock &destination, const void *source) |
| void | flush (WriteSession session, const vireo::CommandList &commandList) |
| void | barrier (const vireo::CommandList &commandList, vireo::ResourceState oldState, vireo::ResourceState newState) const |
| ~DeviceMemoryArray () override | |
Public Member Functions inherited from MemoryArray | |
| MemoryBlock | alloc (size_t instanceCount) |
| void | free (const MemoryBlock &bloc) |
| void | retire (const MemoryBlock &bloc, std::vector< std::weak_ptr< const void >> guards) |
| void | collectRetired () |
| void | copyTo (const vireo::CommandList &commandList, const MemoryArray &destination) |
| auto | getBuffer () const |
| virtual | ~MemoryArray () |
| MemoryArray (MemoryArray &) = delete | |
| MemoryArray & | operator= (MemoryArray &) = delete |
Static Public Attributes | |
| static constexpr WriteSession | INVALID_WRITE_SESSION {0} |
Additional Inherited Members | |
Protected Member Functions inherited from MemoryArray | |
| void | freeUnlocked (const MemoryBlock &bloc) |
| 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::shared_ptr< vireo::Vireo > | vireo |
| const std::string | name |
| const size_t | instanceSize |
| std::shared_ptr< vireo::Buffer > | buffer |
| std::list< MemoryBlock > | freeBlocs |
| std::mutex | mutex |
| std::vector< RetiredBlock > | retiredBlocks |
| using WriteSession = uint64 |
Opaque handle returned by beginWrites() and consumed by flush().
| DeviceMemoryArray | ( | const std::shared_ptr< vireo::Vireo > & | vireo, |
| size_t | instanceSize, | ||
| size_t | instanceCount, | ||
| vireo::BufferType | bufferType, | ||
| const std::string & | name | ||
| ) |
Creates a device-only GPU memory array.
| vireo | Vireo instance |
| instanceSize | Size in bytes of one element |
| instanceCount | Maximum number of elements |
| bufferType | Must be VERTEX, INDEX, INDIRECT, DEVICE_STORAGE or READWRITE_STORAGE |
| name | Name used for GPU-side debug labels |
|
override |
| void barrier | ( | const vireo::CommandList & | commandList, |
| vireo::ResourceState | oldState, | ||
| vireo::ResourceState | newState | ||
| ) | const |
Inserts a GPU pipeline/memory barrier for this buffer.
| WriteSession beginWrites | ( | ) |
| void enableGrowth | ( | vireo::ResourceState | readState | ) |
Opens a new write session and returns its opaque handle. Multiple sessions may be open simultaneously from different threads.
Enable geometric growth and synchronized writes on the graphics queue.
| void flush | ( | WriteSession | session, |
| const vireo::CommandList & | commandList | ||
| ) |
Emits GPU copies crated with crite()
Shrink trailing free capacity while preserving all allocation offsets.
| void reserveAllocations | ( | std::span< const size_t > | counts | ) |
Reserve a complete batch of contiguous allocations before recording copies.
| void write | ( | WriteSession | session, |
| const MemoryBlock & | destination, | ||
| const void * | source | ||
| ) |
Copies a memory block in a staging buffer for futur upload (thread-safe)
| session | Handle returned by beginWrites() |
| destination | GPU destination |
| source | CPU source |
|
staticconstexpr |