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;
}
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;
}