MayaFlux 0.4.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 258 of file BufferAccessControl.cpp.

261{
262 if (!buffer) {
264 "Attempted to remove null graphics buffer from token {}",
265 static_cast<int>(token));
266 return;
267 }
268
269 if (auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer)) {
270 if (!m_unit_manager.has_graphics_unit(token)) {
272 "Token {} not found when removing graphics buffer",
273 static_cast<int>(token));
274 return;
275 }
276
277 auto& unit = m_unit_manager.get_graphics_unit_mutable(token);
278 unit.get_buffer()->remove_child_buffer(vk_buffer);
279
280 try {
281 auto buffer_service = Registry::BackendRegistry::instance()
282 .get_service<Registry::Service::BufferService>();
283 if (vk_buffer->is_initialized()) {
284 buffer_service->destroy_buffer(vk_buffer);
285 }
286 } catch (const std::exception& e) {
288 std::source_location::current(),
289 "Failed to cleanup graphics buffer for token {}: {}",
290 static_cast<int>(token), e.what());
291 }
292
294 "Removed graphics buffer from token {} (remaining: {})",
295 static_cast<int>(token),
296 unit.get_buffer()->get_buffer_count());
297 } else {
299 std::source_location::current(),
300 "Unsupported graphics buffer type for token {}",
301 static_cast<int>(token));
302 }
303}
#define MF_INFO(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
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 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: