Fullscreen is broken (sometimes?)
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);
got the same issue here:
SharpDX.SharpDXException
HResult=0x80070005
Mensaje = HRESULT: [0x80070005], Module: [General], ApiCode: [E_ACCESSDENIED/General access denied error], Message: Acceso denegado.
Origen = SharpDX
Seguimiento de la pila:
en SharpDX.Result.CheckError() en C:\projects\sharpdx\Source\SharpDX\Result.cs: línea 195
en SharpDX.DXGI.Factory.CreateSwapChain(IUnknown deviceRef, SwapChainDescription& descRef, SwapChain swapChainOut) en C:\projects\sharpdx\Source\SharpDX.DXGI\Generated\REFERENCE\Interfaces.cs: línea 1519
en SharpDX.DXGI.SwapChain..ctor(Factory factory, ComObject device, SwapChainDescription description) en C:\projects\sharpdx\Source\SharpDX.DXGI\SwapChain.cs: línea 43
en Stride.Graphics.SwapChainGraphicsPresenter.CreateSwapChainForDesktop(IntPtr handle)
en Stride.Graphics.SwapChainGraphicsPresenter.CreateSwapChainForWindows()
en Stride.Graphics.SwapChainGraphicsPresenter.CreateSwapChain()
en Stride.Graphics.SwapChainGraphicsPresenter.OnRecreated()
en Stride.Graphics.ResumeManager.OnRecreate()
en Stride.Games.GameBase.GraphicsDeviceService_DeviceReset(Object sender, EventArgs e)
en Stride.Games.GraphicsDeviceManager.OnDeviceReset(Object sender, EventArgs args)
en Stride.Games.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
en Stride.Games.GraphicsDeviceManager.ChangeOrCreateDevice(Boolean forceCreate)
en Stride.Games.GraphicsDeviceManager.ApplyChanges()
en Stride.Games.GraphicsDeviceManager.Window_FullscreenChanged(Object sender, EventArgs eventArgs)
en Stride.Games.GameWindow.set_IsFullscreen(Boolean value)
en Stride.Games.GameWindow.OnDisableFullScreen(Object source, EventArgs e)
en Stride.Games.GameForm.OnDisableFullScreen(EventArgs e)
en Stride.Games.GameForm.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
en Stride.Games.Win32Native.CallWindowProc(IntPtr wndProc, IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
en Stride.Input.InputSourceWinforms.WndProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
Stride 4.2.0.2232 Graphics api: d3d 11.1 Windows 10 build 19045.4894
I am having this issue now as well in a regular Game Studio project but I have a few more details.
- All are defaults, no resizing in the project
- It crashed when I click a close button in the top toolbar
- It doesn't crash on my primary screen, where it starts
- It crashes only when I close it on my 2 secondary screens
SharpDX.SharpDXException
HResult=0x80070005
Message=HRESULT: [0x80070005], Module: [General], ApiCode: [E_ACCESSDENIED/General access denied error], Message: Access is denied.
Source=SharpDX
StackTrace:
at SharpDX.Result.CheckError() in C:\projects\sharpdx\Source\SharpDX\Result.cs:line 195
at SharpDX.DXGI.Factory.CreateSwapChain(IUnknown deviceRef, SwapChainDescription& descRef, SwapChain swapChainOut) in C:\projects\sharpdx\Source\SharpDX.DXGI\Generated\REFERENCE\Interfaces.cs:line 1519
at SharpDX.DXGI.SwapChain..ctor(Factory factory, ComObject device, SwapChainDescription description) in C:\projects\sharpdx\Source\SharpDX.DXGI\SwapChain.cs:line 43
at Stride.Graphics.SwapChainGraphicsPresenter.CreateSwapChainForDesktop(IntPtr handle)
at Stride.Graphics.SwapChainGraphicsPresenter.CreateSwapChainForWindows()
at Stride.Graphics.SwapChainGraphicsPresenter.CreateSwapChain()
at Stride.Graphics.SwapChainGraphicsPresenter.OnRecreated()
at Stride.Graphics.ResumeManager.OnRecreate()
at Stride.Games.GameBase.GraphicsDeviceService_DeviceReset(Object sender, EventArgs e)
at Stride.Games.GraphicsDeviceManager.OnDeviceReset(Object sender, EventArgs args)
at Stride.Games.GraphicsDeviceManager.CreateDevice(GraphicsDeviceInformation newInfo)
at Stride.Games.GraphicsDeviceManager.ChangeOrCreateDevice(Boolean forceCreate)
at Stride.Games.GraphicsDeviceManager.Window_ClientSizeChanged(Object sender, EventArgs e)
at Stride.Games.GameWindow.OnClientSizeChanged(Object source, EventArgs e)
at Stride.Games.GameForm.OnUserResized(EventArgs e)
at Stride.Games.GameForm.OnClientSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at Stride.Games.GameForm.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
at Stride.Games.Win32Native.CallWindowProc(IntPtr wndProc, IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at Stride.Input.InputSourceWinforms.WndProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
Other observation, the error is further affected by this settings.
If my primary screen is =< 150%, then it doesn't crash even when I close the application on other screens.
If my primary screen is > 150%, the crash happens when the game is closed on both secondary screens.
When I drag a window from the primary screen to secondary, the windows resizes, which is a correct behaviour but it seems that will cause a crash on closing the application.
When it doesn't crash, the window just resizes slightly.
I just tested under the master branch, I get the "Access denied" error when exiting the app using Alt+F4. Otherwise switching to fullscreen works. My scaling is set to 100%.
Also tested with the project I've had this issue originally, still no changes.