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

◆ resolve_back_buffer_read()

MAYAFLUX_API void MayaFlux::Buffers::resolve_back_buffer_read ( TransferHandle &  handle,
const VKBufferResources::GenerationSlot &  slot,
void *  data,
size_t  size,
std::shared_ptr< VKBuffer > &  staging,
size_t  staging_offset = 0 
)

Wait for a recorded download, then copy it out of staging.

Parameters
handleHandle from download_back_buffer_async. Nulled on return. A null handle means the slot was host-visible; slot is read directly in that case.
slotSource slot, needed only for the host-visible path.
dataDestination pointer, at least size bytes.
sizeByte count.
stagingThe same staging buffer the copy was recorded against.
staging_offsetThe same offset it was recorded at.

Issue every download_back_buffer_async in a batch before resolving any of them; resolving as you go reintroduces the serialisation the split exists to avoid.

Definition at line 331 of file StagingUtils.cpp.

338{
339 if (!data || size == 0)
340 return;
341
342 if (!handle) {
343 if (slot.mapped_ptr) {
344 std::memcpy(data, slot.mapped_ptr, size);
345 }
346 return;
347 }
348
349 auto buffer_service = Registry::BackendRegistry::instance()
350 .get_service<Registry::Service::BufferService>();
351
352 buffer_service->wait_fenced(handle);
353
354 auto& resources = staging->get_buffer_resources();
355 buffer_service->invalidate_range(resources.memory, staging_offset, size);
356
357 const auto* base = static_cast<const uint8_t*>(staging->get_mapped_ptr());
358 std::memcpy(data, base + staging_offset, size);
359
360 buffer_service->release_fenced(handle);
361 handle.reset();
362}
bool size

References MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Registry::BackendRegistry::instance(), MayaFlux::Buffers::VKBufferResources::GenerationSlot::mapped_ptr, size, and MayaFlux::Registry::Service::BufferService::wait_fenced.

Referenced by MayaFlux::Buffers::DataReadProcessor::collect_result(), download_back_buffer(), and MayaFlux::Buffers::VolumeGridBuffer::read_fields().

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