vulkan: use cmd size array for queued cmd allocations
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Tue, 30 May 2023 15:11:21 +0000 (11:11 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 31 May 2023 03:13:22 +0000 (03:13 +0000)
minor simplification for consistency

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23322>

src/gallium/frontends/lavapipe/lvp_cmd_buffer.c
src/vulkan/util/vk_cmd_queue_gen.py

index 81d2b77..7a493e7 100644 (file)
@@ -112,7 +112,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetWithTemplateKHR(
    LVP_FROM_HANDLE(lvp_descriptor_update_template, templ, descriptorUpdateTemplate);
    size_t info_size = 0;
    struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
-                                              sizeof(*cmd), 8,
+                                              vk_cmd_queue_type_sizes[VK_CMD_PUSH_DESCRIPTOR_SET_WITH_TEMPLATE_KHR], 8,
                                               VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
    if (!cmd)
       return;
index de48866..3677a0e 100644 (file)
@@ -274,12 +274,7 @@ VkResult vk_enqueue_${to_underscore(c.name)}(struct vk_cmd_queue *queue
 % endfor
 )
 {
-   struct vk_cmd_queue_entry *cmd = vk_zalloc(queue->alloc,
-                                              sizeof(struct vk_cmd_queue_entry_base)
-% if len(c.params) > 1:
-                                              + sizeof(struct ${to_struct_name(c.name)})
-% endif
-                                              , 8,
+   struct vk_cmd_queue_entry *cmd = vk_zalloc(queue->alloc, vk_cmd_queue_type_sizes[${to_enum_name(c.name)}], 8,
                                               VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (!cmd) return VK_ERROR_OUT_OF_HOST_MEMORY;