The Render Pass dependency from the well-known Vulkan tutorial from Sascha Willems looks like this:
.srcSubpass = VK_SUBPASS_EXTERNAL;
.dstSubpass = 0;
.srcStageMask =
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
.srcAccessMask = 0;
.dstStageMask =
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
.dstAccessMask =
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT |
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
The question is, why do we specify EARLY_FRAGMENT stage in srcStageMask? We are waiting for the COLOR_ATTACHMENT stage to complete, which means that all earlier render stages (including EARLY_FRAGMENT) will also be completed - isn't that enough?
srcStageMask=EARLY_FRAGMENT_TESTSdoes seem odd for a source though. Depth/stencil is specified to be written atLATE_FRAGMENT_TESTS, so you can't safely "source" fromEARLYunless it's read-only, at which point you're not really sourcing anything because it must already be in memory.