Confusion about the implicit subpass dependencies

The specs say under 7.1 Render Pass Creation that if there is no subpass dependency specified, an implicit dependency exists. It is stated that the implicit dependency is analogous to the following for the dependency which synchronizes firstSubpass with whatever comes before:

VkSubpassDependency implicitDependency = {
    .srcSubpass = VK_SUBPASS_EXTERNAL;
    .dstSubpass = firstSubpass; // First subpass attachment is used in
    .srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
    .dstStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
    .srcAccessMask = 0;
    .dstAccessMask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT |
                     VK_ACCESS_COLOR_ATTACHMENT_READ_BIT |
                     VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT |
                     VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
                     VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
    .dependencyFlags = 0;
};

Now top of the pipe is stated as the source mask here. Doesn’t this mean that there is effectively no synchronization at all, because top of the pipe of whatever comes before is actually the beginning of whatever comes before, right? So the rest of whatever comes before would be allowed to overlap with my firstSubpass. Do I get this right?

Does all of that just mean that if you do not set up a subpass dependency, there will be no synchronization at all?

What I actually wanted to achieve in a framework that I am developing is a default dependency which is overaggressive in synchronization, i.e. it would synchronize the bottom of the pipe of whatever comes before with the top of the pipe of my firstSubpass. But with that, I have another difficulty. However, I think it is better to ask that in a separate question.

I just landed here while researching Vulkan synchronization. I’m not comfortable with Vulkan yet, so I can not provide a sure thing answer. But I think the dependencies are not limited to the renderpass. Maybe you have a compute job that you want finished before you render. As I said, I’m no expert, so here is my source:

That dependency says in english: "what is already available from something, will be made visible to the first subpass which use the resource.

Vulkan has dependency chaining, so srcStage = TOP is not necesserily the same as “no synchronization”. But I would be afraid to trigger some driver bug, going this untrodden path relying on the implicit dependency.

There’s hidden editor note in the spec explaining the reasoning of including it in the document:

So, because layout transitions are defined in respect to the Subpass Dependencies, the spec must include what happens with layouts if you supply no Dependency. It chose to describe it in a way as if there was those two implicit Dependencies supplied.

1 Like

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