Fullscreen is broken (sometimes?)
Nobody has claimed this yet.
- 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:
- Create a project
- Use this function and call it inside a
Start()method of aStartupScript
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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