zink: check for error when calling vkEnumeratePhysicalDevices

It seems it's possible for Lavapipe to fail to enumerate the physical
devices, so let's handle that and fail all the way up here.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7881>
This commit is contained in:
Erik Faye-Lund 2021-02-05 12:48:37 +01:00 committed by Marge Bot
parent cc8613c8d5
commit 6b38b1ccaf

View file

@ -710,11 +710,15 @@ choose_pdev(const VkInstance instance)
{
uint32_t i, pdev_count;
VkPhysicalDevice *pdevs, pdev = NULL;
vkEnumeratePhysicalDevices(instance, &pdev_count, NULL);
VkResult result = vkEnumeratePhysicalDevices(instance, &pdev_count, NULL);
if (result != VK_SUCCESS)
return VK_NULL_HANDLE;
assert(pdev_count > 0);
pdevs = malloc(sizeof(*pdevs) * pdev_count);
vkEnumeratePhysicalDevices(instance, &pdev_count, pdevs);
result = vkEnumeratePhysicalDevices(instance, &pdev_count, pdevs);
assert(result == VK_SUCCESS);
assert(pdev_count > 0);
for (i = 0; i < pdev_count; ++i) {