removing now useless image optimisation flag

This commit is contained in:
2025-10-22 17:02:33 +02:00
parent 1835db0943
commit 9c4aaea79f
8 changed files with 3 additions and 60 deletions

View File

@@ -4,7 +4,6 @@ MAKE = make --no-print-directory
OS ?= $(shell uname -s) OS ?= $(shell uname -s)
DEBUG ?= false DEBUG ?= false
TOOLCHAIN ?= clang TOOLCHAIN ?= clang
IMAGES_OPTIMIZED ?= true
FORCE_INTEGRATED_GPU ?= false FORCE_INTEGRATED_GPU ?= false
GRAPHICS_MEMORY_DUMP ?= false GRAPHICS_MEMORY_DUMP ?= false
PROFILER ?= false PROFILER ?= false
@@ -69,10 +68,6 @@ ifeq ($(FORCE_INTEGRATED_GPU), true)
_ENABLEDFLAGS += FORCE_INTEGRATED_GPU _ENABLEDFLAGS += FORCE_INTEGRATED_GPU
endif endif
ifeq ($(IMAGES_OPTIMIZED), true)
_ENABLEDFLAGS += IMAGE_OPTIMIZED
endif
ifeq ($(GRAPHICS_MEMORY_DUMP), true) ifeq ($(GRAPHICS_MEMORY_DUMP), true)
_ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP _ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP
endif endif

View File

@@ -103,9 +103,6 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you
### 🛠️ Set the toolchain ### 🛠️ Set the toolchain
If you want to use `GCC` to build the mlx you can use `make TOOLCHAIN=gcc` 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) ### 🖥️ 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. 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.

View File

@@ -16,9 +16,6 @@ MacroLibX has a strong safety support, mainly by checking every pointer that you
### 🛠️ Set the toolchain ### 🛠️ Set the toolchain
To change the compilation toolchain you can use `xmake config --toolchain=[gcc|clang|...]` 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) ### 🖥️ 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. 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.

View File

@@ -7,6 +7,5 @@
-DMLX_BUILD -DMLX_BUILD
-DSDL_MAIN_HANDLED -DSDL_MAIN_HANDLED
-DDEBUG -DDEBUG
-DIMAGE_OPTIMIZED
-D_REENTRANT -D_REENTRANT
-isystem/usr/include/SDL2 -isystem/usr/include/SDL2

View File

@@ -6,7 +6,7 @@
/* By: maldavid <contact@kbz8.me> +#+ +:+ +#+ */ /* By: maldavid <contact@kbz8.me> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 16:56:35 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 * @param y Y coordinate in the image
* *
* @return (int) Return the pixel data * @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); 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 x X coordinate in the image
* @param y Y coordinate in the image * @param y Y coordinate in the image
* @param color Color of the pixel to set * @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); MLX_API void mlx_set_image_pixel(mlx_context mlx, mlx_image image, int x, int y, mlx_color color);

View File

@@ -6,7 +6,7 @@
/* By: maldavid <contact@kbz8.me> +#+ +:+ +#+ */ /* By: maldavid <contact@kbz8.me> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/14 16:17:10 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 * Note: it is responsability of the user to make sure the size of `dst` is
* big enough for the given region. * 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); 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 * Note: it is responsability of the user to make sure the size of `pixels` is
* big enough for the given region. * 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); MLX_API void mlx_set_image_region(mlx_context mlx, mlx_image image, int x, int y, int w, int h, mlx_color* pixels);

View File

@@ -22,12 +22,6 @@
#include <stb_image.h> #include <stb_image.h>
#endif #endif
#ifdef IMAGE_OPTIMIZED
#define TILING VK_IMAGE_TILING_OPTIMAL
#else
#define TILING VK_IMAGE_TILING_LINEAR
#endif
namespace mlx namespace mlx
{ {
mlx_color ReverseColor(mlx_color color) 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) 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(); 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::CreateImageView(VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT);
Image::CreateSampler(); Image::CreateSampler();
if(pixels) if(pixels)

View File

@@ -11,12 +11,6 @@ set_targetdir("./")
set_optimize("fastest") set_optimize("fastest")
-- Options -- Options
option("images_optimized")
set_default(true)
add_defines("IMAGE_OPTIMIZED")
option_end()
option("force_integrated_gpu") option("force_integrated_gpu")
set_default(false) set_default(false)
add_defines("FORCE_INTEGRATED_GPU") add_defines("FORCE_INTEGRATED_GPU")
@@ -48,7 +42,6 @@ target("mlx")
set_default(true) set_default(true)
set_license("MIT") set_license("MIT")
set_kind("shared") set_kind("shared")
add_options("images_optimized")
add_options("force_integrated_gpu") add_options("force_integrated_gpu")
add_options("graphics_memory_dump") add_options("graphics_memory_dump")
add_options("profiler") add_options("profiler")