Adds a graphics buffer to a token.
211{
212 if (auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer)) {
213
215 auto processing_chain = unit.
get_chain();
216
217 if (auto buf_chain = buffer->get_processing_chain()) {
218 if (buf_chain != processing_chain) {
219 processing_chain->merge_chain(buf_chain);
220 }
221 } else {
222 buffer->set_processing_chain(processing_chain, false);
223 }
224
225 try {
226 if (!vk_buffer->is_initialized()) {
229 }
231 vk_buffer->setup_processors(
token);
232 }
233 } catch (const std::exception& e) {
235 std::source_location::current(),
236 "Failed to initialize graphics buffer for token {}: {}",
237 static_cast<int>(
token), e.what());
238 }
239
240 unit.get_buffer()->add_child_buffer(vk_buffer);
241
243 "Added graphics buffer to token {} (total: {})",
244 static_cast<int>(
token),
245 unit.get_buffer()->get_buffer_count());
246
247 } else {
249 std::source_location::current(),
250 "Unsupported graphics buffer type for token {}",
251 static_cast<int>(
token));
252 }
253}
#define MF_INFO(comp, ctx,...)
static MayaFlux::Nodes::ProcessingToken token
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.