Module: Mesa
Branch: main
Commit: 3007f8e95f34541cfd95faeb4f37b17d339de3a3
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3007f8e95f34541cfd95faeb4f37b17d339de3a3

Author: Jason Ekstrand <[email protected]>
Date:   Mon Feb  7 15:19:25 2022 -0600

anv: Don't call DestroyCommandBuffers in AllocateCommandBuffers

Reviewed-by: Lionel Landwerlin <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14917>

---

 src/intel/vulkan/anv_cmd_buffer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_cmd_buffer.c 
b/src/intel/vulkan/anv_cmd_buffer.c
index b06db9ac08f..924f966ebf1 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -261,6 +261,8 @@ anv_cmd_state_reset(struct anv_cmd_buffer *cmd_buffer)
    anv_cmd_state_init(cmd_buffer);
 }
 
+static void anv_cmd_buffer_destroy(struct anv_cmd_buffer *cmd_buffer);
+
 static VkResult anv_create_cmd_buffer(
     struct anv_device *                         device,
     struct anv_cmd_pool *                       pool,
@@ -339,8 +341,10 @@ VkResult anv_AllocateCommandBuffers(
    }
 
    if (result != VK_SUCCESS) {
-      anv_FreeCommandBuffers(_device, pAllocateInfo->commandPool,
-                             i, pCommandBuffers);
+      while (i--) {
+         ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, pCommandBuffers[i]);
+         anv_cmd_buffer_destroy(cmd_buffer);
+      }
       for (i = 0; i < pAllocateInfo->commandBufferCount; i++)
          pCommandBuffers[i] = VK_NULL_HANDLE;
    }

Reply via email to