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

◆ remove_graphics_buffer()

void MayaFlux::Buffers::BufferAccessControl::remove_graphics_buffer ( const std::shared_ptr< Buffer > &  buffer,
ProcessingToken  token 
)

Removes a graphics buffer from a token.

Parameters
bufferGraphics buffer to remove
tokenProcessing domain

Definition at line 262 of file BufferAccessControl.cpp.

265{
266 if (!buffer) {
268 "Attempted to remove null graphics buffer from token {}",
269 static_cast<int>(token));
270 return;
271 }
272
273 if (auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer)) {
274 if (!m_unit_manager.has_graphics_unit(token)) {
276 "Token {} not found when removing graphics buffer",
277 static_cast<int>(token));
278 return;
279 }
280
281 auto& unit = m_unit_manager.get_graphics_unit_mutable(token);
282 unit.get_buffer()->remove_child_buffer(vk_buffer);
283
284 try {
285 auto buffer_service = Registry::BackendRegistry::instance()
286 .get_service<Registry::Service::BufferService>();
287 if (vk_buffer->is_initialized()) {
288 buffer_service->destroy_buffer(vk_buffer);
289 }
290 } catch (const std::exception& e) {
292 std::source_location::current(),
293 "Failed to cleanup graphics buffer for token {}: {}",
294 static_cast<int>(token), e.what());
295 }
296
298 "Removed graphics buffer from token {} (remaining: {})",
299 static_cast<int>(token),
300 unit.get_buffer()->get_buffer_count());
301 } else {
303 std::source_location::current(),
304 "Unsupported graphics buffer type for token {}",
305 static_cast<int>(token));
306 }
307}
#define MF_INFO(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
TokenUnitManager & m_unit_manager
Reference to the token/unit manager for storage operations.
RootGraphicsUnit & get_graphics_unit_mutable(ProcessingToken token)
Gets an existing graphics unit without creating if missing (mutable)
bool has_graphics_unit(ProcessingToken token) const
Checks if a graphics unit exists for the given token.
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
@ 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< RootGraphicsBuffer > get_buffer() const

References buffer, MayaFlux::Journal::BufferManagement, MayaFlux::Journal::Core, MayaFlux::Registry::Service::BufferService::destroy_buffer, MayaFlux::Buffers::RootGraphicsUnit::get_buffer(), MayaFlux::Buffers::TokenUnitManager::get_graphics_unit_mutable(), MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Buffers::TokenUnitManager::has_graphics_unit(), MayaFlux::Registry::BackendRegistry::instance(), m_unit_manager, MF_INFO, and MF_WARN.

Referenced by remove_buffer(), and terminate_active_buffers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: