MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_data()

Read buffer contents as Kakshya DataVariant.

For host-visible buffers this returns a single DataVariant containing the raw bytes. For device-local buffers this warns and returns empty; use Buffers::download_from_gpu to read GPU-only memory.

Returns
Vector of DataVariant objects representing buffer contents.

Definition at line 121 of file VKBuffer.cpp.

122{
123 if (!is_initialized()) {
125 "Cannot get_data from uninitialized VKBuffer");
126 return {};
127 }
128
129 if (is_host_visible() && m_resources.mapped_ptr) {
130 await_use();
132
133 std::vector<uint8_t> raw_bytes(m_size_bytes);
134 std::memcpy(raw_bytes.data(), m_resources.mapped_ptr, m_size_bytes);
135 return { raw_bytes };
136 }
137
139 "get_data() on a device-local buffer is not supported, use Buffers::download_from_gpu");
140 return {};
141}
#define MF_WARN(comp, ctx,...)
void await_use() const
Block until the latest recorded submission has completed; returns at once if none.
Definition VKBuffer.cpp:217
bool is_initialized() const
Check whether Vulkan handles are present (buffer registered).
Definition VKBuffer.hpp:283
bool is_host_visible() const
Whether this VKBuffer should be host-visible.
Definition VKBuffer.hpp:373
void mark_invalid_range(size_t offset, size_t size)
Mark a range as invalid (needs download).
Definition VKBuffer.cpp:453
@ BufferManagement
Buffer Management (Buffers::BufferManager, creating buffers).
@ Buffers
Buffers, Managers, processors and processing chains.