# VkSubpassDescription2(3) Manual Page

## Name

VkSubpassDescription2 - Structure specifying a subpass description

## C Specification

The `VkSubpassDescription2` structure is defined as:

    typedef struct VkSubpassDescription2 {
        VkStructureType                  sType;
        const void*                      pNext;
        VkSubpassDescriptionFlags        flags;
        VkPipelineBindPoint              pipelineBindPoint;
        uint32_t                         viewMask;
        uint32_t                         inputAttachmentCount;
        const VkAttachmentReference2*    pInputAttachments;
        uint32_t                         colorAttachmentCount;
        const VkAttachmentReference2*    pColorAttachments;
        const VkAttachmentReference2*    pResolveAttachments;
        const VkAttachmentReference2*    pDepthStencilAttachment;
        uint32_t                         preserveAttachmentCount;
        const uint32_t*                  pPreserveAttachments;
    } VkSubpassDescription2;

or the equivalent

    typedef VkSubpassDescription2 VkSubpassDescription2KHR;

## Members

- `sType` is the type of this structure.

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

- `flags` is a bitmask of VkSubpassDescriptionFlagBits specifying usage of the subpass.

- `pipelineBindPoint` is a VkPipelineBindPoint value specifying the pipeline type supported for this subpass.

- `viewMask` is a bitfield of view indices describing which views rendering is broadcast to in this subpass, when multiview is enabled.

- `inputAttachmentCount` is the number of input attachments.

- `pInputAttachments` is a pointer to an array of VkAttachmentReference2 structures defining the input attachments for this subpass and their layouts.

- `colorAttachmentCount` is the number of color attachments.

- `pColorAttachments` is a pointer to an array of VkAttachmentReference2 structures defining the color attachments for this subpass and their layouts.

- `pResolveAttachments` is an optional array of `colorAttachmentCount` VkAttachmentReference2 structures defining the resolve attachments for this subpass and their layouts.

- `pDepthStencilAttachment` is a pointer to a VkAttachmentReference2 structure specifying the depth/stencil attachment for this subpass and its layout.

- `preserveAttachmentCount` is the number of preserved attachments.

- `pPreserveAttachments` is a pointer to an array of `preserveAttachmentCount` render pass attachment indices identifying attachments that are not used by this subpass, but whose contents must be preserved throughout the subpass.

## Description

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

`viewMask` has the same effect for the described subpass as VkRenderPassMultiviewCreateInfo::`pViewMasks` has on each corresponding subpass.

Valid Usage

- `pipelineBindPoint` must be `VK_PIPELINE_BIND_POINT_GRAPHICS`

- `colorAttachmentCount` must be less than or equal to `VkPhysicalDeviceLimits`::`maxColorAttachments`

- If the first use of an attachment in this render pass is as an input attachment, and the attachment is not also used as a color or depth/stencil attachment in the same subpass, then `loadOp` must not be `VK_ATTACHMENT_LOAD_OP_CLEAR`

- If `pResolveAttachments` is not `NULL`, for each resolve attachment that does not have the value `VK_ATTACHMENT_UNUSED`, the corresponding color attachment must not have the value `VK_ATTACHMENT_UNUSED`

- If `pResolveAttachments` is not `NULL`, for each resolve attachment that is not `VK_ATTACHMENT_UNUSED`, the corresponding color attachment must not have a sample count of `VK_SAMPLE_COUNT_1_BIT`

- If `pResolveAttachments` is not `NULL`, each resolve attachment that is not `VK_ATTACHMENT_UNUSED` must have a sample count of `VK_SAMPLE_COUNT_1_BIT`

- Any given element of `pResolveAttachments` must have the same VkFormat as its corresponding color attachment

- All attachments in `pColorAttachments` that are not `VK_ATTACHMENT_UNUSED` must have the same sample count

- All attachments in `pInputAttachments` that are not `VK_ATTACHMENT_UNUSED` must have formats whose features contain at least one of `VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT` or `VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT`.

- All attachments in `pColorAttachments` that are not `VK_ATTACHMENT_UNUSED` must have formats whose features contain `VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT`

- All attachments in `pResolveAttachments` that are not `VK_ATTACHMENT_UNUSED` must have formats whose features contain `VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT`

- If `pDepthStencilAttachment` is not `NULL` and the attachment is not `VK_ATTACHMENT_UNUSED` then it must have a format whose features contain `VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT`

- If the `VK_AMD_mixed_attachment_samples` extension is enabled, all attachments in `pColorAttachments` that are not `VK_ATTACHMENT_UNUSED` must have a sample count that is smaller than or equal to the sample count of `pDepthStencilAttachment` if it is not `VK_ATTACHMENT_UNUSED`

- If neither the `VK_AMD_mixed_attachment_samples` nor the `VK_NV_framebuffer_mixed_samples` extensions are enabled, and if `pDepthStencilAttachment` is not `VK_ATTACHMENT_UNUSED` and any attachments in `pColorAttachments` are not `VK_ATTACHMENT_UNUSED`, they must have the same sample count

- The `attachment` member of any element of `pPreserveAttachments` must not be `VK_ATTACHMENT_UNUSED`

- Any given element of `pPreserveAttachments` must not also be an element of any other member of the subpass description

- If any attachment is used by more than one VkAttachmentReference member, then each use must use the same `layout`

- If `flags` includes `VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX`, it must also include `VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX`.

- If the `attachment` member of any element of `pInputAttachments` is not `VK_ATTACHMENT_UNUSED`, then the `aspectMask` member must be a valid combination of VkImageAspectFlagBits

- If the `attachment` member of any element of `pInputAttachments` is not `VK_ATTACHMENT_UNUSED`, then the `aspectMask` member must not be `0`

- If the `attachment` member of any element of `pInputAttachments` is not `VK_ATTACHMENT_UNUSED`, then the `aspectMask` member must not include `VK_IMAGE_ASPECT_METADATA_BIT`

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2`

- `flags` must be a valid combination of VkSubpassDescriptionFlagBits values

- `pipelineBindPoint` must be a valid VkPipelineBindPoint value

- If `inputAttachmentCount` is not `0`, `pInputAttachments` must be a valid pointer to an array of `inputAttachmentCount` valid VkAttachmentReference2 structures

- If `colorAttachmentCount` is not `0`, `pColorAttachments` must be a valid pointer to an array of `colorAttachmentCount` valid VkAttachmentReference2 structures

- If `colorAttachmentCount` is not `0`, and `pResolveAttachments` is not `NULL`, `pResolveAttachments` must be a valid pointer to an array of `colorAttachmentCount` valid VkAttachmentReference2 structures

- If `pDepthStencilAttachment` is not `NULL`, `pDepthStencilAttachment` must be a valid pointer to a valid VkAttachmentReference2 structure

- If `preserveAttachmentCount` is not `0`, `pPreserveAttachments` must be a valid pointer to an array of `preserveAttachmentCount` `uint32_t` values

## See Also

VkAttachmentReference2, VkPipelineBindPoint, VkRenderPassCreateInfo2, VkStructureType, VkSubpassDescriptionFlags

## 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.