summaryrefslogtreecommitdiffstats
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp
index b657fc61bb..86de6497d0 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -182,6 +182,7 @@ static int converter_max_line_length = 100000;
HashMap<Main::CLIScope, Vector<String>> forwardable_cli_arguments;
#endif
+static bool single_threaded_scene = false;
bool use_startup_benchmark = false;
String startup_benchmark_file;
@@ -209,6 +210,7 @@ static bool use_debug_profiler = false;
static bool debug_collisions = false;
static bool debug_paths = false;
static bool debug_navigation = false;
+static bool debug_avoidance = false;
#endif
static int frame_delay = 0;
static bool disable_render_loop = false;
@@ -452,10 +454,12 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" --gpu-abort Abort on graphics API usage errors (usually validation layer errors). May help see the problem if your system freezes.\n");
#endif
OS::get_singleton()->print(" --remote-debug <uri> Remote debug (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007).\n");
+ OS::get_singleton()->print(" --single-threaded-scene Scene tree runs in single-threaded mode. Sub-thread groups are disabled and run on the main thread.\n");
#if defined(DEBUG_ENABLED)
OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n");
OS::get_singleton()->print(" --debug-paths Show path lines when running the scene.\n");
OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
+ OS::get_singleton()->print(" --debug-avoidance Show navigation polygons when running the scene.\n");
OS::get_singleton()->print(" --debug-stringnames Print all StringName allocations to stdout when the engine quits.\n");
#endif
OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n");
@@ -1140,6 +1144,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing remote debug server uri, aborting.\n");
goto error;
}
+ } else if (I->get() == "--single-threaded-scene") {
+ single_threaded_scene = true;
} else if (I->get() == "--build-solutions") { // Build the scripting solution such C#
auto_build_solutions = true;
@@ -1308,6 +1314,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
debug_paths = true;
} else if (I->get() == "--debug-navigation") {
debug_navigation = true;
+ } else if (I->get() == "--debug-avoidance") {
+ debug_avoidance = true;
} else if (I->get() == "--debug-stringnames") {
StringName::set_debug_stringnames(true);
#endif
@@ -2846,11 +2854,26 @@ bool Main::start() {
}
if (debug_navigation) {
sml->set_debug_navigation_hint(true);
+ }
+ if (debug_avoidance) {
+ sml->set_debug_avoidance_hint(true);
+ }
+ if (debug_navigation || debug_avoidance) {
NavigationServer3D::get_singleton()->set_active(true);
NavigationServer3D::get_singleton()->set_debug_enabled(true);
+ if (debug_navigation) {
+ NavigationServer3D::get_singleton()->set_debug_navigation_enabled(true);
+ }
+ if (debug_avoidance) {
+ NavigationServer3D::get_singleton()->set_debug_avoidance_enabled(true);
+ }
}
#endif
+ if (single_threaded_scene) {
+ sml->set_disable_node_threading(true);
+ }
+
bool embed_subwindows = GLOBAL_GET("display/window/subwindows/embed_subwindows");
if (single_window || (!project_manager && !editor && embed_subwindows) || !DisplayServer::get_singleton()->has_feature(DisplayServer::Feature::FEATURE_SUBWINDOWS)) {
@@ -3423,6 +3446,8 @@ void Main::cleanup(bool p_force) {
movie_writer->end();
}
+ ResourceLoader::clear_thread_load_tasks();
+
ResourceLoader::remove_custom_loaders();
ResourceSaver::remove_custom_savers();
@@ -3439,8 +3464,6 @@ void Main::cleanup(bool p_force) {
ResourceLoader::clear_translation_remaps();
ResourceLoader::clear_path_remaps();
- ResourceLoader::clear_thread_load_tasks();
-
ScriptServer::finish_languages();
// Sync pending commands that may have been queued from a different thread during ScriptServer finalization