Browse Source

Disable AMD switchable graphics on Windows with Vulkan to fix driver issue

This is a required workaround on setups with AMD integrated graphics
+ NVIDIA dedicated GPU to be able to start the engine with the Forward+
or Forward Mobile rendering methods.

While a AMD driver update can resolve this issue, it still gets reported
regularly and is likely to become a source of support headache for people
distributing projects made with Godot (as this also affects exported projects).

(cherry picked from commit 31a9345189ea041da798cf99b18c4e53571f53f1)
Hugo Locurcio 2 years ago
parent
commit
30f079ecb5
1 changed files with 5 additions and 0 deletions
  1. 5 0
      platform/windows/os_windows.cpp

+ 5 - 0
platform/windows/os_windows.cpp

@@ -156,6 +156,11 @@ 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;