MayaFlux 0.4.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 259 of file BackendResoureManager.cpp.

260{
261 if (!buffer) {
263 "Attempted to cleanup null VulkanBuffer");
264 return;
265 }
266
267 auto it = std::ranges::find(m_managed_buffers, buffer);
268 if (it == m_managed_buffers.end()) {
269 return;
270 }
271
272 auto& res = it->get()->get_buffer_resources();
273
274 if (res.mapped_ptr) {
275 m_context.get_device().unmapMemory(res.memory);
276 }
277
278 if (res.index_buffer) {
279 m_context.get_device().destroyBuffer(res.index_buffer);
280 }
281
282 if (res.index_memory) {
283 m_context.get_device().freeMemory(res.index_memory);
284 }
285
286 if (res.buffer) {
287 m_context.get_device().destroyBuffer(res.buffer);
288 }
289
290 if (res.memory) {
291 m_context.get_device().freeMemory(res.memory);
292 }
293
295 "VulkanBuffer cleaned up: {:p}", static_cast<void*>(res.buffer));
296
297 m_managed_buffers.erase(it);
298}
#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: