radv: Return correct result in EnumeratePhysicalDevices
authorNicolas Koch <nioko1337@gmail.com>
Wed, 12 Oct 2016 11:55:46 +0000 (13:55 +0200)
committerDave Airlie <airlied@redhat.com>
Wed, 12 Oct 2016 23:11:13 +0000 (09:11 +1000)
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.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_device.c

index 6e06863f8eadab1ed0eb56c5d1714c519c3edd77..71b1481a5ae8f8873b1c8d0e7ed1720c9d0d6a49 100644 (file)
@@ -295,6 +295,8 @@ VkResult radv_EnumeratePhysicalDevices(
        } else if (*pPhysicalDeviceCount >= 1) {
                pPhysicalDevices[0] = radv_physical_device_to_handle(&instance->physicalDevice);
                *pPhysicalDeviceCount = 1;
+       } else if (*pPhysicalDeviceCount < instance->physicalDeviceCount) {
+               return VK_INCOMPLETE;
        } else {
                *pPhysicalDeviceCount = 0;
        }