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

◆ read_field()

void MayaFlux::Buffers::VolumeGridBuffer::read_field ( const std::string &  name,
void *  data,
size_t  size 
)

Copy the current read slot of a field to host memory.

Parameters
nameField name.
dataDestination pointer, at least get_field_bytes(name) bytes.
sizeByte count; must equal get_field_bytes(name).

Blocking. Records a fenced device-to-host copy and waits on it from the calling thread. Not for per-frame use on the graphics thread.

Definition at line 665 of file VolumeGridBuffer.cpp.

666{
667 const auto* field = find_field(name, "read_field");
668 if (!field) {
669 return;
670 }
671
672 const size_t expected = static_cast<size_t>(get_cell_count()) * field->stride_bytes;
673 if (size != expected) {
675 "VolumeGridBuffer::read_field: size {} does not match expected {} for '{}'",
676 size, expected, name);
677 return;
678 }
679
680 const uint32_t slot = field->read_is_a ? field->slot_a : field->slot_b;
683}
#define MF_ERROR(comp, ctx,...)
bool size
std::string name
Definition VKDevice.cpp:123
const VKBufferResources & get_buffer_resources() const
Get all buffer resources at once (read-only)
Definition VKBuffer.hpp:343
const Field * find_field(const std::string &name, const char *context) const
Resolve a field by name.
TransferHandle m_pending_transfer
In-flight seed upload, resolved before the next transfer.
uint32_t get_cell_count() const
Total cell count.
std::shared_ptr< VKBuffer > m_transfer_staging
Reused across seed and read calls.
void resolve_transfer(TransferHandle &handle)
Wait for a transfer and release its resources.
void download_back_buffer(const VKBufferResources::GenerationSlot &slot, void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Download a raw back_buffers slot to host memory.
@ BufferManagement
Buffer Management (Buffers::BufferManager, creating buffers)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferManagement, MayaFlux::Journal::Buffers, MayaFlux::Buffers::download_back_buffer(), find_field(), MayaFlux::Buffers::VKBuffer::get_buffer_resources(), get_cell_count(), m_pending_transfer, m_transfer_staging, MF_ERROR, name, MayaFlux::Buffers::resolve_transfer(), and size.

Referenced by accumulate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: