Godot Engine – Multi-platform 2D and 3D game engine
Fail when attempting to profile in release exports
HolonProduction5913cd27514f
diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cppindex 6ad8e07f8a7..7fd75a95ca0 100644--- a/core/debugger/engine_debugger.cpp+++ b/core/debugger/engine_debugger.cpp@@ -80,7 +80,7 @@ void EngineDebugger::profiler_enable(const StringName &p_name, bool p_enabled, cvoid EngineDebugger::profiler_add_frame_data(const StringName &p_name, const Array &p_data) {ERR_FAIL_COND_MSG(!profilers.has(p_name), vformat("Can't add frame data, no profiler: '%s'.", p_name));Profiler &p = profilers[p_name];- if (p.add) {+ if (p.active && p.add) {p.add(p.data, p_data);}}diff --git a/main/main.cpp b/main/main.cppindex 5acdd19af2a..572780c66ee 100644--- a/main/main.cpp+++ b/main/main.cpp@@ -261,8 +261,8 @@ static bool force_res = false;// Debug-static bool use_debug_profiler = false;#ifdef DEBUG_ENABLED+static bool use_debug_profiler = false;static bool debug_collisions = false;static bool debug_paths = false;static bool debug_navigation = false;@@ -587,12 +587,12 @@ void Main::print_help(const char *p_binary) {print_help_option("--accessibility-driver <driver>", "Select accessibility driver ['accesskit', 'dummy'].\n");print_help_title("Debug options");-#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)+#ifdef DEBUG_ENABLEDprint_help_option("-d, --debug", "Debug (local stdout debugger).\n");print_help_option("-b, --breakpoints", "Breakpoint list as source:line comma-separated pairs, no spaces (use %%20 instead).\n");print_help_option("--ignore-error-breaks", "If debugger is connected, prevents sending error breakpoints.\n");-#endifprint_help_option("--profiling", "Enable profiling in the script debugger.\n");+#endifprint_help_option("--gpu-profile", "Show a GPU profile of the tasks that took the most time during frame rendering.\n");print_help_option("--gpu-validation", "Enable graphics API validation layers for debugging.\n");#ifdef DEBUG_ENABLED@@ -1461,9 +1461,13 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phgoto error;}} else if (arg == "--profiling") { // enable profiling-+#ifdef DEBUG_ENABLEDuse_debug_profiler = true;-+#else+ ERR_PRINT(+ "`--profiling` was specified on the command line, but this Godot binary was compiled without debug. Aborting.\n"+ "To be able to use it, use the `target=template_debug` SCons option when compiling Godot.\n");+#endif} else if (arg == "-l" || arg == "--language") { // languageif (N) {@@ -3836,11 +3840,13 @@ Error Main::setup2(bool p_show_boot_logo) {BindingsGenerator::handle_cmdline_args(cmdline_args);#endif+#ifdef DEBUG_ENABLEDif (use_debug_profiler && EngineDebugger::is_active()) {// Start the "scripts" profiler, used in local debugging.// We could add more, and make the CLI arg require a comma-separated list of profilers.EngineDebugger::get_singleton()->profiler_enable("scripts", true);}+#endifif (!project_manager) {// If not running the project manager, and now that the engine is