From f50dd2d94641a68cf199d21ff5fa72a45e4823ff Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Sat, 14 Sep 2024 09:55:19 +0200 Subject: [PATCH] fixing compilation issues --- Makefile | 116 +- compile_commands.json | 1890 +++++++---------- example/build.sh | 4 +- runtime/Includes/Core/SDLManager.h | 5 + runtime/Includes/Platform/Inputs.h | 2 +- runtime/Includes/PreCompiled.h | 2 +- runtime/Includes/Renderer/Image.h | 2 +- runtime/Includes/Renderer/RenderCore.h | 1 - .../Renderer/Vulkan/VulkanPrototypes.h | 4 +- runtime/Includes/Utils/NonOwningPtr.inl | 2 + runtime/Sources/Core/Application.cpp | 2 - runtime/Sources/Core/Logs.cpp | 10 +- runtime/Sources/Core/SDLManager.cpp | 38 +- runtime/Sources/Platform/Inputs.cpp | 20 + runtime/Sources/Renderer/Descriptor.cpp | 2 +- runtime/Sources/Renderer/Image.cpp | 38 +- .../Sources/Renderer/Pipelines/Graphics.cpp | 6 +- runtime/Sources/Renderer/Pipelines/Shader.cpp | 23 +- runtime/Sources/Renderer/RenderCore.cpp | 17 +- .../Sources/Renderer/RenderPasses/2DPass.cpp | 12 +- .../Renderer/RenderPasses/FinalPass.cpp | 2 +- runtime/Sources/Renderer/Renderer.cpp | 22 +- runtime/Sources/Renderer/SceneRenderer.cpp | 2 +- .../Sources/Renderer/Vulkan/VulkanLoader.cpp | 22 +- .../Sources/Renderer/Vulkan/VulkanLoader.h | 6 +- third_party/kvf.h | 27 +- 26 files changed, 1036 insertions(+), 1241 deletions(-) diff --git a/Makefile b/Makefile index 93a6343..27f0102 100644 --- a/Makefile +++ b/Makefile @@ -1,102 +1,120 @@ NAME = libmlx.so +MAKE = make --no-print-directory -SRCS = $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Core)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Platform)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Graphics)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Renderer)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Renderer/Vulkan)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Renderer/Pipelines)) -SRCS += $(wildcard $(addsuffix /*.cpp, ./runtime/Sources/Renderer/RenderPasses)) - -OBJ_DIR = objs/makefile -OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) - -PCH = ./runtime/Includes/PreCompiled.h -GCH = ./runtime/Includes/PreCompiled.h.gch - -OS = $(shell uname -s) +OS ?= $(shell uname -s) DEBUG ?= false TOOLCHAIN ?= clang IMAGES_OPTIMIZED ?= true FORCE_INTEGRATED_GPU ?= false GRAPHICS_MEMORY_DUMP ?= false PROFILER ?= false -FORCE_WAYLAND ?= false +_ENABLEDFLAGS = -MODE = "release" +SRCS = $(wildcard $(addsuffix /*.cpp, runtime/Sources/Core)) +SRCS += $(wildcard $(addsuffix /*.cpp, runtime/Sources/Graphics)) +SRCS += $(wildcard $(addsuffix /*.cpp, runtime/Sources/Platform)) +SRCS += $(wildcard $(addsuffix /*.cpp, runtime/Sources/Renderer)) +SRCS += $(wildcard $(addsuffix /*.cpp, runtime/Sources/Renderer/**)) + +OBJ_DIR = objs/make/$(shell echo $(OS) | tr '[:upper:]' '[:lower:]') +OBJS := $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) CXX = clang++ - -CXXFLAGS = -std=c++20 -O3 -fPIC -Wall -Wextra -Wno-deprecated -DSDL_MAIN_HANDLED +CXXFLAGS = -std=c++20 -O3 -fPIC -Wall -Wextra -DSDL_MAIN_HANDLED INCLUDES = -I./includes -I./runtime/Includes -I./runtime/Sources -I./third_party -LDLIBS = - ifeq ($(TOOLCHAIN), gcc) CXX = g++ + CXXFLAGS += -Wno-error=cpp +else + CXXFLAGS += -Wno-error=#warning endif ifeq ($(OS), Darwin) - LDLIBS += -L /opt/homebrew/lib -lSDL2 + LDFLAGS += -L /opt/homebrew/lib -lSDL2 CXXFLAGS += -I /opt/homebrew/include NAME = libmlx.dylib endif ifeq ($(DEBUG), true) - CXXFLAGS += -g -D DEBUG - MODE = "debug" + CXXFLAGS += -g3 -D DEBUG + LDFLAGS += -rdynamic endif ifeq ($(FORCE_INTEGRATED_GPU), true) - CXXFLAGS += -D FORCE_INTEGRATED_GPU + _ENABLEDFLAGS += FORCE_INTEGRATED_GPU endif ifeq ($(IMAGES_OPTIMIZED), true) - CXXFLAGS += -D IMAGE_OPTIMIZED + _ENABLEDFLAGS += IMAGE_OPTIMIZED endif ifeq ($(GRAPHICS_MEMORY_DUMP), true) - CXXFLAGS += -D GRAPHICS_MEMORY_DUMP + _ENABLEDFLAGS += GRAPHICS_MEMORY_DUMP endif ifeq ($(PROFILER), true) - CXXFLAGS += -D PROFILER + _ENABLEDFLAGS += PROFILER endif -ifeq ($(FORCE_WAYLAND), true) - CXXFLAGS += -D FORCE_WAYLAND -endif +CXXFLAGS += $(addprefix -D, $(_ENABLEDFLAGS)) RM = rm -rf -$(OBJ_DIR)/%.o: %.cpp $(GCH) - @printf "\033[1;32m[compiling... "$(MODE)" "$(CXX)"]\033[1;00m "$<"\n" +TPUT = tput -T xterm-256color +_RESET := $(shell $(TPUT) sgr0) +_BOLD := $(shell $(TPUT) bold) +_ITALIC := $(shell $(TPUT) sitm) +_UNDER := $(shell $(TPUT) smul) +_GREEN := $(shell $(TPUT) setaf 2) +_YELLOW := $(shell $(TPUT) setaf 3) +_RED := $(shell $(TPUT) setaf 1) +_GRAY := $(shell $(TPUT) setaf 8) +_PURPLE := $(shell $(TPUT) setaf 5) + +ifeq ($(DEBUG), true) + MODE := $(_RESET)$(_PURPLE)$(_BOLD)Debug$(_RESET)$(_PURPLE) + COLOR := $(_PURPLE) +else + MODE := $(_RESET)$(_GREEN)$(_BOLD)Release$(_RESET)$(_GREEN) + COLOR := $(_GREEN) +endif + +OBJS_TOTAL = $(words $(OBJS)) +N_OBJS := $(shell find $(OBJ_DIR) -type f -name '*.o' 2>/dev/null | wc -l) +OBJS_TOTAL := $(shell echo $$(( $(OBJS_TOTAL) - $(N_OBJS) ))) +CURR_OBJ = 0 + +$(OBJ_DIR)/%.o: %.cpp + @mkdir -p $(dir $@) + @$(eval CURR_OBJ=$(shell echo $$(( $(CURR_OBJ) + 1 )))) + @$(eval PERCENT=$(shell echo $$(( $(CURR_OBJ) * 100 / $(OBJS_TOTAL) )))) + @printf "$(COLOR)($(_BOLD)%3s%%$(_RESET)$(COLOR)) $(_RESET)Compiling $(_BOLD)$<$(_RESET)\n" "$(PERCENT)" @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@ -all: $(NAME) +all: _printbuildinfos + @$(MAKE) $(NAME) -$(GCH): - @printf "\033[1;32m[compiling... "$(MODE)" "$(CXX)"]\033[1;00m PreCompiled header\n" - @$(CXX) $(CXXFLAGS) $(INCLUDES) -c $(PCH) -o $(GCH) +$(NAME): $(OBJS) + @printf "Linking $(_BOLD)$(NAME)$(_RESET)\n" + @$(CXX) -shared -o $(NAME) $(OBJS) $(LDFLAGS) + @printf "$(_BOLD)$(NAME)$(_RESET) compiled $(COLOR)$(_BOLD)successfully$(_RESET)\n" -$(NAME): $(OBJ_DIR) $(GCH) $(OBJS) - @printf "\033[1;32m[linking ... "$(MODE)"]\033[1;00m "$@"\n" - @$(CXX) -shared -o $(NAME) $(OBJS) $(LDLIBS) - @printf "\033[1;32m[build finished]\033[1;00m\n" +_printbuildinfos: + @printf "$(_PURPLE)$(_BOLD)MacroLibX $(_RESET)Compiling in $(_BOLD)$(MODE)$(_RESET) mode on $(_BOLD)$(OS)$(_RESET) | Using $(_BOLD)$(CXX)$(_RESET), flags: $(_BOLD)$(_ENABLEDFLAGS)$(_RESET)\n" -$(OBJ_DIR): - @mkdir -p $(sort $(addprefix $(OBJ_DIR)/, $(dir $(SRCS)))) - @printf "\033[1;32m[created objs directory]\033[1;00m\n" +debug: + @$(MAKE) all DEBUG=true -j$(shell nproc) clean: @$(RM) $(OBJ_DIR) - @printf "\033[1;32m[object files removed]\033[1;00m\n" + @printf "Cleaned $(_BOLD)$(OBJ_DIR)$(_RESET)\n" fclean: clean @$(RM) $(NAME) - @$(RM) $(GCH) - @printf "\033[1;32m["$(NAME)" and gch removed]\033[1;00m\n" + @printf "Cleaned $(_BOLD)$(NAME)$(_RESET)\n" -re: fclean all +re: fclean _printbuildinfos + @$(MAKE) $(NAME) -.PHONY: all clean fclean re pch +.PHONY: all clean debug fclean re diff --git a/compile_commands.json b/compile_commands.json index 650f005..e9651ae 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -1,1082 +1,812 @@ [ - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/application.cpp", - "-o", - "objs/makefile/./src/core/application.o" - ], - "file": "src/core/application.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/bridge.cpp", - "-o", - "objs/makefile/./src/core/bridge.o" - ], - "file": "src/core/bridge.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/errors.cpp", - "-o", - "objs/makefile/./src/core/errors.o" - ], - "file": "src/core/errors.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/graphics.cpp", - "-o", - "objs/makefile/./src/core/graphics.o" - ], - "file": "src/core/graphics.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/memory.cpp", - "-o", - "objs/makefile/./src/core/memory.o" - ], - "file": "src/core/memory.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/UUID.cpp", - "-o", - "objs/makefile/./src/core/UUID.o" - ], - "file": "src/core/UUID.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/platform/inputs.cpp", - "-o", - "objs/makefile/./src/platform/inputs.o" - ], - "file": "src/platform/inputs.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/platform/window.cpp", - "-o", - "objs/makefile/./src/platform/window.o" - ], - "file": "src/platform/window.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/pixel_put.cpp", - "-o", - "objs/makefile/./src/renderer/pixel_put.o" - ], - "file": "src/renderer/pixel_put.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/renderer.cpp", - "-o", - "objs/makefile/./src/renderer/renderer.o" - ], - "file": "src/renderer/renderer.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/buffers/vk_buffer.cpp", - "-o", - "objs/makefile/./src/renderer/buffers/vk_buffer.o" - ], - "file": "src/renderer/buffers/vk_buffer.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/buffers/vk_ubo.cpp", - "-o", - "objs/makefile/./src/renderer/buffers/vk_ubo.o" - ], - "file": "src/renderer/buffers/vk_ubo.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/buffers/vk_vbo.cpp", - "-o", - "objs/makefile/./src/renderer/buffers/vk_vbo.o" - ], - "file": "src/renderer/buffers/vk_vbo.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/command/cmd_manager.cpp", - "-o", - "objs/makefile/./src/renderer/command/cmd_manager.o" - ], - "file": "src/renderer/command/cmd_manager.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/command/single_time_cmd_manager.cpp", - "-o", - "objs/makefile/./src/renderer/command/single_time_cmd_manager.o" - ], - "file": "src/renderer/command/single_time_cmd_manager.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/command/vk_cmd_buffer.cpp", - "-o", - "objs/makefile/./src/renderer/command/vk_cmd_buffer.o" - ], - "file": "src/renderer/command/vk_cmd_buffer.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/command/vk_cmd_pool.cpp", - "-o", - "objs/makefile/./src/renderer/command/vk_cmd_pool.o" - ], - "file": "src/renderer/command/vk_cmd_pool.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/memory.cpp", - "-o", - "objs/makefile/./src/renderer/core/memory.o" - ], - "file": "src/renderer/core/memory.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/render_core.cpp", - "-o", - "objs/makefile/./src/renderer/core/render_core.o" - ], - "file": "src/renderer/core/render_core.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/vk_device.cpp", - "-o", - "objs/makefile/./src/renderer/core/vk_device.o" - ], - "file": "src/renderer/core/vk_device.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/vk_fence.cpp", - "-o", - "objs/makefile/./src/renderer/core/vk_fence.o" - ], - "file": "src/renderer/core/vk_fence.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/vk_instance.cpp", - "-o", - "objs/makefile/./src/renderer/core/vk_instance.o" - ], - "file": "src/renderer/core/vk_instance.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/vk_queues.cpp", - "-o", - "objs/makefile/./src/renderer/core/vk_queues.o" - ], - "file": "src/renderer/core/vk_queues.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/vk_semaphore.cpp", - "-o", - "objs/makefile/./src/renderer/core/vk_semaphore.o" - ], - "file": "src/renderer/core/vk_semaphore.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/vk_surface.cpp", - "-o", - "objs/makefile/./src/renderer/core/vk_surface.o" - ], - "file": "src/renderer/core/vk_surface.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/core/vk_validation_layers.cpp", - "-o", - "objs/makefile/./src/renderer/core/vk_validation_layers.o" - ], - "file": "src/renderer/core/vk_validation_layers.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/descriptors/vk_descriptor_pool.cpp", - "-o", - "objs/makefile/./src/renderer/descriptors/vk_descriptor_pool.o" - ], - "file": "src/renderer/descriptors/vk_descriptor_pool.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/descriptors/vk_descriptor_set.cpp", - "-o", - "objs/makefile/./src/renderer/descriptors/vk_descriptor_set.o" - ], - "file": "src/renderer/descriptors/vk_descriptor_set.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/descriptors/vk_descriptor_set_layout.cpp", - "-o", - "objs/makefile/./src/renderer/descriptors/vk_descriptor_set_layout.o" - ], - "file": "src/renderer/descriptors/vk_descriptor_set_layout.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/images/texture_atlas.cpp", - "-o", - "objs/makefile/./src/renderer/images/texture_atlas.o" - ], - "file": "src/renderer/images/texture_atlas.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/images/texture.cpp", - "-o", - "objs/makefile/./src/renderer/images/texture.o" - ], - "file": "src/renderer/images/texture.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/images/vk_image.cpp", - "-o", - "objs/makefile/./src/renderer/images/vk_image.o" - ], - "file": "src/renderer/images/vk_image.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/pipeline/pipeline.cpp", - "-o", - "objs/makefile/./src/renderer/pipeline/pipeline.o" - ], - "file": "src/renderer/pipeline/pipeline.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/renderpass/vk_framebuffer.cpp", - "-o", - "objs/makefile/./src/renderer/renderpass/vk_framebuffer.o" - ], - "file": "src/renderer/renderpass/vk_framebuffer.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/renderpass/vk_render_pass.cpp", - "-o", - "objs/makefile/./src/renderer/renderpass/vk_render_pass.o" - ], - "file": "src/renderer/renderpass/vk_render_pass.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/swapchain/vk_swapchain.cpp", - "-o", - "objs/makefile/./src/renderer/swapchain/vk_swapchain.o" - ], - "file": "src/renderer/swapchain/vk_swapchain.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/fps.cpp", - "-o", - "objs/makefile/./src/core/fps.o" - ], - "file": "src/core/fps.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/core/profiler.cpp", - "-o", - "objs/makefile/./src/core/profiler.o" - ], - "file": "src/core/profiler.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/descriptors/descriptor_pool_manager.cpp", - "-o", - "objs/makefile/./src/renderer/descriptors/descriptor_pool_manager.o" - ], - "file": "src/renderer/descriptors/descriptor_pool_manager.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/texts/font.cpp", - "-o", - "objs/makefile/./src/renderer/texts/font.o" - ], - "file": "src/renderer/texts/font.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/texts/font_library.cpp", - "-o", - "objs/makefile/./src/renderer/texts/font_library.o" - ], - "file": "src/renderer/texts/font_library.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/texts/text.cpp", - "-o", - "objs/makefile/./src/renderer/texts/text.o" - ], - "file": "src/renderer/texts/text.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/texts/text_descriptor.cpp", - "-o", - "objs/makefile/./src/renderer/texts/text_descriptor.o" - ], - "file": "src/renderer/texts/text_descriptor.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/texts/text_library.cpp", - "-o", - "objs/makefile/./src/renderer/texts/text_library.o" - ], - "file": "src/renderer/texts/text_library.cpp" - }, - { - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", - "arguments": [ - "clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-Wall", - "-Wextra", - "-Werror", - "-DSDL_MAIN_HANDLED", - "-Wno-error=", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "src/renderer/texts/text_manager.cpp", - "-o", - "objs/makefile/./src/renderer/texts/text_manager.o" - ], - "file": "src/renderer/texts/text_manager.cpp" - } + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/Application.o", + "runtime/Sources/Core/Application.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/Application.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/Application.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/Bridge.o", + "runtime/Sources/Core/Bridge.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/Bridge.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/Bridge.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/EventBus.o", + "runtime/Sources/Core/EventBus.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/EventBus.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/EventBus.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/EventListener.o", + "runtime/Sources/Core/EventListener.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/EventListener.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/EventListener.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/Fps.o", + "runtime/Sources/Core/Fps.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/Fps.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/Fps.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/Graphics.o", + "runtime/Sources/Core/Graphics.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/Graphics.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/Graphics.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/Logs.o", + "runtime/Sources/Core/Logs.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/Logs.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/Logs.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/Memory.o", + "runtime/Sources/Core/Memory.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/Memory.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/Memory.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/Profiler.o", + "runtime/Sources/Core/Profiler.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/Profiler.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/Profiler.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/SDLManager.o", + "runtime/Sources/Core/SDLManager.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/SDLManager.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/SDLManager.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Core/UUID.o", + "runtime/Sources/Core/UUID.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Core/UUID.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Core/UUID.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Graphics/Mesh.o", + "runtime/Sources/Graphics/Mesh.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Graphics/Mesh.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Graphics/Mesh.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Graphics/PixelPutManager.o", + "runtime/Sources/Graphics/PixelPutManager.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Graphics/PixelPutManager.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Graphics/PixelPutManager.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Graphics/Scene.o", + "runtime/Sources/Graphics/Scene.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Graphics/Scene.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Graphics/Scene.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Graphics/Sprite.o", + "runtime/Sources/Graphics/Sprite.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Graphics/Sprite.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Graphics/Sprite.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Platform/Inputs.o", + "runtime/Sources/Platform/Inputs.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Platform/Inputs.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Platform/Inputs.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Platform/Window.o", + "runtime/Sources/Platform/Window.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Platform/Window.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Platform/Window.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Buffer.o", + "runtime/Sources/Renderer/Buffer.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Buffer.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Buffer.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Descriptor.o", + "runtime/Sources/Renderer/Descriptor.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Descriptor.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Descriptor.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Image.o", + "runtime/Sources/Renderer/Image.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Image.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Image.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Memory.o", + "runtime/Sources/Renderer/Memory.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Memory.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Memory.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/RenderCore.o", + "runtime/Sources/Renderer/RenderCore.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/RenderCore.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/RenderCore.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Renderer.o", + "runtime/Sources/Renderer/Renderer.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Renderer.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Renderer.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/SceneRenderer.o", + "runtime/Sources/Renderer/SceneRenderer.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/SceneRenderer.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/SceneRenderer.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Pipelines/Graphics.o", + "runtime/Sources/Renderer/Pipelines/Graphics.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Pipelines/Graphics.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Pipelines/Graphics.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Pipelines/Shader.o", + "runtime/Sources/Renderer/Pipelines/Shader.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Pipelines/Shader.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Pipelines/Shader.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/RenderPasses/2DPass.o", + "runtime/Sources/Renderer/RenderPasses/2DPass.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/RenderPasses/2DPass.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/RenderPasses/2DPass.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/RenderPasses/FinalPass.o", + "runtime/Sources/Renderer/RenderPasses/FinalPass.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/RenderPasses/FinalPass.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/RenderPasses/FinalPass.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/RenderPasses/Passes.o", + "runtime/Sources/Renderer/RenderPasses/Passes.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/RenderPasses/Passes.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/RenderPasses/Passes.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++20", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g3", + "-D", + "DEBUG", + "-DIMAGE_OPTIMIZED", + "-I./includes", + "-I./runtime/Includes", + "-I./runtime/Sources", + "-I./third_party", + "-c", + "-o", + "objs/make/linux/runtime/Sources/Renderer/Vulkan/VulkanLoader.o", + "runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp" + ], + "directory": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX", + "file": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp", + "output": "/home/kbz8/Documents/Code/42/Other/MacroLibX/MacroLibX/objs/make/linux/runtime/Sources/Renderer/Vulkan/VulkanLoader.o" + } ] diff --git a/example/build.sh b/example/build.sh index 1b95a5d..b332c18 100755 --- a/example/build.sh +++ b/example/build.sh @@ -5,8 +5,8 @@ if [ -e a.out ]; then fi if [ $(uname -s) = 'Darwin' ]; then - clang main.c ../libmlx.dylib -L /opt/homebrew/lib -lglfw -g; + clang main.c ../libmlx.dylib -L /opt/homebrew/lib -lSDL2 -g; else - clang main.c ../libmlx.so -lglfw -g -Wall -Wextra -Werror; + clang main.c ../libmlx.so -lSDL2 -g -Wall -Wextra -Werror; fi diff --git a/runtime/Includes/Core/SDLManager.h b/runtime/Includes/Core/SDLManager.h index ddb7b21..cdc514c 100644 --- a/runtime/Includes/Core/SDLManager.h +++ b/runtime/Includes/Core/SDLManager.h @@ -22,6 +22,11 @@ namespace mlx inline void SetEventCallback(func::function functor, void* userdata) { f_callback = std::move(functor); p_callback_data = userdata; } + std::int32_t GetX() const noexcept; + std::int32_t GetY() const noexcept; + std::int32_t GetXRel() const noexcept; + std::int32_t GetYRel() const noexcept; + private: SDLManager() = default; ~SDLManager() = default; diff --git a/runtime/Includes/Platform/Inputs.h b/runtime/Includes/Platform/Inputs.h index bd1c91d..1114058 100644 --- a/runtime/Includes/Platform/Inputs.h +++ b/runtime/Includes/Platform/Inputs.h @@ -19,7 +19,7 @@ namespace mlx public: Inputs(); - void RegisterWindow(std::shared_ptr window); + inline void RegisterWindow(std::shared_ptr window) { m_windows[window->GetID()] = window; } std::int32_t GetX() const noexcept; std::int32_t GetY() const noexcept; diff --git a/runtime/Includes/PreCompiled.h b/runtime/Includes/PreCompiled.h index 231ca2f..c50a067 100644 --- a/runtime/Includes/PreCompiled.h +++ b/runtime/Includes/PreCompiled.h @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -71,7 +72,6 @@ #include #include #include -#include using Handle = void*; diff --git a/runtime/Includes/Renderer/Image.h b/runtime/Includes/Renderer/Image.h index 31b8921..996a3ac 100644 --- a/runtime/Includes/Renderer/Image.h +++ b/runtime/Includes/Renderer/Image.h @@ -111,7 +111,7 @@ namespace mlx void SetPixel(int x, int y, std::uint32_t color) noexcept; int GetPixel(int x, int y) noexcept; - void Update(VkCommandBuffer cmd) const; + void Update(VkCommandBuffer cmd); ~Texture() override { Destroy(); } diff --git a/runtime/Includes/Renderer/RenderCore.h b/runtime/Includes/Renderer/RenderCore.h index 01218a3..04140d1 100644 --- a/runtime/Includes/Renderer/RenderCore.h +++ b/runtime/Includes/Renderer/RenderCore.h @@ -21,7 +21,6 @@ namespace mlx [[nodiscard]] MLX_FORCEINLINE VkPhysicalDevice GetPhysicalDevice() const noexcept { return m_physical_device; } [[nodiscard]] MLX_FORCEINLINE GPUAllocator& GetAllocator() noexcept { return m_allocator; } - inline void WaitDeviceIdle() const noexcept { vkDeviceWaitIdle(m_device); } private: diff --git a/runtime/Includes/Renderer/Vulkan/VulkanPrototypes.h b/runtime/Includes/Renderer/Vulkan/VulkanPrototypes.h index fd96c65..d65439f 100644 --- a/runtime/Includes/Renderer/Vulkan/VulkanPrototypes.h +++ b/runtime/Includes/Renderer/Vulkan/VulkanPrototypes.h @@ -1,5 +1,5 @@ -#ifndef __SCOP_VK_PROTOTYPES__ -#define __SCOP_VK_PROTOTYPES__ +#ifndef __MLX_VK_PROTOTYPES__ +#define __MLX_VK_PROTOTYPES__ #if defined(VULKAN_H_) && !defined(VK_NO_PROTOTYPES) #error "define VK_NO_PROTOTYPES needed" diff --git a/runtime/Includes/Utils/NonOwningPtr.inl b/runtime/Includes/Utils/NonOwningPtr.inl index b35bee5..579809e 100644 --- a/runtime/Includes/Utils/NonOwningPtr.inl +++ b/runtime/Includes/Utils/NonOwningPtr.inl @@ -16,6 +16,7 @@ namespace mlx NonOwningPtr& NonOwningPtr::operator=(T* ptr) { p_ptr = ptr; + return *this; } template @@ -23,6 +24,7 @@ namespace mlx { p_ptr = ptr.p_ptr; ptr.p_ptr = nullptr; + return *this; } template diff --git a/runtime/Sources/Core/Application.cpp b/runtime/Sources/Core/Application.cpp index 6398826..5da8017 100644 --- a/runtime/Sources/Core/Application.cpp +++ b/runtime/Sources/Core/Application.cpp @@ -13,9 +13,7 @@ namespace mlx EventBus::RegisterListener({[](const EventBase& event) { if(event.What() == Event::FatalErrorEventCode) - { std::abort(); - } }, "__MlxApplication" }); m_fps.Init(); diff --git a/runtime/Sources/Core/Logs.cpp b/runtime/Sources/Core/Logs.cpp index 88c063a..37a301b 100644 --- a/runtime/Sources/Core/Logs.cpp +++ b/runtime/Sources/Core/Logs.cpp @@ -38,11 +38,11 @@ namespace mlx switch(type) { - case LogType::Debug: std::cout << Ansi::blue << "[Akel Debug] " << Ansi::def << code_infos << message << '\n'; break; - case LogType::Message: std::cout << Ansi::blue << "[Akel Message] " << Ansi::def << code_infos << message << '\n'; break; - case LogType::Warning: std::cout << Ansi::magenta << "[Akel Warning] " << Ansi::def << code_infos << message << '\n'; break; - case LogType::Error: std::cerr << Ansi::red << "[Akel Error] " << Ansi::def << code_infos << message << '\n'; break; - case LogType::FatalError: std::cerr << Ansi::red << "[Akel Fatal Error] " << Ansi::def << code_infos << message << '\n'; break; + case LogType::Debug: std::cout << Ansi::blue << "[MLX Debug] " << Ansi::def << code_infos << message << '\n'; break; + case LogType::Message: std::cout << Ansi::blue << "[MLX Message] " << Ansi::def << code_infos << message << '\n'; break; + case LogType::Warning: std::cout << Ansi::magenta << "[MLX Warning] " << Ansi::def << code_infos << message << '\n'; break; + case LogType::Error: std::cerr << Ansi::red << "[MLX Error] " << Ansi::def << code_infos << message << '\n'; break; + case LogType::FatalError: std::cerr << Ansi::red << "[MLX Fatal Error] " << Ansi::def << code_infos << message << '\n'; break; default: break; } diff --git a/runtime/Sources/Core/SDLManager.cpp b/runtime/Sources/Core/SDLManager.cpp index cdfe5c6..44d9e44 100644 --- a/runtime/Sources/Core/SDLManager.cpp +++ b/runtime/Sources/Core/SDLManager.cpp @@ -56,10 +56,6 @@ namespace mlx { WatcherData* data = static_cast(userdata); - if(event->type == SDL_MOUSEMOTION) - { - } - std::uint32_t id = event->window.windowID; switch(event->type) { @@ -102,6 +98,7 @@ namespace mlx return 0; }, &watcher_data); + DebugLog("SDL Manager initialized"); } void* SDLManager::CreateWindow(const std::string& title, std::size_t w, std::size_t h, bool hidden) @@ -162,11 +159,44 @@ namespace mlx return Vec2ui{ extent }; } + std::int32_t SDLManager::GetX() const noexcept + { + int dummy; + int x; + SDL_GetMouseState(&x, &dummy); + return x; + } + + std::int32_t SDLManager::GetY() const noexcept + { + int dummy; + int y; + SDL_GetMouseState(&dummy, &y); + return y; + } + + std::int32_t SDLManager::GetXRel() const noexcept + { + int dummy; + int x; + SDL_GetRelativeMouseState(&x, &dummy); + return x; + } + + std::int32_t SDLManager::GetYRel() const noexcept + { + int dummy; + int y; + SDL_GetRelativeMouseState(&dummy, &y); + return y; + } + void SDLManager::Shutdown() noexcept { if(m_drop_sdl_responsability) return; SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_EVENTS); SDL_Quit(); + DebugLog("SDL Manager uninitialized"); } } diff --git a/runtime/Sources/Platform/Inputs.cpp b/runtime/Sources/Platform/Inputs.cpp index 03943e0..b93561f 100644 --- a/runtime/Sources/Platform/Inputs.cpp +++ b/runtime/Sources/Platform/Inputs.cpp @@ -15,4 +15,24 @@ namespace mlx m_events_hooks[window_id][event].hook(code, m_events_hooks[window_id][event].param); }, nullptr); } + + std::int32_t Inputs::GetX() const noexcept + { + return SDLManager::Get().GetX(); + } + + std::int32_t Inputs::GetY() const noexcept + { + return SDLManager::Get().GetY(); + } + + std::int32_t Inputs::GetXRel() const noexcept + { + return SDLManager::Get().GetXRel(); + } + + std::int32_t Inputs::GetYRel() const noexcept + { + return SDLManager::Get().GetYRel(); + } } diff --git a/runtime/Sources/Renderer/Descriptor.cpp b/runtime/Sources/Renderer/Descriptor.cpp index 4ccbced..bbed657 100644 --- a/runtime/Sources/Renderer/Descriptor.cpp +++ b/runtime/Sources/Renderer/Descriptor.cpp @@ -33,7 +33,7 @@ namespace mlx } DescriptorSet::DescriptorSet(VkDescriptorSetLayout layout, const std::vector& descriptors) - : m_set_layout(layout), m_descriptors(descriptors) + : m_descriptors(descriptors), m_set_layout(layout) { for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) m_set[i] = kvfAllocateDescriptorSet(RenderCore::Get().GetDevice(), layout); diff --git a/runtime/Sources/Renderer/Image.cpp b/runtime/Sources/Renderer/Image.cpp index 591bb96..0310469 100644 --- a/runtime/Sources/Renderer/Image.cpp +++ b/runtime/Sources/Renderer/Image.cpp @@ -3,6 +3,16 @@ #include #include +#define STB_IMAGE_IMPLEMENTATION +#ifdef MLX_COMPILER_GCC + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstringop-overflow" + #include + #pragma GCC diagnostic pop +#else + #include +#endif + namespace mlx { void Image::Init(ImageType type, std::uint32_t width, std::uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, bool is_multisampled) @@ -31,7 +41,7 @@ namespace mlx image_info.usage = usage; image_info.samples = (m_is_multisampled ? VK_SAMPLE_COUNT_4_BIT : VK_SAMPLE_COUNT_1_BIT); image_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; - m_allocation = RenderCore::Get().GetAllocator().CreateImage(&image_info, alloc_info, &m_image); + m_allocation = RenderCore::Get().GetAllocator().CreateImage(&image_info, &alloc_info, m_image); } void Image::CreateImageView(VkImageViewType type, VkImageAspectFlags aspect_flags, int layer_count) noexcept @@ -77,11 +87,11 @@ namespace mlx { VkImageSubresourceRange subresource_range{}; subresource_range.baseMipLevel = 0; - subresource_range.layerCount = (m_type == ImageType::Cube ? 6 : 1); + subresource_range.layerCount = 1; subresource_range.levelCount = 1; subresource_range.baseArrayLayer = 0; - if(m_type == ImageType::Color || m_type == ImageType::Cube) + if(m_type == ImageType::Color) { VkImageLayout old_layout = m_layout; TransitionLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, cmd); @@ -134,10 +144,10 @@ namespace mlx m_has_been_modified = true; } - int GetPixel(int x, int y) noexcept + int Texture::GetPixel(int x, int y) noexcept { MLX_PROFILE_FUNCTION(); - if(x < 0 || y < 0 || static_cast(x) > getWidth() || static_cast(y) > getHeight()) + if(x < 0 || y < 0 || static_cast(x) > m_width || static_cast(y) > m_height) return 0; if(!m_staging_buffer.has_value()) OpenCPUBuffer(); @@ -149,22 +159,16 @@ namespace mlx return *reinterpret_cast(bytes); } - void Update(VkCommandBuffer cmd) const + void Texture::Update(VkCommandBuffer cmd) { if(!m_has_been_modified) return; - std::memcpy(m_staging_buffer.GetMap(), m_cpu_buffer.data(), m_cpu_buffer.size() * kvfGetFormatSize(m_format)); + std::memcpy(m_staging_buffer->GetMap(), m_cpu_buffer.data(), m_cpu_buffer.size() * kvfFormatSize(m_format)); VkImageLayout old_layout = m_layout; - VkCommandBuffer cmd = kvfCreateCommandBuffer(RenderCore::Get().GetDevice()); - kvfBeginCommandBuffer(cmd, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT); TransitionLayout(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, cmd); - kvfCopyBufferToImage(cmd, Image::Get(), staging_buffer.Get(), staging_buffer.GetOffset(), VK_IMAGE_ASPECT_COLOR_BIT, { width, height, 1 }); + kvfCopyBufferToImage(cmd, Image::Get(), m_staging_buffer->Get(), m_staging_buffer->GetOffset(), VK_IMAGE_ASPECT_COLOR_BIT, { m_width, m_height, 1 }); TransitionLayout(old_layout, cmd); - vkEndCommandBuffer(cmd); - VkFence fence = kvfCreateFence(RenderCore::Get().GetDevice()); - kvfSubmitSingleTimeCommandBuffer(RenderCore::Get().GetDevice(), cmd, KVF_GRAPHICS_QUEUE, fence); - kvfDestroyFence(RenderCore::Get().GetDevice(), fence); m_has_been_modified = false; } @@ -176,14 +180,14 @@ namespace mlx return; DebugLog("Texture : enabling CPU mapping"); m_staging_buffer.emplace(); - std::size_t size = m_width * m_height * kvfGetFormatSize(m_format); + std::size_t size = m_width * m_height * kvfFormatSize(m_format); m_staging_buffer->Init(BufferType::Staging, size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, {}); VkImageLayout old_layout = m_layout; VkCommandBuffer cmd = kvfCreateCommandBuffer(RenderCore::Get().GetDevice()); kvfBeginCommandBuffer(cmd, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT); TransitionLayout(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, cmd); - kvfImageToBuffer(cmd, m_image, m_staging_buffer.Get(), m_staging_buffer.GetOffset(), VK_IMAGE_ASPECT_COLOR_BIT, { m_width, m_height, 1 }); + kvfCopyImageToBuffer(cmd, m_staging_buffer->Get(), m_image, m_staging_buffer->GetOffset(), VK_IMAGE_ASPECT_COLOR_BIT, { m_width, m_height, 1 }); TransitionLayout(old_layout, cmd); vkEndCommandBuffer(cmd); VkFence fence = kvfCreateFence(RenderCore::Get().GetDevice()); @@ -191,7 +195,7 @@ namespace mlx kvfDestroyFence(RenderCore::Get().GetDevice(), fence); m_cpu_buffer.resize(m_width * m_height); - std::memcpy(m_cpu_buffer.data(), m_staging_buffer.GetMap(), m_cpu_buffer.size()); + std::memcpy(m_cpu_buffer.data(), m_staging_buffer->GetMap(), m_cpu_buffer.size()); } Texture* StbTextureLoad(const std::filesystem::path& file, int* w, int* h) diff --git a/runtime/Sources/Renderer/Pipelines/Graphics.cpp b/runtime/Sources/Renderer/Pipelines/Graphics.cpp index e85d7f5..7939b5e 100644 --- a/runtime/Sources/Renderer/Pipelines/Graphics.cpp +++ b/runtime/Sources/Renderer/Pipelines/Graphics.cpp @@ -5,7 +5,7 @@ #include #include -namespace Scop +namespace mlx { void GraphicPipeline::Init(const GraphicPipelineDescriptor& descriptor) { @@ -39,7 +39,7 @@ namespace Scop kvfGPipelineBuilderSetCullMode(builder, VK_CULL_MODE_NONE, VK_FRONT_FACE_CLOCKWISE); kvfGPipelineBuilderEnableAlphaBlending(builder); if(p_depth) - kvfGPipelineBuilderEnableDepthTest(builder, (descriptor.depth_test_equal ? VK_COMPARE_OP_EQUAL : VK_COMPARE_OP_LESS), true); + kvfGPipelineBuilderEnableDepthTest(builder, VK_COMPARE_OP_LESS, true); else kvfGPipelineBuilderDisableDepthTest(builder); kvfGPipelineBuilderSetPolygonMode(builder, VK_POLYGON_MODE_FILL, 1.0f); @@ -80,7 +80,7 @@ namespace Scop scissor.extent = fb_extent; vkCmdSetScissor(command_buffer, 0, 1, &scissor); - for(int i = 0; i < m_clears.size(); i++) + for(std::size_t i = 0; i < m_clears.size(); i++) { m_clears[i].color.float32[0] = clear[0]; m_clears[i].color.float32[1] = clear[1]; diff --git a/runtime/Sources/Renderer/Pipelines/Shader.cpp b/runtime/Sources/Renderer/Pipelines/Shader.cpp index 63d8873..fd65276 100644 --- a/runtime/Sources/Renderer/Pipelines/Shader.cpp +++ b/runtime/Sources/Renderer/Pipelines/Shader.cpp @@ -2,9 +2,9 @@ #include #include -namespace Scop +namespace mlx { - Shader::Shader(const std::vector& bytecode, ShaderType type, ShaderLayout layout) : m_bytecode(bytecode), m_layout(std::move(layout)) + Shader::Shader(const std::vector& bytecode, ShaderType type, ShaderLayout layout) : m_layout(std::move(layout)), m_bytecode(bytecode) { switch(type) { @@ -14,7 +14,7 @@ namespace Scop default : FatalError("wtf"); break; } - m_module = kvfCreateShaderModule(RenderCore::Get().GetDevice(), m_bytecode.data(), m_bytecode.size() * 4); + m_module = kvfCreateShaderModule(RenderCore::Get().GetDevice(), reinterpret_cast(m_bytecode.data()), m_bytecode.size() * 4); DebugLog("Vulkan : shader module created"); GeneratePipelineLayout(m_layout); @@ -63,21 +63,4 @@ namespace Scop DebugLog("Vulkan : descriptor set layout destroyed"); } } - - std::shared_ptr LoadShaderFromFile(const std::filesystem::path& filepath, ShaderType type, ShaderLayout layout) - { - std::ifstream stream(filepath, std::ios::binary); - if(!stream.is_open()) - FatalError("Renderer : unable to open a spirv shader file, %", filepath); - std::vector data; - stream.seekg(0); - std::uint32_t part = 0; - while(stream.read(reinterpret_cast(&part), sizeof(part))) - data.push_back(part); - stream.close(); - - std::shared_ptr shader = std::make_shared(data, type, layout); - DebugLog("Vulkan : shader loaded %", filepath); - return shader; - } } diff --git a/runtime/Sources/Renderer/RenderCore.cpp b/runtime/Sources/Renderer/RenderCore.cpp index ebcb6e6..80ca9da 100644 --- a/runtime/Sources/Renderer/RenderCore.cpp +++ b/runtime/Sources/Renderer/RenderCore.cpp @@ -12,28 +12,30 @@ namespace mlx { - static VulkanLoader loader; + static std::unique_ptr loader; void ErrorCallback(const char* message) noexcept { - FatalError(message); + FatalError(message, 0, "", ""); std::cout << std::endl; } void ValidationErrorCallback(const char* message) noexcept { - Error(message); + Error(message, 0, "", ""); std::cout << std::endl; } void ValidationWarningCallback(const char* message) noexcept { - Warning(message); + Warning(message, 0, "", ""); std::cout << std::endl; } void RenderCore::Init() noexcept { + loader = std::make_unique(); + kvfSetErrorCallback(&ErrorCallback); kvfSetValidationErrorCallback(&ValidationErrorCallback); kvfSetValidationWarningCallback(&ValidationWarningCallback); @@ -41,15 +43,15 @@ namespace mlx //kvfAddLayer("VK_LAYER_MESA_overlay"); Window window(1, 1, "", true); - std::vector instance_extentions = window.GetRequiredVulkanInstanceExtentions(); + std::vector instance_extensions = window.GetRequiredVulkanInstanceExtentions(); #ifdef MLX_PLAT_MACOS - instance_extentions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); + instance_extensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); #endif m_instance = kvfCreateInstance(instance_extensions.data(), instance_extensions.size()); DebugLog("Vulkan : instance created"); - loader.LoadInstance(m_instance); + loader->LoadInstance(m_instance); VkSurfaceKHR surface = window.CreateVulkanSurface(m_instance); @@ -77,5 +79,6 @@ namespace mlx DebugLog("Vulkan : logical device destroyed"); kvfDestroyInstance(m_instance); DebugLog("Vulkan : instance destroyed"); + loader.reset(); } } diff --git a/runtime/Sources/Renderer/RenderPasses/2DPass.cpp b/runtime/Sources/Renderer/RenderPasses/2DPass.cpp index a694b8c..962ce99 100644 --- a/runtime/Sources/Renderer/RenderPasses/2DPass.cpp +++ b/runtime/Sources/Renderer/RenderPasses/2DPass.cpp @@ -41,7 +41,7 @@ namespace mlx std::vector fragment_shader_code = { #include }; - p_fragment_shader = std::make_shared(fragment_shader, ShaderType::Fragment, std::move(fragment_shader_layout)); + p_fragment_shader = std::make_shared(fragment_shader_code, ShaderType::Fragment, std::move(fragment_shader_layout)); func::function functor = [this](const EventBase& event) { @@ -50,7 +50,7 @@ namespace mlx if(event.What() == Event::DescriptorPoolResetEventCode) { p_texture_set->Reallocate(); - p_viewer_data_set.Reallocate(); + p_viewer_data_set->Reallocate(); for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { p_viewer_data_set->SetUniformBuffer(i, 0, p_viewer_data_buffer->Get(i)); @@ -64,7 +64,7 @@ namespace mlx p_texture_set = std::make_shared(p_fragment_shader->GetShaderLayout().set_layouts[0].second, p_fragment_shader->GetPipelineLayout().set_layouts[0], ShaderType::Fragment); p_viewer_data_buffer = std::make_shared(); - p_viewer_data_buffer->Init(sizeof(ViewerData2D)); + p_viewer_data_buffer->Init(sizeof(ViewerData)); for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { p_viewer_data_set->SetUniformBuffer(i, 0, p_viewer_data_buffer->Get(i)); @@ -80,7 +80,7 @@ namespace mlx pipeline_descriptor.vertex_shader = p_vertex_shader; pipeline_descriptor.fragment_shader = p_fragment_shader; pipeline_descriptor.color_attachments = { &render_target }; - pipeline_descriptor.depth = scene.GetDepth(); + pipeline_descriptor.depth = &scene.GetDepth(); pipeline_descriptor.clear_color_attachments = false; m_pipeline.Init(pipeline_descriptor); } @@ -88,8 +88,8 @@ namespace mlx std::uint32_t frame_index = renderer.GetCurrentFrameIndex(); ViewerData viewer_data; - viewer_data.projection = Mat4f::Ortho(0.0f, render_target.GetWidth(), render_target.GetHeight(), 0.0f); - static CPUBuffer buffer(sizeof(ViewerData2D)); + viewer_data.projection_matrix = Mat4f::Ortho(0.0f, render_target.GetWidth(), render_target.GetHeight(), 0.0f); + static CPUBuffer buffer(sizeof(ViewerData)); std::memcpy(buffer.GetData(), &viewer_data, buffer.GetSize()); p_viewer_data_buffer->SetData(buffer, frame_index); diff --git a/runtime/Sources/Renderer/RenderPasses/FinalPass.cpp b/runtime/Sources/Renderer/RenderPasses/FinalPass.cpp index 5a057e4..c36d703 100644 --- a/runtime/Sources/Renderer/RenderPasses/FinalPass.cpp +++ b/runtime/Sources/Renderer/RenderPasses/FinalPass.cpp @@ -42,7 +42,7 @@ namespace mlx p_set = std::make_shared(p_fragment_shader->GetShaderLayout().set_layouts[0].second, p_fragment_shader->GetPipelineLayout().set_layouts[0], ShaderType::Fragment); } - void FinalPass::Pass(Scene& scene, Renderer& renderer, Texture& render_target) + void FinalPass::Pass([[maybe_unused]] Scene& scene, Renderer& renderer, Texture& render_target) { if(m_pipeline.GetPipeline() == VK_NULL_HANDLE) { diff --git a/runtime/Sources/Renderer/Renderer.cpp b/runtime/Sources/Renderer/Renderer.cpp index d544e2a..e8bacc7 100644 --- a/runtime/Sources/Renderer/Renderer.cpp +++ b/runtime/Sources/Renderer/Renderer.cpp @@ -36,21 +36,20 @@ namespace mlx p_window = window; - auto& render_core = RenderCore::Get(); - m_surface = p_window->CreateVulkanSurface(render_core::GetInstance()); + m_surface = p_window->CreateVulkanSurface(RenderCore::Get().GetInstance()); DebugLog("Vulkan : surface created"); CreateSwapchain(); for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { - m_image_available_semaphores[i] = kvfCreateSemaphore(render_core.GetDevice()); + m_image_available_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice()); DebugLog("Vulkan : image available semaphore created"); - m_render_finished_semaphores[i] = kvfCreateSemaphore(render_core.GetDevice()); + m_render_finished_semaphores[i] = kvfCreateSemaphore(RenderCore::Get().GetDevice()); DebugLog("Vulkan : render finished semaphore created"); - m_cmd_buffers[i] = kvfCreateCommandBuffer(render_core.GetDevice()); + m_cmd_buffers[i] = kvfCreateCommandBuffer(RenderCore::Get().GetDevice()); DebugLog("Vulkan : command buffer created"); - m_cmd_fences[i] = kvfCreateFence(render_core.GetDevice()); + m_cmd_fences[i] = kvfCreateFence(RenderCore::Get().GetDevice()); DebugLog("Vulkan : fence created"); } } @@ -124,21 +123,20 @@ namespace mlx void Renderer::Destroy() noexcept { - auto& render_core = RenderCore::Get(); - render_core.WaitDeviceIdle(); + RenderCore::Get().WaitDeviceIdle(); for(std::size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { - kvfDestroySemaphore(render_core.GetDevice(), m_image_available_semaphores[i]); + kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_image_available_semaphores[i]); DebugLog("Vulkan : image available semaphore destroyed"); - kvfDestroySemaphore(render_core.GetDevice(), m_render_finished_semaphores[i]); + kvfDestroySemaphore(RenderCore::Get().GetDevice(), m_render_finished_semaphores[i]); DebugLog("Vulkan : render finished semaphore destroyed"); - kvfDestroyFence(render_core.GetDevice(), m_cmd_fences[i]); + kvfDestroyFence(RenderCore::Get().GetDevice(), m_cmd_fences[i]); DebugLog("Vulkan : fence destroyed"); } DestroySwapchain(); - vkDestroySurfaceKHR(render_core.GetInstance(), m_surface, nullptr); + vkDestroySurfaceKHR(RenderCore::Get().GetInstance(), m_surface, nullptr); DebugLog("Vulkan : surface destroyed"); m_surface = VK_NULL_HANDLE; } diff --git a/runtime/Sources/Renderer/SceneRenderer.cpp b/runtime/Sources/Renderer/SceneRenderer.cpp index b6f7860..8c176a0 100644 --- a/runtime/Sources/Renderer/SceneRenderer.cpp +++ b/runtime/Sources/Renderer/SceneRenderer.cpp @@ -4,7 +4,7 @@ #include #include -namespacemlx +namespace mlx { void SceneRenderer::Init() { diff --git a/runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp b/runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp index df743d1..7a7bf81 100644 --- a/runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp +++ b/runtime/Sources/Renderer/Vulkan/VulkanLoader.cpp @@ -1,7 +1,7 @@ #include #include -#ifdef _WIN32 +#ifdef MLX_PLAT_WINDOWS __declspec(dllimport) HMODULE __stdcall LoadLibraryA(LPCSTR); __declspec(dllimport) FARPROC __stdcall GetProcAddress(HMODULE, LPCSTR); __declspec(dllimport) int __stdcall FreeLibrary(HMODULE); @@ -22,20 +22,20 @@ namespace mlx { namespace Internal { - static PFN_vkVoidFunction vkGetInstanceProcAddrStub(Handle context, const char* name) + static inline PFN_vkVoidFunction vkGetInstanceProcAddrStub(Handle context, const char* name) { - return vkGetInstanceProcAddr((VkInstance)context, name); + return vkGetInstanceProcAddr(static_cast(context), name); } } VulkanLoader::VulkanLoader() { - #if defined(_WIN32) + #if defined(MLX_PLAT_WINDOWS) p_module = LoadLibraryA("vulkan-1.dll"); if(!p_module) FatalError("Vulkan loader : failed to load libvulkan"); vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)(void(*)(void))GetProcAddress(p_module, "vkGetInstanceProcAddr"); - #elif defined(__APPLE__) + #elif defined(MLX_PLAT_MACOS) p_module = dlopen("libvulkan.dylib", RTLD_NOW | RTLD_LOCAL); if(!p_module) p_module = dlopen("libvulkan.1.dylib", RTLD_NOW | RTLD_LOCAL); @@ -55,16 +55,18 @@ namespace mlx p_module = dlopen("/usr/local/lib/libvulkan.dylib", RTLD_NOW | RTLD_LOCAL); if(!p_module) FatalError("Vulkan loader : failed to load libvulkan"); - - vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(p_module, "vkGetInstanceProcAddr"); + void* symbol_ptr = dlsym(p_module, "vkGetInstanceProcAddr"); + *(void**)(&vkGetInstanceProcAddr) = symbol_ptr; #else + dlerror(); p_module = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_LOCAL); if(!p_module) p_module = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL); if(!p_module) - FatalError("Vulkan loader : failed to load libvulkan"); + FatalError("Vulkan loader : failed to load libvulkan due to %", dlerror()); DISABLE_GCC_PEDANTIC_WARNINGS - vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(p_module, "vkGetInstanceProcAddr"); + void* symbol_ptr = dlsym(p_module, "vkGetInstanceProcAddr"); + *(void**)(&vkGetInstanceProcAddr) = symbol_ptr; RESTORE_GCC_PEDANTIC_WARNINGS #endif DebugLog("Vulkan loader : libvulkan loaded"); @@ -251,7 +253,7 @@ namespace mlx VulkanLoader::~VulkanLoader() { - #if defined(_WIN32) + #if defined(MLX_PLAT_WINDOWS) FreeLibrary((HMODULE)p_module); #else dlclose(p_module); diff --git a/runtime/Sources/Renderer/Vulkan/VulkanLoader.h b/runtime/Sources/Renderer/Vulkan/VulkanLoader.h index c6a7274..2d2f320 100644 --- a/runtime/Sources/Renderer/Vulkan/VulkanLoader.h +++ b/runtime/Sources/Renderer/Vulkan/VulkanLoader.h @@ -1,7 +1,9 @@ #ifndef __MLX_VULKAN_LOADER__ #define __MLX_VULKAN_LOADER__ -#ifdef _WIN32 +#include + +#ifdef MLX_PLAT_WINDOWS typedef const char* LPCSTR; typedef struct HINSTANCE__* HINSTANCE; typedef HINSTANCE HMODULE; @@ -31,7 +33,7 @@ namespace mlx void LoadDeviceFunctions(void* context, PFN_vkVoidFunction (*load)(void*, const char*)) noexcept; private: - #ifdef _WIN32 + #ifdef MLX_PLAT_WINDOWS HMODULE p_module = nullptr; #else Handle p_module = nullptr; diff --git a/third_party/kvf.h b/third_party/kvf.h index 2fc82ba..6a22d3e 100755 --- a/third_party/kvf.h +++ b/third_party/kvf.h @@ -134,7 +134,7 @@ void kvfDestroySemaphore(VkDevice device, VkSemaphore semaphore); #endif VkImage kvfCreateImage(VkDevice device, uint32_t width, uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, KvfImageType type); -void kvfImageToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkImage src, size_t buffer_offset, VkImageAspectFlagBits aspect, VkExtent3D extent); +void kvfCopyImageToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkImage src, size_t buffer_offset, VkImageAspectFlagBits aspect, VkExtent3D extent); void kvfDestroyImage(VkDevice device, VkImage image); VkImageView kvfCreateImageView(VkDevice device, VkImage image, VkFormat format, VkImageViewType type, VkImageAspectFlags aspect, int layer_count); void kvfDestroyImageView(VkDevice device, VkImageView image_view); @@ -970,6 +970,8 @@ const char* kvfVerbaliseVkResult(VkResult result) VKAPI_ATTR VkBool32 VKAPI_CALL __kvfDebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData) { + (void)messageType; + (void)pUserData; if(messageSeverity == VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { if(__kvf_validation_error_callback != NULL) @@ -1138,7 +1140,7 @@ __KvfQueueFamilies __kvfFindQueueFamilies(VkPhysicalDevice physical, VkSurfaceKH VkQueueFamilyProperties* queue_families = (VkQueueFamilyProperties*)KVF_MALLOC(sizeof(VkQueueFamilyProperties) * queue_family_count); vkGetPhysicalDeviceQueueFamilyProperties(physical, &queue_family_count, queue_families); - for(int i = 0; i < queue_family_count; i++) + for(uint32_t i = 0; i < queue_family_count; i++) { // try to find a queue family index that supports compute but not graphics if(queue_families[i].queueFlags & VK_QUEUE_COMPUTE_BIT && (queue_families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) == 0) @@ -1201,10 +1203,10 @@ int32_t __kvfScorePhysicalDevice(VkPhysicalDevice device, VkSurfaceKHR surface, vkEnumerateDeviceExtensionProperties(device, NULL, &extension_count, props); bool are_there_required_device_extensions = true; - for(int j = 0; j < device_extensions_count; j++) + for(uint32_t j = 0; j < device_extensions_count; j++) { bool is_there_extension = false; - for(int k = 0; k < extension_count; k++) + for(uint32_t k = 0; k < extension_count; k++) { if(strcmp(device_extensions[j], props[k].extensionName) == 0) { @@ -1270,7 +1272,7 @@ VkPhysicalDevice kvfPickGoodPhysicalDevice(VkInstance instance, VkSurfaceKHR sur devices = (VkPhysicalDevice*)KVF_MALLOC(sizeof(VkPhysicalDevice) * device_count + 1); vkEnumeratePhysicalDevices(instance, &device_count, devices); - for(int i = 0; i < device_count; i++) + for(uint32_t i = 0; i < device_count; i++) { int32_t current_device_score = __kvfScorePhysicalDevice(devices[i], surface, device_extensions, device_extensions_count); if(current_device_score > best_device_score) @@ -1465,7 +1467,6 @@ uint32_t kvfGetDeviceQueueFamily(VkDevice device, KvfQueueType queue) KVF_ASSERT(device != VK_NULL_HANDLE); __KvfDevice* kvfdevice = __kvfGetKvfDeviceFromVkDevice(device); KVF_ASSERT(kvfdevice != NULL); - VkQueue vk_queue = VK_NULL_HANDLE; if(queue == KVF_GRAPHICS_QUEUE) return kvfdevice->queues.graphics; else if(queue == KVF_PRESENT_QUEUE) @@ -1508,7 +1509,7 @@ int32_t kvfFindDeviceQueueFamily(VkPhysicalDevice physical, KvfQueueType type) int32_t queue = -1; - for(int i = 0; i < queue_family_count; i++) + for(uint32_t i = 0; i < queue_family_count; i++) { if(type == KVF_COMPUTE_QUEUE) { @@ -1546,7 +1547,7 @@ int32_t kvfFindDeviceQueueFamily(VkPhysicalDevice physical, KvfQueueType type) int32_t queue = -1; - for(int i = 0; i < queue_family_count; i++) + for(uint32_t i = 0; i < queue_family_count; i++) { VkBool32 present_support = false; vkGetPhysicalDeviceSurfaceSupportKHR(physical, i, surface, &present_support); @@ -1629,7 +1630,7 @@ void kvfDestroySemaphore(VkDevice device, VkSemaphore semaphore) VkSurfaceFormatKHR __kvfChooseSwapSurfaceFormat(__KvfSwapchainSupportInternal* support) { - for(int i = 0; i < support->formats_count; i++) + for(uint32_t i = 0; i < support->formats_count; i++) { if(support->formats[i].format == VK_FORMAT_R8G8B8A8_SRGB && support->formats[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) return support->formats[i]; @@ -1641,7 +1642,7 @@ void kvfDestroySemaphore(VkDevice device, VkSemaphore semaphore) { if(try_vsync == false) return VK_PRESENT_MODE_IMMEDIATE_KHR; - for(int i = 0; i < support->presentModes_count; i++) + for(uint32_t i = 0; i < support->presentModes_count; i++) { if(support->presentModes[i] == VK_PRESENT_MODE_MAILBOX_KHR) return support->presentModes[i]; @@ -1781,7 +1782,7 @@ VkImage kvfCreateImage(VkDevice device, uint32_t width, uint32_t height, VkForma return image; } -void kvfImageToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkImage src, size_t buffer_offset, VkImageAspectFlagBits aspect, VkExtent3D extent) +void kvfCopyImageToBuffer(VkCommandBuffer cmd, VkBuffer dst, VkImage src, size_t buffer_offset, VkImageAspectFlagBits aspect, VkExtent3D extent) { KVF_ASSERT(cmd != VK_NULL_HANDLE); KVF_ASSERT(dst != VK_NULL_HANDLE); @@ -2286,7 +2287,7 @@ VkDescriptorSet kvfAllocateDescriptorSet(VkDevice device, VkDescriptorSetLayout __KvfDevice* kvf_device = __kvfGetKvfDeviceFromVkDevice(device); KVF_ASSERT(kvf_device != NULL); VkDescriptorPool pool = VK_NULL_HANDLE; - for(int i = 0; i < kvf_device->sets_pools_size; i++) + for(uint32_t i = 0; i < kvf_device->sets_pools_size; i++) { if(kvf_device->sets_pools[i].size < kvf_device->sets_pools[i].capacity) pool = kvf_device->sets_pools[i].pool; @@ -2397,7 +2398,7 @@ void kvfResetDeviceDescriptorPools(VkDevice device) KVF_ASSERT(device != VK_NULL_HANDLE); __KvfDevice* kvf_device = __kvfGetKvfDeviceFromVkDevice(device); KVF_ASSERT(kvf_device != NULL); - for(int i = 0; i < kvf_device->sets_pools_size; i++) + for(uint32_t i = 0; i < kvf_device->sets_pools_size; i++) { vkResetDescriptorPool(device, kvf_device->sets_pools[i].pool, 0); kvf_device->sets_pools[i].size = 0;