From ee02a7f785b672304346028bc500949050432fa5 Mon Sep 17 00:00:00 2001 From: Lyuma Date: Tue, 29 Mar 2022 00:01:31 -0700 Subject: [PATCH] Keep editor at normal priority on windows. The multithreaded importer often causes system-wide hangs when importing more than 20 files at a time. Running the editor at normal priority allows other applications on the system to be responsive during long imports. --- platform/windows/display_server_windows.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 16323dcc131b..d73239614f4a 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -3626,7 +3626,11 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win } #endif - if (!OS::get_singleton()->is_in_low_processor_usage_mode()) { + if (!Engine::get_singleton()->is_editor_hint() && !OS::get_singleton()->is_in_low_processor_usage_mode()) { + // Increase priority for projects that are not in low-processor mode (typically games) + // to reduce the risk of frame stuttering. + // This is not done for the editor to prevent importers or resource bakers + // from making the system unresponsive. SetPriorityClass(GetCurrentProcess(), ABOVE_NORMAL_PRIORITY_CLASS); DWORD index = 0; HANDLE handle = AvSetMmThreadCharacteristics("Games", &index);