Skip to content

Commit 5cd9d2d

Browse files
committed
Merge pull request #113741 from blueskythlikesclouds/rd-vulkan-fallback-fix
Fix Vulkan failing to initialize when compiling without D3D12.
2 parents 979b619 + 7205e21 commit 5cd9d2d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

platform/windows/display_server_windows.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ DisplayServer::WindowID DisplayServerWindows::create_sub_window(WindowMode p_mod
16251625

16261626
#ifdef RD_ENABLED
16271627
if (rendering_context != nullptr) {
1628-
_create_rendering_context_window(window_id);
1628+
_create_rendering_context_window(window_id, rendering_driver);
16291629
}
16301630
#endif
16311631
#ifdef GLES3_ENABLED
@@ -6606,7 +6606,7 @@ void DisplayServerWindows::_destroy_window(WindowID p_window_id) {
66066606
}
66076607

66086608
#ifdef RD_ENABLED
6609-
Error DisplayServerWindows::_create_rendering_context_window(WindowID p_window_id) {
6609+
Error DisplayServerWindows::_create_rendering_context_window(WindowID p_window_id, const String &p_rendering_driver) {
66106610
DEV_ASSERT(rendering_context != nullptr);
66116611

66126612
WindowData &wd = windows[p_window_id];
@@ -6620,19 +6620,19 @@ Error DisplayServerWindows::_create_rendering_context_window(WindowID p_window_i
66206620
#endif
66216621
} wpd;
66226622
#ifdef VULKAN_ENABLED
6623-
if (rendering_driver == "vulkan") {
6623+
if (p_rendering_driver == "vulkan") {
66246624
wpd.vulkan.window = wd.hWnd;
66256625
wpd.vulkan.instance = hInstance;
66266626
}
66276627
#endif
66286628
#ifdef D3D12_ENABLED
6629-
if (rendering_driver == "d3d12") {
6629+
if (p_rendering_driver == "d3d12") {
66306630
wpd.d3d12.window = wd.hWnd;
66316631
}
66326632
#endif
66336633

66346634
Error err = rendering_context->window_create(p_window_id, &wpd);
6635-
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Failed to create %s window.", rendering_driver));
6635+
ERR_FAIL_COND_V_MSG(err != OK, err, vformat("Failed to create %s window.", p_rendering_driver));
66366636

66376637
rendering_context->window_set_size(p_window_id, wd.width, wd.height);
66386638
wd.rendering_context_window_created = true;
@@ -7224,7 +7224,7 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
72247224
main_window_created = true;
72257225
}
72267226

7227-
if (_create_rendering_context_window(MAIN_WINDOW_ID) == OK) {
7227+
if (_create_rendering_context_window(MAIN_WINDOW_ID, tested_rendering_driver) == OK) {
72287228
rendering_device = memnew(RenderingDevice);
72297229
if (rendering_device->initialize(rendering_context, MAIN_WINDOW_ID) == OK) {
72307230
#ifdef VULKAN_ENABLED

platform/windows/display_server_windows.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ class DisplayServerWindows : public DisplayServer {
393393
void _destroy_window(WindowID p_window_id); // Destroys only what was needed to be created for the main window. Does not destroy transient parent dependencies or GL/rendering context windows.
394394

395395
#ifdef RD_ENABLED
396-
Error _create_rendering_context_window(WindowID p_window_id);
396+
Error _create_rendering_context_window(WindowID p_window_id, const String &p_rendering_driver);
397397
void _destroy_rendering_context_window(WindowID p_window_id);
398398
#endif
399399

0 commit comments

Comments
 (0)