diff --git a/Makefile b/Makefile index 4d974cc..1770e0b 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ MAKE = make --no-print-directory OS ?= $(shell uname -s) DEBUG ?= false TOOLCHAIN ?= clang -IMAGES_OPTIMIZED ?= true FORCE_INTEGRATED_GPU ?= false GRAPHICS_MEMORY_DUMP ?= false PROFILER ?= false @@ -69,10 +68,6 @@ ifeq ($(FORCE_INTEGRATED_GPU), true) _ENABLEDFLAGS += FORCE_INTEGRATED_GPU endif -ifeq ($(IMAGES_OPTIMIZED), true) - _ENABLEDFLAGS += IMAGE_OPTIMIZED -endif - ifeq ($(GRAPHICS_MEMORY_DUMP), true) _ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP endif diff --git a/README.md b/README.md index 63f0097..ce236ec 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,6 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you ### 🛠️ Set the toolchain If you want to use `GCC` to build the mlx you can use `make TOOLCHAIN=gcc` -### ⚠️⚠️⚠️ 🖼️ Image optimisations ⚠️⚠️⚠️ -If you run into glitches when writing or reading pixels from images you can turn off images optimisations by using `make IMAGES_OPTIMIZED=false`. - ### 🖥️ Force the integrated GPU (not recommended) You can force the mlx to use your integrated GPU by using `make FORCE_INTEGRATED_GPU=true`. Note that there are a lot of chances that your application crashes by using that. diff --git a/XMAKE_BUILD.md b/XMAKE_BUILD.md index 4f3c0e8..9ff249b 100644 --- a/XMAKE_BUILD.md +++ b/XMAKE_BUILD.md @@ -16,9 +16,6 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you ### 🛠️ Set the toolchain To change the compilation toolchain you can use `xmake config --toolchain=[gcc|clang|...]` -### ⚠️⚠️⚠️ 🖼️ Image optimisations ⚠️⚠️⚠️ -If you run into glitches when writing or reading pixels from images you can turn off images optimisations by using `xmake config --images_optimized=n`. - ### 🖥️ Force the integrated GPU (not recommended) You can force the mlx to use your integrated GPU using `xmake config --force_integrated_gpu=y`. Note that there are a lot of chances that your application crashes by using that. diff --git a/compile_flags.txt b/compile_flags.txt index 00cbbea..4bb4be0 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -7,6 +7,5 @@ -DMLX_BUILD -DSDL_MAIN_HANDLED -DDEBUG --DIMAGE_OPTIMIZED -D_REENTRANT -isystem/usr/include/SDL2 diff --git a/includes/mlx.h b/includes/mlx.h index abc9adb..a64f0d4 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: 2025/03/12 22:26:32 by maldavid ### ########.fr */ +/* Updated: 2025/10/22 16:59:21 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -361,14 +361,6 @@ MLX_API void mlx_destroy_image(mlx_context mlx, mlx_image image); * @param y Y coordinate in the image * * @return (int) Return the pixel data - * - * /!\ If you run into glitches when writing or reading pixels from images /!\ - * You need to add IMAGES_OPTIMIZED=false to your make mlx command - * ``` - * ~ git clone https://github.com/seekrs/MacroLibX.git - * ~ cd MacroLibX - * ~ make IMAGES_OPTIMIZED=false - * ``` */ MLX_API mlx_color mlx_get_image_pixel(mlx_context mlx, mlx_image image, int x, int y); @@ -380,14 +372,6 @@ MLX_API mlx_color mlx_get_image_pixel(mlx_context mlx, mlx_image image, int x, i * @param x X coordinate in the image * @param y Y coordinate in the image * @param color Color of the pixel to set - * - * /!\ If you run into glitches when writing or reading pixels from images /!\ - * You need to add IMAGES_OPTIMIZED=false to your make mlx command - * ``` - * ~ git clone https://github.com/seekrs/MacroLibX.git - * ~ cd MacroLibX - * ~ make IMAGES_OPTIMIZED=false - * ``` */ MLX_API void mlx_set_image_pixel(mlx_context mlx, mlx_image image, int x, int y, mlx_color color); diff --git a/includes/mlx_extended.h b/includes/mlx_extended.h index 5041d29..d668104 100644 --- a/includes/mlx_extended.h +++ b/includes/mlx_extended.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/12/14 16:17:10 by maldavid #+# #+# */ -/* Updated: 2025/03/12 22:03:45 by maldavid ### ########.fr */ +/* Updated: 2025/10/22 16:59:38 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -122,14 +122,6 @@ MLX_API void mlx_pixel_put_region(mlx_context mlx, mlx_window win, int x, int y, * * Note: it is responsability of the user to make sure the size of `dst` is * big enough for the given region. - * - * /!\ If you run into glitches when writing or reading pixels from images /!\ - * You need to add IMAGES_OPTIMIZED=false to your make mlx command - * ``` - * ~ git clone https://github.com/seekrs/MacroLibX.git - * ~ cd MacroLibX - * ~ make IMAGES_OPTIMIZED=false - * ``` */ MLX_API void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* dst); @@ -146,14 +138,6 @@ MLX_API void mlx_get_image_region(mlx_context mlx, mlx_image image, int x, int y * * Note: it is responsability of the user to make sure the size of `pixels` is * big enough for the given region. - * - * /!\ If you run into glitches when writing or reading pixels from images /!\ - * You need to add IMAGES_OPTIMIZED=false to your make mlx command - * ``` - * ~ git clone https://github.com/seekrs/MacroLibX.git - * ~ cd MacroLibX - * ~ make IMAGES_OPTIMIZED=false - * ``` */ MLX_API void mlx_set_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* pixels); diff --git a/runtime/Sources/Renderer/Image.cpp b/runtime/Sources/Renderer/Image.cpp index 0aa37b2..10859f7 100644 --- a/runtime/Sources/Renderer/Image.cpp +++ b/runtime/Sources/Renderer/Image.cpp @@ -22,12 +22,6 @@ #include #endif -#ifdef IMAGE_OPTIMIZED - #define TILING VK_IMAGE_TILING_OPTIMAL -#else - #define TILING VK_IMAGE_TILING_LINEAR -#endif - namespace mlx { mlx_color ReverseColor(mlx_color color) @@ -186,7 +180,7 @@ namespace mlx void Texture::Init(CPUBuffer pixels, std::uint32_t width, std::uint32_t height, VkFormat format, bool is_multisampled, [[maybe_unused]] std::string_view debug_name) { MLX_PROFILE_FUNCTION(); - Image::Init(ImageType::Color, width, height, format, TILING, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, is_multisampled, std::move(debug_name)); + Image::Init(ImageType::Color, width, height, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, is_multisampled, std::move(debug_name)); Image::CreateImageView(VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT); Image::CreateSampler(); if(pixels) diff --git a/xmake.lua b/xmake.lua index f7445a4..b56789e 100644 --- a/xmake.lua +++ b/xmake.lua @@ -11,12 +11,6 @@ set_targetdir("./") set_optimize("fastest") -- Options - -option("images_optimized") - set_default(true) - add_defines("IMAGE_OPTIMIZED") -option_end() - option("force_integrated_gpu") set_default(false) add_defines("FORCE_INTEGRATED_GPU") @@ -48,7 +42,6 @@ target("mlx") set_default(true) set_license("MIT") set_kind("shared") - add_options("images_optimized") add_options("force_integrated_gpu") add_options("graphics_memory_dump") add_options("profiler")