MayaFlux 0.1.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 78 of file BufferDownloadProcessor.cpp.

79{
80 auto it = m_staging_buffers.find(source);
81 if (it != m_staging_buffers.end() && it->second->get_size_bytes() >= source->get_size_bytes() && it->second->is_initialized()) {
82 return;
83 }
84
85 auto staging_buffer = std::make_shared<VKBuffer>(
86 source->get_size_bytes(),
89
90 if (!m_buffer_service) {
91 error<std::runtime_error>(
94 std::source_location::current(),
95 "No processing context available for staging buffer initialization");
96 }
97
98 if (!staging_buffer->is_initialized()) {
99 try {
100 m_buffer_service->initialize_buffer(staging_buffer);
101 } catch (const std::exception& e) {
105 std::source_location::current(),
106 "Failed to initialize staging buffer: {}", e.what());
107 }
108 }
109
110 m_staging_buffers[source] = staging_buffer;
111
113 "Created staging buffer for download: {} bytes", staging_buffer->get_size_bytes());
114}
#define MF_INFO(comp, ctx,...)
std::unordered_map< std::shared_ptr< Buffer >, std::shared_ptr< VKBuffer > > m_staging_buffers
Registry::Service::BufferService * m_buffer_service
Definition VKBuffer.hpp:468
@ STAGING
Host-visible staging buffer (CPU-writable)
@ 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.
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, MayaFlux::Buffers::VKBuffer::STAGING, and MayaFlux::Kakshya::UNKNOWN.

Referenced by download_device_local().

+ Here is the caller graph for this function: