vulkan/queue: Split vk_queue_submit into create and submit

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25576>
This commit is contained in:
Faith Ekstrand
2023-10-05 18:59:35 -05:00
committed by Marge Bot
parent f0392779d9
commit c3bf1a67a1

View File

@@ -803,10 +803,10 @@ struct vulkan_submit_info {
};
static VkResult
vk_queue_submit(struct vk_queue *queue,
const struct vulkan_submit_info *info)
vk_queue_submit_create(struct vk_queue *queue,
const struct vulkan_submit_info *info,
struct vk_queue_submit **submit_out)
{
struct vk_device *device = queue->base.device;
VkResult result;
uint32_t sparse_memory_bind_entry_count = 0;
uint32_t sparse_memory_image_bind_entry_count = 0;
@@ -889,6 +889,22 @@ vk_queue_submit(struct vk_queue *queue,
assert(signal_count == submit->signal_count);
*submit_out = submit;
return VK_SUCCESS;
fail:
vk_queue_submit_destroy(queue, submit);
return result;
}
static VkResult
vk_queue_submit(struct vk_queue *queue,
struct vk_queue_submit *submit)
{
struct vk_device *device = queue->base.device;
VkResult result;
/* If this device supports threaded submit, we can't rely on the client
* ordering requirements to ensure submits happen in the right order. Even
* if this queue doesn't have a submit thread, another queue (possibly in a
@@ -1231,7 +1247,12 @@ vk_common_QueueSubmit2(VkQueue _queue,
.signals = pSubmits[i].pSignalSemaphoreInfos,
.fence = i == submitCount - 1 ? fence : NULL
};
VkResult result = vk_queue_submit(queue, &info);
struct vk_queue_submit *submit;
VkResult result = vk_queue_submit_create(queue, &info, &submit);
if (unlikely(result != VK_SUCCESS))
return result;
result = vk_queue_submit(queue, submit);
if (unlikely(result != VK_SUCCESS))
return result;
}
@@ -1333,7 +1354,10 @@ vk_common_QueueBindSparse(VkQueue _queue,
.image_binds = pBindInfo[i].pImageBinds,
.fence = i == bindInfoCount - 1 ? fence : NULL
};
VkResult result = vk_queue_submit(queue, &info);
struct vk_queue_submit *submit;
VkResult result = vk_queue_submit_create(queue, &info, &submit);
if (likely(result == VK_SUCCESS))
result = vk_queue_submit(queue, submit);
STACK_ARRAY_FINISH(wait_semaphore_infos);
STACK_ARRAY_FINISH(signal_semaphore_infos);