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

◆ download_back_buffers()

void MayaFlux::Buffers::BufferDownloadProcessor::download_back_buffers ( const std::shared_ptr< VKBuffer > &  source)
private

Definition at line 205 of file BufferDownloadProcessor.cpp.

206{
207 auto it = m_back_buffers_target_map.find(std::static_pointer_cast<Buffer>(source));
208 if (it == m_back_buffers_target_map.end()) {
209 return;
210 }
211
212 auto& targets = it->second;
213 auto& resources = source->get_buffer_resources();
214
215 if (targets.size() != resources.back_buffers.size()) {
217 "download_back_buffers: {} targets configured, {} entries present",
218 targets.size(), resources.back_buffers.size());
219 return;
220 }
221
222 auto& staging = m_staging_buffers[std::static_pointer_cast<Buffer>(source)];
223
224 for (size_t i = 0; i < resources.back_buffers.size(); ++i) {
225 auto target = std::dynamic_pointer_cast<VKBuffer>(targets[i]);
226 if (!target) {
228 "download_back_buffers: target {} is not a VKBuffer", i);
229 continue;
230 }
231
232 const size_t bytes = target->get_size_bytes();
233 std::vector<uint8_t> raw(bytes);
234 download_back_buffer(resources.back_buffers[i], raw.data(), bytes, staging);
235
236 target->set_data({ raw });
237 }
238}
#define MF_RT_ERROR(comp, ctx,...)
std::unordered_map< std::shared_ptr< Buffer >, std::shared_ptr< VKBuffer > > m_staging_buffers
Maps source VKBuffer -> staging buffer (for device-local transfers)
std::unordered_map< std::shared_ptr< Buffer >, std::vector< std::shared_ptr< Buffer > > > m_back_buffers_target_map
Maps source VKBuffer -> vector of target Buffers for back_buffers.
void download_back_buffer(const VKBufferResources::GenerationSlot &slot, void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Download a raw back_buffers slot to host memory.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
Source source()
Begin a Source chain.
Definition Plot.hpp:128

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::download_back_buffer(), m_back_buffers_target_map, m_staging_buffers, and MF_RT_ERROR.

Referenced by processing_function().

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