From 80540be211adbc9e19c6cb95a1ddfddd890847a9 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Fri, 29 Sep 2017 14:15:13 +0200 Subject: vo_gpu: vulkan: properly depend on the swapchain acquire semaphore This is now associated with the ra_tex directly and used in the correct way, rather than hackily done from submit_frame. --- video/out/vulkan/ra_vk.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'video/out/vulkan/ra_vk.c') diff --git a/video/out/vulkan/ra_vk.c b/video/out/vulkan/ra_vk.c index 0ffd5097f5..1cfeb4a948 100644 --- a/video/out/vulkan/ra_vk.c +++ b/video/out/vulkan/ra_vk.c @@ -321,8 +321,16 @@ struct ra_tex_vk { // the signal guards reuse, and can be NULL struct vk_signal *sig; VkPipelineStageFlags sig_stage; + VkSemaphore ext_dep; // external semaphore, not owned by the ra_tex }; +void ra_tex_vk_external_dep(struct ra *ra, struct ra_tex *tex, VkSemaphore dep) +{ + struct ra_tex_vk *tex_vk = tex->priv; + assert(!tex_vk->ext_dep); + tex_vk->ext_dep = dep; +} + // Small helper to ease image barrier creation. if `discard` is set, the contents // of the image will be undefined after the barrier static void tex_barrier(struct ra *ra, struct vk_cmd *cmd, struct ra_tex *tex, @@ -332,6 +340,11 @@ static void tex_barrier(struct ra *ra, struct vk_cmd *cmd, struct ra_tex *tex, struct mpvk_ctx *vk = ra_vk_get(ra); struct ra_tex_vk *tex_vk = tex->priv; + if (tex_vk->ext_dep) { + vk_cmd_dep(cmd, tex_vk->ext_dep, stage); + tex_vk->ext_dep = NULL; + } + VkImageMemoryBarrier imgBarrier = { .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, .oldLayout = tex_vk->current_layout, -- cgit v1.2.3