[Mesa-dev] [PATCH] anv: set command buffer to NULL when allocations fail

Jason Ekstrand jason at jlekstrand.net
Wed Jan 25 17:01:47 UTC 2017


On Wed, Jan 25, 2017 at 8:29 AM, Lionel Landwerlin <
lionel.g.landwerlin at intel.com> wrote:

> 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 <lionel.g.landwerlin at intel.com>
> ---
>  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 3a23048c47..5886fa63e6 100644
> --- a/src/intel/vulkan/anv_cmd_buffer.c
> +++ b/src/intel/vulkan/anv_cmd_buffer.c
> @@ -232,9 +232,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;
>

This could be memset...  I don't care that much.


> +   }
>
>     return result;
>  }
> --
> 2.11.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170125/b5159cab/attachment.html>


More information about the mesa-dev mailing list