Skip to content

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

Open
@nfagerlund

Description

@nfagerlund

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorO-WindowsSpecific to the Windows desktop operating system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions