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

◆ cleanup_buffer()

void MayaFlux::Core::BackendResourceManager::cleanup_buffer ( const std::shared_ptr< Buffers::VKBuffer > &  buffer)

Cleanup a buffer and release associated resources.

Parameters
bufferShared pointer to the buffer to cleanup

Definition at line 296 of file BackendResoureManager.cpp.

297{
298 if (!buffer) {
300 "Attempted to cleanup null VKBuffer");
301 return;
302 }
303
304 auto it = std::ranges::find(m_managed_buffers, buffer);
305 if (it == m_managed_buffers.end()) {
306 return;
307 }
308
309 auto& res = it->get()->get_buffer_resources();
310
311 if (res.mapped_ptr) {
312 m_context.get_device().unmapMemory(res.memory);
313 }
314
315 if (res.index_buffer) {
316 m_context.get_device().destroyBuffer(res.index_buffer);
317 }
318
319 if (res.index_memory) {
320 m_context.get_device().freeMemory(res.index_memory);
321 }
322
323 if (res.buffer) {
324 m_context.get_device().destroyBuffer(res.buffer);
325 }
326
327 if (res.memory) {
328 m_context.get_device().freeMemory(res.memory);
329 }
330
332 "VKBuffer cleaned up: {:p}", static_cast<void*>(res.buffer));
333
334 m_managed_buffers.erase(it);
335}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
std::vector< std::shared_ptr< Buffers::VKBuffer > > m_managed_buffers
vk::Device get_device() const
Get logical device.
Definition VKContext.hpp:49
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Core::VKContext::get_device(), MayaFlux::Journal::GraphicsBackend, m_context, m_managed_buffers, MF_ERROR, and MF_INFO.

Referenced by cleanup(), download_image_data(), setup_backend_service(), and upload_image_data().

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