FNA-XNA / FNA3D

FNA3D - 3D Graphics Library for FNA
http://fna-xna.github.io/
Other
285 stars 47 forks source link

Could not create swapchain! Error Code: The operation completed successfully. (0x00000000) #214

Open Chicken-Bones opened 1 week ago

Chicken-Bones commented 1 week ago

Requesting some help from a tML issue that has affected a number of users. I don't have a reproduction myself, but I'm having difficulty ascertaining the cause of the error.

[19:15:52.051] [Main Thread/INFO] [tML]: High DPI Display detected: setting FNA to highdpi mode
[19:15:52.053] [Main Thread/DEBUG] [FNA]: Querying linked library versions...
[19:15:52.054] [Main Thread/DEBUG] [FNA]: SDL v2.28.2
[19:15:52.054] [Main Thread/DEBUG] [FNA]: FNA3D v23.10.0
...
[19:15:53.228] [Main Thread/INFO] [FNA]: SDL Video Diver: windows
[19:15:53.228] [Main Thread/INFO] [FNA]: FNA3D Driver: D3D11
[19:15:53.228] [Main Thread/INFO] [FNA]: D3D11 Adapter: NVIDIA GeForce RTX 4060 Laptop GPU
[19:15:53.277] [Main Thread/ERROR] [FNA]: Could not create swapchain! Error Code: The operation completed successfully. (0x00000000)
[19:15:53.295] [Main Thread/WARN] [tML]: Silently Caught Exception: 
System.InvalidOperationException: Could not create swapchain! Error Code: The operation completed successfully. (0x00000000)
   at Microsoft.Xna.Framework.FNALoggerEXT.FNA3DLogError(IntPtr msg)
   at Microsoft.Xna.Framework.Graphics.FNA3D.FNA3D_CreateDevice(FNA3D_PresentationParameters& presentationParameters, Byte debugMode)
   at Microsoft.Xna.Framework.Graphics.GraphicsDevice..ctor(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters)
   at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice()

We're still running FNA3D 23.10, so I imagine it's going through D3D11_INTERNAL_LogError. The only way I can see to get an error code of 0 is if ID3D11Device_GetDeviceRemovedReason is returning 0 but I don't have any ideas from there

if (res == DXGI_ERROR_DEVICE_REMOVED)
{
    res = ID3D11Device_GetDeviceRemovedReason(device);
}

Original issue: https://github.com/tModLoader/tModLoader/issues/4417

flibitijibibo commented 1 week ago

Working backwards is probably the way to go - figuring out why it calls the error reporting function will help a bit, the HRESULT is getting absorbed by this... really odd error.