mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Improve device ordering
Make sure that integrated GPUs are preferred over CPU implementations on systems that have no dedicated GPU.
This commit is contained in:
parent
bcadc04932
commit
a60916f7ee
@ -169,8 +169,21 @@ namespace dxvk {
|
||||
|
||||
std::sort(result.begin(), result.end(),
|
||||
[] (const Rc<DxvkAdapter>& a, const Rc<DxvkAdapter>& b) -> bool {
|
||||
return a->deviceProperties().deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
|
||||
&& b->deviceProperties().deviceType != VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU;
|
||||
static const std::array<VkPhysicalDeviceType, 3> deviceTypes = {{
|
||||
VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU,
|
||||
VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU,
|
||||
VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU,
|
||||
}};
|
||||
|
||||
uint32_t aRank = deviceTypes.size();
|
||||
uint32_t bRank = deviceTypes.size();
|
||||
|
||||
for (uint32_t i = 0; i < std::min(aRank, bRank); i++) {
|
||||
if (a->deviceProperties().deviceType == deviceTypes[i]) aRank = i;
|
||||
if (b->deviceProperties().deviceType == deviceTypes[i]) bRank = i;
|
||||
}
|
||||
|
||||
return aRank < bRank;
|
||||
});
|
||||
|
||||
if (result.size() == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user