Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change
WinitPlugin
defaults to limit game update rate when window i…
…s not visible (bevyengine#7611) Fixes bevyengine#5856. Fixes bevyengine#8080. Fixes bevyengine#9040. # Objective We need to limit the update rate of games whose windows are not visible (minimized or completely occluded). Compositors typically ignore the VSync settings of windows that aren't visible. That, combined with the lack of rendering work, results in a scenario where an app becomes completely CPU-bound and starts updating without limit. There are currently three update modes. - `Continuous` updates an app as often as possible. - `Reactive` updates when new window or device events have appeared, a timer expires, or a redraw is requested. - `ReactiveLowPower` is the same as `Reactive` except it ignores device events (e.g. general mouse movement). The problem is that the default "game" settings are set to `Contiuous` even when no windows are visible. ### More Context - libsdl-org/SDL#1871 - glfw/glfw#680 - godotengine/godot#19741 - godotengine/godot#64708 ## Solution Change the default "unfocused" `UpdateMode` for games to `ReactiveLowPower` just like desktop apps. This way, even when the window is occluded, the app still updates at a sensible rate or if something about the window changes. I chose 20Hz arbitrarily.
- Loading branch information