stride3d / stride3d/stride

Game issues when switching window between fullscreen and windowed mode

Open
#932 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Graphics bug priority-high work-estimate-S
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Official Release

Version: Stride 4.0.0.1 beta04 1317

Platform(s): Windows

Describe the bug
There are multiple issues when it comes to trying to switch screen using winforms as the window renderer. Switching from windowed mode to fullscreen mode using the method game.Windows.IsFullscreen = bool will work 99.9% of the time, very occassionally ending with a NullReference in Stride.Graphics.SwapChainGraphicsPresenter.OnDestroyed();

image

When trying to go from fullscreen to windowed mode the system destroys the window, but seemingly a new one is not created, and the game continues to run as a background process, having to be killed in task manager. game.Windows.IsFullscreen as a swap method respects the PreferredFullscreenSize & PreferredWindowedSize values set earlier in the code.

Using game.GraphicsDeviceManager.IsFullScreen as the method to change also only works going from a windowed screen to fullscreen, although this method just seems to make the current resolution fullscreen and does not respect PreferredFullscreenSize settings.

To Reproduce
The following code is where I experience the error:

        public override void Update()
        {
            if (toggleWindow)
            {
                bool toggle = game.Window.IsFullscreen;
                toggle = !toggle;
                
                game.Window.IsFullscreen = toggle;
                Settings.SetIsFullscreen(toggle);
                toggleWindow = false;
            }
}

Expected behavior
The window to switch between fullscreen and windowed mode as apprpriate and for PreferredFullscreenSize & PreferredWindowedSize values to be respected.

Screenshots
Here is a link to a video showing the window not coming back up after switching from fullscreen to windowed mode.

https://youtu.be/5klndyDkLX8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the fullscreen/windowed transitions through game.Window.IsFullscreen and compare them with GraphicsDeviceManager.IsFullScreen. Inspect Stride.Graphics.SwapChainGraphicsPresenter.OnDestroyed() around the reported NullReference and window destruction behavior. Done means both transitions reliably restore the window and respect PreferredFullscreenSize and PreferredWindowedSize.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.