mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
vulkan: Track the current pipeline stage of images
This way, we can in theory properly transition images because we know which stage to transition from. IN practice this is happening in future commits.
This commit is contained in:
parent
ef4930723b
commit
fee497f9e1
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user