Skip to content

Commit 2dc5755

Browse files
committed
build: exclude Tracy from release builds
1 parent 8abc43a commit 2dc5755

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

externals/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,11 @@ add_library(Dear_ImGui
189189
target_include_directories(Dear_ImGui INTERFACE dear_imgui/)
190190

191191
# Tracy
192-
option(TRACY_ENABLE "" ON)
192+
if (CMAKE_BUILD_TYPE STREQUAL "Release")
193+
option(TRACY_ENABLE "" OFF)
194+
else()
195+
option(TRACY_ENABLE "" ON)
196+
endif()
193197
option(TRACY_NO_CRASH_HANDLER "" ON) # Otherwise texture cache exceptions will be treaten as a crash
194198
option(TRACY_ON_DEMAND "" ON)
195199
option(TRACY_NO_FRAME_IMAGE "" ON)

src/common/debug.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
#include <tracy/Tracy.hpp>
1515

1616
static inline bool IsProfilerConnected() {
17+
#if TRACY_ENABLE
1718
return tracy::GetProfiler().IsConnected();
19+
#else
20+
return false;
21+
#endif
1822
}
1923

2024
#define TRACY_GPU_ENABLED 0

src/video_core/renderer_vulkan/vk_scheduler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ std::mutex Scheduler::submit_mutex;
1414

1515
Scheduler::Scheduler(const Instance& instance)
1616
: instance{instance}, master_semaphore{instance}, command_pool{instance, &master_semaphore} {
17+
#if TRACY_GPU_ENABLED
1718
profiler_scope = reinterpret_cast<tracy::VkCtxScope*>(std::malloc(sizeof(tracy::VkCtxScope)));
19+
#endif
1820
AllocateWorkerCommandBuffers();
1921
}
2022

2123
Scheduler::~Scheduler() {
24+
#if TRACY_GPU_ENABLED
2225
std::free(profiler_scope);
26+
#endif
2327
}
2428

2529
void Scheduler::BeginRendering(const RenderState& new_state) {
@@ -93,23 +97,27 @@ void Scheduler::AllocateWorkerCommandBuffers() {
9397
ASSERT_MSG(begin_result == vk::Result::eSuccess, "Failed to begin command buffer: {}",
9498
vk::to_string(begin_result));
9599

100+
#if TRACY_GPU_ENABLED
96101
auto* profiler_ctx = instance.GetProfilerContext();
97102
if (profiler_ctx) {
98103
static const auto scope_loc =
99104
GPU_SCOPE_LOCATION("Guest Frame", MarkersPalette::GpuMarkerColor);
100105
new (profiler_scope) tracy::VkCtxScope{profiler_ctx, &scope_loc, current_cmdbuf, true};
101106
}
107+
#endif
102108
}
103109

104110
void Scheduler::SubmitExecution(SubmitInfo& info) {
105111
std::scoped_lock lk{submit_mutex};
106112
const u64 signal_value = master_semaphore.NextTick();
107113

114+
#if TRACY_GPU_ENABLED
108115
auto* profiler_ctx = instance.GetProfilerContext();
109116
if (profiler_ctx) {
110117
profiler_scope->~VkCtxScope();
111118
TracyVkCollect(profiler_ctx, current_cmdbuf);
112119
}
120+
#endif
113121

114122
EndRendering();
115123
auto end_result = current_cmdbuf.end();

0 commit comments

Comments
 (0)