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

◆ readback_primary()

std::vector< float > MayaFlux::Yantra::GpuDispatchCore::readback_primary ( size_t  float_count)
protected

Read back the primary output buffer into a float vector.

Selects the first OUTPUT or INPUT_OUTPUT binding. Caps readback to the lesser of the requested float count and the allocated buffer size.

Parameters
float_countNumber of float elements to attempt to read.
Returns
Float vector of length min(float_count, allocated / sizeof(float)).

Definition at line 448 of file GpuDispatchCore.cpp.

449{
450 const size_t idx = find_first_output_index();
451
452 for (const auto& b : m_bindings) {
453 if (b.binding != idx)
454 continue;
457 return {};
458 break;
459 }
460
461 const size_t allocated = m_resources.buffer_allocated_bytes(dispatch_key(), idx);
462 const size_t byte_size = std::min(float_count * sizeof(float), allocated);
463 std::vector<float> out(byte_size / sizeof(float));
464 m_resources.download(dispatch_key(), idx, out.data(), byte_size);
465 return out;
466}
size_t b
std::vector< float > * out
const std::string & dispatch_key() const
The key used for this context's GpuResourceManager unit.
std::vector< GpuBufferBinding > m_bindings
void download(const std::string &key, size_t index, float *dest, size_t byte_size)
size_t buffer_allocated_bytes(const std::string &key, size_t index) const

References b, MayaFlux::Yantra::GpuResourceManager::buffer_allocated_bytes(), dispatch_key(), MayaFlux::Yantra::GpuResourceManager::download(), find_first_output_index(), MayaFlux::Portal::Graphics::GpuBufferBinding::IMAGE_SAMPLED, MayaFlux::Portal::Graphics::GpuBufferBinding::IMAGE_STORAGE, m_bindings, m_resources, and out.

Referenced by MayaFlux::Yantra::ShaderExecutionContext< InputType, OutputType >::collect_result(), dispatch_core(), dispatch_core_chained(), and dispatch_core_chained_indirect().

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