godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.1k stars 21.18k forks source link

Incorrect fallback to Direct3D 12 on Vulkan-unsupported device #98848

Open dsd opened 1 week ago

dsd commented 1 week ago

Tested versions

System information

Windows, Intel 4600 graphics

Issue description

When opening an existing project that is set to use the Forward+ renderer, these errors occur on this device:

Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org
OpenGL API 3.3.0 - Build 20.19.15.5126 - Compatibility - Using Device: Intel - Intel(R) HD Graphics 4600

Project is missing: D:/CURSOS/UTP/ENDLESS/GAME MAKING/path-to-the-throne/godot/project.godot
Editing project: D:/CURSOS/UTP/ENDLESS/Game Maiking/path-to-the-throne/godot
Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org
WARNING: Your video card drivers seem not to support Vulkan, switching to Direct3D 12.
     at: DisplayServerWindows (platform/windows/display_server_windows.cpp:5985)
D3D12 11_0 - Forward+ - Using Device #0: Intel - Intel(R) HD Graphics 4600
WARNING: PSO caching is not implemented yet in the Direct3D 12 driver.
     at: pipeline_cache_create (drivers/d3d12/rendering_device_driver_d3d12.cpp:4906)
ERROR:ERROR: Shader translation at stage Compute failed.
 Shader translation at stage Compute failed.
   at: ERROR:(drivers/d3d12/rendering_device_driver_d3d12.cpp:3289)

After this, several hundred more gfx-related errors appear in the logs, with the Godot editor window fully black. After a few seconds the window goes away with this crash:

================================================================
CrashHandlerException: Program crashed with signal 11
Engine version: Godot Engine v4.3.stable.official (77dcf97d82cbfe4e4615475fa52ca03da645dbd8)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] error(-1): no debug info in PE/COFF executable
[2] error(-1): no debug info in PE/COFF executable
[3] error(-1): no debug info in PE/COFF executable
[4] error(-1): no debug info in PE/COFF executable
[5] error(-1): no debug info in PE/COFF executable
[6] error(-1): no debug info in PE/COFF executable
[7] error(-1): no debug info in PE/COFF executable
[8] error(-1): no debug info in PE/COFF executable
[9] error(-1): no debug info in PE/COFF executable
[10] error(-1): no debug info in PE/COFF executable
[11] error(-1): no debug info in PE/COFF executable
[12] error(-1): no debug info in PE/COFF executable
[13] error(-1): no debug info in PE/COFF executable
[14] error(-1): no debug info in PE/COFF executable
[15] error(-1): no debug info in PE/COFF executable
[16] error(-1): no debug info in PE/COFF executable
[17] error(-1): no debug info in PE/COFF executable
[18] error(-1): no debug info in PE/COFF executable
[19] error(-1): no debug info in PE/COFF executable
[20] error(-1): no debug info in PE/COFF executable
-- END OF BACKTRACE --
================================================================

Intel 4600 does not support Vulkan nor Direct3D 12 on Windows.

The same thing happens in Godot 4.4 dev 3. (Sorry I did not capture logs from 4.4) However, Godot 4.4 will not allow me to create a new project with Forward+ because it detects the lack of gfx support. That's a great addition!

Can something similar be applied to opening of existing projects? In this case, I would expect Godot to either give me a friendly error message saying that it can't open the project because of incompatible renderer, or for it to automatically fall back to Compatibility renderer (perhaps with some notification of this).

I see some type of fallback has been implemented via https://github.com/godotengine/godot-proposals/issues/8006 but it seems not to be working in this case.

Steps to reproduce

  1. Open Godot project manager
  2. Open any existing project that uses Forward+ renderer
bruvzg commented 1 week ago

I see some type of fallback has been implemented via https://github.com/godotengine/godot-proposals/issues/8006 but it seems not to be working in this case.

D3D12 11_0 - Forward+ - Using Device #0: Intel - Intel(R) HD Graphics 4600

The problem with current fallback system, it is done in an early stage of renderer initialization, and only works if API is completely missing (e.g, DX12→GL should work on Windows 7). Windows 10+ always have some level of DX12 support. It's running with 11.0 feature level, which is insufficient for Godot, but renderer init still works, and fallback doesn't trigger.

lrahmann commented 1 week ago

Godot can work with DX12 11_* as long as they support SM6.1 (some older Intel GPUs actually do this and their Vulkan support is not that good anyway). The issue at hand here is #98207 but I currently do not have the time to do a proper pull request for this one. Older SM cannot be supported due with the approach Godot took for DirectX support.

dsd commented 1 week ago

Thanks for the context.

On this device, Godot 4.4 refuses to create a new project with Forward+. Does that imply there is a codepath there that is detecting that D3D12 is not usable? If so, I wonder if we can use it (or get inspiration from it) here.