PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
- PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
- bool has_props2, has_pci_bus;
+ PFN_vkGetPhysicalDeviceProperties2 GetPhysicalDeviceProperties2;
+ bool has_pci_bus, has_vulkan11;
bool has_wayland, has_xcb;
};
}
for (unsigned i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
- if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))
- info->has_props2 = true;
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
if (!strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME))
info->has_wayland = true;
#endif
}
+ /*
+ * The loader is currently not able to handle GetPhysicalDeviceProperties2KHR calls in
+ * EnumeratePhysicalDevices when there are other layers present. To avoid mysterious crashes
+ * for users just use only the vulkan version for now.
+ */
+ info->has_vulkan11 = pCreateInfo->pApplicationInfo &&
+ pCreateInfo->pApplicationInfo->apiVersion >= VK_MAKE_VERSION(1, 1, 0);
+
info->GetPhysicalDeviceProcAddr = (PFN_GetPhysicalDeviceProcAddr)info->GetInstanceProcAddr(*pInstance, "vk_layerGetPhysicalDeviceProcAddr");
#define DEVSEL_GET_CB(func) info->func = (PFN_vk##func)info->GetInstanceProcAddr(*pInstance, "vk" #func)
DEVSEL_GET_CB(DestroyInstance);
DEVSEL_GET_CB(EnumeratePhysicalDeviceGroups);
DEVSEL_GET_CB(GetPhysicalDeviceProperties);
DEVSEL_GET_CB(EnumerateDeviceExtensionProperties);
- if (info->has_props2)
- DEVSEL_GET_CB(GetPhysicalDeviceProperties2KHR);
+ if (info->has_vulkan11)
+ DEVSEL_GET_CB(GetPhysicalDeviceProperties2);
#undef DEVSEL_GET_CB
device_select_layer_add_instance(*pInstance, info);
VkPhysicalDeviceProperties2KHR properties = (VkPhysicalDeviceProperties2KHR){
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR
};
- if (info->has_props2 && info->has_pci_bus)
+ if (info->has_vulkan11 && info->has_pci_bus)
properties.pNext = &ext_pci_properties;
- if (info->GetPhysicalDeviceProperties2KHR)
- info->GetPhysicalDeviceProperties2KHR(device, &properties);
+ if (info->GetPhysicalDeviceProperties2)
+ info->GetPhysicalDeviceProperties2(device, &properties);
else
info->GetPhysicalDeviceProperties(device, &properties.properties);
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR
};
- if (info->has_props2 && info->has_pci_bus)
+ if (info->has_vulkan11 && info->has_pci_bus)
properties.pNext = &ext_pci_properties;
- if (info->GetPhysicalDeviceProperties2KHR)
- info->GetPhysicalDeviceProperties2KHR(device, &properties);
+ if (info->GetPhysicalDeviceProperties2)
+ info->GetPhysicalDeviceProperties2(device, &properties);
else
info->GetPhysicalDeviceProperties(device, &properties.properties);