MayaFlux 0.5.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 421 of file GpuDispatchCore.cpp.

422{
423 const size_t idx = find_first_output_index();
424
425 for (const auto& b : m_bindings) {
426 if (b.binding != idx)
427 continue;
430 return {};
431 break;
432 }
433
434 const size_t allocated = m_resources.buffer_allocated_bytes(dispatch_key(), idx);
435 const size_t byte_size = std::min(float_count * sizeof(float), allocated);
436 std::vector<float> out(byte_size / sizeof(float));
437 m_resources.download(dispatch_key(), idx, out.data(), byte_size);
438 return out;
439}
size_t b
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, and m_resources.

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: