anv: Return correct result in EnumeratePhysicalDevices
authorNicolas Koch <nioko1337@gmail.com>
Thu, 6 Oct 2016 19:21:32 +0000 (21:21 +0200)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 12 Oct 2016 05:58:27 +0000 (22:58 -0700)
If pPhysicalDevices is too small for all physical devices,
the driver must return VK_INCOMPLETE.
Since only a single physical device is supported, this is only the case
when pPhysicalDeviceCount == 0 && pPhysicalDevices != NULL.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/vulkan/anv_device.c

index 02246ba8e8a6d956e96f10b1d6c5f0bf6cfee83e..24f7227aa815fcba9df01efaeec534f848efc579 100644 (file)
@@ -385,6 +385,8 @@ VkResult anv_EnumeratePhysicalDevices(
    } else if (*pPhysicalDeviceCount >= 1) {
       pPhysicalDevices[0] = anv_physical_device_to_handle(&instance->physicalDevice);
       *pPhysicalDeviceCount = 1;
+   } else if (*pPhysicalDeviceCount < instance->physicalDeviceCount) {
+      return VK_INCOMPLETE;
    } else {
       *pPhysicalDeviceCount = 0;
    }