Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fe21f68 authored by Ian Elliott's avatar Ian Elliott Committed by Jesse Hall
Browse files

Fix Vulkan null_driver's EnumeratePhysicalDevices()

Counter to the Vulkan spec, the EnumeratePhysicalDevices() function was always
setting the count to 1, even when it didn't write anything.  This caused a
crash with the "dEQP-VK.api.info.instance.physical_devices" test case of the
Vulkan CTS v1.0.2.

Test: Run Vulkan CTS v1.0.2 (doesn't crash right away)
Change-Id: I1b7ba9f11229197efb825d8d0ad1b9ad88f029fb
parent c1e25bd5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -343,9 +343,14 @@ void DestroyInstance(VkInstance instance,
VkResult EnumeratePhysicalDevices(VkInstance instance,
                                  uint32_t* physical_device_count,
                                  VkPhysicalDevice* physical_devices) {
    if (physical_devices && *physical_device_count >= 1)
    if (!physical_devices)
        *physical_device_count = 1;
    else if (*physical_device_count == 0)
        return VK_INCOMPLETE;
    else {
        physical_devices[0] = &instance->physical_device;
        *physical_device_count = 1;
    }
    return VK_SUCCESS;
}