Color attachment synchronization

I’m learning from the tutorial: Multisampling - Vulkan Tutorial. I’m using “frames in flight” and want to make sure I’ve synchronized access to the single color attachment correctly.

VkSubpassDependency dependency {
            .srcSubpass = VK_SUBPASS_EXTERNAL,
            .dstSubpass = 0,

            .srcStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT,
            .dstStageMask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT | VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT

            .srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
            .dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT
};

And there is one more question: Specification: "Within a subpass of a render pass instance, for a given (x,y,layer,sample) sample location, the following operations are guaranteed to execute in rasterization order, for each separate primitive that includes that sample location:

Fragment operations, in the order defined". Why do we need to synchronize access to color and depth attachments if the order is specified in the specification? Or after finishing and restarting a render pass it is no longer “Within a subpass of a render pass instance”?

If you are talking about a subpass dependency, then by definition, you are talking about something that happens between two subpasses (or a subpass and the world outside of the render pass instance). And therefore is not “within a subpass”.

Thank you! What about the first question?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.