Skip to content
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

Merged
merged 1 commit into from
May 30, 2019

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented May 29, 2019

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.

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.
@Calinou Calinou force-pushed the decrease-editor-fps-unfocused branch from 84781dc to ac14efc Compare May 30, 2019 13:43
@akien-mga akien-mga merged commit 6895ad3 into godotengine:master May 30, 2019
@akien-mga
Copy link
Member

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")));
Copy link
Contributor

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.

Copy link
Member Author

@Calinou Calinou May 30, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Editor is very laggy when "Low Processor Mode Sleep Usec" is different that default
4 participants