VkSubpassDependency
The VkSubpassDependency
structure is defined as:
typedef struct VkSubpassDependency {
uint32_t srcSubpass;
uint32_t dstSubpass;
VkPipelineStageFlags srcStageMask;
VkPipelineStageFlags dstStageMask;
VkAccessFlags srcAccessMask;
VkAccessFlags dstAccessMask;
VkDependencyFlags dependencyFlags;
} VkSubpassDependency;
srcSubpass
is the subpass index of the first subpass in the dependency, orVK_SUBPASS_EXTERNAL
.dstSubpass
is the subpass index of the second subpass in the dependency, orVK_SUBPASS_EXTERNAL
.srcStageMask
is a bitmask of VkPipelineStageFlagBits specifying the source stage mask.dstStageMask
is a bitmask of VkPipelineStageFlagBits specifying the destination stage masksrcAccessMask
is a bitmask of VkAccessFlagBits specifying a source access mask.dstAccessMask
is a bitmask of VkAccessFlagBits specifying a destination access mask.dependencyFlags
is a bitmask of VkDependencyFlagBits.
If srcSubpass
is equal to dstSubpass
then the
VkSubpassDependency does not directly define a
dependency.
Instead, it enables pipeline barriers to be used in a render pass instance
within the identified subpass, where the scopes of one pipeline barrier
must be a subset of those described by one subpass dependency.
Subpass dependencies specified in this way that include
framebuffer-space stages in the
srcStageMask
must only include
framebuffer-space stages in
dstStageMask
, and must include VK_DEPENDENCY_BY_REGION_BIT
.
When a subpass dependency is specified in this way for a subpass that has
more than one view in its view mask, its dependencyFlags
must include
VK_DEPENDENCY_VIEW_LOCAL_BIT
.
If srcSubpass
and dstSubpass
are not equal, when a render pass
instance which includes a subpass dependency is submitted to a queue, it
defines a dependency between the subpasses
identified by srcSubpass
and dstSubpass
.
If srcSubpass
is equal to VK_SUBPASS_EXTERNAL
, the first
synchronization scope includes
commands that occur earlier in submission
order than the vkCmdBeginRenderPass used to begin the render pass
instance.
Otherwise, the first set of commands includes all commands submitted as part
of the subpass instance identified by srcSubpass
and any
load, store, or multisample resolve
operations on attachments used in srcSubpass
.
In either case, the first synchronization scope is limited to operations on
the pipeline stages determined by the
source stage mask specified by
srcStageMask
.
If dstSubpass
is equal to VK_SUBPASS_EXTERNAL
, the second
synchronization scope includes
commands that occur later in submission
order than the vkCmdEndRenderPass used to end the render pass
instance.
Otherwise, the second set of commands includes all commands submitted as
part of the subpass instance identified by dstSubpass
and any
load, store, and multisample resolve
operations on attachments used in dstSubpass
.
In either case, the second synchronization scope is limited to operations on
the pipeline stages determined by the
destination stage mask specified
by dstStageMask
.
The first access scope is
limited to accesses in the pipeline stages determined by the
source stage mask specified by
srcStageMask
.
It is also limited to access types in the source access mask specified by srcAccessMask
.
The second access scope is
limited to accesses in the pipeline stages determined by the
destination stage mask specified
by dstStageMask
.
It is also limited to access types in the destination access mask specified by dstAccessMask
.
The availability and visibility operations defined by a subpass dependency affect the execution of image layout transitions within the render pass.
For non-attachment resources, the memory dependency expressed by subpass
dependency is nearly identical to that of a VkMemoryBarrier (with
matching srcAccessMask
and dstAccessMask
parameters) submitted
as a part of a vkCmdPipelineBarrier (with matching srcStageMask
and dstStageMask
parameters).
The only difference being that its scopes are limited to the identified
subpasses rather than potentially affecting everything before and after.
For attachments however, subpass dependencies work more like a
VkImageMemoryBarrier defined similarly to the VkMemoryBarrier
above, the queue family indices set to VK_QUEUE_FAMILY_IGNORED
, and
layouts as follows:
- The equivalent to
oldLayout
is the attachment’s layout according to the subpass description forsrcSubpass
. - The equivalent to
newLayout
is the attachment’s layout according to the subpass description fordstSubpass
.
Valid Usage
VUID-VkSubpassDependency-srcStageMask-04090
If the geometryShader
feature is not
enabled, srcStageMask
must not contain
VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT
VUID-VkSubpassDependency-srcStageMask-04091
If the tessellationShader
feature
is not enabled, srcStageMask
must not contain
VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT
or
VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT
VUID-VkSubpassDependency-srcStageMask-04092
If the conditionalRendering
feature is not enabled, srcStageMask
must not contain
VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT
VUID-VkSubpassDependency-srcStageMask-04093
If the fragmentDensityMap
feature
is not enabled, srcStageMask
must not contain
VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT
VUID-VkSubpassDependency-srcStageMask-04094
If the transformFeedback
feature
is not enabled, srcStageMask
must not contain
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT
VUID-VkSubpassDependency-srcStageMask-04095
If the meshShader
feature is not enabled,
srcStageMask
must not contain
VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT
VUID-VkSubpassDependency-srcStageMask-04096
If the taskShader
feature is not enabled,
srcStageMask
must not contain
VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT
VUID-VkSubpassDependency-srcStageMask-07318
If neither the shadingRateImage
or
attachmentFragmentShadingRate
are enabled, srcStageMask
must not contain
VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR
VUID-VkSubpassDependency-srcStageMask-03937
If the synchronization2
feature is
not enabled, srcStageMask
must not be 0
VUID-VkSubpassDependency-srcStageMask-07949
If neither the VK_NV_ray_tracing extension or
rayTracingPipeline
feature are
enabled, srcStageMask
must not contain
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR
VUID-VkSubpassDependency-dstStageMask-04090
If the geometryShader
feature is not
enabled, dstStageMask
must not contain
VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT
VUID-VkSubpassDependency-dstStageMask-04091
If the tessellationShader
feature
is not enabled, dstStageMask
must not contain
VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT
or
VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT
VUID-VkSubpassDependency-dstStageMask-04092
If the conditionalRendering
feature is not enabled, dstStageMask
must not contain
VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT
VUID-VkSubpassDependency-dstStageMask-04093
If the fragmentDensityMap
feature
is not enabled, dstStageMask
must not contain
VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT
VUID-VkSubpassDependency-dstStageMask-04094
If the transformFeedback
feature
is not enabled, dstStageMask
must not contain
VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT
VUID-VkSubpassDependency-dstStageMask-04095
If the meshShader
feature is not enabled,
dstStageMask
must not contain
VK_PIPELINE_STAGE_MESH_SHADER_BIT_EXT
VUID-VkSubpassDependency-dstStageMask-04096
If the taskShader
feature is not enabled,
dstStageMask
must not contain
VK_PIPELINE_STAGE_TASK_SHADER_BIT_EXT
VUID-VkSubpassDependency-dstStageMask-07318
If neither the shadingRateImage
or
attachmentFragmentShadingRate
are enabled, dstStageMask
must not contain
VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR
VUID-VkSubpassDependency-dstStageMask-03937
If the synchronization2
feature is
not enabled, dstStageMask
must not be 0
VUID-VkSubpassDependency-dstStageMask-07949
If neither the VK_NV_ray_tracing extension or
rayTracingPipeline
feature are
enabled, dstStageMask
must not contain
VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR
VUID-VkSubpassDependency-srcSubpass-00864
srcSubpass
must be less than or equal to dstSubpass
, unless
one of them is VK_SUBPASS_EXTERNAL
, to avoid cyclic dependencies
and ensure a valid execution order
VUID-VkSubpassDependency-srcSubpass-00865
srcSubpass
and dstSubpass
must not both be equal to
VK_SUBPASS_EXTERNAL
VUID-VkSubpassDependency-srcSubpass-06809
If srcSubpass
is equal to dstSubpass
and srcStageMask
includes a framebuffer-space
stage, dstStageMask
must only contain
framebuffer-space stages
VUID-VkSubpassDependency-srcAccessMask-00868
Any access flag included in srcAccessMask
must be supported by
one of the pipeline stages in srcStageMask
, as specified in the
table of supported access
types
VUID-VkSubpassDependency-dstAccessMask-00869
Any access flag included in dstAccessMask
must be supported by
one of the pipeline stages in dstStageMask
, as specified in the
table of supported access
types
VUID-VkSubpassDependency-srcSubpass-02243
If srcSubpass
equals dstSubpass
, and srcStageMask
and
dstStageMask
both include a
framebuffer-space stage, then
dependencyFlags
must include VK_DEPENDENCY_BY_REGION_BIT
VUID-VkSubpassDependency-dependencyFlags-02520
If dependencyFlags
includes VK_DEPENDENCY_VIEW_LOCAL_BIT
,
srcSubpass
must not be equal to VK_SUBPASS_EXTERNAL
VUID-VkSubpassDependency-dependencyFlags-02521
If dependencyFlags
includes VK_DEPENDENCY_VIEW_LOCAL_BIT
,
dstSubpass
must not be equal to VK_SUBPASS_EXTERNAL
VUID-VkSubpassDependency-srcSubpass-00872
If srcSubpass
equals dstSubpass
and that subpass has more
than one bit set in the view mask, then dependencyFlags
must
include VK_DEPENDENCY_VIEW_LOCAL_BIT
Valid Usage (Implicit)
VUID-VkSubpassDependency-srcStageMask-parameter
srcStageMask
must be a valid combination of VkPipelineStageFlagBits values
VUID-VkSubpassDependency-dstStageMask-parameter
dstStageMask
must be a valid combination of VkPipelineStageFlagBits values
VUID-VkSubpassDependency-srcAccessMask-parameter
srcAccessMask
must be a valid combination of VkAccessFlagBits values
VUID-VkSubpassDependency-dstAccessMask-parameter
dstAccessMask
must be a valid combination of VkAccessFlagBits values
VUID-VkSubpassDependency-dependencyFlags-parameter
dependencyFlags
must be a valid combination of VkDependencyFlagBits values