Verify if the adapter is available in RenderingContextDriverD3D12::_initialize_devices
#112293
+35
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #112282
According to Microsoft's documentation, when the
ppDeviceparameter ofD3D12CreateDeviceisnull, 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
d3d12normally.It's still uncertain what impact this has on performance.