radv: Fix descriptor set allocation failure.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 30 Jul 2019 20:23:02 +0000 (22:23 +0200)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tue, 30 Jul 2019 20:33:24 +0000 (22:33 +0200)
Set all the handles to VK_NULL_HANDLE:

"If the creation of any of those descriptor sets fails, then the implementation
must destroy all successfully created descriptor set objects from this command,
set all entries of the pDescriptorSets array to VK_NULL_HANDLE and return the
error."

(Vulkan 1.1.117 Spec, section 13.2)

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_descriptor_set.c

index 7d3e6812b4e9d9ee96f7d2d0fdc230c2a9358f25..6f999a4595b27dca7f631c827c2db81507e3575b 100644 (file)
@@ -796,9 +796,13 @@ VkResult radv_AllocateDescriptorSets(
                pDescriptorSets[i] = radv_descriptor_set_to_handle(set);
        }
 
-       if (result != VK_SUCCESS)
+       if (result != VK_SUCCESS) {
                radv_FreeDescriptorSets(_device, pAllocateInfo->descriptorPool,
                                        i, pDescriptorSets);
+               for (i = 0; i < pAllocateInfo->descriptorSetCount; i++) {
+                       pDescriptorSets[i] = VK_NULL_HANDLE;
+               }
+       }
        return result;
 }