summaryrefslogtreecommitdiffstats
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 9c9542325e..439cd385c0 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -83,6 +83,7 @@
#ifndef _3D_DISABLED
#include "servers/physics_server_3d.h"
+#include "servers/physics_server_3d_dummy.h"
#include "servers/xr_server.h"
#endif // _3D_DISABLED
@@ -140,7 +141,6 @@ static Engine *engine = nullptr;
static ProjectSettings *globals = nullptr;
static Input *input = nullptr;
static InputMap *input_map = nullptr;
-static WorkerThreadPool *worker_thread_pool = nullptr;
static TranslationServer *translation_server = nullptr;
static Performance *performance = nullptr;
static PackedData *packed_data = nullptr;
@@ -321,7 +321,15 @@ void initialize_physics() {
// Physics server not found, Use the default physics
physics_server_3d = PhysicsServer3DManager::get_singleton()->new_default_server();
}
- ERR_FAIL_NULL(physics_server_3d);
+
+ // Fall back to dummy if no default server has been registered.
+ if (!physics_server_3d) {
+ WARN_PRINT(vformat("Falling back to dummy PhysicsServer3D; 3D physics functionality will be disabled. If this is intended, set the %s project setting to Dummy.", PhysicsServer3DManager::setting_property_name));
+ physics_server_3d = memnew(PhysicsServer3DDummy);
+ }
+
+ // Should be impossible, but make sure it's not null.
+ ERR_FAIL_NULL_MSG(physics_server_3d, "Failed to initialize PhysicsServer3D.");
physics_server_3d->init();
#endif // _3D_DISABLED
@@ -691,8 +699,6 @@ Error Main::test_setup() {
register_core_settings(); // Here globals are present.
- worker_thread_pool = memnew(WorkerThreadPool);
-
translation_server = memnew(TranslationServer);
tsman = memnew(TextServerManager);
@@ -803,8 +809,6 @@ void Main::test_cleanup() {
ResourceSaver::remove_custom_savers();
PropertyListHelper::clear_base_helpers();
- WorkerThreadPool::get_singleton()->finish();
-
#ifdef TOOLS_ENABLED
GDExtensionManager::get_singleton()->deinitialize_extensions(GDExtension::INITIALIZATION_LEVEL_EDITOR);
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_EDITOR);
@@ -846,9 +850,6 @@ void Main::test_cleanup() {
if (physics_server_2d_manager) {
memdelete(physics_server_2d_manager);
}
- if (worker_thread_pool) {
- memdelete(worker_thread_pool);
- }
if (globals) {
memdelete(globals);
}
@@ -939,7 +940,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
register_core_settings(); //here globals are present
- worker_thread_pool = memnew(WorkerThreadPool);
translation_server = memnew(TranslationServer);
performance = memnew(Performance);
GDREGISTER_CLASS(Performance);
@@ -1986,6 +1986,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_vulkan", true);
GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_d3d12", true);
+ GLOBAL_DEF_RST("rendering/rendering_device/fallback_to_opengl3", true);
}
{
@@ -2629,10 +2630,6 @@ error:
if (translation_server) {
memdelete(translation_server);
}
- if (worker_thread_pool) {
- worker_thread_pool->finish();
- memdelete(worker_thread_pool);
- }
if (globals) {
memdelete(globals);
}
@@ -4514,7 +4511,7 @@ void Main::cleanup(bool p_force) {
ResourceLoader::clear_translation_remaps();
ResourceLoader::clear_path_remaps();
- WorkerThreadPool::get_singleton()->finish();
+ WorkerThreadPool::get_singleton()->exit_languages_threads();
ScriptServer::finish_languages();
@@ -4606,9 +4603,6 @@ void Main::cleanup(bool p_force) {
if (physics_server_2d_manager) {
memdelete(physics_server_2d_manager);
}
- if (worker_thread_pool) {
- memdelete(worker_thread_pool);
- }
if (globals) {
memdelete(globals);
}