[gtk+/wip/matthiasc/renderpasses: 2/6] Add semaphores to the command buffer submit api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/renderpasses: 2/6] Add semaphores to the command buffer submit api
- Date: Thu, 28 Sep 2017 03:24:25 +0000 (UTC)
commit ff111b3f4f79bd9423a2095a050deabfafae4d56
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Sep 27 20:09:35 2017 -0400
Add semaphores to the command buffer submit api
This will be used in the future.
Update all callers to pass no semaphores.
gsk/gskvulkancommandpool.c | 33 ++++++++++++++++++---------------
gsk/gskvulkancommandpoolprivate.h | 4 ++++
gsk/gskvulkanimage.c | 4 ++--
gsk/gskvulkanrender.c | 2 +-
4 files changed, 25 insertions(+), 18 deletions(-)
---
diff --git a/gsk/gskvulkancommandpool.c b/gsk/gskvulkancommandpool.c
index c2b9747..bcba6a9 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 0373908..bb362f3 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 f64a3ac..4ea8a44 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 f87f4cc..5888866 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))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]