radv: ignore subpass self-dependencies
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 20 Nov 2018 12:48:34 +0000 (13:48 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 21 Nov 2018 09:02:59 +0000 (10:02 +0100)
Unnecessary as they allow the app to call vkCmdPipelineBarrier()
inside the render pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_pass.c

index 9cd1b31a0a03c8254093a4451e747c11bf274425..f8e5ea40954921ede53973bb4bfd478f6819b2d7 100644 (file)
@@ -337,7 +337,17 @@ 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;