summaryrefslogtreecommitdiffstats
path: root/platform/windows
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-29 15:17:26 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-29 15:17:26 +0200
commit9a8f18b9bf5a4de2cb339f7d17992053a776b57a (patch)
tree7c26ce714ec4519524baf97d80001ca53ef8f7d3 /platform/windows
parentf9474f0925500a536edceb5564dbf2808496e37d (diff)
parentd30c1e6a8f017ce3837fc97c2532508b49891100 (diff)
downloadredot-engine-9a8f18b9bf5a4de2cb339f7d17992053a776b57a.tar.gz
Merge pull request #94796 from kus04e4ek/backfall
Windows: Fall back to D3D12 if Vulkan is not supported and vice versa
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/display_server_windows.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 1f932b72b0..020ef0c31b 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -5947,10 +5947,37 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
if (rendering_context) {
if (rendering_context->initialize() != OK) {
- memdelete(rendering_context);
- rendering_context = nullptr;
- r_error = ERR_UNAVAILABLE;
- return;
+ bool failed = true;
+#if defined(VULKAN_ENABLED)
+ bool fallback_to_vulkan = GLOBAL_GET("rendering/rendering_device/fallback_to_vulkan");
+ if (failed && fallback_to_vulkan && rendering_driver != "vulkan") {
+ memdelete(rendering_context);
+ rendering_context = memnew(RenderingContextDriverVulkanWindows);
+ if (rendering_context->initialize() == OK) {
+ WARN_PRINT("Your video card drivers seem not to support Direct3D 12, switching to Vulkan.");
+ rendering_driver = "vulkan";
+ failed = false;
+ }
+ }
+#endif
+#if defined(D3D12_ENABLED)
+ bool fallback_to_d3d12 = GLOBAL_GET("rendering/rendering_device/fallback_to_d3d12");
+ if (failed && fallback_to_d3d12 && rendering_driver != "d3d12") {
+ memdelete(rendering_context);
+ rendering_context = memnew(RenderingContextDriverD3D12);
+ if (rendering_context->initialize() == OK) {
+ WARN_PRINT("Your video card drivers seem not to support Vulkan, switching to Direct3D 12.");
+ rendering_driver = "d3d12";
+ failed = false;
+ }
+ }
+#endif
+ if (failed) {
+ memdelete(rendering_context);
+ rendering_context = nullptr;
+ r_error = ERR_UNAVAILABLE;
+ return;
+ }
}
}
#endif