From da16437210b44912fb5969cdfa13ee1b36eb6bf7 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Wed, 13 Aug 2025 01:49:25 +0200 Subject: [PATCH] fix(test): ensure building works without renderdoc --- framegen/CMakeLists.txt | 4 ++++ framegen/public/lsfg_3_1.hpp | 2 ++ framegen/public/lsfg_3_1p.hpp | 2 ++ framegen/v3.1_src/lsfg.cpp | 10 ++++++++++ framegen/v3.1p_src/lsfg.cpp | 10 ++++++++++ 5 files changed, 28 insertions(+) diff --git a/framegen/CMakeLists.txt b/framegen/CMakeLists.txt index a10b886..409ba8b 100644 --- a/framegen/CMakeLists.txt +++ b/framegen/CMakeLists.txt @@ -5,6 +5,10 @@ if(NOT LSFGVK_EXCESS_DEBUG) set(CMAKE_CXX_VISIBILITY_PRESET "hidden") endif() +if(LSFGVK_EXCESS_DEBUG) + add_compile_definitions(LSFGVK_EXCESS_DEBUG) +endif() + project(lsfg-vk-framegen DESCRIPTION "Lossless Scaling Frame Generation Backend" LANGUAGES CXX) diff --git a/framegen/public/lsfg_3_1.hpp b/framegen/public/lsfg_3_1.hpp index 5db4219..66c92ee 100644 --- a/framegen/public/lsfg_3_1.hpp +++ b/framegen/public/lsfg_3_1.hpp @@ -27,6 +27,7 @@ namespace LSFG_3_1 { bool forceDisableFp16, const std::function(const std::string&, bool)>& loader); +#ifdef LSFGVK_EXCESS_DEBUG /// /// Initialize the renderdoc API. /// @@ -34,6 +35,7 @@ namespace LSFG_3_1 { /// [[gnu::visibility("default")]] void initializeRenderDoc(); +#endif // LSFGVK_EXCESS_DEBUG /// /// Create a new LSFG context on a swapchain. diff --git a/framegen/public/lsfg_3_1p.hpp b/framegen/public/lsfg_3_1p.hpp index 957bf09..cb44a27 100644 --- a/framegen/public/lsfg_3_1p.hpp +++ b/framegen/public/lsfg_3_1p.hpp @@ -27,6 +27,7 @@ namespace LSFG_3_1P { bool forceDisableFp16, const std::function(const std::string&, bool)>& loader); +#ifdef LSFGVK_EXCESS_DEBUG /// /// Initialize the renderdoc API. /// @@ -34,6 +35,7 @@ namespace LSFG_3_1P { /// [[gnu::visibility("default")]] void initializeRenderDoc(); +#endif // LSFGVK_EXCESS_DEBUG /// /// Create a new LSFG context on a swapchain. diff --git a/framegen/v3.1_src/lsfg.cpp b/framegen/v3.1_src/lsfg.cpp index c8b5ed9..a84a245 100644 --- a/framegen/v3.1_src/lsfg.cpp +++ b/framegen/v3.1_src/lsfg.cpp @@ -10,8 +10,10 @@ #include "common/exception.hpp" #include "common/utils.hpp" +#ifdef LSFGVK_EXCESS_DEBUG #include #include +#endif // LSFGVK_EXCESS_DEBUG #include #include @@ -30,7 +32,9 @@ namespace { std::optional device; std::unordered_map contexts; +#ifdef LSFGVK_EXCESS_DEBUG std::optional renderdoc; +#endif // LSFGVK_EXCESS_DEBUG } void LSFG_3_1::initialize(uint64_t deviceUUID, @@ -58,6 +62,7 @@ void LSFG_3_1::initialize(uint64_t deviceUUID, std::srand(static_cast(std::time(nullptr))); } +#ifdef LSFGVK_EXCESS_DEBUG void LSFG_3_1::initializeRenderDoc() { if (renderdoc.has_value()) return; @@ -74,6 +79,7 @@ void LSFG_3_1::initializeRenderDoc() { throw LSFG::vulkan_error(VK_ERROR_INITIALIZATION_FAILED, "RenderDoc API not found"); } } +#endif // LSFGVK_EXCESS_DEBUG int32_t LSFG_3_1::createContext( int in0, int in1, const std::vector& outN, @@ -94,15 +100,19 @@ void LSFG_3_1::presentContext(int32_t id, int inSem, const std::vector& out if (it == contexts.end()) throw LSFG::vulkan_error(VK_ERROR_UNKNOWN, "Context not found"); +#ifdef LSFGVK_EXCESS_DEBUG if (renderdoc.has_value()) (*renderdoc)->StartFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance->handle()), nullptr); +#endif // LSFGVK_EXCESS_DEBUG it->second.present(*device, inSem, outSem); +#ifdef LSFGVK_EXCESS_DEBUG if (renderdoc.has_value()) { vkDeviceWaitIdle(device->device.handle()); (*renderdoc)->EndFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance->handle()), nullptr); } +#endif // LSFGVK_EXCESS_DEBUG } void LSFG_3_1::deleteContext(int32_t id) { diff --git a/framegen/v3.1p_src/lsfg.cpp b/framegen/v3.1p_src/lsfg.cpp index e123e54..f59ddff 100644 --- a/framegen/v3.1p_src/lsfg.cpp +++ b/framegen/v3.1p_src/lsfg.cpp @@ -10,8 +10,10 @@ #include "common/exception.hpp" #include "common/utils.hpp" +#ifdef LSFGVK_EXCESS_DEBUG #include #include +#endif // LSFGVK_EXCESS_DEBUG #include #include @@ -30,7 +32,9 @@ namespace { std::optional device; std::unordered_map contexts; +#ifdef LSFGVK_EXCESS_DEBUG std::optional renderdoc; +#endif // LSFGVK_EXCESS_DEBUG } void LSFG_3_1P::initialize(uint64_t deviceUUID, @@ -58,6 +62,7 @@ void LSFG_3_1P::initialize(uint64_t deviceUUID, std::srand(static_cast(std::time(nullptr))); } +#ifdef LSFGVK_EXCESS_DEBUG void LSFG_3_1P::initializeRenderDoc() { if (renderdoc.has_value()) return; @@ -74,6 +79,7 @@ void LSFG_3_1P::initializeRenderDoc() { throw LSFG::vulkan_error(VK_ERROR_INITIALIZATION_FAILED, "RenderDoc API not found"); } } +#endif // LSFGVK_EXCESS_DEBUG int32_t LSFG_3_1P::createContext( int in0, int in1, const std::vector& outN, @@ -94,15 +100,19 @@ void LSFG_3_1P::presentContext(int32_t id, int inSem, const std::vector& ou if (it == contexts.end()) throw LSFG::vulkan_error(VK_ERROR_UNKNOWN, "Context not found"); +#ifdef LSFGVK_EXCESS_DEBUG if (renderdoc.has_value()) (*renderdoc)->StartFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance->handle()), nullptr); +#endif // LSFGVK_EXCESS_DEBUG it->second.present(*device, inSem, outSem); +#ifdef LSFGVK_EXCESS_DEBUG if (renderdoc.has_value()) { vkDeviceWaitIdle(device->device.handle()); (*renderdoc)->EndFrameCapture(RENDERDOC_DEVICEPOINTER_FROM_VKINSTANCE(instance->handle()), nullptr); } +#endif // LSFGVK_EXCESS_DEBUG } void LSFG_3_1P::deleteContext(int32_t id) {