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

(cherry picked from commit 485200342d)
Signed-off-by: phosit <phosit@autistici.org>
This commit is contained in:
Vladislav Belov 2025-11-11 01:50:58 +01:00 committed by phosit
parent fbc1b160e1
commit 8420377789
No known key found for this signature in database
GPG key ID: C9430B600671C268
2 changed files with 16 additions and 4 deletions

View file

@ -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

View file

@ -407,10 +407,19 @@ std::unique_ptr<CDevice> 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;