-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decrease the editor FPS cap when the window is unfocused #29297
Decrease the editor FPS cap when the window is unfocused #29297
Conversation
This decreases CPU/GPU usage when the window is unfocused, which can be beneficial to laptop users. This also makes the low-processor mode sleep project setting no longer affect the editor. Instead, two new editor settings now define the duration of sleeping when the editor is focused and unfocused. This closes godotengine#24209 and partially addresses godotengine#29257.
84781dc
to
ac14efc
Compare
Thanks! |
if (p_what == MainLoop::NOTIFICATION_WM_FOCUS_OUT) { | ||
|
||
// Set a low FPS cap to decrease CPU/GPU usage while the editor is unfocused | ||
OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(int(EDITOR_GET("interface/editor/unfocused_low_processor_mode_sleep_usec"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if low_processor_usage_mode_sleep_usec
was already enabled but the setting is disabled? This line would turn off low_processor_usage_mode_sleep_usec
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The low_processor_mode_sleep_usec
setting is independent from low_processor_mode
(the former accepts an integer, the latter accepts a boolean). Note that having low-processor mode enabled with low_processor_mode_sleep_usec
set to 0 is not the same as having it disabled. In this case, framerate will be unlimited, but the application will not be re-rendered if nothing changes in the viewport.
This decreases CPU/GPU usage when the window is unfocused, which can be beneficial to laptop users.
This also makes the low-processor mode sleep project setting no longer affect the editor. Instead, two new editor settings now define the duration of sleeping when the editor is focused and unfocused.
There might be a few cases where disabling the unfocused FPS cap makes sense (e.g. someone who's previewing shaders while working in another window), so I thought it'd make sense to have new settings here.
This closes #24209 and partially addresses #29257.