VK: Fixed GPU selection.

This commit is contained in:
Бранимир Караџић 2022-08-23 08:28:29 -07:00
parent 75a335f01f
commit 6cb74deed4

View File

@ -1385,7 +1385,8 @@ VK_IMPORT_INSTANCE
BX_TRACE("\t API version: %d.%d.%d"
, VK_API_VERSION_MAJOR(pdp.apiVersion)
, VK_API_VERSION_MINOR(pdp.apiVersion)
, VK_API_VERSION_PATCH(pdp.apiVersion) );
, VK_API_VERSION_PATCH(pdp.apiVersion)
);
BX_TRACE("\t API variant: %d", VK_API_VERSION_VARIANT(pdp.apiVersion) );
BX_TRACE("\tDriver version: %x", pdp.driverVersion);
BX_TRACE("\t VendorId: %x", pdp.vendorID);
@ -1400,11 +1401,21 @@ VK_IMPORT_INSTANCE
&& (BGFX_PCI_ID_NONE == g_caps.vendorId || pdp.vendorID == g_caps.vendorId)
&& (0 == g_caps.deviceId || pdp.deviceID == g_caps.deviceId) )
{
if (BX_ENABLED(BGFX_CONFIG_PREFER_DISCRETE_GPU) && (pdp.deviceType != VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) )
if (pdp.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU
|| pdp.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)
{
fallbackPhysicalDeviceIdx = ii;
}
else
physicalDeviceIdx = ii;
}
else
{
if (pdp.deviceType == VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU)
{
fallbackPhysicalDeviceIdx = ii;
}
else if (pdp.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
{
physicalDeviceIdx = ii;
}
@ -1417,10 +1428,10 @@ VK_IMPORT_INSTANCE
for (uint32_t jj = 0; jj < pdmp.memoryTypeCount; ++jj)
{
BX_TRACE("\t%3d: flags 0x%08x, index %d"
, jj
, pdmp.memoryTypes[jj].propertyFlags
, pdmp.memoryTypes[jj].heapIndex
);
, jj
, pdmp.memoryTypes[jj].propertyFlags
, pdmp.memoryTypes[jj].heapIndex
);
}
BX_TRACE("\tMemory heap count: %d", pdmp.memoryHeapCount);
@ -1429,10 +1440,10 @@ VK_IMPORT_INSTANCE
char size[16];
bx::prettify(size, BX_COUNTOF(size), pdmp.memoryHeaps[jj].size);
BX_TRACE("\t%3d: flags 0x%08x, size %10s"
, jj
, pdmp.memoryHeaps[jj].flags
, size
);
, jj
, pdmp.memoryHeaps[jj].flags
, size
);
}
bx::memCopy(&physicalDeviceExtensions[ii][0], &s_extension[0], sizeof(s_extension) );