-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Switching desktops causes a spike in usage #8080
Comments
I bet that this is no longer being framerate throttled by vsync. Can you check how fast your main loop runs while your desktop is swapped? And try playing with https://docs.rs/bevy/latest/bevy/window/enum.PresentMode.html |
print.log |
No matter which PresentMode I use, the effect is the same, and Vsync fails when switching desktops |
Well, that's very helpful to know. What happens if you use |
bevy_framepace is effective in terms of limiting the frame rate, but it feels like it causes significant frame rate fluctuations and doesn't support bevy@0.10 |
this is the same as #5856 |
…s not visible (#7611) Fixes #5856. Fixes #8080. Fixes #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.
Bevy version
v0.10.0
[Optional] Relevant system information
If you cannot get Bevy to build or run on your machine, please include:
cargo --version
)cargo 1.67.1 (8ecd4f20a 2023-01-10)
macOS Ventura 13.2.1
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
SystemInfo { os: "MacOS 13.2.1 ", kernel: "22.3.0", cpu: "Apple M1", core_count: "8", memory: "8.0 GiB" }
What you did
On macOS, I'm used to using multiple desktops for windows [main desktop, browser, VS Code], and when I run a bevy program, a window is created on the main desktop, which is all fine at that point. By the time I switch to another desktop, the footprint of this bevy program goes up a lot, causing my computer to start heating up. This problem has nothing to do with my code, it just needs to be run and it will do that.
Additional information
Other information that can be used to further reproduce or isolate the problem.
This commonly includes:
Normal:
Switch desktop for a while and then come back:
The text was updated successfully, but these errors were encountered: