From 054d55c741f3625ba802bf636df5c9bc2f614cde Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Wed, 24 Dec 2025 02:18:18 +0100 Subject: [PATCH] refactor(cleanup): be nicer on older compilers --- CMakeLists.txt | 5 +++-- lsfg-vk-backend/src/extraction/dll_reader.cpp | 1 + lsfg-vk-backend/src/extraction/shader_registry.cpp | 1 + lsfg-vk-layer/src/entrypoint.cpp | 1 + lsfg-vk-layer/src/instance.hpp | 2 +- lsfg-vk-layer/src/swapchain.cpp | 9 +++++---- lsfg-vk-layer/src/swapchain.hpp | 6 +++--- lsfg-vk-ui/CMakeLists.txt | 1 + lsfg-vk-ui/src/backend.cpp | 7 ++++--- lsfg-vk-ui/src/backend.hpp | 5 +++-- lsfg-vk-ui/src/main.cpp | 4 ++-- lsfg-vk-ui/src/utils.cpp | 5 +++-- 12 files changed, 28 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b11401..904da76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,16 +4,17 @@ include(GNUInstallDirs) # === READ HERE FOR BUILD OPTIONS === option(LSFGVK_BUILD_VULKAN_LAYER "Build the Vulkan layer" ON) -option(LSFGVK_BUILD_USER_INTERFACE "Build the user interface" ON) +option(LSFGVK_BUILD_USER_INTERFACE "Build the user interface" OFF) option(LSFGVK_BUILD_DEBUG_TOOL "Build the debug tool" OFF) option(LSFGVK_INSTALL_DEVELOP "Install development files" OFF) -option(LSFGVK_INSTALL_XDG_FILES "Install xdg app files" ON) +option(LSFGVK_INSTALL_XDG_FILES "Install xdg app files" OFF) # === READ HERE FOR BUILD OPTIONS === set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_SKIP_RPATH ON) if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) diff --git a/lsfg-vk-backend/src/extraction/dll_reader.cpp b/lsfg-vk-backend/src/extraction/dll_reader.cpp index 25a3e8a..b6554ab 100644 --- a/lsfg-vk-backend/src/extraction/dll_reader.cpp +++ b/lsfg-vk-backend/src/extraction/dll_reader.cpp @@ -72,6 +72,7 @@ struct ResourceDataEntry { }; #pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-container" namespace { /// Safely cast a vector to a pointer of type T diff --git a/lsfg-vk-backend/src/extraction/shader_registry.cpp b/lsfg-vk-backend/src/extraction/shader_registry.cpp index 0238375..36935bc 100644 --- a/lsfg-vk-backend/src/extraction/shader_registry.cpp +++ b/lsfg-vk-backend/src/extraction/shader_registry.cpp @@ -32,6 +32,7 @@ namespace { /// patch the generate shader void patchGenerateShader(std::vector& data, bool hdr) { #pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" #pragma clang diagnostic ignored "-Wunsafe-buffer-usage-in-container" auto* _ptr = data.data(); const std::span words( diff --git a/lsfg-vk-layer/src/entrypoint.cpp b/lsfg-vk-layer/src/entrypoint.cpp index 8d9a51c..8914e64 100644 --- a/lsfg-vk-layer/src/entrypoint.cpp +++ b/lsfg-vk-layer/src/entrypoint.cpp @@ -344,6 +344,7 @@ namespace { VkResult myvkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* info) { #pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" VkResult result = VK_SUCCESS; diff --git a/lsfg-vk-layer/src/instance.hpp b/lsfg-vk-layer/src/instance.hpp index 72eb7a6..f1a6181 100644 --- a/lsfg-vk-layer/src/instance.hpp +++ b/lsfg-vk-layer/src/instance.hpp @@ -71,7 +71,7 @@ namespace lsfgvk::layer { ls::WatchedConfig config; std::optional active_profile; - ls::lazy backend; + ls::lazy backend; std::unordered_map swapchains; }; diff --git a/lsfg-vk-layer/src/swapchain.cpp b/lsfg-vk-layer/src/swapchain.cpp index 76e8d92..e86b645 100644 --- a/lsfg-vk-layer/src/swapchain.cpp +++ b/lsfg-vk-layer/src/swapchain.cpp @@ -64,7 +64,7 @@ void layer::context_ModifySwapchainCreateInfo(const ls::GameConf& profile, uint3 } } -Swapchain::Swapchain(const vk::Vulkan& vk, lsfgvk::backend::Instance& backend, +Swapchain::Swapchain(const vk::Vulkan& vk, backend::Instance& backend, ls::GameConf profile, SwapchainInfo info) : instance(backend), profile(std::move(profile)), info(std::move(info)) { @@ -92,13 +92,13 @@ Swapchain::Swapchain(const vk::Vulkan& vk, lsfgvk::backend::Instance& backend, this->syncSemaphore.emplace(vk, 0, std::nullopt, &syncFd); try { - this->ctx = ls::owned_ptr>( - new ls::R(backend.openContext( + this->ctx = ls::owned_ptr>( + new ls::R(backend.openContext( { sourceFds.at(0), sourceFds.at(1) }, destinationFds, syncFd, extent.width, extent.height, hdr, this->profile.flow_scale, this->profile.performance_mode )), - [backend = &backend](ls::R& ctx) { + [backend = &backend](ls::R& ctx) { backend->closeContext(ctx); } ); @@ -141,6 +141,7 @@ VkResult Swapchain::present(const vk::Vulkan& vk, // update present mode when not using pacing if (this->profile.pacing == ls::Pacing::None) { #pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunknown-warning-option" #pragma clang diagnostic ignored "-Wunsafe-buffer-usage" auto* info = reinterpret_cast(next_chain); while (info) { diff --git a/lsfg-vk-layer/src/swapchain.hpp b/lsfg-vk-layer/src/swapchain.hpp index 75de2a3..a4b4e49 100644 --- a/lsfg-vk-layer/src/swapchain.hpp +++ b/lsfg-vk-layer/src/swapchain.hpp @@ -42,7 +42,7 @@ namespace lsfgvk::layer { /// @param backend lsfg-vk backend instance /// @param profile active game profile /// @param info swapchain info - Swapchain(const vk::Vulkan& vk, lsfgvk::backend::Instance& backend, + Swapchain(const vk::Vulkan& vk, backend::Instance& backend, ls::GameConf profile, SwapchainInfo info); /// present a frame @@ -70,8 +70,8 @@ namespace lsfgvk::layer { std::vector passes; std::vector> postCopySemaphores; - ls::R instance; - ls::owned_ptr> ctx; + ls::R instance; + ls::owned_ptr> ctx; size_t idx{1}; size_t fidx{0}; // real frame index diff --git a/lsfg-vk-ui/CMakeLists.txt b/lsfg-vk-ui/CMakeLists.txt index 412186f..b2b79c4 100644 --- a/lsfg-vk-ui/CMakeLists.txt +++ b/lsfg-vk-ui/CMakeLists.txt @@ -28,6 +28,7 @@ set_target_properties(lsfg-vk-ui PROPERTIES AUTOUIC ON) target_compile_options(lsfg-vk-ui PRIVATE + -Wno-unknown-warning-option -Wno-ctad-maybe-unsupported -Wno-unsafe-buffer-usage-in-libc-call -Wno-global-constructors diff --git a/lsfg-vk-ui/src/backend.cpp b/lsfg-vk-ui/src/backend.cpp index 89ba98a..fcf9381 100644 --- a/lsfg-vk-ui/src/backend.cpp +++ b/lsfg-vk-ui/src/backend.cpp @@ -1,10 +1,11 @@ +#include +#include +#include + #include "backend.hpp" #include "utils.hpp" #include "lsfg-vk-common/configuration/config.hpp" -#include -#include -#include #include #include #include diff --git a/lsfg-vk-ui/src/backend.hpp b/lsfg-vk-ui/src/backend.hpp index 49f1828..9ed23d2 100644 --- a/lsfg-vk-ui/src/backend.hpp +++ b/lsfg-vk-ui/src/backend.hpp @@ -1,10 +1,11 @@ #pragma once -#include "lsfg-vk-common/configuration/config.hpp" - #include #include #include + +#include "lsfg-vk-common/configuration/config.hpp" + #include #include diff --git a/lsfg-vk-ui/src/main.cpp b/lsfg-vk-ui/src/main.cpp index d1178bb..5c25c99 100644 --- a/lsfg-vk-ui/src/main.cpp +++ b/lsfg-vk-ui/src/main.cpp @@ -1,11 +1,11 @@ -#include "backend.hpp" - #include #include #include #include #include +#include "backend.hpp" + using namespace lsfgvk::ui; int main(int argc, char* argv[]) { diff --git a/lsfg-vk-ui/src/utils.cpp b/lsfg-vk-ui/src/utils.cpp index 373ab87..bd8309b 100644 --- a/lsfg-vk-ui/src/utils.cpp +++ b/lsfg-vk-ui/src/utils.cpp @@ -1,8 +1,9 @@ +#include +#include + #include "utils.hpp" #include "lsfg-vk-backend/lsfgvk.hpp" -#include -#include #include #include #include