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

◆ ensure_staging_buffer()

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

Definition at line 83 of file BufferDownloadProcessor.cpp.

84{
85 auto it = m_staging_buffers.find(source);
86 if (it != m_staging_buffers.end() && it->second->get_size_bytes() >= source->get_size_bytes() && it->second->is_initialized()) {
87 return;
88 }
89
90 auto staging_buffer = std::make_shared<VKBuffer>(
91 source->get_size_bytes(),
92 VKBuffer::Usage::STAGING,
94
95 if (!m_buffer_service) {
96 error<std::runtime_error>(
99 std::source_location::current(),
100 "No processing context available for staging buffer initialization");
101 }
102
103 if (!staging_buffer->is_initialized()) {
104 try {
105 m_buffer_service->initialize_buffer(staging_buffer);
106 } catch (const std::exception& e) {
110 std::source_location::current(),
111 "Failed to initialize staging buffer: {}", e.what());
112 }
113 }
114
115 m_staging_buffers[source] = staging_buffer;
116
118 "Created staging buffer for download: {} bytes", staging_buffer->get_size_bytes());
119}
#define MF_INFO(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)
Registry::Service::BufferService * m_buffer_service
Definition VKBuffer.hpp:667
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Buffers
Buffers, Managers, processors and processing chains.
@ UNKNOWN
Unknown or undefined modality.
Source source()
Begin a Source chain.
Definition Plot.hpp:128
std::function< void(const std::shared_ptr< void > &)> initialize_buffer
Initialize a buffer object.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Registry::Service::BufferService::initialize_buffer, MayaFlux::Buffers::VKBufferProcessor::m_buffer_service, m_staging_buffers, MF_INFO, and MayaFlux::Kakshya::UNKNOWN.

Referenced by download_device_local().

+ Here is the caller graph for this function: