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

◆ read_field()

void MayaFlux::Buffers::DataReadProcessor::read_field ( std::string  name)

Read the current read slot of a named field on the attached buffer.

Resolves a VolumeGridBuffer field or a NetworkGeometryBuffer state field, at the time the request runs so a swapped generation is not read stale.

Definition at line 83 of file DataReadProcessor.cpp.

84{
85 arm([name = std::move(name)](DataReadProcessor& self, const std::shared_ptr<VKBuffer>& vk, PendingRead& pending) {
86 if (const auto volume = std::dynamic_pointer_cast<VolumeGridBuffer>(vk);
87 volume && volume->has_field(name)) {
88 const size_t bytes = volume->get_field_bytes(name);
89 pending.handle = {
90 .buffer = volume->read_handle(name),
91 .mapped_ptr = nullptr,
92 .size_bytes = bytes,
93 };
94 return submit_read(pending, self.m_staging, bytes, 0, false, true);
95 }
96
97 if (const auto network = std::dynamic_pointer_cast<NetworkGeometryBuffer>(vk);
98 network && network->has_state(name)) {
99 const size_t bytes = network->get_state_bytes(name);
100 pending.handle = gpu_buffer_handle(network->read_state_slot(name), bytes);
101 return submit_read(pending, self.m_staging, bytes, 0, true, true);
102 }
103
105 "DataReadProcessor read_field found no field named '{}' on the attached buffer", name);
106 return false;
107 });
108}
#define MF_RT_ERROR(comp, ctx,...)
Core::GlobalNetworkConfig network
Definition Config.cpp:43
std::string name
Definition VKDevice.cpp:123
static bool submit_read(PendingRead &pending, std::shared_ptr< VKBuffer > &staging, size_t available_bytes, size_t byte_count, bool mapped, bool transferable)
Portal::Graphics::GpuBufferHandle gpu_buffer_handle(const std::shared_ptr< VKBuffer > &buffer)
View a buffer's primary GPU storage without reading it back.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References arm(), MayaFlux::Portal::Graphics::GpuBufferHandle::buffer, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::gpu_buffer_handle(), MayaFlux::Buffers::DataReadProcessor::PendingRead::handle, m_staging, MF_RT_ERROR, name, network, and submit_read().

+ Here is the call graph for this function: