From f69b8510ba0f6d24e32ffec9f3f8d0fef9dcfd12 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Wed, 25 Jan 2017 16:22:40 +0000 Subject: [PATCH] anv: set command buffer to NULL when allocations fail The spec section 5.2 says: "vkAllocateCommandBuffers can be used to create multiple command buffers. If the creation of any of those command buffers fails, the implementation must destroy all successfully created command buffer objects from this command, set all entries of the pCommandBuffers array to VK_NULL_HANDLE and return the error." Fixes: dEQP-VK.api.object_management.alloc_callback_fail_multiple.command_buffer_primary dEQP-VK.api.object_management.alloc_callback_fail_multiple.command_buffer_secondary Signed-off-by: Lionel Landwerlin Reviewed-by: Jason Ekstrand Cc: "13.0 17.0" (cherry picked from commit 25e21cb8d065799888e0c5db80b0e616ffddc560) --- src/intel/vulkan/anv_cmd_buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c index 44ae67d0191..994aec99681 100644 --- a/src/intel/vulkan/anv_cmd_buffer.c +++ b/src/intel/vulkan/anv_cmd_buffer.c @@ -288,9 +288,12 @@ VkResult anv_AllocateCommandBuffers( break; } - if (result != VK_SUCCESS) + if (result != VK_SUCCESS) { anv_FreeCommandBuffers(_device, pAllocateInfo->commandPool, i, pCommandBuffers); + for (i = 0; i < pAllocateInfo->commandBufferCount; i++) + pCommandBuffers[i] = VK_NULL_HANDLE; + } return result; }