Skip to content

Commit 6b98a57

Browse files
committed
Fix tracy implementation when no callstack sampling is desired.
1 parent bad1287 commit 6b98a57

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

core/profiling/profiling.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,22 @@
3939
#define TRACY_ENABLE
4040
#include <tracy/Tracy.hpp>
4141

42-
#ifndef TRACY_CALLSTACK
43-
#define TRACY_CALLSTACK 0
44-
#endif
45-
4642
// Define tracing macros.
4743
#define GodotProfileFrameMark FrameMark
4844
#define GodotProfileZone(m_zone_name) ZoneScopedN(m_zone_name)
4945
#define GodotProfileZoneGroupedFirst(m_group_name, m_zone_name) ZoneNamedN(__godot_tracy_zone_##m_group_name, m_zone_name, true)
5046
#define GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name) __godot_tracy_zone_##m_group_name.~ScopedZone();
47+
#ifndef TRACY_CALLSTACK
48+
#define GodotProfileZoneGrouped(m_group_name, m_zone_name) \
49+
GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name); \
50+
static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location, TracyLine){ m_zone_name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; \
51+
new (&__godot_tracy_zone_##m_group_name) tracy::ScopedZone(&TracyConcat(__tracy_source_location, TracyLine), true)
52+
#else
5153
#define GodotProfileZoneGrouped(m_group_name, m_zone_name) \
5254
GodotProfileZoneGroupedEndEarly(m_group_name, m_zone_name); \
5355
static constexpr tracy::SourceLocationData TracyConcat(__tracy_source_location, TracyLine){ m_zone_name, TracyFunction, TracyFile, (uint32_t)TracyLine, 0 }; \
5456
new (&__godot_tracy_zone_##m_group_name) tracy::ScopedZone(&TracyConcat(__tracy_source_location, TracyLine), TRACY_CALLSTACK, true)
57+
#endif
5558

5659
void godot_init_profiler();
5760

0 commit comments

Comments
 (0)