diff --git a/includes/mlx.h b/includes/mlx.h index e2f2570..14f4453 100644 --- a/includes/mlx.h +++ b/includes/mlx.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/04 16:56:35 by maldavid #+# #+# */ -/* Updated: 2023/12/20 00:57:15 by kiroussa ### ########.fr */ +/* Updated: 2023/12/27 17:19:50 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -31,6 +31,7 @@ typedef enum MLX_WINDOW_EVENT = 5 } mlx_event_type; + /** * @brief Initializes the MLX internal application * @@ -38,6 +39,7 @@ typedef enum */ MLX_API void* mlx_init(); + /** * @brief Creates a new window * @@ -50,6 +52,7 @@ MLX_API void* mlx_init(); */ MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title); + /** * @brief Gives a function to be executed at each loop turn * @@ -59,9 +62,9 @@ MLX_API void* mlx_new_window(void* mlx, int w, int h, const char* title); * * @return (int) Always return 0, made this to copy the behaviour of the original MLX */ - MLX_API int mlx_loop_hook(void* mlx, int (*f)(void*), void* param); + /** * @brief Starts the internal main loop * @@ -71,6 +74,7 @@ MLX_API int mlx_loop_hook(void* mlx, int (*f)(void*), void* param); */ MLX_API int mlx_loop(void* mlx); + /** * @brief Ends the internal main loop * @@ -80,6 +84,7 @@ MLX_API int mlx_loop(void* mlx); */ MLX_API int mlx_loop_end(void* mlx); + /** * @brief Shows mouse cursor * @@ -87,6 +92,7 @@ MLX_API int mlx_loop_end(void* mlx); */ MLX_API int mlx_mouse_show(); + /** * @brief Hides mouse cursor * @@ -94,6 +100,7 @@ MLX_API int mlx_mouse_show(); */ MLX_API int mlx_mouse_hide(); + /** * @brief Moves cursor to givent position * @@ -106,6 +113,7 @@ MLX_API int mlx_mouse_hide(); */ MLX_API int mlx_mouse_move(void* mlx, void* win, int x, int y); + /** * @brief Get cursor's position * @@ -160,6 +168,7 @@ MLX_API int mlx_pixel_put(void* mlx, void* win, int x, int y, int color); */ MLX_API void* mlx_new_image(void* mlx, int width, int height); + /** * @brief Get image pixel data * @@ -180,6 +189,7 @@ MLX_API void* mlx_new_image(void* mlx, int width, int height); */ MLX_API int mlx_get_image_pixel(void* mlx, void* img, int x, int y); + /** * @brief Set image pixel data * @@ -201,6 +211,7 @@ MLX_API int mlx_get_image_pixel(void* mlx, void* img, int x, int y); */ MLX_API void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color); + /** * @brief Put image to the given window * @@ -214,6 +225,7 @@ MLX_API void mlx_set_image_pixel(void* mlx, void* img, int x, int y, int color); */ MLX_API int mlx_put_image_to_window(void* mlx, void* win, void* img, int x, int y); + /** * @brief Destroys internal image * @@ -237,6 +249,7 @@ MLX_API int mlx_destroy_image(void* mlx, void* img); */ MLX_API void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* height); + /** * @brief Create a new image from a jpg file * @@ -249,6 +262,7 @@ MLX_API void* mlx_png_file_to_image(void* mlx, char* filename, int* width, int* */ MLX_API void* mlx_jpg_file_to_image(void* mlx, char* filename, int* width, int* height); + /** * @brief Create a new image from a bmp file * @@ -288,6 +302,7 @@ MLX_API int mlx_string_put(void* mlx, void* win, int x, int y, int color, char* */ MLX_API void mlx_set_font(void* mlx, void* win, char* filepath); + /** * @brief Loads a font to be used by `mlx_string_put` and scales it * diff --git a/src/core/application.cpp b/src/core/application.cpp index 1335786..21bc253 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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(ptr); texture->destroy(); } diff --git a/src/core/errors.h b/src/core/errors.h index d5aa359..9bfde94 100644 --- a/src/core/errors.h +++ b/src/core/errors.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/src/core/graphics.cpp b/src/core/graphics.cpp index 69db6e3..cd936f7 100644 --- a/src/core/graphics.cpp +++ b/src/core/graphics.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/src/core/graphics.inl b/src/core/graphics.inl index b5555e8..a03bd9f 100644 --- a/src/core/graphics.inl +++ b/src/core/graphics.inl @@ -10,7 +10,6 @@ /* */ /* ************************************************************************** */ -#include "renderer/images/texture.h" #include #include diff --git a/src/platform/window.cpp b/src/platform/window.cpp index 39b6093..aee77aa 100644 --- a/src/platform/window.cpp +++ b/src/platform/window.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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()); diff --git a/src/renderer/core/memory.cpp b/src/renderer/core/memory.cpp index 5ff7c67..8712085 100644 --- a/src/renderer/core/memory.cpp +++ b/src/renderer/core/memory.cpp @@ -6,7 +6,7 @@ /* By: kbz_8 +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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(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; } } diff --git a/src/renderer/core/vk_validation_layers.cpp b/src/renderer/core/vk_validation_layers.cpp index 27d7341..dfb3443 100644 --- a/src/renderer/core/vk_validation_layers.cpp +++ b/src/renderer/core/vk_validation_layers.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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");