MayaFlux 0.2.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 255 of file BufferAccessControl.cpp.

258{
259 if (!buffer) {
261 "Attempted to remove null graphics buffer from token {}",
262 static_cast<int>(token));
263 return;
264 }
265
266 if (auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer)) {
269 "Token {} not found when removing graphics buffer",
270 static_cast<int>(token));
271 return;
272 }
273
275 unit.get_buffer()->remove_child_buffer(vk_buffer);
276
277 try {
278 auto buffer_service = Registry::BackendRegistry::instance()
279 .get_service<Registry::Service::BufferService>();
280 if (vk_buffer->is_initialized()) {
281 buffer_service->destroy_buffer(vk_buffer);
282 }
283 } catch (const std::exception& e) {
285 std::source_location::current(),
286 "Failed to cleanup graphics buffer for token {}: {}",
287 static_cast<int>(token), e.what());
288 }
289
291 "Removed graphics buffer from token {} (remaining: {})",
292 static_cast<int>(token),
293 unit.get_buffer()->get_buffer_count());
294 } else {
296 std::source_location::current(),
297 "Unsupported graphics buffer type for token {}",
298 static_cast<int>(token));
299 }
300}
#define MF_INFO(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
static MayaFlux::Nodes::ProcessingToken token
Definition Timers.cpp:8
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, MF_WARN, and token.

Referenced by remove_buffer(), and terminate_active_buffers().

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