From 144626946e18d34111d4cc3013771cbc3bb8e740 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 24 Apr 2018 12:57:39 -0700 Subject: [PATCH] anv/pass: Move some dependency setup into a helper This new helper takes a VkSubpassDependency2KHR for future-proofing. Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_pass.c | 52 ++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c index fe9b3d69819..b70de87a82b 100644 --- a/src/intel/vulkan/anv_pass.c +++ b/src/intel/vulkan/anv_pass.c @@ -25,6 +25,29 @@ #include "vk_util.h" +static void +anv_render_pass_add_subpass_dep(struct anv_render_pass *pass, + const VkSubpassDependency2KHR *dep) +{ + if (dep->dstSubpass == VK_SUBPASS_EXTERNAL) { + pass->subpass_flushes[pass->subpass_count] |= + anv_pipe_invalidate_bits_for_access_flags(dep->dstAccessMask); + } else { + assert(dep->dstSubpass < pass->subpass_count); + pass->subpass_flushes[dep->dstSubpass] |= + anv_pipe_invalidate_bits_for_access_flags(dep->dstAccessMask); + } + + if (dep->srcSubpass == VK_SUBPASS_EXTERNAL) { + pass->subpass_flushes[0] |= + anv_pipe_flush_bits_for_access_flags(dep->srcAccessMask); + } else { + assert(dep->srcSubpass < pass->subpass_count); + pass->subpass_flushes[dep->srcSubpass + 1] |= + anv_pipe_flush_bits_for_access_flags(dep->srcAccessMask); + } +} + /* Do a second "compile" step on a render pass */ static void anv_render_pass_compile(struct anv_render_pass *pass) @@ -223,24 +246,17 @@ VkResult anv_CreateRenderPass( } for (uint32_t i = 0; i < pCreateInfo->dependencyCount; i++) { - const VkSubpassDependency *dep = &pCreateInfo->pDependencies[i]; - if (dep->dstSubpass == VK_SUBPASS_EXTERNAL) { - pass->subpass_flushes[pass->subpass_count] |= - anv_pipe_invalidate_bits_for_access_flags(dep->dstAccessMask); - } else { - assert(dep->dstSubpass < pass->subpass_count); - pass->subpass_flushes[dep->dstSubpass] |= - anv_pipe_invalidate_bits_for_access_flags(dep->dstAccessMask); - } - - if (dep->srcSubpass == VK_SUBPASS_EXTERNAL) { - pass->subpass_flushes[0] |= - anv_pipe_flush_bits_for_access_flags(dep->srcAccessMask); - } else { - assert(dep->srcSubpass < pass->subpass_count); - pass->subpass_flushes[dep->srcSubpass + 1] |= - anv_pipe_flush_bits_for_access_flags(dep->srcAccessMask); - } + /* Convert to a Dependency2KHR */ + struct VkSubpassDependency2KHR dep2 = { + .srcSubpass = pCreateInfo->pDependencies[i].srcSubpass, + .dstSubpass = pCreateInfo->pDependencies[i].dstSubpass, + .srcStageMask = pCreateInfo->pDependencies[i].srcStageMask, + .dstStageMask = pCreateInfo->pDependencies[i].dstStageMask, + .srcAccessMask = pCreateInfo->pDependencies[i].srcAccessMask, + .dstAccessMask = pCreateInfo->pDependencies[i].dstAccessMask, + .dependencyFlags = pCreateInfo->pDependencies[i].dependencyFlags, + }; + anv_render_pass_add_subpass_dep(pass, &dep2); } /* From the Vulkan 1.0.39 spec: -- 2.30.2