Skip to content

Conversation

@scgm0
Copy link
Contributor

@scgm0 scgm0 commented Nov 1, 2025

Fix #112282

According to Microsoft's documentation, when the ppDevice parameter of D3D12CreateDevice is null, it can verify whether a device can be created without actually creating one. Therefore, it should be possible to use this method to determine if an adapter is truly available.

Although I'm not entirely sure if my code is correct, I have conducted simple tests on both a Windows 11 virtual machine and a physical machine. Now, it correctly triggers rendering fallback in the virtual machine, and the physical machine can also use d3d12 normally.

It's still uncertain what impact this has on performance.

@scgm0 scgm0 force-pushed the Improve-`RenderingContextDriverD3D12--_initialize_devices` branch from af3296a to ebf4ea4 Compare November 2, 2025 23:00
Copy link
Contributor

@blueskythlikesclouds blueskythlikesclouds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code make sense to me, but the device initialization process warrants a refactor to fix #98207 anyway, which would also naturally handle your issue. It's better if we can avoid the D3D12 runtime validating the adapter twice.

@AThousandShips AThousandShips added this to the 4.6 milestone Nov 3, 2025
@scgm0
Copy link
Contributor Author

scgm0 commented Nov 3, 2025

Code make sense to me, but the device initialization process warrants a refactor to fix #98207 anyway, which would also naturally handle your issue. It's better if we can avoid the D3D12 runtime validating the adapter twice.

It appears that some functionalities can only be verified after the device is created. The solutions are either to move the actual logic of device initialization to RenderingContextDriverD3D12 for verification, or to add minimal device initialization code in RenderingContextDriverD3D12 for validation purposes.

So, should I close this PR and wait for the refactoring, or can we merge this PR first and then proceed with the refactoring?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to properly trigger rendering fallback when using d3d12.

4 participants