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

Window.set_resolution() and set_present_mode() don't have expected side-effects #5111

Open
nfagerlund opened this issue Jun 27, 2022 · 1 comment
Labels
C-Bug An unexpected or incorrect behavior O-Windows Specific to the Windows desktop operating system

Comments

@nfagerlund
Copy link
Contributor

nfagerlund commented Jun 27, 2022

Bevy version

main at a138804

[Optional] Relevant system information

Windows 10 21H2

What you did

#4865 adds a simple example for testing whether Bevy is keeping a consistent frame pace and an accurate time step. That example uses several methods on a bevy::window::Window struct so you can test the effects of various presentation options without needing to compile and restart:

  • set_present_mode
  • set_mode
  • set_resolution (for restoring the window to a default size when switching back to windowed mode)

What went wrong

set_mode switches the window between windowed, borderless, and fullscreen modes depending on its argument. This is the behavior I expected for the other two methods.

But set_present_mode and set_resolution have no visible effect, at least not on Windows 10 (which is currently the easiest platform for me to test on). The window size after switching back to windowed mode is always the same as the fullscreen resolution, and the present mode stays locked to Fifo. (For the latter, it's easy to tell because the example in #4865 also includes frame time diagnostics; if you switch the starting present mode to Mailbox or Immediate and recompile, the average frame times are somewhere down in the 2-3ms neighborhood on this computer, as opposed to the 16.6ms neighborhood you get with Fifo on a 60hz monitor.)

You can tell from the log messages that the methods are properly changing the values stored in the primary Window struct; it's just that queuing those other WindowCommands doesn't seem to get anything done.

I haven't yet been able to check whether these methods work on other platforms or not.

@nfagerlund nfagerlund added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 27, 2022
@alice-i-cecile alice-i-cecile added O-Windows Specific to the Windows desktop operating system and removed S-Needs-Triage This issue needs to be labelled labels Jun 27, 2022
@alice-i-cecile
Copy link
Member

Many of the Window methods currently have no effect when called after app start. As I understand it this is due to the way Bevy is connected to winit.

Until this is fixed, we should at the very least document this limitation.

bors bot pushed a commit that referenced this issue Sep 21, 2022
# Objective

- Reconfigure surface after present mode changes. It seems that this is not done currently at runtime. It's pretty common for games to change such graphical settings at runtime.
- Fixes present mode issue in #5111 

## Solution

- Exactly like resolution change gets tracked when extracting window, do the same for present mode.

Additionally, I added present mode (vsync) toggling to window settings example.
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 19, 2022
# Objective

- Reconfigure surface after present mode changes. It seems that this is not done currently at runtime. It's pretty common for games to change such graphical settings at runtime.
- Fixes present mode issue in bevyengine#5111 

## Solution

- Exactly like resolution change gets tracked when extracting window, do the same for present mode.

Additionally, I added present mode (vsync) toggling to window settings example.
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 28, 2022
# Objective

- Reconfigure surface after present mode changes. It seems that this is not done currently at runtime. It's pretty common for games to change such graphical settings at runtime.
- Fixes present mode issue in bevyengine#5111 

## Solution

- Exactly like resolution change gets tracked when extracting window, do the same for present mode.

Additionally, I added present mode (vsync) toggling to window settings example.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
# Objective

- Reconfigure surface after present mode changes. It seems that this is not done currently at runtime. It's pretty common for games to change such graphical settings at runtime.
- Fixes present mode issue in bevyengine#5111 

## Solution

- Exactly like resolution change gets tracked when extracting window, do the same for present mode.

Additionally, I added present mode (vsync) toggling to window settings example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior O-Windows Specific to the Windows desktop operating system
Projects
None yet
Development

No branches or pull requests

2 participants