Module: Mesa
Branch: master
Commit: 6b38b1ccafbea38986ae419df026e2bb05972ada
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6b38b1ccafbea38986ae419df026e2bb05972ada

Author: Erik Faye-Lund <[email protected]>
Date:   Fri Feb  5 12:48:37 2021 +0100

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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7881>

---

 src/gallium/drivers/zink/zink_screen.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_screen.c 
b/src/gallium/drivers/zink/zink_screen.c
index 56cd9b79f5e..d1b37aed829 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -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) {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to