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

Author: Jason Ekstrand <[email protected]>
Date:   Wed Mar  9 14:15:58 2022 -0600

vulkan,lavapipe: Move some enqueue helpers to common code

Reviewed-by: Boris Brezillon <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>

---

 src/gallium/frontends/lavapipe/lvp_cmd_buffer.c | 159 -------------------
 src/gallium/frontends/lavapipe/lvp_execute.c    |   6 +-
 src/vulkan/runtime/meson.build                  |   1 +
 src/vulkan/runtime/vk_cmd_enqueue.c             | 196 ++++++++++++++++++++++++
 4 files changed, 200 insertions(+), 162 deletions(-)

diff --git a/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c 
b/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c
index 4c5e4ddb87e..18f9ad7fe16 100644
--- a/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c
+++ b/src/gallium/frontends/lavapipe/lvp_cmd_buffer.c
@@ -261,165 +261,6 @@ VKAPI_ATTR void VKAPI_CALL lvp_TrimCommandPool(
    list_inithead(&pool->free_cmd_buffers);
 }
 
-VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiEXT(
-    VkCommandBuffer                             commandBuffer,
-    uint32_t                                    drawCount,
-    const VkMultiDrawInfoEXT                   *pVertexInfo,
-    uint32_t                                    instanceCount,
-    uint32_t                                    firstInstance,
-    uint32_t                                    stride)
-{
-   LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
-
-   struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                              sizeof(*cmd), 8,
-                                              
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-   if (!cmd)
-      return;
-
-   cmd->type = VK_CMD_DRAW_MULTI_EXT;
-   list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
-
-   cmd->u.draw_multi_ext.draw_count = drawCount;
-   if (pVertexInfo) {
-      unsigned i = 0;
-      cmd->u.draw_multi_ext.vertex_info = 
vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                                    
sizeof(*cmd->u.draw_multi_ext.vertex_info) * drawCount,
-                                                    8,
-                                                    
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-      vk_foreach_multi_draw(draw, i, pVertexInfo, drawCount, stride)
-         memcpy(&cmd->u.draw_multi_ext.vertex_info[i], draw, 
sizeof(*cmd->u.draw_multi_ext.vertex_info));
-   }
-   cmd->u.draw_multi_ext.instance_count = instanceCount;
-   cmd->u.draw_multi_ext.first_instance = firstInstance;
-   cmd->u.draw_multi_ext.stride = stride;
-}
-
-VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiIndexedEXT(
-    VkCommandBuffer                             commandBuffer,
-    uint32_t                                    drawCount,
-    const VkMultiDrawIndexedInfoEXT            *pIndexInfo,
-    uint32_t                                    instanceCount,
-    uint32_t                                    firstInstance,
-    uint32_t                                    stride,
-    const int32_t                              *pVertexOffset)
-{
-   LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
-
-   struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                              sizeof(*cmd), 8,
-                                              
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-   if (!cmd)
-      return;
-
-   cmd->type = VK_CMD_DRAW_MULTI_INDEXED_EXT;
-   list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
-
-   cmd->u.draw_multi_indexed_ext.draw_count = drawCount;
-
-   if (pIndexInfo) {
-      unsigned i = 0;
-      cmd->u.draw_multi_indexed_ext.index_info = 
vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                                           
sizeof(*cmd->u.draw_multi_indexed_ext.index_info) * drawCount,
-                                                           8,
-                                                           
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-      vk_foreach_multi_draw_indexed(draw, i, pIndexInfo, drawCount, stride) {
-         cmd->u.draw_multi_indexed_ext.index_info[i].firstIndex = 
draw->firstIndex;
-         cmd->u.draw_multi_indexed_ext.index_info[i].indexCount = 
draw->indexCount;
-         if (pVertexOffset == NULL)
-            cmd->u.draw_multi_indexed_ext.index_info[i].vertexOffset = 
draw->vertexOffset;
-      }
-   }
-
-   cmd->u.draw_multi_indexed_ext.instance_count = instanceCount;
-   cmd->u.draw_multi_indexed_ext.first_instance = firstInstance;
-   cmd->u.draw_multi_indexed_ext.stride = stride;
-
-   if (pVertexOffset) {
-      cmd->u.draw_multi_indexed_ext.vertex_offset = 
vk_zalloc(cmd_buffer->vk.cmd_queue.alloc, 
sizeof(*cmd->u.draw_multi_indexed_ext.vertex_offset), 8, 
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-      memcpy(cmd->u.draw_multi_indexed_ext.vertex_offset, pVertexOffset, 
sizeof(*cmd->u.draw_multi_indexed_ext.vertex_offset));
-   }
-}
-
-VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetKHR(
-   VkCommandBuffer                             commandBuffer,
-   VkPipelineBindPoint                         pipelineBindPoint,
-   VkPipelineLayout                            layout,
-   uint32_t                                    set,
-   uint32_t                                    descriptorWriteCount,
-   const VkWriteDescriptorSet*                 pDescriptorWrites)
-{
-   LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
-   struct vk_cmd_push_descriptor_set_khr *pds;
-
-   struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                              sizeof(*cmd), 8,
-                                              
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-   if (!cmd)
-      return;
-
-   pds = &cmd->u.push_descriptor_set_khr;
-
-   cmd->type = VK_CMD_PUSH_DESCRIPTOR_SET_KHR;
-   list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
-
-   pds->pipeline_bind_point = pipelineBindPoint;
-   pds->layout = layout;
-   pds->set = set;
-   pds->descriptor_write_count = descriptorWriteCount;
-
-   if (pDescriptorWrites) {
-      pds->descriptor_writes = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                         sizeof(*pds->descriptor_writes) * 
descriptorWriteCount,
-                                         8,
-                                         VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-      memcpy(pds->descriptor_writes,
-             pDescriptorWrites,
-             sizeof(*pds->descriptor_writes) * descriptorWriteCount);
-
-      for (unsigned i = 0; i < descriptorWriteCount; i++) {
-         switch (pds->descriptor_writes[i].descriptorType) {
-         case VK_DESCRIPTOR_TYPE_SAMPLER:
-         case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
-         case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
-         case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
-         case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
-            pds->descriptor_writes[i].pImageInfo = 
vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                         sizeof(VkDescriptorImageInfo) * 
pds->descriptor_writes[i].descriptorCount,
-                                         8,
-                                         VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-            memcpy((VkDescriptorImageInfo 
*)pds->descriptor_writes[i].pImageInfo,
-                   pDescriptorWrites[i].pImageInfo,
-                   sizeof(VkDescriptorImageInfo) * 
pds->descriptor_writes[i].descriptorCount);
-            break;
-         case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
-         case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
-            pds->descriptor_writes[i].pTexelBufferView = 
vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                         sizeof(VkBufferView) * 
pds->descriptor_writes[i].descriptorCount,
-                                         8,
-                                         VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-            memcpy((VkBufferView *)pds->descriptor_writes[i].pTexelBufferView,
-                   pDescriptorWrites[i].pTexelBufferView,
-                   sizeof(VkBufferView) * 
pds->descriptor_writes[i].descriptorCount);
-            break;
-         case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
-         case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
-         case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
-         case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
-         default:
-            pds->descriptor_writes[i].pBufferInfo = 
vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                         sizeof(VkDescriptorBufferInfo) * 
pds->descriptor_writes[i].descriptorCount,
-                                         8,
-                                         VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
-            memcpy((VkDescriptorBufferInfo 
*)pds->descriptor_writes[i].pBufferInfo,
-                   pDescriptorWrites[i].pBufferInfo,
-                   sizeof(VkDescriptorBufferInfo) * 
pds->descriptor_writes[i].descriptorCount);
-            break;
-         }
-      }
-   }
-}
-
 VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetWithTemplateKHR(
    VkCommandBuffer                             commandBuffer,
    VkDescriptorUpdateTemplate                  descriptorUpdateTemplate,
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c 
b/src/gallium/frontends/lavapipe/lvp_execute.c
index 0c183e861f9..433df2cdb8e 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -3879,11 +3879,11 @@ void lvp_add_enqueue_cmd_entrypoints(struct 
vk_device_dispatch_table *disp)
    ENQUEUE_CMD(CmdBindVertexBuffers)
    ENQUEUE_CMD(CmdBindVertexBuffers2)
    ENQUEUE_CMD(CmdDraw)
-//   ENQUEUE_CMD(CmdDrawMultiEXT)
+   ENQUEUE_CMD(CmdDrawMultiEXT)
    ENQUEUE_CMD(CmdDrawIndexed)
    ENQUEUE_CMD(CmdDrawIndirect)
    ENQUEUE_CMD(CmdDrawIndexedIndirect)
-//   ENQUEUE_CMD(CmdDrawMultiIndexedEXT)
+   ENQUEUE_CMD(CmdDrawMultiIndexedEXT)
    ENQUEUE_CMD(CmdDispatch)
    ENQUEUE_CMD(CmdDispatchBase)
    ENQUEUE_CMD(CmdDispatchIndirect)
@@ -3919,7 +3919,7 @@ void lvp_add_enqueue_cmd_entrypoints(struct 
vk_device_dispatch_table *disp)
    ENQUEUE_CMD(CmdExecuteCommands)
    ENQUEUE_CMD(CmdDrawIndirectCount)
    ENQUEUE_CMD(CmdDrawIndexedIndirectCount)
-//   ENQUEUE_CMD(CmdPushDescriptorSetKHR)
+   ENQUEUE_CMD(CmdPushDescriptorSetKHR)
 //   ENQUEUE_CMD(CmdPushDescriptorSetWithTemplateKHR)
    ENQUEUE_CMD(CmdBindTransformFeedbackBuffersEXT)
    ENQUEUE_CMD(CmdBeginTransformFeedbackEXT)
diff --git a/src/vulkan/runtime/meson.build b/src/vulkan/runtime/meson.build
index b1fbef54deb..664f14d4fd3 100644
--- a/src/vulkan/runtime/meson.build
+++ b/src/vulkan/runtime/meson.build
@@ -25,6 +25,7 @@ vk_physical_device_features_gen_depend_files = [
 
 vulkan_runtime_files = files(
   'vk_cmd_copy.c',
+  'vk_cmd_enqueue.c',
   'vk_command_buffer.c',
   'vk_command_buffer.h',
   'vk_command_pool.c',
diff --git a/src/vulkan/runtime/vk_cmd_enqueue.c 
b/src/vulkan/runtime/vk_cmd_enqueue.c
new file mode 100644
index 00000000000..b54f90edbb6
--- /dev/null
+++ b/src/vulkan/runtime/vk_cmd_enqueue.c
@@ -0,0 +1,196 @@
+/*
+ * Copyright © 2019 Red Hat.
+ * Copyright © 2022 Collabora, LTD
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "vk_alloc.h"
+#include "vk_cmd_enqueue_entrypoints.h"
+#include "vk_command_buffer.h"
+#include "vk_util.h"
+
+VKAPI_ATTR void VKAPI_CALL
+vk_cmd_enqueue_CmdDrawMultiEXT(VkCommandBuffer commandBuffer,
+                               uint32_t drawCount,
+                               const VkMultiDrawInfoEXT *pVertexInfo,
+                               uint32_t instanceCount,
+                               uint32_t firstInstance,
+                               uint32_t stride)
+{
+   VK_FROM_HANDLE(vk_command_buffer, cmd_buffer, commandBuffer);
+
+   struct vk_cmd_queue_entry *cmd =
+      vk_zalloc(cmd_buffer->cmd_queue.alloc, sizeof(*cmd), 8,
+                VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+   if (!cmd)
+      return;
+
+   cmd->type = VK_CMD_DRAW_MULTI_EXT;
+   list_addtail(&cmd->cmd_link, &cmd_buffer->cmd_queue.cmds);
+
+   cmd->u.draw_multi_ext.draw_count = drawCount;
+   if (pVertexInfo) {
+      unsigned i = 0;
+      cmd->u.draw_multi_ext.vertex_info =
+         vk_zalloc(cmd_buffer->cmd_queue.alloc,
+                   sizeof(*cmd->u.draw_multi_ext.vertex_info) * drawCount, 8,
+                   VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+
+      vk_foreach_multi_draw(draw, i, pVertexInfo, drawCount, stride) {
+         memcpy(&cmd->u.draw_multi_ext.vertex_info[i], draw,
+                sizeof(*cmd->u.draw_multi_ext.vertex_info));
+      }
+   }
+   cmd->u.draw_multi_ext.instance_count = instanceCount;
+   cmd->u.draw_multi_ext.first_instance = firstInstance;
+   cmd->u.draw_multi_ext.stride = stride;
+}
+
+VKAPI_ATTR void VKAPI_CALL
+vk_cmd_enqueue_CmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer,
+                                      uint32_t drawCount,
+                                      const VkMultiDrawIndexedInfoEXT 
*pIndexInfo,
+                                      uint32_t instanceCount,
+                                      uint32_t firstInstance,
+                                      uint32_t stride,
+                                      const int32_t *pVertexOffset)
+{
+   VK_FROM_HANDLE(vk_command_buffer, cmd_buffer, commandBuffer);
+
+   struct vk_cmd_queue_entry *cmd =
+      vk_zalloc(cmd_buffer->cmd_queue.alloc, sizeof(*cmd), 8,
+                VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+   if (!cmd)
+      return;
+
+   cmd->type = VK_CMD_DRAW_MULTI_INDEXED_EXT;
+   list_addtail(&cmd->cmd_link, &cmd_buffer->cmd_queue.cmds);
+
+   cmd->u.draw_multi_indexed_ext.draw_count = drawCount;
+
+   if (pIndexInfo) {
+      unsigned i = 0;
+      cmd->u.draw_multi_indexed_ext.index_info =
+         vk_zalloc(cmd_buffer->cmd_queue.alloc,
+                   sizeof(*cmd->u.draw_multi_indexed_ext.index_info) * 
drawCount, 8,
+                   VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+
+      vk_foreach_multi_draw_indexed(draw, i, pIndexInfo, drawCount, stride) {
+         cmd->u.draw_multi_indexed_ext.index_info[i].firstIndex = 
draw->firstIndex;
+         cmd->u.draw_multi_indexed_ext.index_info[i].indexCount = 
draw->indexCount;
+         if (pVertexOffset == NULL)
+            cmd->u.draw_multi_indexed_ext.index_info[i].vertexOffset = 
draw->vertexOffset;
+      }
+   }
+
+   cmd->u.draw_multi_indexed_ext.instance_count = instanceCount;
+   cmd->u.draw_multi_indexed_ext.first_instance = firstInstance;
+   cmd->u.draw_multi_indexed_ext.stride = stride;
+
+   if (pVertexOffset) {
+      cmd->u.draw_multi_indexed_ext.vertex_offset =
+         vk_zalloc(cmd_buffer->cmd_queue.alloc,
+                   sizeof(*cmd->u.draw_multi_indexed_ext.vertex_offset), 8,
+                   VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+
+      memcpy(cmd->u.draw_multi_indexed_ext.vertex_offset, pVertexOffset,
+             sizeof(*cmd->u.draw_multi_indexed_ext.vertex_offset));
+   }
+}
+
+VKAPI_ATTR void VKAPI_CALL
+vk_cmd_enqueue_CmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer,
+                                       VkPipelineBindPoint pipelineBindPoint,
+                                       VkPipelineLayout layout,
+                                       uint32_t set,
+                                       uint32_t descriptorWriteCount,
+                                       const VkWriteDescriptorSet 
*pDescriptorWrites)
+{
+   VK_FROM_HANDLE(vk_command_buffer, cmd_buffer, commandBuffer);
+   struct vk_cmd_push_descriptor_set_khr *pds;
+
+   struct vk_cmd_queue_entry *cmd =
+      vk_zalloc(cmd_buffer->cmd_queue.alloc, sizeof(*cmd), 8,
+                VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+   if (!cmd)
+      return;
+
+   pds = &cmd->u.push_descriptor_set_khr;
+
+   cmd->type = VK_CMD_PUSH_DESCRIPTOR_SET_KHR;
+   list_addtail(&cmd->cmd_link, &cmd_buffer->cmd_queue.cmds);
+
+   pds->pipeline_bind_point = pipelineBindPoint;
+   pds->layout = layout;
+   pds->set = set;
+   pds->descriptor_write_count = descriptorWriteCount;
+
+   if (pDescriptorWrites) {
+      pds->descriptor_writes =
+         vk_zalloc(cmd_buffer->cmd_queue.alloc,
+                   sizeof(*pds->descriptor_writes) * descriptorWriteCount, 8,
+                   VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+      memcpy(pds->descriptor_writes,
+             pDescriptorWrites,
+             sizeof(*pds->descriptor_writes) * descriptorWriteCount);
+
+      for (unsigned i = 0; i < descriptorWriteCount; i++) {
+         switch (pds->descriptor_writes[i].descriptorType) {
+         case VK_DESCRIPTOR_TYPE_SAMPLER:
+         case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
+         case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
+         case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
+         case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
+            pds->descriptor_writes[i].pImageInfo =
+               vk_zalloc(cmd_buffer->cmd_queue.alloc,
+                         sizeof(VkDescriptorImageInfo) * 
pds->descriptor_writes[i].descriptorCount, 8,
+                         VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+            memcpy((VkDescriptorImageInfo 
*)pds->descriptor_writes[i].pImageInfo,
+                   pDescriptorWrites[i].pImageInfo,
+                   sizeof(VkDescriptorImageInfo) * 
pds->descriptor_writes[i].descriptorCount);
+            break;
+         case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
+         case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
+            pds->descriptor_writes[i].pTexelBufferView =
+               vk_zalloc(cmd_buffer->cmd_queue.alloc,
+                         sizeof(VkBufferView) * 
pds->descriptor_writes[i].descriptorCount, 8,
+                         VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+            memcpy((VkBufferView *)pds->descriptor_writes[i].pTexelBufferView,
+                   pDescriptorWrites[i].pTexelBufferView,
+                   sizeof(VkBufferView) * 
pds->descriptor_writes[i].descriptorCount);
+            break;
+         case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
+         case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
+         case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
+         case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
+         default:
+            pds->descriptor_writes[i].pBufferInfo =
+               vk_zalloc(cmd_buffer->cmd_queue.alloc,
+                         sizeof(VkDescriptorBufferInfo) * 
pds->descriptor_writes[i].descriptorCount, 8,
+                         VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
+            memcpy((VkDescriptorBufferInfo 
*)pds->descriptor_writes[i].pBufferInfo,
+                   pDescriptorWrites[i].pBufferInfo,
+                   sizeof(VkDescriptorBufferInfo) * 
pds->descriptor_writes[i].descriptorCount);
+            break;
+         }
+      }
+   }
+}

Reply via email to