From 485200342dd744eecf2ea57bccdd9c3d0c88c665 Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Tue, 11 Nov 2025 01:50:58 +0100 Subject: [PATCH] Disables Vulkan devices sorting by default Currently we always choose the best device. But it's not always desirable. A more safe approach is to use the default device (with index 0). The only downside of that is if a user didn't adjust settings then the game might run on an integrated GPU instead of a discrete one. In the future it'll be solved by selecting GPU in options: #8529 Fixes #8455 --- binaries/data/config/default.cfg | 3 +++ source/renderer/backend/vulkan/Device.cpp | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/binaries/data/config/default.cfg b/binaries/data/config/default.cfg index 3bcd2d0018..a9daf6fd9b 100644 --- a/binaries/data/config/default.cfg +++ b/binaries/data/config/default.cfg @@ -140,6 +140,9 @@ renderer.backend.vulkan.disabledescriptorindexing = false renderer.backend.vulkan.deviceindexoverride = -1 renderer.backend.vulkan.destroyoldswapchainbefore = false +; In case index override isn't enough we might choose a device automatically. +renderer.backend.vulkan.choosebestdevice = false + renderer.backend.vulkan.debugbarrierafterframebufferpass = false renderer.backend.vulkan.debugwaitidlebeforeacquire = false renderer.backend.vulkan.debugwaitidlebeforepresent = false diff --git a/source/renderer/backend/vulkan/Device.cpp b/source/renderer/backend/vulkan/Device.cpp index e3fba3a6be..a004c8d415 100644 --- a/source/renderer/backend/vulkan/Device.cpp +++ b/source/renderer/backend/vulkan/Device.cpp @@ -407,10 +407,19 @@ std::unique_ptr CDevice::Create(SDL_Window* window) } if (choosedDeviceIt == device->m_AvailablePhysicalDevices.end()) { - // We need to choose the best available device fits our needs. - choosedDeviceIt = min_element( - availablePhyscialDevices.begin(), availablePhyscialDevices.end(), - ComparePhysicalDevices); + const bool chooseBestDevice{g_ConfigDB.Get("renderer.backend.vulkan.choosebestdevice", false)}; + if (chooseBestDevice) + { + // We need to choose the best available device fits our needs. + choosedDeviceIt = min_element( + availablePhyscialDevices.begin(), availablePhyscialDevices.end(), + ComparePhysicalDevices); + } + else + { + // By default we assume that the Vulkan driver provides a decent default. + choosedDeviceIt = availablePhyscialDevices.begin(); + } } device->m_ChoosenDevice = *choosedDeviceIt; const SAvailablePhysicalDevice& choosenDevice = device->m_ChoosenDevice;