diff --git a/gsk/gskvulkancommandpool.c b/gsk/gskvulkancommandpool.c index c2b974715a..bcba6a9fc1 100644 --- a/gsk/gskvulkancommandpool.c +++ b/gsk/gskvulkancommandpool.c @@ -75,33 +75,36 @@ gsk_vulkan_command_pool_get_buffer (GskVulkanCommandPool *self) void gsk_vulkan_command_pool_submit_buffer (GskVulkanCommandPool *self, VkCommandBuffer command_buffer, + gsize wait_semaphore_count, + VkSemaphore *wait_semaphores, + gsize signal_semaphore_count, + VkSemaphore *signal_semaphores, VkFence fence) { + VkPipelineStageFlags *wait_semaphore_flags = NULL; + GSK_VK_CHECK (vkEndCommandBuffer, command_buffer); + if (wait_semaphore_count > 0) + { + wait_semaphore_flags = alloca (sizeof (VkPipelineStageFlags) * wait_semaphore_count); + for (int i = 0; i < wait_semaphore_count; i++) + wait_semaphore_flags[i] = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; + } + GSK_VK_CHECK (vkQueueSubmit, gdk_vulkan_context_get_queue (self->vulkan), 1, &(VkSubmitInfo) { .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO, -/* - .waitSemaphoreCount = 1, - .pWaitSemaphores = (VkSemaphore[1]) { - gdk_vulkan_context_get_draw_semaphore (self->vulkan) - }, -*/ - .pWaitDstStageMask = (VkPipelineStageFlags []) { - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, - }, + .waitSemaphoreCount = wait_semaphore_count, + .pWaitSemaphores = wait_semaphores, + .pWaitDstStageMask = wait_semaphore_flags, .commandBufferCount = 1, .pCommandBuffers = (VkCommandBuffer[1]) { command_buffer }, -/* - .signalSemaphoreCount = 1, - .pSignalSemaphores = (VkSemaphore[1]) { - gdk_vulkan_context_get_draw_semaphore (self->vulkan) - } -*/ + .signalSemaphoreCount = signal_semaphore_count, + .pSignalSemaphores = signal_semaphores, }, fence); } diff --git a/gsk/gskvulkancommandpoolprivate.h b/gsk/gskvulkancommandpoolprivate.h index 037390812b..bb362f3fd9 100644 --- a/gsk/gskvulkancommandpoolprivate.h +++ b/gsk/gskvulkancommandpoolprivate.h @@ -15,6 +15,10 @@ void gsk_vulkan_command_pool_reset (GskVulk VkCommandBuffer gsk_vulkan_command_pool_get_buffer (GskVulkanCommandPool *self); void gsk_vulkan_command_pool_submit_buffer (GskVulkanCommandPool *self, VkCommandBuffer buffer, + gsize wait_semaphore_count, + VkSemaphore *wait_semaphores, + gsize signal_semaphores_count, + VkSemaphore *signal_semaphores, VkFence fence); G_END_DECLS diff --git a/gsk/gskvulkanimage.c b/gsk/gskvulkanimage.c index f64a3ac592..4ea8a44295 100644 --- a/gsk/gskvulkanimage.c +++ b/gsk/gskvulkanimage.c @@ -154,7 +154,7 @@ gsk_vulkan_uploader_upload (GskVulkanUploader *self) 0, NULL, self->before_buffer_barriers->len, (VkBufferMemoryBarrier *) self->before_buffer_barriers->data, self->before_image_barriers->len, (VkImageMemoryBarrier *) self->before_image_barriers->data); - gsk_vulkan_command_pool_submit_buffer (self->command_pool, command_buffer, VK_NULL_HANDLE); + gsk_vulkan_command_pool_submit_buffer (self->command_pool, command_buffer, 0, NULL, 0, NULL, VK_NULL_HANDLE); g_array_set_size (self->before_buffer_barriers, 0); g_array_set_size (self->before_image_barriers, 0); } @@ -176,7 +176,7 @@ gsk_vulkan_uploader_upload (GskVulkanUploader *self) if (self->copy_buffer != VK_NULL_HANDLE) { - gsk_vulkan_command_pool_submit_buffer (self->command_pool, self->copy_buffer, VK_NULL_HANDLE); + gsk_vulkan_command_pool_submit_buffer (self->command_pool, self->copy_buffer, 0, NULL, 0, NULL, VK_NULL_HANDLE); self->copy_buffer = VK_NULL_HANDLE; } } diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c index f87f4cc5da..58888667b5 100644 --- a/gsk/gskvulkanrender.c +++ b/gsk/gskvulkanrender.c @@ -594,7 +594,7 @@ gsk_vulkan_render_draw (GskVulkanRender *self, vkCmdEndRenderPass (command_buffer); } - gsk_vulkan_command_pool_submit_buffer (self->command_pool, command_buffer, self->fence); + gsk_vulkan_command_pool_submit_buffer (self->command_pool, command_buffer, 0, NULL, 0, NULL, self->fence); if (GSK_RENDER_MODE_CHECK (SYNC)) {