summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2024-04-04 10:18:08 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2024-04-10 18:47:42 +0200
commit65686dedf9778e829287f63c7179a523d44fa085 (patch)
treee0f5b969bd28d7937291a8efab12a1063109d313 /main
parentc28f5901c7f9ac8885032f9b30db788e08e72911 (diff)
downloadredot-engine-65686dedf9778e829287f63c7179a523d44fa085.tar.gz
Use WorkerThreadPool for Server threads
* Servers now use WorkerThreadPool for background computation. * This helps keep the number of threads used fixed at all times. * It also ensures everything works on HTML5 with threads. * And makes it easier to support disabling threads for also HTML5. CommandQueueMT now syncs with the servers via the WorkerThreadPool yielding mechanism, which makes its classic main sync semaphore superfluous. Also, some warnings about calls that kill performance when using threaded rendering are removed because there's a mechanism that warns about that in a more general fashion. Co-authored-by: Pedro J. Estébanez <pedrojrulez@gmail.com>
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 357033b6d8..5f5118aa75 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2274,6 +2274,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// Editor and project manager cannot run with rendering in a separate thread (they will crash on startup).
rtm = OS::RENDER_THREAD_SAFE;
}
+#if !defined(THREADS_ENABLED)
+ rtm = OS::RENDER_THREAD_SAFE;
+#endif
OS::get_singleton()->_render_thread_mode = OS::RenderThreadMode(rtm);
}
@@ -2717,7 +2720,9 @@ Error Main::setup2() {
}
if (OS::get_singleton()->_render_thread_mode == OS::RENDER_SEPARATE_THREAD) {
- WARN_PRINT("The Multi-Threaded rendering thread model is experimental, and has known issues which can lead to project crashes. Use the Single-Safe option in the project settings instead.");
+ WARN_PRINT("The Multi-Threaded rendering thread model is experimental. Feel free to try it since it will eventually become a stable feature.\n"
+ "However, bear in mind that at the moment it can lead to project crashes or instability.\n"
+ "So, unless you want to test the engine, use the Single-Safe option in the project settings instead.");
}
/* Initialize Pen Tablet Driver */
@@ -4025,11 +4030,11 @@ bool Main::iteration() {
if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) {
if (RenderingServer::get_singleton()->has_changed()) {
RenderingServer::get_singleton()->draw(true, scaled_step); // flush visual commands
- Engine::get_singleton()->frames_drawn++;
+ Engine::get_singleton()->increment_frames_drawn();
}
} else {
RenderingServer::get_singleton()->draw(true, scaled_step); // flush visual commands
- Engine::get_singleton()->frames_drawn++;
+ Engine::get_singleton()->increment_frames_drawn();
force_redraw_requested = false;
}
}