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

◆ submit_read()

bool MayaFlux::Buffers::DataReadProcessor::submit_read ( PendingRead &  pending,
std::shared_ptr< VKBuffer > &  staging,
size_t  available_bytes,
size_t  byte_count,
bool  mapped,
bool  transferable 
)
staticprivate

Definition at line 416 of file DataReadProcessor.cpp.

423{
424 if (byte_count == 0) {
425 byte_count = available_bytes;
426 }
427
428 if (byte_count > available_bytes || !pending.handle.buffer) {
430 "DataReadProcessor requested {} bytes from a {} byte buffer",
431 byte_count, available_bytes);
432 return false;
433 }
434
435 pending.bytes.resize(byte_count);
436
437 if (byte_count != 0 && mapped && pending.handle.mapped_ptr) {
438 std::memcpy(pending.bytes.data(), pending.handle.mapped_ptr, byte_count);
439 } else if (byte_count != 0) {
440 if (!transferable) {
442 "DataReadProcessor source has no mapped memory or transfer-source usage");
443 return false;
444 }
445
446 pending.transfer = download_back_buffer_async(
447 generation_slot(pending.handle), byte_count, staging);
448
449 if (!pending.transfer) {
451 "DataReadProcessor failed to submit a device-local read");
452 return false;
453 }
454 }
455
456 return true;
457}
#define MF_RT_ERROR(comp, ctx,...)
VKBufferResources::GenerationSlot generation_slot(const Portal::Graphics::GpuBufferHandle &handle)
Express a buffer handle as the slot the back_buffers transfer helpers take.
TransferHandle download_back_buffer_async(const VKBufferResources::GenerationSlot &slot, size_t size, std::shared_ptr< VKBuffer > &staging, size_t staging_offset)
Record a slot-to-staging copy without waiting for completion.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Portal::Graphics::GpuBufferHandle::buffer, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::DataReadProcessor::PendingRead::bytes, MayaFlux::Buffers::download_back_buffer_async(), MayaFlux::Buffers::generation_slot(), MayaFlux::Buffers::DataReadProcessor::PendingRead::handle, MayaFlux::Portal::Graphics::GpuBufferHandle::mapped_ptr, MF_RT_ERROR, and MayaFlux::Buffers::DataReadProcessor::PendingRead::transfer.

Referenced by read_back_buffer(), read_buffer(), read_bytes(), read_field(), read_mesh(), and read_vertices().

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