stride icon indicating copy to clipboard operation
stride copied to clipboard

Fullscreen is broken (sometimes?)

Open NicusorN5 opened this issue 6 months ago • 1 comments

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);

NicusorN5 avatar Aug 16 '24 09:08 NicusorN5