Adds a graphics buffer to a token.
214{
215 if (auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer)) {
216
218 auto processing_chain = unit.
get_chain();
219
220 if (auto buf_chain = buffer->get_processing_chain()) {
221 if (buf_chain != processing_chain) {
222 processing_chain->merge_chain(buf_chain);
223 }
224 } else {
225 buffer->set_processing_chain(processing_chain, false);
226 }
227
228 try {
229 if (!vk_buffer->is_initialized()) {
232 }
234 vk_buffer->setup_processors(token);
235 }
236 } catch (const std::exception& e) {
238 std::source_location::current(),
239 "Failed to initialize graphics buffer for token {}: {}",
240 static_cast<int>(token), e.what());
241 }
242
243 unit.get_buffer()->add_child_buffer(vk_buffer);
244
246 "Added graphics buffer to token {} (total: {})",
247 static_cast<int>(token),
248 unit.get_buffer()->get_buffer_count());
249
250 } else {
252 std::source_location::current(),
253 "Unsupported graphics buffer type for token {}",
254 static_cast<int>(token));
255 }
256}
#define MF_INFO(comp, ctx,...)
TokenUnitManager & m_unit_manager
Reference to the token/unit manager for storage operations.
Registry::Service::BufferService * m_buffer_service
Vulkan buffer processing context.
void initialize_buffer_service()
Initializes the buffer service for Vulkan operations.
RootGraphicsUnit & get_or_create_graphics_unit(ProcessingToken token)
Gets or creates a root graphics unit for the specified token.
@ BufferManagement
Buffer Management (Buffers::BufferManager, creating buffers)
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.
@ Core
Core engine, backend, subsystems.
std::shared_ptr< BufferProcessingChain > get_chain() const
std::function< void(const std::shared_ptr< void > &)> initialize_buffer
Initialize a buffer object.