73{
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
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 {
95 } catch (const std::exception& e) {
99 std::source_location::current(),
100 "Failed to initialize staging buffer: {}", e.what());
101 }
102 }
103
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
@ 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.