# VkSubpassDependency2(3) Manual Page

## Name

VkSubpassDependency2 - Structure specifying a subpass dependency

## C Specification

The `VkSubpassDependency2` structure is defined as:

    typedef struct VkSubpassDependency2 {
        VkStructureType         sType;
        const void*             pNext;
        uint32_t                srcSubpass;
        uint32_t                dstSubpass;
        VkPipelineStageFlags    srcStageMask;
        VkPipelineStageFlags    dstStageMask;
        VkAccessFlags           srcAccessMask;
        VkAccessFlags           dstAccessMask;
        VkDependencyFlags       dependencyFlags;
        int32_t                 viewOffset;
    } VkSubpassDependency2;

or the equivalent

    typedef VkSubpassDependency2 VkSubpassDependency2KHR;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to an extension-specific structure.

- `srcSubpass` is the subpass index of the first subpass in the dependency, or `VK_SUBPASS_EXTERNAL`.

- `dstSubpass` is the subpass index of the second subpass in the dependency, or `VK_SUBPASS_EXTERNAL`.

- `srcStageMask` is a bitmask of VkPipelineStageFlagBits specifying the source stage mask.

- `dstStageMask` is a bitmask of VkPipelineStageFlagBits specifying the destination stage mask

- `srcAccessMask` 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.

- `viewOffset` controls which views in the source subpass the views in the destination subpass depend on.

## Description

Parameters defined by this structure with the same name as those in VkSubpassDependency have the identical effect to those parameters.

`viewOffset` has the same effect for the described subpass dependency as VkRenderPassMultiviewCreateInfo::`pViewOffsets` has on each corresponding subpass dependency.

Valid Usage

- If the geometry shaders feature is not enabled, `srcStageMask` must not contain `VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT`

- If the geometry shaders feature is not enabled, `dstStageMask` must not contain `VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT`

- If the tessellation shaders feature is not enabled, `srcStageMask` must not contain `VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT` or `VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT`

- If the tessellation shaders feature is not enabled, `dstStageMask` must not contain `VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT` or `VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT`

- `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

- `srcSubpass` and `dstSubpass` must not both be equal to `VK_SUBPASS_EXTERNAL`

- If `srcSubpass` is equal to `dstSubpass` and not all of the stages in `srcStageMask` and `dstStageMask` are framebuffer-space stages, the logically latest pipeline stage in `srcStageMask` must be logically earlier than or equal to the logically earliest pipeline stage in `dstStageMask`

- 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

- 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

- If `dependencyFlags` includes `VK_DEPENDENCY_VIEW_LOCAL_BIT`, `srcSubpass` must not be equal to `VK_SUBPASS_EXTERNAL`

- If `dependencyFlags` includes `VK_DEPENDENCY_VIEW_LOCAL_BIT`, `dstSubpass` must not be equal to `VK_SUBPASS_EXTERNAL`

- If `srcSubpass` equals `dstSubpass`, and `srcStageMask` and `dstStageMask` both include a framebuffer-space stage, then `dependencyFlags` must include `VK_DEPENDENCY_BY_REGION_BIT`

- If `viewOffset` is not equal to `0`, `srcSubpass` must not be equal to `dstSubpass`

- If `dependencyFlags` does not include `VK_DEPENDENCY_VIEW_LOCAL_BIT`, `viewOffset` must be `0`

- If `viewOffset` is not `0`, `srcSubpass` must not be equal to `dstSubpass`.

- If the mesh shaders feature is not enabled, `srcStageMask` must not contain `VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV`

- If the task shaders feature is not enabled, `srcStageMask` must not contain `VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV`

- If the mesh shaders feature is not enabled, `dstStageMask` must not contain `VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV`

- If the task shaders feature is not enabled, `dstStageMask` must not contain `VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV`

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2`

- `srcStageMask` must be a valid combination of VkPipelineStageFlagBits values

- `srcStageMask` must not be `0`

- `dstStageMask` must be a valid combination of VkPipelineStageFlagBits values

- `dstStageMask` must not be `0`

- `srcAccessMask` must be a valid combination of VkAccessFlagBits values

- `dstAccessMask` must be a valid combination of VkAccessFlagBits values

- `dependencyFlags` must be a valid combination of VkDependencyFlagBits values

## See Also

VkAccessFlags, VkDependencyFlags, VkPipelineStageFlags, VkRenderPassCreateInfo2, VkStructureType

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.