From e46b14fd30bab30f139ab1fdcf6d5a6f3587608d Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 17 Feb 2023 17:47:55 +0100 Subject: [PATCH] Move code to Windows Vulkan context initialization context This workaround is not needed for rendering drivers other than Vulkan. (cherry picked from commit 950c5b57e498c81309f27d2e6114d2653a9b6bdd) --- platform/windows/os_windows.cpp | 5 ----- platform/windows/vulkan_context_win.cpp | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 94c3c63b9d4..4ac76a51794 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -156,11 +156,6 @@ static void _error_handler(void *p_self, const char *p_func, const char *p_file, void OS_Windows::initialize() { crash_handler.initialize(); - // Workaround for Vulkan not working on setups with AMD integrated graphics + NVIDIA dedicated GPU (GH-57708). - // This prevents using AMD integrated graphics with Vulkan entirely, but it allows the engine to start - // even on outdated/broken driver setups. - OS::get_singleton()->set_environment("DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1", "1"); - #ifdef WINDOWS_DEBUG_OUTPUT_ENABLED error_handlers.errfunc = _error_handler; error_handlers.userdata = this; diff --git a/platform/windows/vulkan_context_win.cpp b/platform/windows/vulkan_context_win.cpp index cf4383fc331..4c1e6eebe4f 100644 --- a/platform/windows/vulkan_context_win.cpp +++ b/platform/windows/vulkan_context_win.cpp @@ -55,6 +55,10 @@ Error VulkanContextWindows::window_create(DisplayServer::WindowID p_window_id, D } VulkanContextWindows::VulkanContextWindows() { + // Workaround for Vulkan not working on setups with AMD integrated graphics + NVIDIA dedicated GPU (GH-57708). + // This prevents using AMD integrated graphics with Vulkan entirely, but it allows the engine to start + // even on outdated/broken driver setups. + OS::get_singleton()->set_environment("DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1", "1"); } VulkanContextWindows::~VulkanContextWindows() {