diff --git a/gsk/vulkan/gskvulkandownloadop.c b/gsk/vulkan/gskvulkandownloadop.c index 756ba41c0a..1647eb0f55 100644 --- a/gsk/vulkan/gskvulkandownloadop.c +++ b/gsk/vulkan/gskvulkandownloadop.c @@ -33,10 +33,12 @@ gsk_vulkan_download_op_command_with_area (GskVulkanOp *op, const cairo_rectangle_int_t *area, GskVulkanBuffer **buffer) { + VkPipelineStageFlags stage; VkImageLayout image_layout; VkAccessFlags access; gsize stride; + stage = gsk_vulkan_image_get_vk_pipeline_stage (image); image_layout = gsk_vulkan_image_get_vk_image_layout (image); access = gsk_vulkan_image_get_vk_access (image); stride = area->width * gdk_memory_format_bytes_per_pixel (gsk_vulkan_image_get_format (image)); @@ -45,7 +47,7 @@ gsk_vulkan_download_op_command_with_area (GskVulkanOp *op, GSK_VULKAN_READ); vkCmdPipelineBarrier (command_buffer, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, + stage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, NULL, @@ -77,6 +79,7 @@ gsk_vulkan_download_op_command_with_area (GskVulkanOp *op, }, }); gsk_vulkan_image_set_vk_image_layout (image, + VK_PIPELINE_STAGE_TRANSFER_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_ACCESS_TRANSFER_READ_BIT); @@ -111,7 +114,7 @@ gsk_vulkan_download_op_command_with_area (GskVulkanOp *op, vkCmdPipelineBarrier (command_buffer, VK_PIPELINE_STAGE_TRANSFER_BIT, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, + stage, 0, 0, NULL, 0, NULL, @@ -133,7 +136,7 @@ gsk_vulkan_download_op_command_with_area (GskVulkanOp *op, }, }); - gsk_vulkan_image_set_vk_image_layout (image, image_layout, access); + gsk_vulkan_image_set_vk_image_layout (image, stage, image_layout, access); return op->next; } diff --git a/gsk/vulkan/gskvulkanimage.c b/gsk/vulkan/gskvulkanimage.c index a473e1a744..232cf8cc33 100644 --- a/gsk/vulkan/gskvulkanimage.c +++ b/gsk/vulkan/gskvulkanimage.c @@ -25,6 +25,7 @@ struct _GskVulkanImage VkImageView vk_image_view; VkFramebuffer vk_framebuffer; + VkPipelineStageFlags vk_pipeline_stage; VkImageLayout vk_image_layout; VkAccessFlags vk_access; @@ -662,6 +663,12 @@ gsk_vulkan_image_get_image_view (GskVulkanImage *self) return self->vk_image_view; } +VkPipelineStageFlags +gsk_vulkan_image_get_vk_pipeline_stage (GskVulkanImage *self) +{ + return self->vk_pipeline_stage; +} + VkImageLayout gsk_vulkan_image_get_vk_image_layout (GskVulkanImage *self) { @@ -675,10 +682,12 @@ gsk_vulkan_image_get_vk_access (GskVulkanImage *self) } void -gsk_vulkan_image_set_vk_image_layout (GskVulkanImage *self, - VkImageLayout image_layout, - VkAccessFlags access) +gsk_vulkan_image_set_vk_image_layout (GskVulkanImage *self, + VkPipelineStageFlags stage, + VkImageLayout image_layout, + VkAccessFlags access) { + self->vk_pipeline_stage = stage; self->vk_image_layout = image_layout; self->vk_access = access; } diff --git a/gsk/vulkan/gskvulkanimageprivate.h b/gsk/vulkan/gskvulkanimageprivate.h index 9f712b71bf..f91ce8ff8d 100644 --- a/gsk/vulkan/gskvulkanimageprivate.h +++ b/gsk/vulkan/gskvulkanimageprivate.h @@ -48,9 +48,11 @@ void gsk_vulkan_image_unmap (GskVulk gsize gsk_vulkan_image_get_width (GskVulkanImage *self); gsize gsk_vulkan_image_get_height (GskVulkanImage *self); +VkPipelineStageFlags gsk_vulkan_image_get_vk_pipeline_stage (GskVulkanImage *self); VkImageLayout gsk_vulkan_image_get_vk_image_layout (GskVulkanImage *self); VkAccessFlags gsk_vulkan_image_get_vk_access (GskVulkanImage *self); void gsk_vulkan_image_set_vk_image_layout (GskVulkanImage *self, + VkPipelineStageFlags stage, VkImageLayout image_layout, VkAccessFlags access); VkImage gsk_vulkan_image_get_vk_image (GskVulkanImage *self); diff --git a/gsk/vulkan/gskvulkanrenderpassop.c b/gsk/vulkan/gskvulkanrenderpassop.c index f01aa217a8..2cd99413d5 100644 --- a/gsk/vulkan/gskvulkanrenderpassop.c +++ b/gsk/vulkan/gskvulkanrenderpassop.c @@ -194,6 +194,7 @@ gsk_vulkan_render_pass_end_op_command (GskVulkanOp *op, vkCmdEndRenderPass (command_buffer); gsk_vulkan_image_set_vk_image_layout (self->image, + VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, self->final_layout, gsk_vulkan_image_get_vk_access (self->image)); return op->next; diff --git a/gsk/vulkan/gskvulkanuploadop.c b/gsk/vulkan/gskvulkanuploadop.c index ff66dff5c8..aa85688a84 100644 --- a/gsk/vulkan/gskvulkanuploadop.c +++ b/gsk/vulkan/gskvulkanuploadop.c @@ -80,6 +80,7 @@ gsk_vulkan_upload_op_command_with_area (GskVulkanOp *op, }, }); gsk_vulkan_image_set_vk_image_layout (image, + VK_PIPELINE_STAGE_TRANSFER_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_ACCESS_TRANSFER_WRITE_BIT); @@ -137,6 +138,7 @@ gsk_vulkan_upload_op_command_with_area (GskVulkanOp *op, }); gsk_vulkan_image_set_vk_image_layout (image, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_ACCESS_SHADER_READ_BIT); @@ -163,6 +165,7 @@ gsk_vulkan_upload_op_command (GskVulkanOp *op, *buffer = NULL; gsk_vulkan_image_set_vk_image_layout (image, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_ACCESS_SHADER_READ_BIT);