## C Specification

The VkSubpassDescription2KHR structure is defined as:

typedef struct VkSubpassDescription2KHR {
VkStructureType                     sType;
const void*                         pNext;
VkSubpassDescriptionFlags           flags;
VkPipelineBindPoint                 pipelineBindPoint;
uint32_t                            inputAttachmentCount;
const VkAttachmentReference2KHR*    pInputAttachments;
uint32_t                            colorAttachmentCount;
const VkAttachmentReference2KHR*    pColorAttachments;
const VkAttachmentReference2KHR*    pResolveAttachments;
const VkAttachmentReference2KHR*    pDepthStencilAttachment;
uint32_t                            preserveAttachmentCount;
const uint32_t*                     pPreserveAttachments;
} 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 an array of VkAttachmentReference2KHR structures defining the input attachments for this subpass and their layouts.

• colorAttachmentCount is the number of color attachments.

• pColorAttachments is an array of VkAttachmentReference2KHR structures defining the color attachments for this subpass and their layouts.

• pResolveAttachments is an optional array of colorAttachmentCount VkAttachmentReference2KHR structures defining the resolve attachments for this subpass and their layouts.

• pDepthStencilAttachment is a pointer to a VkAttachmentReference2KHR specifying the depth/stencil attachment for this subpass and its layout.

• preserveAttachmentCount is the number of preserved attachments.

• pPreserveAttachments is 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

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

• The aspectMask member of any element of pInputAttachments must be a valid combination of VkImageAspectFlagBits

• The aspectMask member of any element of pInputAttachments must not be 0

• The aspectMask member of each element of pInputAttachments must not include VK_IMAGE_ASPECT_METADATA_BIT

Valid Usage (Implicit)
• sType must be VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR

• 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 VkAttachmentReference2KHR structures

• If colorAttachmentCount is not 0, pColorAttachments must be a valid pointer to an array of colorAttachmentCount valid VkAttachmentReference2KHR structures

• If colorAttachmentCount is not 0, and pResolveAttachments is not NULL, pResolveAttachments must be a valid pointer to an array of colorAttachmentCount valid VkAttachmentReference2KHR structures

• If pDepthStencilAttachment is not NULL, pDepthStencilAttachment must be a valid pointer to a valid VkAttachmentReference2KHR structure

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