From 8f4dc6e3b546a819871dac5ab7be2f8f21d894f5 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Tue, 17 Dec 2024 01:40:58 +0100 Subject: [PATCH] fixing gcc/msvc error --- runtime/Sources/Graphics/PutPixelManager.cpp | 15 +++++++-------- runtime/Sources/Renderer/Memory.cpp | 1 + xmake.lua | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/Sources/Graphics/PutPixelManager.cpp b/runtime/Sources/Graphics/PutPixelManager.cpp index 06cedf6..1adc0a6 100644 --- a/runtime/Sources/Graphics/PutPixelManager.cpp +++ b/runtime/Sources/Graphics/PutPixelManager.cpp @@ -44,14 +44,6 @@ namespace mlx MLX_PROFILE_FUNCTION(); Verify((bool)p_renderer, "invalid renderer pointer"); - VkExtent2D extent; - if(p_renderer->GetWindow()) - extent = kvfGetSwapchainImagesSize(p_renderer->GetSwapchain().Get()); - else if(p_renderer->GetRenderTarget()) - extent = VkExtent2D{ .width = p_renderer->GetRenderTarget()->GetWidth(), .height = p_renderer->GetRenderTarget()->GetHeight() }; - else - FatalError("a renderer was created without window nor render target attached (wtf)"); - auto it = m_placements.find(draw_layer); if(it != m_placements.end()) { @@ -62,6 +54,13 @@ namespace mlx if(m_current_texture_index >= m_textures.size()) { + VkExtent2D extent; + if(p_renderer->GetWindow()) + extent = kvfGetSwapchainImagesSize(p_renderer->GetSwapchain().Get()); + else if(p_renderer->GetRenderTarget()) + extent = VkExtent2D{ .width = p_renderer->GetRenderTarget()->GetWidth(), .height = p_renderer->GetRenderTarget()->GetHeight() }; + else + FatalError("a renderer was created without window nor render target attached (wtf)"); #ifdef DEBUG m_textures.push_back(std::make_unique(CPUBuffer{}, extent.width, extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, "mlx_put_pixel_layer_" + std::to_string(m_current_texture_index))); #else diff --git a/runtime/Sources/Renderer/Memory.cpp b/runtime/Sources/Renderer/Memory.cpp index 58c27c6..16734c2 100644 --- a/runtime/Sources/Renderer/Memory.cpp +++ b/runtime/Sources/Renderer/Memory.cpp @@ -12,6 +12,7 @@ #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wunused-variable" + #pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wparentheses" #include #pragma GCC diagnostic pop diff --git a/xmake.lua b/xmake.lua index 857433a..c145724 100644 --- a/xmake.lua +++ b/xmake.lua @@ -3,7 +3,7 @@ add_requires("libsdl", { configs = { sdlmain = false } }) add_rules("mode.debug", "mode.release") -set_languages("cxx20", "c99") +set_languages("cxx20", "c11") set_objectdir("objs/xmake/$(os)_$(arch)") set_targetdir("./") @@ -94,7 +94,7 @@ target("Test") add_deps("mlx") - add_files("example/main.c") + add_files("example/main.c", { languages = "c99" }) add_defines("SDL_MAIN_HANDLED")