fixing issue when creating multiple mlx application with leaks in the first one

This commit is contained in:
2023-12-28 01:06:03 +01:00
parent b144afd3fe
commit ac3b28c922
8 changed files with 30 additions and 16 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */
/* Updated: 2023/12/24 08:56:33 by kbz_8 ### ########.fr */
/* Updated: 2023/12/27 21:30:10 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -64,7 +64,7 @@ namespace mlx::core
void Application::destroyTexture(void* ptr)
{
vkDeviceWaitIdle(Render_Core::get().getDevice().get()); // TODO : synchronize with another method than stopping all the GPU porcess
vkDeviceWaitIdle(Render_Core::get().getDevice().get()); // TODO : synchronize with another method than stopping all the GPU process
Texture* texture = static_cast<Texture*>(ptr);
texture->destroy();
}

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:42:32 by maldavid #+# #+# */
/* Updated: 2023/12/11 19:46:57 by kbz_8 ### ########.fr */
/* Updated: 2023/12/27 17:21:07 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */
/* Updated: 2023/12/24 09:39:45 by kbz_8 ### ########.fr */
/* Updated: 2023/12/27 21:27:48 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */

View File

@@ -10,7 +10,6 @@
/* */
/* ************************************************************************** */
#include "renderer/images/texture.h"
#include <core/graphics.h>
#include <type_traits>

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:36:44 by maldavid #+# #+# */
/* Updated: 2023/12/10 22:49:11 by kbz_8 ### ########.fr */
/* Updated: 2023/12/27 16:57:28 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -31,6 +31,8 @@ namespace mlx
MLX_Window::MLX_Window(std::size_t w, std::size_t h, const std::string& title) : _width(w), _height(h)
{
if(title.find("vvaas") != std::string::npos)
core::error::report(e_kind::message, "vvaas est mauvais");
_win = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h, SDL_WINDOW_VULKAN | SDL_WINDOW_SHOWN);
if(!_win)
core::error::report(e_kind::fatal_error, std::string("unable to open a new window, ") + SDL_GetError());

View File

@@ -6,7 +6,7 @@
/* By: kbz_8 <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/20 22:02:37 by kbz_8 #+# #+# */
/* Updated: 2023/12/16 19:14:15 by maldavid ### ########.fr */
/* Updated: 2023/12/27 21:31:04 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,11 +17,7 @@
#define VMA_STATIC_VULKAN_FUNCTIONS 0
#define VMA_DYNAMIC_VULKAN_FUNCTIONS 0
#define VMA_VULKAN_VERSION 1002000
#ifdef DEBUG
#define VMA_ASSERT(expr) (static_cast<bool>(expr) ? void(0) : mlx::core::error::report(e_kind::fatal_error, "Graphics allocator : an assertion has been catched : '%s'", #expr))
#else
#define VMA_ASSERT(expr) ((void)0)
#endif
#define VMA_ASSERT(expr) ((void)0)
#define VMA_IMPLEMENTATION
#ifdef MLX_COMPILER_CLANG
@@ -177,5 +173,7 @@ namespace mlx
else if(_active_buffers_allocations != 0)
core::error::report(e_kind::error, "Graphics allocator : some MLX-dependant allocations were not freed before destroying the display (%d active allocations), please report, this should not happen", _active_buffers_allocations);
vmaDestroyAllocator(_allocator);
_active_buffers_allocations = 0;
_active_images_allocations = 0;
}
}

View File

@@ -6,7 +6,7 @@
/* By: maldavid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/19 14:05:25 by maldavid #+# #+# */
/* Updated: 2023/12/10 22:25:36 by kbz_8 ### ########.fr */
/* Updated: 2023/12/28 01:01:03 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -27,7 +27,7 @@ namespace mlx
VkDebugUtilsMessengerCreateInfoEXT createInfo;
populateDebugMessengerCreateInfo(createInfo);
if(createDebugUtilsMessengerEXT(&createInfo, nullptr) != VK_SUCCESS)
core::error::report(e_kind::error, "Vulkan : failed to set up debug messenger");
core::error::report(e_kind::warning, "Vulkan : failed to set up debug messenger");
#ifdef DEBUG
else
core::error::report(e_kind::message, "Vulkan : enabled validation layers");