stride3d / stride3d/stride

Fullscreen is broken (sometimes?)

Open
#2,413 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Release Type: Github + Official

Version: Github latest commit + Latest 4.2.0.2188

Platform(s): Windows, DX11 Level 11_1

Describe the bug
When enabling fullscreen, a DXGI_ERROR_INVALID_CALL/InvalidCall error is thrown, otherwise (very rarely) a black screen is being presented.

Can't seem to reproduce using a empty project. :(

To Reproduce
Steps to reproduce the behavior:

  1. Create a project
  2. Use this function and call it inside a Start() method of a StartupScript
public void ChangeScreen(bool fullscreen, int width, int height)
{
	Game.Window.Visible = false;

	var size = new Int2(width, height);

	if (fullscreen)
		Game.Window.PreferredFullscreenSize = size;
	else
	{
		Game.Window.SetSize(size);
		Game.Window.PreferredWindowedSize = size;
	}

	Game.Window.IsFullscreen = fullscreen;

	Game.Window.Visible = true;
}

Expected behavior
Crash bad.

Log and callstacks

[Game]: Error: Unexpected exception. Stride.Graphics.GraphicsException: Unexpected error on Present (device status: Normal)
 ---> SharpDX.SharpDXException: HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall], Message: The application made a call that is invalid. Either the parameters of the call or the state of some object was incorrect.
Enable the D3D debug layer in order to see details via debug messages.

   at Stride.Graphics.SwapChainGraphicsPresenter.Present()
   --- End of inner exception stack trace ---
   at Stride.Graphics.SwapChainGraphicsPresenter.Present()
   at Stride.Games.GraphicsDeviceManager.Stride.Games.IGraphicsDeviceManager.EndDraw(Boolean present)
   at Stride.Games.GameBase.EndDraw(Boolean present)
   at Stride.Engine.Game.EndDraw(Boolean present) in D:\Projects\stride\sources\engine\Stride.Engine\Engine\Game.cs:line 445
   at Stride.Games.GameBase.RawTick(TimeSpan elapsedTimePerUpdate, Int32 updateCount, Single drawInterpolationFactor, Boolean drawFrame)
   at Stride.Games.GameBase.RawTickProducer()
Stride.Graphics.GraphicsException: Unexpected error on Present (device status: Normal)
 ---> SharpDX.SharpDXException: HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall], Message: The application made a call that is invalid. Either the parameters of the call or the state of some object was incorrect.
Enable the D3D debug layer in order to see details via debug messages.

   at Stride.Graphics.SwapChainGraphicsPresenter.Present()
   --- End of inner exception stack trace ---
   at Stride.Graphics.SwapChainGraphicsPresenter.Present()
   at Stride.Games.GraphicsDeviceManager.Stride.Games.IGraphicsDeviceManager.EndDraw(Boolean present)
   at Stride.Games.GameBase.EndDraw(Boolean present)
   at Stride.Engine.Game.EndDraw(Boolean present) in D:\Projects\stride\sources\engine\Stride.Engine\Engine\Game.cs:line 445
   at Stride.Games.GameBase.RawTick(TimeSpan elapsedTimePerUpdate, Int32 updateCount, Single drawInterpolationFactor, Boolean drawFrame)
   at Stride.Games.GameBase.RawTickProducer()

Workaround
Use borderless fullscreen, like so:

Game.Window.SetSize(new Int2(1920, 1080));
Game.Window.Position = new Int2(0, 0);

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 with Stride.Graphics.SwapChainGraphicsPresenter.Present(), then inspect Stride.Engine\Engine\Game.cs at line 445 and the fullscreen transition used by Game.Window. Reproduce the reported StartupScript sequence on Windows with DX11, using the DXGI error and black-screen behavior as outcomes. Done means fullscreen changes no longer produce DXGI_ERROR_INVALID_CALL or a black screen.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
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.