anv: Properly enumerate physical devices when none are present
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 14 Mar 2017 02:30:26 +0000 (19:30 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 14 Mar 2017 16:08:07 +0000 (09:08 -0700)
src/intel/vulkan/anv_device.c

index d8eafb9..5d1bbf6 100644 (file)
@@ -412,8 +412,11 @@ VkResult anv_EnumeratePhysicalDevices(
       }
    }
 
-   vk_outarray_append(&out, i) {
-      *i = anv_physical_device_to_handle(&instance->physicalDevice);
+   if (instance->physicalDeviceCount > 0) {
+      assert(instance->physicalDeviceCount == 1);
+      vk_outarray_append(&out, i) {
+         *i = anv_physical_device_to_handle(&instance->physicalDevice);
+      }
    }
 
    return vk_outarray_status(&out);