From 52f5c24f9696d30eb68cc4110f3852374e1b388b Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 23 Sep 2024 16:09:34 -0400 Subject: [PATCH] Add frame market support, and enable on demand tracing. --- project.hxp | 2 +- source/funkin/util/WindowUtil.hx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/project.hxp b/project.hxp index 74402016f..73a12538a 100644 --- a/project.hxp +++ b/project.hxp @@ -537,7 +537,7 @@ class Project extends HXProject { setHaxedef("HXCPP_TELEMETRY"); // Enable telemetry setHaxedef("HXCPP_TRACY"); // Enable Tracy telemetry setHaxedef("HXCPP_TRACY_MEMORY"); // Track memory allocations - // setHaxedef("HXCPP_TRACY_ON_DEMAND"); // Only collect telemetry when Tracy is open and reachable + setHaxedef("HXCPP_TRACY_ON_DEMAND"); // Only collect telemetry when Tracy is open and reachable // setHaxedef("HXCPP_TRACY_INCLUDE_CALLSTACKS"); // Inspect callstacks per zone, inflating telemetry data setHaxedef("absolute-paths"); // Fix source locations so Tracy can see them diff --git a/source/funkin/util/WindowUtil.hx b/source/funkin/util/WindowUtil.hx index 0fe63fe32..d9d43614a 100644 --- a/source/funkin/util/WindowUtil.hx +++ b/source/funkin/util/WindowUtil.hx @@ -91,6 +91,14 @@ class WindowUtil windowExit.dispatch(exitCode); }); + #if FEATURE_DEBUG_TRACY + // Apply a marker to indicate frame end for the Tracy profiler. + // Do this only if Tracy is configured to prevent lag. + openfl.Lib.current.stage.addEventListener(openfl.events.Event.EXIT_FRAME, (e:openfl.events.Event) -> { + cpp.vm.tracy.TracyProfiler.frameMark(); + }); + #end + openfl.Lib.current.stage.addEventListener(openfl.events.KeyboardEvent.KEY_DOWN, (e:openfl.events.KeyboardEvent) -> { for (key in PlayerSettings.player1.controls.getKeysForAction(WINDOW_FULLSCREEN)) {