From 91661fd206f03ab24b9fc41ccc53f902f35a8269 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Wed, 10 Jan 2024 18:32:40 +0100 Subject: [PATCH] adding profiler --- Makefile | 7 +- compile_commands.json | 1484 +++++++++++------ src/core/application.cpp | 5 +- src/core/application.h | 3 +- src/core/application.inl | 9 + src/core/graphics.cpp | 9 +- src/core/graphics.h | 3 +- src/core/graphics.inl | 5 + src/core/profiler.cpp | 79 + src/core/profiler.h | 146 ++ src/platform/inputs.cpp | 4 +- src/renderer/buffers/vk_buffer.cpp | 8 +- src/renderer/buffers/vk_ubo.cpp | 6 +- src/renderer/command/vk_cmd_buffer.cpp | 18 +- src/renderer/core/memory.cpp | 10 +- .../descriptors/vk_descriptor_set.cpp | 7 +- src/renderer/font.cpp | 6 +- src/renderer/images/texture.cpp | 10 +- src/renderer/pixel_put.cpp | 9 +- src/renderer/renderer.cpp | 7 +- src/renderer/renderpass/vk_render_pass.cpp | 5 +- src/renderer/text_library.cpp | 11 +- src/renderer/text_pipeline.cpp | 9 +- 23 files changed, 1325 insertions(+), 535 deletions(-) create mode 100644 src/core/profiler.cpp create mode 100644 src/core/profiler.h diff --git a/Makefile b/Makefile index 831a281..c621183 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: maldavid +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2022/10/04 16:43:41 by maldavid #+# #+# # -# Updated: 2023/12/31 01:09:30 by maldavid ### ########.fr # +# Updated: 2024/01/10 14:20:30 by maldavid ### ########.fr # # # # **************************************************************************** # @@ -26,6 +26,7 @@ TOOLCHAIN ?= clang IMAGES_OPTIMIZED ?= true FORCE_INTEGRATED_GPU ?= false GRAPHICS_MEMORY_DUMP ?= false +PROFILER ?= false MODE = "release" @@ -66,6 +67,10 @@ ifeq ($(GRAPHICS_MEMORY_DUMP), true) CXXFLAGS += -D GRAPHICS_MEMORY_DUMP endif +ifeq ($(PROFILER), true) + CXXFLAGS += -D PROFILER +endif + RM = rm -rf $(OBJ_DIR)/%.o: %.cpp diff --git a/compile_commands.json b/compile_commands.json index ff20728..2ff098d 100644 --- a/compile_commands.json +++ b/compile_commands.json @@ -5,6 +5,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -12,12 +20,12 @@ "-I./third_party", "-c", "-o", - "src/renderer/text_pipeline.o", - "src/renderer/text_pipeline.cpp" + "objs/makefile/./src/core/application.o", + "src/core/application.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/text_pipeline.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/text_pipeline.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/core/application.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/core/application.o" }, { "arguments": [ @@ -25,6 +33,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -32,12 +48,12 @@ "-I./third_party", "-c", "-o", - "src/renderer/buffers/vk_vbo.o", - "src/renderer/buffers/vk_vbo.cpp" + "objs/makefile/./src/core/bridge.o", + "src/core/bridge.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/buffers/vk_vbo.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/buffers/vk_vbo.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/core/bridge.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/core/bridge.o" }, { "arguments": [ @@ -45,6 +61,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -52,12 +76,12 @@ "-I./third_party", "-c", "-o", - "src/renderer/pixel_put.o", - "src/renderer/pixel_put.cpp" + "objs/makefile/./src/core/errors.o", + "src/core/errors.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/pixel_put.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/pixel_put.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/core/errors.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/core/errors.o" }, { "arguments": [ @@ -65,6 +89,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -72,12 +104,12 @@ "-I./third_party", "-c", "-o", - "src/core/graphics.o", + "objs/makefile/./src/core/graphics.o", "src/core/graphics.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/core/graphics.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/core/graphics.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/core/graphics.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/core/graphics.o" }, { "arguments": [ @@ -85,6 +117,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -92,12 +132,12 @@ "-I./third_party", "-c", "-o", - "src/renderer/buffers/vk_ubo.o", - "src/renderer/buffers/vk_ubo.cpp" + "objs/makefile/./src/core/memory.o", + "src/core/memory.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/buffers/vk_ubo.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/buffers/vk_ubo.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/core/memory.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/core/memory.o" }, { "arguments": [ @@ -105,6 +145,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -112,12 +160,40 @@ "-I./third_party", "-c", "-o", - "src/platform/inputs.o", + "objs/makefile/./src/core/UUID.o", + "src/core/UUID.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/core/UUID.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/core/UUID.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/platform/inputs.o", "src/platform/inputs.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/platform/inputs.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/platform/inputs.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/platform/inputs.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/platform/inputs.o" }, { "arguments": [ @@ -125,6 +201,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -132,492 +216,12 @@ "-I./third_party", "-c", "-o", - "src/renderer/renderer.o", - "src/renderer/renderer.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/renderer.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/renderer.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/text_library.o", - "src/renderer/text_library.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/text_library.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/text_library.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/buffers/vk_buffer.o", - "src/renderer/buffers/vk_buffer.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/buffers/vk_buffer.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/buffers/vk_buffer.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/command/cmd_manager.o", - "src/renderer/command/cmd_manager.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/command/cmd_manager.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/command/cmd_manager.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/vk_device.o", - "src/renderer/core/vk_device.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_device.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_device.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/command/vk_cmd_buffer.o", - "src/renderer/command/vk_cmd_buffer.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/command/vk_cmd_buffer.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/command/vk_cmd_buffer.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/render_core.o", - "src/renderer/core/render_core.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/render_core.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/render_core.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/command/vk_cmd_pool.o", - "src/renderer/command/vk_cmd_pool.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/command/vk_cmd_pool.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/command/vk_cmd_pool.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/vk_instance.o", - "src/renderer/core/vk_instance.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_instance.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_instance.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/vk_semaphore.o", - "src/renderer/core/vk_semaphore.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_semaphore.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_semaphore.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/vk_queues.o", - "src/renderer/core/vk_queues.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_queues.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_queues.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/vk_validation_layers.o", - "src/renderer/core/vk_validation_layers.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_validation_layers.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_validation_layers.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/vk_surface.o", - "src/renderer/core/vk_surface.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_surface.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_surface.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/core/vk_fence.o", - "src/renderer/core/vk_fence.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_fence.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/core/vk_fence.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/descriptors/vk_descriptor_pool.o", - "src/renderer/descriptors/vk_descriptor_pool.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/descriptors/vk_descriptor_pool.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/descriptors/vk_descriptor_pool.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/images/texture_atlas.o", - "src/renderer/images/texture_atlas.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/images/texture_atlas.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/images/texture_atlas.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/descriptors/vk_descriptor_set.o", - "src/renderer/descriptors/vk_descriptor_set.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/descriptors/vk_descriptor_set.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/descriptors/vk_descriptor_set.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/swapchain/vk_framebuffer.o", - "src/renderer/swapchain/vk_framebuffer.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_framebuffer.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_framebuffer.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/pipeline/pipeline.o", - "src/renderer/pipeline/pipeline.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/pipeline/pipeline.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/pipeline/pipeline.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/images/vk_image.o", - "src/renderer/images/vk_image.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/images/vk_image.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/images/vk_image.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/descriptors/vk_descriptor_set_layout.o", - "src/renderer/descriptors/vk_descriptor_set_layout.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/descriptors/vk_descriptor_set_layout.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/descriptors/vk_descriptor_set_layout.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/swapchain/vk_imageview.o", - "src/renderer/swapchain/vk_imageview.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_imageview.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_imageview.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/swapchain/vk_swapchain.o", - "src/renderer/swapchain/vk_swapchain.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_swapchain.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_swapchain.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/renderer/swapchain/vk_render_pass.o", - "src/renderer/swapchain/vk_render_pass.cpp" - ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_render_pass.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/swapchain/vk_render_pass.o" - }, - { - "arguments": [ - "/usr/bin/clang++", - "-std=c++17", - "-O3", - "-fPIC", - "-D", - "IMAGE_OPTIMIZED", - "-I./includes", - "-I./src", - "-I./third_party", - "-c", - "-o", - "src/platform/window.o", + "objs/makefile/./src/platform/window.o", "src/platform/window.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/platform/window.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/platform/window.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/platform/window.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/platform/window.o" }, { "arguments": [ @@ -625,6 +229,14 @@ "-std=c++17", "-O3", "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", "-D", "IMAGE_OPTIMIZED", "-I./includes", @@ -632,11 +244,851 @@ "-I./third_party", "-c", "-o", - "src/renderer/images/texture.o", + "objs/makefile/./src/renderer/font.o", + "src/renderer/font.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/font.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/font.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/pixel_put.o", + "src/renderer/pixel_put.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/pixel_put.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/pixel_put.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/renderer.o", + "src/renderer/renderer.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/renderer.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/renderer.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/text_library.o", + "src/renderer/text_library.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/text_library.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/text_library.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/text_pipeline.o", + "src/renderer/text_pipeline.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/text_pipeline.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/text_pipeline.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/buffers/vk_buffer.o", + "src/renderer/buffers/vk_buffer.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/buffers/vk_buffer.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/buffers/vk_buffer.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/buffers/vk_ubo.o", + "src/renderer/buffers/vk_ubo.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/buffers/vk_ubo.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/buffers/vk_ubo.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/buffers/vk_vbo.o", + "src/renderer/buffers/vk_vbo.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/buffers/vk_vbo.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/buffers/vk_vbo.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/command/cmd_manager.o", + "src/renderer/command/cmd_manager.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/command/cmd_manager.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/command/cmd_manager.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/command/single_time_cmd_manager.o", + "src/renderer/command/single_time_cmd_manager.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/command/single_time_cmd_manager.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/command/single_time_cmd_manager.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/command/vk_cmd_buffer.o", + "src/renderer/command/vk_cmd_buffer.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/command/vk_cmd_buffer.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/command/vk_cmd_buffer.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/command/vk_cmd_pool.o", + "src/renderer/command/vk_cmd_pool.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/command/vk_cmd_pool.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/command/vk_cmd_pool.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/memory.o", + "src/renderer/core/memory.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/memory.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/memory.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/render_core.o", + "src/renderer/core/render_core.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/render_core.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/render_core.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/vk_device.o", + "src/renderer/core/vk_device.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/vk_device.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/vk_device.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/vk_fence.o", + "src/renderer/core/vk_fence.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/vk_fence.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/vk_fence.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/vk_instance.o", + "src/renderer/core/vk_instance.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/vk_instance.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/vk_instance.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/vk_queues.o", + "src/renderer/core/vk_queues.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/vk_queues.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/vk_queues.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/vk_semaphore.o", + "src/renderer/core/vk_semaphore.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/vk_semaphore.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/vk_semaphore.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/vk_surface.o", + "src/renderer/core/vk_surface.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/vk_surface.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/vk_surface.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/core/vk_validation_layers.o", + "src/renderer/core/vk_validation_layers.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/core/vk_validation_layers.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/core/vk_validation_layers.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/descriptors/vk_descriptor_pool.o", + "src/renderer/descriptors/vk_descriptor_pool.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/descriptors/vk_descriptor_pool.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/descriptors/vk_descriptor_pool.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/descriptors/vk_descriptor_set.o", + "src/renderer/descriptors/vk_descriptor_set.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/descriptors/vk_descriptor_set.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/descriptors/vk_descriptor_set.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/descriptors/vk_descriptor_set_layout.o", + "src/renderer/descriptors/vk_descriptor_set_layout.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/descriptors/vk_descriptor_set_layout.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/descriptors/vk_descriptor_set_layout.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/images/texture_atlas.o", + "src/renderer/images/texture_atlas.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/images/texture_atlas.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/images/texture_atlas.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/images/texture.o", "src/renderer/images/texture.cpp" ], - "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX", - "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/images/texture.cpp", - "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/src/renderer/images/texture.o" + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/images/texture.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/images/texture.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/images/vk_image.o", + "src/renderer/images/vk_image.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/images/vk_image.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/images/vk_image.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/pipeline/pipeline.o", + "src/renderer/pipeline/pipeline.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/pipeline/pipeline.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/pipeline/pipeline.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/renderpass/vk_framebuffer.o", + "src/renderer/renderpass/vk_framebuffer.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/renderpass/vk_framebuffer.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/renderpass/vk_framebuffer.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/renderpass/vk_render_pass.o", + "src/renderer/renderpass/vk_render_pass.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/renderpass/vk_render_pass.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/renderpass/vk_render_pass.o" + }, + { + "arguments": [ + "/usr/bin/clang++", + "-std=c++17", + "-O3", + "-fPIC", + "-Wall", + "-Wextra", + "-Werror", + "-DSDL_MAIN_HANDLED", + "-Wno-error=", + "-g", + "-D", + "DEBUG", + "-D", + "IMAGE_OPTIMIZED", + "-I./includes", + "-I./src", + "-I./third_party", + "-c", + "-o", + "objs/makefile/./src/renderer/swapchain/vk_swapchain.o", + "src/renderer/swapchain/vk_swapchain.cpp" + ], + "directory": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX", + "file": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/src/renderer/swapchain/vk_swapchain.cpp", + "output": "/home/kbz_8/Documents/Programmation/42/other/MacroLibX/MacroLibX/objs/makefile/src/renderer/swapchain/vk_swapchain.o" } ] diff --git a/src/core/application.cpp b/src/core/application.cpp index 21bc253..dc7de9a 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/04 22:10:52 by maldavid #+# #+# */ -/* Updated: 2023/12/27 21:30:10 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 16:44:14 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -48,6 +48,7 @@ namespace mlx::core void* Application::newTexture(int w, int h) { + MLX_PROFILE_FUNCTION(); #ifdef DEBUG _textures.emplace_front().create(nullptr, w, h, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_unamed_user_texture"); #else @@ -58,12 +59,14 @@ namespace mlx::core void* Application::newStbTexture(char* file, int* w, int* h) { + MLX_PROFILE_FUNCTION(); _textures.emplace_front(stbTextureLoad(file, w, h)); return &_textures.front(); } void Application::destroyTexture(void* ptr) { + MLX_PROFILE_FUNCTION(); vkDeviceWaitIdle(Render_Core::get().getDevice().get()); // TODO : synchronize with another method than stopping all the GPU process Texture* texture = static_cast(ptr); texture->destroy(); diff --git a/src/core/application.h b/src/core/application.h index 24c2368..cb3aa07 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/04 21:49:46 by maldavid #+# #+# */ -/* Updated: 2023/12/22 21:04:48 by kbz_8 ### ########.fr */ +/* Updated: 2024/01/10 14:17:24 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,6 +25,7 @@ #include #include #include +#include namespace mlx::core { diff --git a/src/core/application.inl b/src/core/application.inl index 83ecb16..c1aa586 100644 --- a/src/core/application.inl +++ b/src/core/application.inl @@ -56,6 +56,7 @@ namespace mlx::core void* Application::newGraphicsSuport(std::size_t w, std::size_t h, const char* title) { + MLX_PROFILE_FUNCTION(); auto it = std::find_if(_textures.begin(), _textures.end(), [=](const Texture& texture) { return &texture == reinterpret_cast(const_cast(title)); @@ -77,24 +78,28 @@ namespace mlx::core void Application::clearGraphicsSupport(void* win) { + MLX_PROFILE_FUNCTION(); CHECK_WINDOW_PTR(win); _graphics[*static_cast(win)]->clearRenderData(); } void Application::destroyGraphicsSupport(void* win) { + MLX_PROFILE_FUNCTION(); CHECK_WINDOW_PTR(win); _graphics[*static_cast(win)].reset(); } void Application::pixelPut(void* win, int x, int y, uint32_t color) const noexcept { + MLX_PROFILE_FUNCTION(); CHECK_WINDOW_PTR(win); _graphics[*static_cast(win)]->pixelPut(x, y, color); } void Application::stringPut(void* win, int x, int y, int color, char* str) { + MLX_PROFILE_FUNCTION(); CHECK_WINDOW_PTR(win); if(str == nullptr) { @@ -111,12 +116,14 @@ namespace mlx::core void Application::loadFont(void* win, const std::filesystem::path& filepath, float scale) { + MLX_PROFILE_FUNCTION(); CHECK_WINDOW_PTR(win); _graphics[*static_cast(win)]->loadFont(filepath, scale); } void Application::texturePut(void* win, void* img, int x, int y) { + MLX_PROFILE_FUNCTION(); CHECK_WINDOW_PTR(win); if(img == nullptr) { @@ -132,6 +139,7 @@ namespace mlx::core int Application::getTexturePixel(void* img, int x, int y) { + MLX_PROFILE_FUNCTION(); if(img == nullptr) { core::error::report(e_kind::error, "wrong texture (NULL)"); @@ -148,6 +156,7 @@ namespace mlx::core void Application::setTexturePixel(void* img, int x, int y, uint32_t color) { + MLX_PROFILE_FUNCTION(); if(img == nullptr) { core::error::report(e_kind::error, "wrong texture (NULL)"); diff --git a/src/core/graphics.cpp b/src/core/graphics.cpp index cd936f7..7f6cb3b 100644 --- a/src/core/graphics.cpp +++ b/src/core/graphics.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */ -/* Updated: 2023/12/27 21:27:48 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:23:26 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,6 +22,7 @@ namespace mlx _height(h), _id(id) { + MLX_PROFILE_FUNCTION(); _renderer->setWindow(nullptr); _renderer->init(render_target); _pixel_put_pipeline.init(w, h, *_renderer); @@ -36,6 +37,7 @@ namespace mlx _height(h), _id(id) { + MLX_PROFILE_FUNCTION(); _renderer->setWindow(_window.get()); _renderer->init(nullptr); _pixel_put_pipeline.init(w, h, *_renderer); @@ -44,6 +46,7 @@ namespace mlx void GraphicsSupport::render() noexcept { + MLX_PROFILE_FUNCTION(); if(!_renderer->beginFrame()) return; _proj = glm::ortho(0, _width, 0, _height); @@ -71,11 +74,12 @@ namespace mlx } _pixel_put_pipeline.present(); - sets[1] = _pixel_put_pipeline.getDescriptorSet(); vkCmdBindDescriptorSets(cmd_buff, VK_PIPELINE_BIND_POINT_GRAPHICS, _renderer->getPipeline().getPipelineLayout(), 0, sets.size(), sets.data(), 0, nullptr); _pixel_put_pipeline.render(*_renderer); + _text_put_pipeline->render(sets); + _renderer->endFrame(); for(auto& data : _textures_to_render) @@ -94,6 +98,7 @@ namespace mlx GraphicsSupport::~GraphicsSupport() { + MLX_PROFILE_FUNCTION(); vkDeviceWaitIdle(Render_Core::get().getDevice().get()); _text_put_pipeline->destroy(); _pixel_put_pipeline.destroy(); diff --git a/src/core/graphics.h b/src/core/graphics.h index 35cb991..fc789eb 100644 --- a/src/core/graphics.h +++ b/src/core/graphics.h @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */ -/* Updated: 2024/01/07 01:27:09 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 14:18:48 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,6 +27,7 @@ #include #include #include +#include namespace mlx { diff --git a/src/core/graphics.inl b/src/core/graphics.inl index a03bd9f..d1718ad 100644 --- a/src/core/graphics.inl +++ b/src/core/graphics.inl @@ -20,6 +20,7 @@ namespace mlx void GraphicsSupport::clearRenderData() noexcept { + MLX_PROFILE_FUNCTION(); _textures_to_render.clear(); _pixel_put_pipeline.clear(); _text_put_pipeline->clear(); @@ -27,16 +28,19 @@ namespace mlx void GraphicsSupport::pixelPut(int x, int y, uint32_t color) noexcept { + MLX_PROFILE_FUNCTION(); _pixel_put_pipeline.setPixel(x, y, color); } void GraphicsSupport::stringPut(int x, int y, int color, std::string str) { + MLX_PROFILE_FUNCTION(); _text_put_pipeline->put(x, y, color, str); } void GraphicsSupport::texturePut(Texture* texture, int x, int y) { + MLX_PROFILE_FUNCTION(); _textures_to_render.emplace_back(texture, x, y); auto it = std::find(_textures_to_render.begin(), _textures_to_render.end() - 1, _textures_to_render.back()); if(it != _textures_to_render.end() - 1) @@ -45,6 +49,7 @@ namespace mlx void GraphicsSupport::loadFont(const std::filesystem::path& filepath, float scale) { + MLX_PROFILE_FUNCTION(); _text_put_pipeline->loadFont(filepath, scale); } } diff --git a/src/core/profiler.cpp b/src/core/profiler.cpp new file mode 100644 index 0000000..43bc96d --- /dev/null +++ b/src/core/profiler.cpp @@ -0,0 +1,79 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* profiler.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: maldavid +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/10 13:56:21 by maldavid #+# #+# */ +/* Updated: 2024/01/10 18:17:35 by maldavid ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include +#include +#include + +namespace mlx +{ + void Profiler::beginRuntimeSession() + { + std::lock_guard lock(_mutex); + if(_runtime_session_began) + return; + _output_stream.open("./runtime_profile.mlx.json", std::ofstream::out | std::ofstream::trunc); + + if(_output_stream.is_open()) + writeHeader(); + else + core::error::report(e_kind::error, "Profiler : cannot open runtime profile file"); + _runtime_session_began = true; + } + + void Profiler::appendProfileData(ProfileResult&& result) + { + std::lock_guard lock(_mutex); + auto it = _profile_data.find(result.name); + if(it != _profile_data.end()) + { + result.elapsed_time = (result.elapsed_time + it->second.second.elapsed_time) / it->second.first; + _profile_data[result.name].first++; + _profile_data[result.name].second = result; + } + else + _profile_data[result.name] = std::make_pair(1, result); + } + + void Profiler::writeProfile(const ProfileResult& result) + { + std::stringstream json; + json << std::setprecision(9) << std::fixed; + json << ",\n{\n"; + json << "\t\"type\" : \"function\"," << '\n'; + json << "\t\"name\" : \"" << result.name << "\"," << '\n'; + json << "\t\"thread id\" : " << result.thread_id << "," << '\n'; + json << "\t\"average duration\" : \"" << result.elapsed_time.count() << "ms\"\n"; + json << "}"; + _output_stream << json.str(); + } + + void Profiler::endRuntimeSession() + { + std::lock_guard lock(_mutex); + if(!_runtime_session_began) + return; + for(auto& [_, pair] : _profile_data) + writeProfile(pair.second); + writeFooter(); + _output_stream.close(); + _profile_data.clear(); + _runtime_session_began = false; + } + + Profiler::~Profiler() + { + if(!_runtime_session_began) + return; + endRuntimeSession(); + } +} diff --git a/src/core/profiler.h b/src/core/profiler.h new file mode 100644 index 0000000..436fa8f --- /dev/null +++ b/src/core/profiler.h @@ -0,0 +1,146 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* profiler.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: maldavid +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/01/10 13:35:45 by maldavid #+# #+# */ +/* Updated: 2024/01/10 18:16:47 by maldavid ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef __MLX_PROFILER__ +#define __MLX_PROFILER__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace mlx +{ + using FloatingPointMilliseconds = std::chrono::duration; + + struct ProfileResult + { + std::string name; + FloatingPointMilliseconds elapsed_time; + std::thread::id thread_id; + }; + + class Profiler : public Singleton + { + friend class Singleton; + + public: + Profiler(const Profiler&) = delete; + Profiler(Profiler&&) = delete; + + void appendProfileData(ProfileResult&& result); + + private: + Profiler() { beginRuntimeSession(); } + ~Profiler(); + + void beginRuntimeSession(); + void writeProfile(const ProfileResult& result); + void endRuntimeSession(); + inline void writeHeader() + { + _output_stream << "{\"profileData\":[{}"; + _output_stream.flush(); + } + + inline void writeFooter() + { + _output_stream << "]}"; + _output_stream.flush(); + } + + private: + std::unordered_map> _profile_data; + std::ofstream _output_stream; + std::mutex _mutex; + bool _runtime_session_began = false; + }; + + class ProfilerTimer + { + public: + ProfilerTimer(const char* name) : _name(name) + { + _start_timepoint = std::chrono::steady_clock::now(); + } + + inline void stop() + { + auto end_timepoint = std::chrono::steady_clock::now(); + auto high_res_start = FloatingPointMilliseconds{ _start_timepoint.time_since_epoch() }; + auto elapsed_time = std::chrono::time_point_cast(end_timepoint).time_since_epoch() - std::chrono::time_point_cast(_start_timepoint).time_since_epoch(); + + Profiler::get().appendProfileData({ _name, elapsed_time, std::this_thread::get_id() }); + + _stopped = true; + } + + ~ProfilerTimer() + { + if(!_stopped) + stop(); + } + + private: + std::chrono::time_point _start_timepoint; + const char* _name; + bool _stopped = false; + }; + + namespace ProfilerUtils + { + template + struct ChangeResult + { + char data[N]; + }; + + template + constexpr auto cleanupOutputString(const char(&expr)[N], const char(&remove)[K]) + { + ChangeResult result = {}; + + std::size_t srcIndex = 0; + std::size_t dstIndex = 0; + while(srcIndex < N) + { + std::size_t matchIndex = 0; + while(matchIndex < K - 1 && srcIndex + matchIndex < N - 1 && expr[srcIndex + matchIndex] == remove[matchIndex]) + matchIndex++; + if(matchIndex == K - 1) + srcIndex += matchIndex; + result.data[dstIndex++] = expr[srcIndex] == '"' ? '\'' : expr[srcIndex]; + srcIndex++; + } + return result; + } + } +} + +#ifdef PROFILER + #define MLX_PROFILE_SCOPE_LINE2(name, line) constexpr auto fixedName##line = ::mlx::ProfilerUtils::cleanupOutputString(name, "__cdecl ");\ + ::mlx::ProfilerTimer timer##line(fixedName##line.data) + #define MLX_PROFILE_SCOPE_LINE(name, line) MLX_PROFILE_SCOPE_LINE2(name, line) + #define MLX_PROFILE_SCOPE(name) MLX_PROFILE_SCOPE_LINE(name, __LINE__) + #define MLX_PROFILE_FUNCTION() MLX_PROFILE_SCOPE(MLX_FUNC_SIG) +#else + #define MLX_PROFILE_SCOPE(name) + #define MLX_PROFILE_FUNCTION() +#endif + +#endif diff --git a/src/platform/inputs.cpp b/src/platform/inputs.cpp index bb369db..412732a 100644 --- a/src/platform/inputs.cpp +++ b/src/platform/inputs.cpp @@ -6,18 +6,20 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/05 16:30:19 by maldavid #+# #+# */ -/* Updated: 2023/12/11 19:01:14 by kbz_8 ### ########.fr */ +/* Updated: 2024/01/10 18:31:13 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #include "inputs.h" #include #include +#include namespace mlx { void Input::update() { + MLX_PROFILE_FUNCTION(); _xRel = 0; _yRel = 0; diff --git a/src/renderer/buffers/vk_buffer.cpp b/src/renderer/buffers/vk_buffer.cpp index ef8ec78..b00e21f 100644 --- a/src/renderer/buffers/vk_buffer.cpp +++ b/src/renderer/buffers/vk_buffer.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/08 18:55:57 by maldavid #+# #+# */ -/* Updated: 2024/01/07 01:18:35 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:30:31 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +23,7 @@ namespace mlx { void Buffer::create(Buffer::kind type, VkDeviceSize size, VkBufferUsageFlags usage, const char* name, const void* data) { + MLX_PROFILE_FUNCTION(); _usage = usage; if(type == Buffer::kind::constant || type == Buffer::kind::dynamic_device_local) { @@ -52,6 +54,7 @@ namespace mlx void Buffer::destroy() noexcept { + MLX_PROFILE_FUNCTION(); // not creating destroyer in `create` as some image may be copied (and so `this` will be invalid) CmdResource::setDestroyer([this]() { @@ -66,6 +69,7 @@ namespace mlx void Buffer::createBuffer(VkBufferUsageFlags usage, VmaAllocationCreateInfo info, VkDeviceSize size, [[maybe_unused]] const char* name) { + MLX_PROFILE_FUNCTION(); VkBufferCreateInfo bufferInfo{}; bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; bufferInfo.size = size; @@ -90,6 +94,7 @@ namespace mlx bool Buffer::copyFromBuffer(const Buffer& buffer) noexcept { + MLX_PROFILE_FUNCTION(); if(!(_usage & VK_BUFFER_USAGE_TRANSFER_DST_BIT)) { core::error::report(e_kind::error, "Vulkan : buffer cannot be the destination of a copy because it does not have the correct usage flag"); @@ -114,6 +119,7 @@ namespace mlx void Buffer::pushToGPU() noexcept { + MLX_PROFILE_FUNCTION(); VmaAllocationCreateInfo alloc_info{}; alloc_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE; diff --git a/src/renderer/buffers/vk_ubo.cpp b/src/renderer/buffers/vk_ubo.cpp index 2369b5b..686663f 100644 --- a/src/renderer/buffers/vk_ubo.cpp +++ b/src/renderer/buffers/vk_ubo.cpp @@ -6,18 +6,20 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/06 18:45:52 by maldavid #+# #+# */ -/* Updated: 2023/12/10 22:22:28 by kbz_8 ### ########.fr */ +/* Updated: 2024/01/10 18:30:57 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #include "vk_ubo.h" #include #include +#include namespace mlx { void UBO::create(Renderer* renderer, uint32_t size, [[maybe_unused]] const char* name) { + MLX_PROFILE_FUNCTION(); _renderer = renderer; for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) @@ -37,11 +39,13 @@ namespace mlx void UBO::setData(uint32_t size, const void* data) { + MLX_PROFILE_FUNCTION(); std::memcpy(_maps[_renderer->getActiveImageIndex()], data, static_cast(size)); } void UBO::setDynamicData(uint32_t size, const void* data) { + MLX_PROFILE_FUNCTION(); std::memcpy(_maps[_renderer->getActiveImageIndex()], data, static_cast(size)); _buffers[_renderer->getActiveImageIndex()].flush(); } diff --git a/src/renderer/command/vk_cmd_buffer.cpp b/src/renderer/command/vk_cmd_buffer.cpp index 5ff7066..1ffc118 100644 --- a/src/renderer/command/vk_cmd_buffer.cpp +++ b/src/renderer/command/vk_cmd_buffer.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/06 18:26:06 by maldavid #+# #+# */ -/* Updated: 2024/01/07 01:07:07 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:30:04 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,6 +17,7 @@ #include #include #include +#include namespace mlx { @@ -42,6 +43,7 @@ namespace mlx void CmdBuffer::init(kind type, CmdPool* pool) { + MLX_PROFILE_FUNCTION(); _type = type; _pool = pool; @@ -64,6 +66,7 @@ namespace mlx void CmdBuffer::beginRecord(VkCommandBufferUsageFlags usage) { + MLX_PROFILE_FUNCTION(); if(!isInit()) core::error::report(e_kind::fatal_error, "Vulkan : begenning record on un uninit command buffer"); if(_state == state::recording) @@ -80,6 +83,7 @@ namespace mlx void CmdBuffer::bindVertexBuffer(Buffer& buffer) noexcept { + MLX_PROFILE_FUNCTION(); if(!isRecording()) { core::error::report(e_kind::warning, "Vulkan : trying to bind a vertex buffer to a non recording command buffer"); @@ -94,6 +98,7 @@ namespace mlx void CmdBuffer::bindIndexBuffer(Buffer& buffer) noexcept { + MLX_PROFILE_FUNCTION(); if(!isRecording()) { core::error::report(e_kind::warning, "Vulkan : trying to bind a index buffer to a non recording command buffer"); @@ -107,6 +112,7 @@ namespace mlx void CmdBuffer::copyBuffer(Buffer& dst, Buffer& src) noexcept { + MLX_PROFILE_FUNCTION(); if(!isRecording()) { core::error::report(e_kind::warning, "Vulkan : trying to do a buffer to buffer copy in a non recording command buffer"); @@ -129,6 +135,7 @@ namespace mlx void CmdBuffer::copyBufferToImage(Buffer& buffer, Image& image) noexcept { + MLX_PROFILE_FUNCTION(); if(!isRecording()) { core::error::report(e_kind::warning, "Vulkan : trying to do a buffer to image copy in a non recording command buffer"); @@ -160,6 +167,7 @@ namespace mlx void CmdBuffer::copyImagetoBuffer(Image& image, Buffer& buffer) noexcept { + MLX_PROFILE_FUNCTION(); if(!isRecording()) { core::error::report(e_kind::warning, "Vulkan : trying to do an image to buffer copy in a non recording command buffer"); @@ -191,6 +199,7 @@ namespace mlx void CmdBuffer::transitionImageLayout(Image& image, VkImageLayout new_layout) noexcept { + MLX_PROFILE_FUNCTION(); if(!isRecording()) { core::error::report(e_kind::warning, "Vulkan : trying to do an image layout transition in a non recording command buffer"); @@ -238,6 +247,7 @@ namespace mlx void CmdBuffer::endRecord() { + MLX_PROFILE_FUNCTION(); if(!isInit()) core::error::report(e_kind::fatal_error, "Vulkan : ending record on un uninit command buffer"); if(_state != state::recording) @@ -250,6 +260,7 @@ namespace mlx void CmdBuffer::submitIdle(bool shouldWaitForExecution) noexcept { + MLX_PROFILE_FUNCTION(); if(_type != kind::single_time) { core::error::report(e_kind::error, "Vulkan : try to perform an idle submit on a command buffer that is not single-time, this is not allowed"); @@ -274,6 +285,7 @@ namespace mlx void CmdBuffer::submit(Semaphore* semaphores) noexcept { + MLX_PROFILE_FUNCTION(); std::array signalSemaphores; std::array waitSemaphores; @@ -309,6 +321,7 @@ namespace mlx void CmdBuffer::updateSubmitState() noexcept { + MLX_PROFILE_FUNCTION(); if(!_fence.isReady()) return; @@ -320,6 +333,7 @@ namespace mlx void CmdBuffer::preTransferBarrier() noexcept { + MLX_PROFILE_FUNCTION(); VkMemoryBarrier memoryBarrier{}; memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER; memoryBarrier.pNext = nullptr; @@ -331,6 +345,7 @@ namespace mlx void CmdBuffer::postTransferBarrier() noexcept { + MLX_PROFILE_FUNCTION(); VkMemoryBarrier memoryBarrier{}; memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER; memoryBarrier.pNext = nullptr; @@ -342,6 +357,7 @@ namespace mlx void CmdBuffer::destroy() noexcept { + MLX_PROFILE_FUNCTION(); _fence.destroy(); _cmd_buffer = VK_NULL_HANDLE; _state = state::uninit; diff --git a/src/renderer/core/memory.cpp b/src/renderer/core/memory.cpp index 89c4b62..8c3c840 100644 --- a/src/renderer/core/memory.cpp +++ b/src/renderer/core/memory.cpp @@ -6,12 +6,13 @@ /* By: kbz_8 +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/10/20 22:02:37 by kbz_8 #+# #+# */ -/* Updated: 2024/01/07 00:09:18 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:29:07 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #include #include +#include #include #define VMA_STATIC_VULKAN_FUNCTIONS 0 @@ -86,6 +87,7 @@ namespace mlx VmaAllocation GPUallocator::createBuffer(const VkBufferCreateInfo* binfo, const VmaAllocationCreateInfo* vinfo, VkBuffer& buffer, const char* name) noexcept { + MLX_PROFILE_FUNCTION(); VmaAllocation allocation; VkResult res = vmaCreateBuffer(_allocator, binfo, vinfo, &buffer, &allocation, nullptr); if(res != VK_SUCCESS) @@ -104,6 +106,7 @@ namespace mlx void GPUallocator::destroyBuffer(VmaAllocation allocation, VkBuffer buffer) noexcept { + MLX_PROFILE_FUNCTION(); vkDeviceWaitIdle(Render_Core::get().getDevice().get()); vmaDestroyBuffer(_allocator, buffer, allocation); #ifdef DEBUG @@ -114,6 +117,7 @@ namespace mlx VmaAllocation GPUallocator::createImage(const VkImageCreateInfo* iminfo, const VmaAllocationCreateInfo* vinfo, VkImage& image, const char* name) noexcept { + MLX_PROFILE_FUNCTION(); VmaAllocation allocation; VkResult res = vmaCreateImage(_allocator, iminfo, vinfo, &image, &allocation, nullptr); if(res != VK_SUCCESS) @@ -132,6 +136,7 @@ namespace mlx void GPUallocator::destroyImage(VmaAllocation allocation, VkImage image) noexcept { + MLX_PROFILE_FUNCTION(); vkDeviceWaitIdle(Render_Core::get().getDevice().get()); vmaDestroyImage(_allocator, image, allocation); #ifdef DEBUG @@ -142,6 +147,7 @@ namespace mlx void GPUallocator::mapMemory(VmaAllocation allocation, void** data) noexcept { + MLX_PROFILE_FUNCTION(); VkResult res = vmaMapMemory(_allocator, allocation, data); if(res != VK_SUCCESS) core::error::report(e_kind::fatal_error, "Graphics allocator : unable to map GPU memory to CPU memory, %s", RCore::verbaliseResultVk(res)); @@ -149,6 +155,7 @@ namespace mlx void GPUallocator::unmapMemory(VmaAllocation allocation) noexcept { + MLX_PROFILE_FUNCTION(); vmaUnmapMemory(_allocator, allocation); } @@ -173,6 +180,7 @@ namespace mlx void GPUallocator::flush(VmaAllocation allocation, VkDeviceSize size, VkDeviceSize offset) noexcept { + MLX_PROFILE_FUNCTION(); vmaFlushAllocation(_allocator, allocation, offset, size); } diff --git a/src/renderer/descriptors/vk_descriptor_set.cpp b/src/renderer/descriptors/vk_descriptor_set.cpp index b840c7f..423db02 100644 --- a/src/renderer/descriptors/vk_descriptor_set.cpp +++ b/src/renderer/descriptors/vk_descriptor_set.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/01/23 18:40:44 by maldavid #+# #+# */ -/* Updated: 2024/01/03 13:14:24 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:28:34 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,11 +17,13 @@ #include #include #include +#include namespace mlx { void DescriptorSet::init(Renderer* renderer, DescriptorPool* pool, DescriptorSetLayout* layout) { + MLX_PROFILE_FUNCTION(); _renderer = renderer; _layout = layout; _pool = pool; @@ -47,6 +49,7 @@ namespace mlx void DescriptorSet::writeDescriptor(int binding, UBO* ubo) const noexcept { + MLX_PROFILE_FUNCTION(); auto device = Render_Core::get().getDevice().get(); for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) @@ -71,6 +74,7 @@ namespace mlx void DescriptorSet::writeDescriptor(int binding, const Image& image) const noexcept { + MLX_PROFILE_FUNCTION(); auto device = Render_Core::get().getDevice().get(); VkDescriptorImageInfo imageInfo{}; @@ -92,6 +96,7 @@ namespace mlx DescriptorSet DescriptorSet::duplicate() { + MLX_PROFILE_FUNCTION(); DescriptorSet set; set.init(_renderer, _pool, _layout); return set; diff --git a/src/renderer/font.cpp b/src/renderer/font.cpp index b053b8f..ad2f24e 100644 --- a/src/renderer/font.cpp +++ b/src/renderer/font.cpp @@ -6,12 +6,13 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/11 22:06:09 by kbz_8 #+# #+# */ -/* Updated: 2023/12/14 19:11:41 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:27:14 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #include #include +#include #include constexpr const int RANGE = 1024; @@ -20,6 +21,7 @@ namespace mlx { Font::Font(Renderer& renderer, const std::filesystem::path& path, float scale) : non_copyable(), _name(path.string()), _scale(scale) { + MLX_PROFILE_FUNCTION(); std::vector tmp_bitmap(RANGE * RANGE); std::vector vulkan_bitmap(RANGE * RANGE * 4); @@ -56,6 +58,7 @@ namespace mlx Font::Font(class Renderer& renderer, const std::string& name, const std::vector& ttf_data, float scale) : non_copyable(), _name(name), _scale(scale) { + MLX_PROFILE_FUNCTION(); std::vector tmp_bitmap(RANGE * RANGE); std::vector vulkan_bitmap(RANGE * RANGE * 4); stbtt_pack_context pc; @@ -79,6 +82,7 @@ namespace mlx Font::~Font() { + MLX_PROFILE_FUNCTION(); _atlas.destroy(); } } diff --git a/src/renderer/images/texture.cpp b/src/renderer/images/texture.cpp index 5a3b3da..4443304 100644 --- a/src/renderer/images/texture.cpp +++ b/src/renderer/images/texture.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/03/31 18:03:35 by maldavid #+# #+# */ -/* Updated: 2023/12/31 00:49:16 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:28:11 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ #include #include #include +#include #include #define STB_IMAGE_IMPLEMENTATION @@ -31,6 +32,7 @@ namespace mlx { void Texture::create(uint8_t* pixels, uint32_t width, uint32_t height, VkFormat format, const char* name, bool dedicated_memory) { + MLX_PROFILE_FUNCTION(); Image::create(width, height, format, TILING, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT, name, dedicated_memory); Image::createImageView(VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_COLOR_BIT); Image::createSampler(); @@ -79,6 +81,7 @@ namespace mlx void Texture::setPixel(int x, int y, uint32_t color) noexcept { + MLX_PROFILE_FUNCTION(); if(x < 0 || y < 0 || static_cast(x) > getWidth() || static_cast(y) > getHeight()) return; if(_map == nullptr) @@ -89,6 +92,7 @@ namespace mlx int Texture::getPixel(int x, int y) noexcept { + MLX_PROFILE_FUNCTION(); if(x < 0 || y < 0 || static_cast(x) > getWidth() || static_cast(y) > getHeight()) return 0; if(_map == nullptr) @@ -99,6 +103,7 @@ namespace mlx void Texture::openCPUmap() { + MLX_PROFILE_FUNCTION(); if(_map != nullptr) return; @@ -123,6 +128,7 @@ namespace mlx void Texture::render(Renderer& renderer, int x, int y) { + MLX_PROFILE_FUNCTION(); if(_has_been_modified) { std::memcpy(_map, _cpu_map.data(), _cpu_map.size() * formatSize(getFormat())); @@ -139,6 +145,7 @@ namespace mlx void Texture::destroy() noexcept { + MLX_PROFILE_FUNCTION(); Image::destroy(); if(_buf_map.has_value()) _buf_map->destroy(); @@ -148,6 +155,7 @@ namespace mlx Texture stbTextureLoad(std::filesystem::path file, int* w, int* h) { + MLX_PROFILE_FUNCTION(); Texture texture; int channels; uint8_t* data = nullptr; diff --git a/src/renderer/pixel_put.cpp b/src/renderer/pixel_put.cpp index c94d30b..c8780bd 100644 --- a/src/renderer/pixel_put.cpp +++ b/src/renderer/pixel_put.cpp @@ -6,17 +6,19 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/03/31 15:14:50 by maldavid #+# #+# */ -/* Updated: 2023/12/23 19:34:30 by kbz_8 ### ########.fr */ +/* Updated: 2024/01/10 18:26:59 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #include #include +#include namespace mlx { void PixelPutPipeline::init(uint32_t width, uint32_t height, Renderer& renderer) noexcept { + MLX_PROFILE_FUNCTION(); _texture.create(nullptr, width, height, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_pixel_put_pipeline_texture", true); _texture.setDescriptor(renderer.getFragDescriptorSet().duplicate()); @@ -29,6 +31,7 @@ namespace mlx void PixelPutPipeline::setPixel(int x, int y, uint32_t color) noexcept { + MLX_PROFILE_FUNCTION(); if(x < 0 || y < 0 || x > static_cast(_width) || y > static_cast(_height)) return; _cpu_map[(y * _width) + x] = color; @@ -37,12 +40,14 @@ namespace mlx void PixelPutPipeline::clear() { + MLX_PROFILE_FUNCTION(); _cpu_map.assign(_width * _height, 0); _has_been_modified = true; } void PixelPutPipeline::present() noexcept { + MLX_PROFILE_FUNCTION(); if(_has_been_modified) { std::memcpy(_buffer_map, _cpu_map.data(), sizeof(uint32_t) * _cpu_map.size()); @@ -54,11 +59,13 @@ namespace mlx void PixelPutPipeline::render(Renderer& renderer) noexcept { + MLX_PROFILE_FUNCTION(); _texture.render(renderer, 0, 0); } void PixelPutPipeline::destroy() noexcept { + MLX_PROFILE_FUNCTION(); _buffer.destroy(); _texture.destroy(); } diff --git a/src/renderer/renderer.cpp b/src/renderer/renderer.cpp index e2c8bdb..6cb8578 100644 --- a/src/renderer/renderer.cpp +++ b/src/renderer/renderer.cpp @@ -6,18 +6,20 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/18 17:25:16 by maldavid #+# #+# */ -/* Updated: 2024/01/07 01:00:18 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 14:18:35 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #include #include #include +#include namespace mlx { void Renderer::init(Texture* render_target) { + MLX_PROFILE_FUNCTION(); if(render_target == nullptr) { _surface.create(*this); @@ -70,6 +72,7 @@ namespace mlx bool Renderer::beginFrame() { + MLX_PROFILE_FUNCTION(); auto device = Render_Core::get().getDevice().get(); if(_render_target == nullptr) @@ -118,6 +121,7 @@ namespace mlx void Renderer::endFrame() { + MLX_PROFILE_FUNCTION(); _pass.end(getActiveCmdBuffer()); _cmd.getCmdBuffer(_current_frame_index).endRecord(); @@ -156,6 +160,7 @@ namespace mlx void Renderer::destroy() { + MLX_PROFILE_FUNCTION(); vkDeviceWaitIdle(Render_Core::get().getDevice().get()); _pipeline.destroy(); diff --git a/src/renderer/renderpass/vk_render_pass.cpp b/src/renderer/renderpass/vk_render_pass.cpp index 6bd6b6c..94c7eb1 100644 --- a/src/renderer/renderpass/vk_render_pass.cpp +++ b/src/renderer/renderpass/vk_render_pass.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/10/06 18:21:36 by maldavid #+# #+# */ -/* Updated: 2024/01/03 13:17:56 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:27:43 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ #include #include #include +#include namespace mlx { @@ -80,6 +81,7 @@ namespace mlx void RenderPass::begin(class CmdBuffer& cmd, class FrameBuffer& fb) { + MLX_PROFILE_FUNCTION(); if(_is_running) return; @@ -99,6 +101,7 @@ namespace mlx void RenderPass::end(class CmdBuffer& cmd) { + MLX_PROFILE_FUNCTION(); if(!_is_running) return; vkCmdEndRenderPass(cmd.get()); diff --git a/src/renderer/text_library.cpp b/src/renderer/text_library.cpp index 0a68dd4..63109e3 100644 --- a/src/renderer/text_library.cpp +++ b/src/renderer/text_library.cpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/10 11:59:57 by maldavid #+# #+# */ -/* Updated: 2023/12/12 23:03:33 by kbz_8 ### ########.fr */ +/* Updated: 2024/01/10 18:26:44 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,11 +14,13 @@ #include #include #include +#include namespace mlx { void TextData::init(std::string text, Font const* font, std::vector vbo_data, std::vector ibo_data) { + MLX_PROFILE_FUNCTION(); _text = std::move(text); _font = font; #ifdef DEBUG @@ -34,17 +36,20 @@ namespace mlx void TextData::bind(Renderer& renderer) noexcept { + MLX_PROFILE_FUNCTION(); _vbo[renderer.getActiveImageIndex()].bind(renderer); _ibo.bind(renderer); } void TextData::updateVertexData(int frame, std::vector vbo_data) { + MLX_PROFILE_FUNCTION(); _vbo[frame].setData(sizeof(Vertex) * vbo_data.size(), static_cast(vbo_data.data())); } void TextData::destroy() noexcept { + MLX_PROFILE_FUNCTION(); for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) _vbo[i].destroy(); _ibo.destroy(); @@ -52,6 +57,7 @@ namespace mlx std::shared_ptr TextLibrary::getTextData(TextID id) { + MLX_PROFILE_FUNCTION(); if(!_cache.count(id)) core::error::report(e_kind::fatal_error, "Text Library : wrong text ID '%d'", id); return _cache[id]; @@ -59,6 +65,7 @@ namespace mlx TextID TextLibrary::addTextToLibrary(std::shared_ptr text) { + MLX_PROFILE_FUNCTION(); auto it = std::find_if(_cache.begin(), _cache.end(), [=](const std::pair>& v) { return v.second->getText() == text->getText(); @@ -72,6 +79,7 @@ namespace mlx void TextLibrary::removeTextFromLibrary(TextID id) { + MLX_PROFILE_FUNCTION(); if(_cache.count(id)) { _cache[id]->destroy(); @@ -81,6 +89,7 @@ namespace mlx void TextLibrary::clearLibrary() { + MLX_PROFILE_FUNCTION(); for(auto [id, text] : _cache) text->destroy(); _cache.clear(); diff --git a/src/renderer/text_pipeline.cpp b/src/renderer/text_pipeline.cpp index 4353168..c40162b 100644 --- a/src/renderer/text_pipeline.cpp +++ b/src/renderer/text_pipeline.cpp @@ -6,11 +6,12 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */ -/* Updated: 2024/01/08 21:42:15 by maldavid ### ########.fr */ +/* Updated: 2024/01/10 18:26:24 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ #include +#include #include #include @@ -38,6 +39,7 @@ namespace mlx void TextDrawData::init(TextLibrary& library, Font* const font) noexcept { + MLX_PROFILE_FUNCTION(); std::vector vertexData; std::vector indexData; @@ -77,12 +79,14 @@ namespace mlx void TextPutPipeline::init(Renderer* renderer) noexcept { + MLX_PROFILE_FUNCTION(); _renderer = renderer; _font_in_use = &const_cast(*_font_set.emplace(*_renderer, "default", dogica_ttf, 6.0f).first); } void TextPutPipeline::loadFont(const std::filesystem::path& filepath, float scale) { + MLX_PROFILE_FUNCTION(); if(filepath.string() == "default") // we're sure it is already loaded _font_in_use = &const_cast(*_font_set.emplace(*_renderer, "default", dogica_ttf, scale).first); else @@ -91,6 +95,7 @@ namespace mlx void TextPutPipeline::put(int x, int y, int color, std::string str) { + MLX_PROFILE_FUNCTION(); auto res = _drawlist.emplace(std::move(str), color, x, y); if(res.second) const_cast(*res.first).init(_library, _font_in_use); @@ -107,6 +112,7 @@ namespace mlx void TextPutPipeline::render(std::array& sets) { + MLX_PROFILE_FUNCTION(); for(auto& draw : _drawlist) { std::shared_ptr draw_data = _library.getTextData(draw.id); @@ -131,6 +137,7 @@ namespace mlx void TextPutPipeline::destroy() noexcept { + MLX_PROFILE_FUNCTION(); _library.clearLibrary(); _drawlist.clear(); _font_set.clear();