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 239 of file BackendResoureManager.cpp.

240{
241 if (!buffer) {
243 "Attempted to cleanup null VulkanBuffer");
244 return;
245 }
246
247 auto it = std::ranges::find(m_managed_buffers, buffer);
248 if (it == m_managed_buffers.end()) {
249 return;
250 }
251
252 auto& res = it->get()->get_buffer_resources();
253
254 if (res.mapped_ptr) {
255 m_context.get_device().unmapMemory(res.memory);
256 }
257
258 if (res.index_buffer) {
259 m_context.get_device().destroyBuffer(res.index_buffer);
260 }
261
262 if (res.index_memory) {
263 m_context.get_device().freeMemory(res.index_memory);
264 }
265
266 if (res.buffer) {
267 m_context.get_device().destroyBuffer(res.buffer);
268 }
269
270 if (res.memory) {
271 m_context.get_device().freeMemory(res.memory);
272 }
273
275 "VulkanBuffer cleaned up: {:p}", static_cast<void*>(res.buffer));
276
277 m_managed_buffers.erase(it);
278}
#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: