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

◆ ensure_staging_buffer()

void MayaFlux::Buffers::BufferUploadProcessor::ensure_staging_buffer ( const std::shared_ptr< VKBuffer > &  target)
private

Definition at line 72 of file BufferUploadProcessor.cpp.

73{
74 auto it = m_staging_buffers.find(target);
75 if (it != m_staging_buffers.end() && it->second->get_size_bytes() >= target->get_size_bytes() && it->second->is_initialized()) {
76 return;
77 }
78
79 auto staging_buffer = std::make_shared<VKBuffer>(
80 target->get_size_bytes(),
81 VKBuffer::Usage::STAGING,
83
84 if (!m_buffer_service) {
85 error<std::runtime_error>(
88 std::source_location::current(),
89 "No processing context available for staging buffer initialization");
90 }
91
92 if (!staging_buffer->is_initialized()) {
93 try {
94 m_buffer_service->initialize_buffer(staging_buffer);
95 } catch (const std::exception& e) {
99 std::source_location::current(),
100 "Failed to initialize staging buffer: {}", e.what());
101 }
102 }
103
104 m_staging_buffers[target] = staging_buffer;
105
107 "Created staging buffer: {} bytes", staging_buffer->get_size_bytes());
108}
#define MF_INFO(comp, ctx,...)
std::unordered_map< std::shared_ptr< Buffer >, std::shared_ptr< VKBuffer > > m_staging_buffers
Maps target 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.
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 upload_device_local().

+ Here is the caller graph for this function: