mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-26 17:37:03 +00:00
build: exclude Tracy from release builds
This commit is contained in:
parent
8abc43a03d
commit
2dc5755799
6
externals/CMakeLists.txt
vendored
6
externals/CMakeLists.txt
vendored
|
@ -189,7 +189,11 @@ add_library(Dear_ImGui
|
||||||
target_include_directories(Dear_ImGui INTERFACE dear_imgui/)
|
target_include_directories(Dear_ImGui INTERFACE dear_imgui/)
|
||||||
|
|
||||||
# Tracy
|
# Tracy
|
||||||
option(TRACY_ENABLE "" ON)
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
|
option(TRACY_ENABLE "" OFF)
|
||||||
|
else()
|
||||||
|
option(TRACY_ENABLE "" ON)
|
||||||
|
endif()
|
||||||
option(TRACY_NO_CRASH_HANDLER "" ON) # Otherwise texture cache exceptions will be treaten as a crash
|
option(TRACY_NO_CRASH_HANDLER "" ON) # Otherwise texture cache exceptions will be treaten as a crash
|
||||||
option(TRACY_ON_DEMAND "" ON)
|
option(TRACY_ON_DEMAND "" ON)
|
||||||
option(TRACY_NO_FRAME_IMAGE "" ON)
|
option(TRACY_NO_FRAME_IMAGE "" ON)
|
||||||
|
|
|
@ -14,7 +14,11 @@
|
||||||
#include <tracy/Tracy.hpp>
|
#include <tracy/Tracy.hpp>
|
||||||
|
|
||||||
static inline bool IsProfilerConnected() {
|
static inline bool IsProfilerConnected() {
|
||||||
|
#if TRACY_ENABLE
|
||||||
return tracy::GetProfiler().IsConnected();
|
return tracy::GetProfiler().IsConnected();
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TRACY_GPU_ENABLED 0
|
#define TRACY_GPU_ENABLED 0
|
||||||
|
|
|
@ -14,12 +14,16 @@ std::mutex Scheduler::submit_mutex;
|
||||||
|
|
||||||
Scheduler::Scheduler(const Instance& instance)
|
Scheduler::Scheduler(const Instance& instance)
|
||||||
: instance{instance}, master_semaphore{instance}, command_pool{instance, &master_semaphore} {
|
: instance{instance}, master_semaphore{instance}, command_pool{instance, &master_semaphore} {
|
||||||
|
#if TRACY_GPU_ENABLED
|
||||||
profiler_scope = reinterpret_cast<tracy::VkCtxScope*>(std::malloc(sizeof(tracy::VkCtxScope)));
|
profiler_scope = reinterpret_cast<tracy::VkCtxScope*>(std::malloc(sizeof(tracy::VkCtxScope)));
|
||||||
|
#endif
|
||||||
AllocateWorkerCommandBuffers();
|
AllocateWorkerCommandBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
Scheduler::~Scheduler() {
|
Scheduler::~Scheduler() {
|
||||||
|
#if TRACY_GPU_ENABLED
|
||||||
std::free(profiler_scope);
|
std::free(profiler_scope);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scheduler::BeginRendering(const RenderState& new_state) {
|
void Scheduler::BeginRendering(const RenderState& new_state) {
|
||||||
|
@ -93,23 +97,27 @@ void Scheduler::AllocateWorkerCommandBuffers() {
|
||||||
ASSERT_MSG(begin_result == vk::Result::eSuccess, "Failed to begin command buffer: {}",
|
ASSERT_MSG(begin_result == vk::Result::eSuccess, "Failed to begin command buffer: {}",
|
||||||
vk::to_string(begin_result));
|
vk::to_string(begin_result));
|
||||||
|
|
||||||
|
#if TRACY_GPU_ENABLED
|
||||||
auto* profiler_ctx = instance.GetProfilerContext();
|
auto* profiler_ctx = instance.GetProfilerContext();
|
||||||
if (profiler_ctx) {
|
if (profiler_ctx) {
|
||||||
static const auto scope_loc =
|
static const auto scope_loc =
|
||||||
GPU_SCOPE_LOCATION("Guest Frame", MarkersPalette::GpuMarkerColor);
|
GPU_SCOPE_LOCATION("Guest Frame", MarkersPalette::GpuMarkerColor);
|
||||||
new (profiler_scope) tracy::VkCtxScope{profiler_ctx, &scope_loc, current_cmdbuf, true};
|
new (profiler_scope) tracy::VkCtxScope{profiler_ctx, &scope_loc, current_cmdbuf, true};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scheduler::SubmitExecution(SubmitInfo& info) {
|
void Scheduler::SubmitExecution(SubmitInfo& info) {
|
||||||
std::scoped_lock lk{submit_mutex};
|
std::scoped_lock lk{submit_mutex};
|
||||||
const u64 signal_value = master_semaphore.NextTick();
|
const u64 signal_value = master_semaphore.NextTick();
|
||||||
|
|
||||||
|
#if TRACY_GPU_ENABLED
|
||||||
auto* profiler_ctx = instance.GetProfilerContext();
|
auto* profiler_ctx = instance.GetProfilerContext();
|
||||||
if (profiler_ctx) {
|
if (profiler_ctx) {
|
||||||
profiler_scope->~VkCtxScope();
|
profiler_scope->~VkCtxScope();
|
||||||
TracyVkCollect(profiler_ctx, current_cmdbuf);
|
TracyVkCollect(profiler_ctx, current_cmdbuf);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
EndRendering();
|
EndRendering();
|
||||||
auto end_result = current_cmdbuf.end();
|
auto end_result = current_cmdbuf.end();
|
||||||
|
|
Loading…
Reference in a new issue