2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #12781 from goldenx86/dozen

Demote dozen to the bottom of the device list
This commit is contained in:
Matías Locatti 2024-01-25 03:58:09 -03:00 committed by GitHub
commit f3749394ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,6 +39,10 @@ void SortPhysicalDevicesPerVendor(std::vector<VkPhysicalDevice>& devices,
} }
} }
bool IsMicrosoftDozen(const char* device_name) {
return std::strstr(device_name, "Microsoft") != nullptr;
}
void SortPhysicalDevices(std::vector<VkPhysicalDevice>& devices, const InstanceDispatch& dld) { void SortPhysicalDevices(std::vector<VkPhysicalDevice>& devices, const InstanceDispatch& dld) {
// Sort by name, this will set a base and make GPUs with higher numbers appear first // Sort by name, this will set a base and make GPUs with higher numbers appear first
// (e.g. GTX 1650 will intentionally be listed before a GTX 1080). // (e.g. GTX 1650 will intentionally be listed before a GTX 1080).
@ -52,6 +56,12 @@ void SortPhysicalDevices(std::vector<VkPhysicalDevice>& devices, const InstanceD
}); });
// Prefer Nvidia over AMD, AMD over Intel, Intel over the rest. // Prefer Nvidia over AMD, AMD over Intel, Intel over the rest.
SortPhysicalDevicesPerVendor(devices, dld, {0x10DE, 0x1002, 0x8086}); SortPhysicalDevicesPerVendor(devices, dld, {0x10DE, 0x1002, 0x8086});
// Demote Microsoft's Dozen devices to the bottom.
SortPhysicalDevices(
devices, dld,
[](const VkPhysicalDeviceProperties& lhs, const VkPhysicalDeviceProperties& rhs) {
return IsMicrosoftDozen(rhs.deviceName) && !IsMicrosoftDozen(lhs.deviceName);
});
} }
template <typename T> template <typename T>