MayaFlux 0.4.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 305 of file GpuDispatchCore.cpp.

306{
307 const size_t idx = find_first_output_index();
308
309 if (idx < m_bindings.size()) {
310 const auto et = m_bindings[idx].element_type;
313 return {};
314 }
315
316 const size_t allocated = m_resources.buffer_allocated_bytes(idx);
317 const size_t byte_size = std::min(float_count * sizeof(float), allocated);
318 std::vector<float> out(byte_size / sizeof(float));
319 m_resources.download(idx, out.data(), byte_size);
320 return out;
321}
std::vector< GpuBufferBinding > m_bindings
size_t buffer_allocated_bytes(size_t index) const
void download(size_t index, float *dest, size_t byte_size)

References MayaFlux::Yantra::GpuResourceManager::buffer_allocated_bytes(), MayaFlux::Yantra::GpuResourceManager::download(), find_first_output_index(), MayaFlux::Yantra::GpuBufferBinding::IMAGE_SAMPLED, MayaFlux::Yantra::GpuBufferBinding::IMAGE_STORAGE, m_bindings, and m_resources.

Referenced by dispatch_core(), and dispatch_core_chained().

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