debug_printf("vkBeginCommandBuffer failed\n");
}
-static bool
-submit_cmdbuf(struct zink_context *ctx, VkCommandBuffer cmdbuf, VkFence fence)
+void
+zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
{
+ if (vkEndCommandBuffer(batch->cmdbuf) != VK_SUCCESS) {
+ debug_printf("vkEndCommandBuffer failed\n");
+ return;
+ }
+
+ assert(batch->fence == NULL);
+ batch->fence = zink_create_fence(ctx->base.screen);
+ if (!batch->fence)
+ return;
+
VkPipelineStageFlags wait = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
VkSubmitInfo si = {};
si.pSignalSemaphores = NULL;
si.pWaitDstStageMask = &wait;
si.commandBufferCount = 1;
- si.pCommandBuffers = &cmdbuf;
+ si.pCommandBuffers = &batch->cmdbuf;
- if (vkQueueSubmit(ctx->queue, 1, &si, fence) != VK_SUCCESS) {
+ if (vkQueueSubmit(ctx->queue, 1, &si, batch->fence->fence) != VK_SUCCESS)
debug_printf("vkQueueSubmit failed\n");
- return false;
- }
-
- return true;
-}
-
-void
-zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
-{
- if (vkEndCommandBuffer(batch->cmdbuf) != VK_SUCCESS) {
- debug_printf("vkEndCommandBuffer failed\n");
- return;
- }
-
- assert(batch->fence == NULL);
- batch->fence = zink_create_fence(ctx->base.screen);
- if (!batch->fence ||
- !submit_cmdbuf(ctx, batch->cmdbuf, batch->fence->fence))
- return;
}
void