vulkan/cmd_queue: Do not free if driver_free_cb is provided

Avoids crashes when the custom implementation allocates differently.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
This commit is contained in:
Konstantin Seurer
2025-07-24 16:06:19 +02:00
committed by Marge Bot
parent 9efb3ee511
commit c29db0965c
2 changed files with 11 additions and 3 deletions
+6
View File
@@ -88,6 +88,9 @@ vk_cmd_push_descriptor_set_with_template2_free(
vk_free(queue->alloc, (void *)pnext->pPushConstantRanges);
vk_free(queue->alloc, pnext);
}
vk_free(queue->alloc, (void *)info->pData);
vk_free(queue->alloc, info);
}
VKAPI_ATTR void VKAPI_CALL
@@ -756,6 +759,9 @@ vk_free_cmd_push_descriptor_set2(struct vk_cmd_queue *queue,
struct vk_cmd_queue_entry *cmd)
{
ralloc_free(cmd->driver_data);
vk_free(queue->alloc, (void *)cmd->u.push_descriptor_set2.push_descriptor_set_info->pDescriptorWrites);
vk_free(queue->alloc, cmd->u.push_descriptor_set2.push_descriptor_set_info);
}
VKAPI_ATTR void VKAPI_CALL vk_cmd_enqueue_CmdPushDescriptorSet2(
+5 -3
View File
@@ -329,10 +329,11 @@ vk_free_queue(struct vk_cmd_queue *queue)
{
struct vk_cmd_queue_entry *tmp, *cmd;
LIST_FOR_EACH_ENTRY_SAFE(cmd, tmp, &queue->cmds, cmd_link) {
if (cmd->driver_free_cb)
if (cmd->driver_free_cb) {
cmd->driver_free_cb(queue, cmd);
else
vk_free(queue->alloc, cmd->driver_data);
vk_free(queue->alloc, cmd);
continue;
}
switch(cmd->type) {
% for c in commands:
% if c.guard is not None:
@@ -348,6 +349,7 @@ vk_free_queue(struct vk_cmd_queue *queue)
case VK_CMD_TYPE_COUNT:
break;
}
vk_free(queue->alloc, cmd->driver_data);
vk_free(queue->alloc, cmd);
}
}