vulkan/device_select: Only call vkGetPhysicalDeviceProperties2 if the device supports it.
vkGetPhysicalDeviceProperties2 is not allowed to be used with a 1.0 device
because it's a vulkan 1.1 function.
Closes: #4396
Fixes: 38ce8d4d
("vulkan/device_select: Stop using device properties 2.")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9462>
This commit is contained in:
parent
8bc9ae1bc6
commit
fb1100d718
|
@ -193,6 +193,13 @@ static void device_select_DestroyInstance(VkInstance instance, const VkAllocatio
|
||||||
free(info);
|
free(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void get_device_properties(const struct instance_info *info, VkPhysicalDevice device, VkPhysicalDeviceProperties2 *properties)
|
||||||
|
{
|
||||||
|
info->GetPhysicalDeviceProperties(device, &properties->properties);
|
||||||
|
|
||||||
|
if (info->GetPhysicalDeviceProperties2 && properties->properties.apiVersion >= VK_API_VERSION_1_1)
|
||||||
|
info->GetPhysicalDeviceProperties2(device, properties);
|
||||||
|
}
|
||||||
|
|
||||||
static void print_gpu(const struct instance_info *info, unsigned index, VkPhysicalDevice device)
|
static void print_gpu(const struct instance_info *info, unsigned index, VkPhysicalDevice device)
|
||||||
{
|
{
|
||||||
|
@ -205,10 +212,7 @@ static void print_gpu(const struct instance_info *info, unsigned index, VkPhysic
|
||||||
};
|
};
|
||||||
if (info->has_vulkan11 && info->has_pci_bus)
|
if (info->has_vulkan11 && info->has_pci_bus)
|
||||||
properties.pNext = &ext_pci_properties;
|
properties.pNext = &ext_pci_properties;
|
||||||
if (info->GetPhysicalDeviceProperties2)
|
get_device_properties(info, device, &properties);
|
||||||
info->GetPhysicalDeviceProperties2(device, &properties);
|
|
||||||
else
|
|
||||||
info->GetPhysicalDeviceProperties(device, &properties.properties);
|
|
||||||
|
|
||||||
switch(properties.properties.deviceType) {
|
switch(properties.properties.deviceType) {
|
||||||
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
|
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
|
||||||
|
@ -251,10 +255,7 @@ static bool fill_drm_device_info(const struct instance_info *info,
|
||||||
|
|
||||||
if (info->has_vulkan11 && info->has_pci_bus)
|
if (info->has_vulkan11 && info->has_pci_bus)
|
||||||
properties.pNext = &ext_pci_properties;
|
properties.pNext = &ext_pci_properties;
|
||||||
if (info->GetPhysicalDeviceProperties2)
|
get_device_properties(info, device, &properties);
|
||||||
info->GetPhysicalDeviceProperties2(device, &properties);
|
|
||||||
else
|
|
||||||
info->GetPhysicalDeviceProperties(device, &properties.properties);
|
|
||||||
|
|
||||||
drm_device->cpu_device = properties.properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU;
|
drm_device->cpu_device = properties.properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_CPU;
|
||||||
drm_device->dev_info.vendor_id = properties.properties.vendorID;
|
drm_device->dev_info.vendor_id = properties.properties.vendorID;
|
||||||
|
|
Loading…
Reference in New Issue