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

Windows: Fall back to D3D12 if Vulkan is not supported and vice versa #94796

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

kus04e4ek
Copy link
Contributor

@kus04e4ek kus04e4ek commented Jul 26, 2024

Similar approach to rendering/gl_compatibility/fallback_to_angle, rendering/gl_compatibility/fallback_to_gles and rendering/gl_compatibility/fallback_to_native.
Can be tested with this (with this Godot will always try to fall back to another driver):

diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index b8fcab64177..36cf4e10bd3 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -5928,7 +5928,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
 #endif
 
 	if (rendering_context) {
-		if (rendering_context->initialize() != OK) {
+		if (true) {
 			bool failed = true;
 #if defined(VULKAN_ENABLED)
 			bool fallback_to_vulkan = GLOBAL_GET("rendering/rendering_device/vulkan/fallback_to_vulkan");

@Calinou
Copy link
Member

Calinou commented Jul 26, 2024

Note that the original issue also refers to PCs without OpenGL support (i.e. ARM laptops without the compatibility pack installed). Falling back to Direct3D 12 on those would imply using a different rendering method – and therefore different visuals – unless ANGLE is used. I expect ANGLE to be quite a bit slower than a native D3D12 implementation.

Either way, this might be worth its own proposal so you can choose which rendering methods can fall back to other ones (e.g. falling back to Compatibility if Forward+/Mobile is not supported, or vice versa).

@kus04e4ek
Copy link
Contributor Author

Not quite sure I understood your comment correctly.

Note that the original issue also refers to PCs without OpenGL support (i.e. ARM laptops without the compatibility pack installed). Falling back to Direct3D 12 on those would imply using a different rendering method.

This PR doesn't do it, it will only fall back to Direct3D 12 from Vulkan. If native OpenGL is not supported Godot already falls back to ANGLE on Windows.

Either way, this might be worth its own proposal so you can choose which rendering methods can fall back to other ones (e.g. falling back to Compatibility if Forward+/Mobile is not supported, or vice versa).

Agree, I think this PR is ok as is for 4.3 cause Godot already falls back to different rendering drivers within the same rendering method, this can be improved in future versions.

@bruvzg
Copy link
Member

bruvzg commented Jul 27, 2024

Note that the original issue also refers to PCs without OpenGL support (i.e. ARM laptops without the compatibility pack installed). Falling back to Direct3D 12 on those would imply using a different rendering method – and therefore different visuals – unless ANGLE is used. I expect ANGLE to be quite a bit slower than a native D3D12 implementation.

Currently, we aren't even trying to load native GL on ARM64 if engine was compiled with ANGLE, it's switching to ANGLE (over D3D11) automatically.

main/main.cpp Outdated
Comment on lines 1960 to 1961
GLOBAL_DEF_RST("rendering/rendering_device/vulkan/fallback_to_vulkan", true);
GLOBAL_DEF_RST("rendering/rendering_device/d3d12/fallback_to_d3d12", true);
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't it be clearer to have it named rendering/rendering_device/d3d12/fallback_to_vulkan and rendering/rendering_device/vulkan/fallback_to_d3d12, since it's Direct3D falling back to Vulkan and vice versa? Or have it directly under the rendering/rendering_device/

Copy link
Contributor Author

@kus04e4ek kus04e4ek Jul 27, 2024

Choose a reason for hiding this comment

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

Moved to rendering/rendering_device/, but I don't have a strong opinion

@akien-mga akien-mga merged commit 9a8f18b into godotengine:master Jul 29, 2024
18 checks passed
@akien-mga
Copy link
Member

Thanks!

@kus04e4ek kus04e4ek deleted the backfall branch July 29, 2024 14:08
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.

Windows PC without Vulkan or OpenGL should default to Direct3D12
4 participants