diff options
author | Samuel Pitoiset <[email protected]> | 2019-01-29 22:18:57 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-02-04 13:19:14 +0100 |
commit | 1e810f1c53fa25f764e3f9aeaa34a931a527f8d1 (patch) | |
tree | c844ae1cbc8e0fe4ed4ba78e0e5afdc047ff76b5 /src/amd/vulkan | |
parent | 2472907563487a3ce6a75ccd7370bcf9d001dd8f (diff) |
radv: add radv_render_pass_add_subpass_dep() helper
To share common code that handles subpass dependencies.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan')
-rw-r--r-- | src/amd/vulkan/radv_pass.c | 78 |
1 files changed, 38 insertions, 40 deletions
diff --git a/src/amd/vulkan/radv_pass.c b/src/amd/vulkan/radv_pass.c index 3ccc877b9c7..b5b06b75b92 100644 --- a/src/amd/vulkan/radv_pass.c +++ b/src/amd/vulkan/radv_pass.c @@ -29,6 +29,31 @@ #include "vk_util.h" static void +radv_render_pass_add_subpass_dep(struct radv_render_pass *pass, + const VkSubpassDependency2KHR *dep) +{ + uint32_t src = dep->srcSubpass; + uint32_t dst = dep->dstSubpass; + + /* Ignore subpass self-dependencies as they allow the app to call + * vkCmdPipelineBarrier() inside the render pass and the driver should + * only do the barrier when called, not when starting the render pass. + */ + if (src == dst) + return; + + if (dst == VK_SUBPASS_EXTERNAL) { + pass->end_barrier.src_stage_mask = dep->srcStageMask; + pass->end_barrier.src_access_mask = dep->srcAccessMask; + pass->end_barrier.dst_access_mask = dep->dstAccessMask; + } else { + pass->subpasses[dst].start_barrier.src_stage_mask = dep->srcStageMask; + pass->subpasses[dst].start_barrier.src_access_mask = dep->srcAccessMask; + pass->subpasses[dst].start_barrier.dst_access_mask = dep->dstAccessMask; + } +} + +static void radv_render_pass_compile(struct radv_render_pass *pass) { for (uint32_t i = 0; i < pass->subpass_count; i++) { @@ -235,26 +260,17 @@ VkResult radv_CreateRenderPass( } for (unsigned i = 0; i < pCreateInfo->dependencyCount; ++i) { - uint32_t src = pCreateInfo->pDependencies[i].srcSubpass; - uint32_t dst = pCreateInfo->pDependencies[i].dstSubpass; - - /* Ignore subpass self-dependencies as they allow the app to - * call vkCmdPipelineBarrier() inside the render pass and the - * driver should only do the barrier when called, not when - * starting the render pass. - */ - if (src == dst) - continue; - - if (dst == VK_SUBPASS_EXTERNAL) { - pass->end_barrier.src_stage_mask = pCreateInfo->pDependencies[i].srcStageMask; - pass->end_barrier.src_access_mask = pCreateInfo->pDependencies[i].srcAccessMask; - pass->end_barrier.dst_access_mask = pCreateInfo->pDependencies[i].dstAccessMask; - } else { - pass->subpasses[dst].start_barrier.src_stage_mask = pCreateInfo->pDependencies[i].srcStageMask; - pass->subpasses[dst].start_barrier.src_access_mask = pCreateInfo->pDependencies[i].srcAccessMask; - pass->subpasses[dst].start_barrier.dst_access_mask = pCreateInfo->pDependencies[i].dstAccessMask; - } + /* 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, + }; + radv_render_pass_add_subpass_dep(pass, &dep2); } radv_render_pass_compile(pass); @@ -391,26 +407,8 @@ VkResult radv_CreateRenderPass2KHR( } for (unsigned i = 0; i < pCreateInfo->dependencyCount; ++i) { - uint32_t src = pCreateInfo->pDependencies[i].srcSubpass; - uint32_t dst = pCreateInfo->pDependencies[i].dstSubpass; - - /* Ignore subpass self-dependencies as they allow the app to - * call vkCmdPipelineBarrier() inside the render pass and the - * driver should only do the barrier when called, not when - * starting the render pass. - */ - if (src == dst) - continue; - - if (dst == VK_SUBPASS_EXTERNAL) { - pass->end_barrier.src_stage_mask = pCreateInfo->pDependencies[i].srcStageMask; - pass->end_barrier.src_access_mask = pCreateInfo->pDependencies[i].srcAccessMask; - pass->end_barrier.dst_access_mask = pCreateInfo->pDependencies[i].dstAccessMask; - } else { - pass->subpasses[dst].start_barrier.src_stage_mask = pCreateInfo->pDependencies[i].srcStageMask; - pass->subpasses[dst].start_barrier.src_access_mask = pCreateInfo->pDependencies[i].srcAccessMask; - pass->subpasses[dst].start_barrier.dst_access_mask = pCreateInfo->pDependencies[i].dstAccessMask; - } + radv_render_pass_add_subpass_dep(pass, + &pCreateInfo->pDependencies[i]); } radv_render_pass_compile(pass); |