Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D11CreateDevice+Hardware crashes and fallback doesn't work #16062

Open
maxkatz6 opened this issue Jun 19, 2024 · 1 comment
Open

D3D11CreateDevice+Hardware crashes and fallback doesn't work #16062

maxkatz6 opened this issue Jun 19, 2024 · 1 comment

Comments

@maxkatz6
Copy link
Member

          @Sewer56 looks like this PR break Angle/DX on my machine:
[OpenGL]Unable to initialize ANGLE-based rendering with DirectX11 : 'System.ArgumentException: Value does not fall within the expected range.
   at Avalonia.Win32.DirectX.DirectXUnmanagedMethods.D3D11CreateDevice(IntPtr adapter, D3D_DRIVER_TYPE DriverType, IntPtr Software, UInt32 Flags, D3D_FEATURE_LEVEL[] pFeatureLevels, UInt32 FeatureLevels, UInt32 SDKVersion, IntPtr& ppDevice, D3D_FEATURE_LEVEL& pFeatureLevel, IntPtr* ppImmediateContext)
   at Avalonia.Win32.OpenGl.Angle.AngleWin32EglDisplay.CreateD3D11Device(IDXGIAdapter1 chosenAdapter, D3D_FEATURE_LEVEL[] featureLevels) in E:\Work\Projects\AvaloniaCopy1\src\Windows\Avalonia.Win32\OpenGl\Angle\AngleWin32EglDisplay.cs:line 175
   at Avalonia.Win32.OpenGl.Angle.AngleWin32EglDisplay.CreateD3D11Display(Win32AngleEglInterface egl) in E:\Work\Projects\AvaloniaCopy1\src\Windows\Avalonia.Win32\OpenGl\Angle\AngleWin32EglDisplay.cs:line 106
   at Avalonia.Win32.OpenGl.Angle.D3D11AngleWin32PlatformGraphics.TryCreate(Win32AngleEglInterface egl) in E:\Work\Projects\AvaloniaCopy1\src\Windows\Avalonia.Win32\OpenGl\Angle\D3D11AngleWin32PlatformGraphics.cs:line 77'
[OpenGL]Unknown requested PlatformApi 'DirectX11'

There are couple of problems:

  1. D3D11CreateDevice+HARDWARE fails here with invalid argument. Don't really know why.
  2. D3D11CreateDevice+SOFTWARE fails too, but UNKNOWN works fine.
  3. D3D11CreateDevice return type should be "int" (non-void), and PreserveSig = false should be removed, if you want to implement fallback logic.
  4. Before each fallback, there should be a warning log message, so developers can easier find this problem. Something like:
Logger.TryGet(LogEventLevel.Warning, LogArea.Win32Platform)?.Log(null, "Unable to create hardware ID3D11Device, error code = {ErrorCode}", $"0x{result:X}")

Originally posted by @maxkatz6 in #16035 (comment)

@Sewer56
Copy link
Contributor

Sewer56 commented Jun 19, 2024

This is technically fixed by

And the feedback was implemented in:

As per #16035 (comment), I'm not sure what the current course of action should be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants