mirror of
https://github.com/PancakeTAS/lsfg-vk.git
synced 2025-10-30 07:01:10 +00:00
fix(test): ensure building works without renderdoc
This commit is contained in:
parent
a71b994d74
commit
da16437210
5 changed files with 28 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ namespace LSFG_3_1 {
|
|||
bool forceDisableFp16,
|
||||
const std::function<std::vector<uint8_t>(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.
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ namespace LSFG_3_1P {
|
|||
bool forceDisableFp16,
|
||||
const std::function<std::vector<uint8_t>(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.
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@
|
|||
#include "common/exception.hpp"
|
||||
#include "common/utils.hpp"
|
||||
|
||||
#ifdef LSFGVK_EXCESS_DEBUG
|
||||
#include <renderdoc_app.h>
|
||||
#include <dlfcn.h>
|
||||
#endif // LSFGVK_EXCESS_DEBUG
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
|
@ -30,7 +32,9 @@ namespace {
|
|||
std::optional<Vulkan> device;
|
||||
std::unordered_map<int32_t, Context> contexts;
|
||||
|
||||
#ifdef LSFGVK_EXCESS_DEBUG
|
||||
std::optional<RENDERDOC_API_1_6_0*> 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<uint32_t>(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<int>& outN,
|
||||
|
|
@ -94,15 +100,19 @@ void LSFG_3_1::presentContext(int32_t id, int inSem, const std::vector<int>& 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) {
|
||||
|
|
|
|||
|
|
@ -10,8 +10,10 @@
|
|||
#include "common/exception.hpp"
|
||||
#include "common/utils.hpp"
|
||||
|
||||
#ifdef LSFGVK_EXCESS_DEBUG
|
||||
#include <renderdoc_app.h>
|
||||
#include <dlfcn.h>
|
||||
#endif // LSFGVK_EXCESS_DEBUG
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
|
|
@ -30,7 +32,9 @@ namespace {
|
|||
std::optional<Vulkan> device;
|
||||
std::unordered_map<int32_t, Context> contexts;
|
||||
|
||||
#ifdef LSFGVK_EXCESS_DEBUG
|
||||
std::optional<RENDERDOC_API_1_6_0*> 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<uint32_t>(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<int>& outN,
|
||||
|
|
@ -94,15 +100,19 @@ void LSFG_3_1P::presentContext(int32_t id, int inSem, const std::vector<int>& 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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue