Skip to content

Conversation

@blueskythlikesclouds
Copy link
Contributor

Fixes #98207.
Fixes #112282.

Currently on Windows, rendering driver fallback only occurs when the rendering context driver fails to initialize. This is insufficient for D3D12, because the D3D12 rendering context driver only creates DXGI objects, which are also used for D3D10/D3D11.

This PR updates the logic to also check whether the rendering device initialization succeeded. So, when D3D12CreateDevice fails or the device capabilities do not meet the Godot requirements, the device is destroyed and the fallback is attempted instead.

If you want to test this artificially, you can force RenderingDeviceDriverD3D12::_initialize_device() or RenderingDeviceDriverD3D12::_check_capabilities() to return an error code.

Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

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

Seems to be working as expected, but I tested it only on systems with D3D12 support (by breaking various checks). Ideally, it should also be tested on old hardware w/o D3D12 support, in case something is failing in an unexpected way.

@scgm0
Copy link
Contributor

scgm0 commented Nov 4, 2025

It appears that the rendering fallback was triggered correctly, but there is a rendering error.
I haven't enabled window transparency, but:
图片
Expected scene:
图片

@blueskythlikesclouds
Copy link
Contributor Author

blueskythlikesclouds commented Nov 4, 2025

It appears that the rendering fallback was triggered correctly, but there is a rendering error.

Does OpenGL normally work on your VM if you explicitly switch to it without invoking any fallback? Please try both master branch and this PR.


Seems to be working as expected, but I tested it only on systems with D3D12 support (by breaking various checks). Ideally, it should also be tested on old hardware w/o D3D12 support, in case something is failing in an unexpected way.

I actually have an old laptop with an Intel GPU that supports neither D3D12 or Vulkan, I'll be testing the PR on it.

@bruvzg
Copy link
Member

bruvzg commented Nov 4, 2025

For the reference, I have tested only DX→Vulkan fallback.

For fully reliable fallback to OpenGL we might need a full engine restart. Some OpenGL drivers can crash if Vulkan content was used in the same process (#103518, #101659).

@scgm0
Copy link
Contributor

scgm0 commented Nov 4, 2025

Does OpenGL normally work on your VM if you explicitly switch to it without invoking any fallback? Please try both master branch and this PR.

Using --rendering-driver opengl3 allows the display to function properly.
图片

@scgm0
Copy link
Contributor

scgm0 commented Nov 4, 2025

Supplement, #112293 can normally trigger rendering fallback and display the screen.
屏幕截图_20251104_213809

@blueskythlikesclouds
Copy link
Contributor Author

blueskythlikesclouds commented Nov 4, 2025

Figured the reason for the transparent window. When D3D12 is attempted first, the window gets created with the WS_EX_NOREDIRECTIONBITMAP flag.

The flag gets removed on the next style change after the fallback, but this doesn't seem to be something that works consistently. It works on my PC, but doesn't on a VM or the old laptop I just tried. See: https://stackoverflow.com/questions/40576394/setwindowlong-with-gwl-exstyle-and-ws-ex-noredirectionbitmap

This may require recreating the window without the flag. So, I should probably tackle this only after the following PR gets merged first: #112344

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

Projects

None yet

4 participants