Structures

VkSubpassDescription2

Structure specifying a subpass description

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;
  • sType is a VkStructureType value identifying this structure.
  • pNext is NULL or a pointer to a structure extending this 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 colorAttachmentCount VkAttachmentReference2 structures defining the color attachments for this subpass and their layouts.
  • pResolveAttachments is NULL or a pointer to an 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.

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.

If a VkFragmentShadingRateAttachmentInfoKHR structure is included in the pNext chain, pFragmentShadingRateAttachment is not NULL, and its attachment member is not VK_ATTACHMENT_UNUSED, the identified attachment defines a fragment shading rate attachment for that subpass.

If any element of pResolveAttachments is an image specified with an VkExternalFormatANDROID, values in the corresponding color attachment will be resolved to the resolve attachment in the same manner as specified for VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID.

If the nullColorAttachmentWithExternalFormatResolve limit is VK_TRUE, values in the color attachment will be loaded from the resolve attachment at the start of rendering, and may also be reloaded any time after a resolve occurs or the resolve attachment is written to; if this occurs it must happen-before any writes to the color attachment are performed which happen-after the resolve that triggers this. If any color component in the external format is subsampled, values will be read from the nearest sample in the image when they are loaded. If the color attachment is also used as an input attachment, the same behavior applies.

Setting the color attachment to VK_ATTACHMENT_UNUSED when an external resolve attachment is used and the nullColorAttachmentWithExternalFormatResolve limit is VK_TRUE will not result in color attachment writes to be discarded for that attachment.

When nullColorAttachmentWithExternalFormatResolve is VK_TRUE, the color output from the subpass can still be read via an input attachment; but the application cannot bind an image view for the color attachment as there is no such image view bound. Instead to access the data as an input attachment applications can use the resolve attachment in its place - using the resolve attachment image for the descriptor, and setting the corresponding element of pInputAttachments to the index of the resolve attachment.

Loads or input attachment reads from the resolve attachment are performed as if using a VkSamplerYcbcrConversionCreateInfo with the following parameters:

where properties is equal to VkPhysicalDeviceExternalFormatResolvePropertiesANDROID returned by the device and forceExplicitReconstruction is effectively ignored as the VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY model is used. The applied swizzle is the same effective swizzle that would be applied by the VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY model, but no range expansion is applied.

Valid Usage

VUID-VkSubpassDescription2-attachment-06912

If the attachment member of an element of pInputAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL or VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL

VUID-VkSubpassDescription2-attachment-06913

If the attachment member of an element of pColorAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL

VUID-VkSubpassDescription2-attachment-06914

If the attachment member of an element of pResolveAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL

VUID-VkSubpassDescription2-attachment-06915

If the attachment member of pDepthStencilAttachment is not VK_ATTACHMENT_UNUSED, ts layout member must not be VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL or VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL

VUID-VkSubpassDescription2-attachment-06916

If the attachment member of an element of pColorAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL or VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL

VUID-VkSubpassDescription2-attachment-06917

If the attachment member of an element of pResolveAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL or VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL

VUID-VkSubpassDescription2-attachment-06918

If the attachment member of an element of pInputAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL

VUID-VkSubpassDescription2-attachment-06919

If the attachment member of an element of pColorAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL

VUID-VkSubpassDescription2-attachment-06920

If the attachment member of an element of pResolveAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL

VUID-VkSubpassDescription2-attachment-06921

If the attachment member of an element of pInputAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR

VUID-VkSubpassDescription2-attachment-06922

If the attachment member of an element of pColorAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR

VUID-VkSubpassDescription2-attachment-06923

If the attachment member of an element of pResolveAttachments is not VK_ATTACHMENT_UNUSED, its layout member must not be VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR

VUID-VkSubpassDescription2-attachment-06251

If the attachment member of pDepthStencilAttachment is not VK_ATTACHMENT_UNUSED and its pNext chain includes a VkAttachmentReferenceStencilLayout structure, the layout member of pDepthStencilAttachment must not be VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL

VUID-VkSubpassDescription2-pipelineBindPoint-04953

pipelineBindPoint must be VK_PIPELINE_BIND_POINT_GRAPHICS or VK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEI

VUID-VkSubpassDescription2-colorAttachmentCount-03063

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

VUID-VkSubpassDescription2-loadOp-03064

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

VUID-VkSubpassDescription2-pResolveAttachments-03067

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

VUID-VkSubpassDescription2-externalFormatResolve-09335

If externalFormatResolve is not enabled and 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

VUID-VkSubpassDescription2-nullColorAttachmentWithExternalFormatResolve-09336

If the nullColorAttachmentWithExternalFormatResolve property is VK_FALSE and pResolveAttachments is not NULL, for each resolve attachment that has a format of VK_FORMAT_UNDEFINED, the corresponding color attachment must not have the value VK_ATTACHMENT_UNUSED

VUID-VkSubpassDescription2-nullColorAttachmentWithExternalFormatResolve-09337

If the nullColorAttachmentWithExternalFormatResolve property is VK_TRUE and pResolveAttachments is not NULL, for each resolve attachment that has a format of VK_FORMAT_UNDEFINED, the corresponding color attachment must have the value VK_ATTACHMENT_UNUSED

VUID-VkSubpassDescription2-externalFormatResolve-09338

If externalFormatResolve is not enabled and 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

VUID-VkSubpassDescription2-externalFormatResolve-09339

If externalFormatResolve is not enabled, each element of pResolveAttachments must have the same VkFormat as its corresponding color attachment

VUID-VkSubpassDescription2-multisampledRenderToSingleSampled-06869

If the multisampledRenderToSingleSampled feature is not enabled, all attachments in pColorAttachments that are not VK_ATTACHMENT_UNUSED must have the same sample count

VUID-VkSubpassDescription2-pInputAttachments-02897

All attachments in pInputAttachments that are not VK_ATTACHMENT_UNUSED and any of the following is true:

VUID-VkSubpassDescription2-pColorAttachments-02898

All attachments in pColorAttachments that are not VK_ATTACHMENT_UNUSED must have image formats whose potential format features contain VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT

VUID-VkSubpassDescription2-pResolveAttachments-09343

All attachments in pResolveAttachments that are not VK_ATTACHMENT_UNUSED and do not have an image format of VK_FORMAT_UNDEFINED must have image formats whose potential format features contain VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT

VUID-VkSubpassDescription2-pDepthStencilAttachment-02900

If pDepthStencilAttachment is not NULL and the attachment is not VK_ATTACHMENT_UNUSED then it must have an image format whose potential format features contain VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT

VUID-VkSubpassDescription2-linearColorAttachment-06499

If the linearColorAttachment feature is enabled and the image is created with VK_IMAGE_TILING_LINEAR, all attachments in pInputAttachments that are not VK_ATTACHMENT_UNUSED must have image formats whose potential format features must contain VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV

VUID-VkSubpassDescription2-linearColorAttachment-06500

If the linearColorAttachment feature is enabled and the image is created with VK_IMAGE_TILING_LINEAR, all attachments in pColorAttachments that are not VK_ATTACHMENT_UNUSED must have image formats whose potential format features must contain VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV

VUID-VkSubpassDescription2-linearColorAttachment-06501

If the linearColorAttachment feature is enabled and the image is created with VK_IMAGE_TILING_LINEAR, all attachments in pResolveAttachments that are not VK_ATTACHMENT_UNUSED must have image formats whose potential format features must contain VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV

VUID-VkSubpassDescription2-None-09456

If either of the following is enabled:

VUID-VkSubpassDescription2-pNext-06870

If the pNext chain includes a VkMultisampledRenderToSingleSampledInfoEXT structure with multisampledRenderToSingleSampledEnable equal to VK_TRUE, then all attachments in pColorAttachments and pDepthStencilAttachment that are not VK_ATTACHMENT_UNUSEDmust have a sample count that is either VK_SAMPLE_COUNT_1_BIT or equal to VkMultisampledRenderToSingleSampledInfoEXT::rasterizationSamples

VUID-VkSubpassDescription2-pNext-06871

If the pNext chain includes a VkMultisampledRenderToSingleSampledInfoEXT structure with multisampledRenderToSingleSampledEnable equal to VK_TRUE, and pDepthStencilAttachment is not NULL, does not have the value VK_ATTACHMENT_UNUSED, and has a sample count of VK_SAMPLE_COUNT_1_BIT, the pNext chain must also include a VkSubpassDescriptionDepthStencilResolve structure with pDepthStencilResolveAttachment that is either NULL or has the value VK_ATTACHMENT_UNUSED

VUID-VkSubpassDescription2-multisampledRenderToSingleSampled-06872

All attachments in pDepthStencilAttachment or pColorAttachments that are not VK_ATTACHMENT_UNUSED must have the same sample count , if none of the following are enabled:

VUID-VkSubpassDescription2-attachment-03073

Each element of pPreserveAttachments must not be VK_ATTACHMENT_UNUSED

VUID-VkSubpassDescription2-pPreserveAttachments-03074

Each element of pPreserveAttachments must not also be an element of any other member of the subpass description

VUID-VkSubpassDescription2-layout-02528

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

VUID-VkSubpassDescription2-flags-03076

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

VUID-VkSubpassDescription2-attachment-02799

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

VUID-VkSubpassDescription2-attachment-02800

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

VUID-VkSubpassDescription2-attachment-02801

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

VUID-VkSubpassDescription2-attachment-04563

If the attachment member of any element of pInputAttachments is not VK_ATTACHMENT_UNUSED, then the aspectMask member must not include VK_IMAGE_ASPECT_MEMORY_PLANEiBIT_EXT for any index i

VUID-VkSubpassDescription2-pDepthStencilAttachment-04440

An attachment must not be used in both pDepthStencilAttachment and pColorAttachments

VUID-VkSubpassDescription2-multiview-06558

If the multiview feature is not enabled, viewMask must be 0

VUID-VkSubpassDescription2-viewMask-06706

The index of the most significant bit in viewMask must be less than maxMultiviewViewCount

VUID-VkSubpassDescription2-externalFormatResolve-09344

If externalFormatResolve is enabled, pResolveAttachments is not NULL, and colorAttachmentCount is not 1, any element of pResolveAttachments that is not VK_ATTACHMENT_UNUSED, must not have a format of VK_FORMAT_UNDEFINED

VUID-VkSubpassDescription2-externalFormatResolve-09345

If externalFormatResolve is enabled, pResolveAttachments is not NULL, any element of pResolveAttachments is not VK_ATTACHMENT_UNUSED and has a format of VK_FORMAT_UNDEFINED, and the corresponding element of pColorAttachments is not VK_ATTACHMENT_UNUSED, the color attachment must have a samples value of 1

VUID-VkSubpassDescription2-externalFormatResolve-09346

If externalFormatResolve is enabled, pResolveAttachments is not NULL, and any element of pResolveAttachments is not VK_ATTACHMENT_UNUSED and has a format of VK_FORMAT_UNDEFINED, viewMask must be 0

VUID-VkSubpassDescription2-externalFormatResolve-09347

If externalFormatResolve is enabled, pResolveAttachments is not NULL, and any element of pResolveAttachments is not VK_ATTACHMENT_UNUSED and has a format of VK_FORMAT_UNDEFINED, VkFragmentShadingRateAttachmentInfoKHR::pFragmentShadingRateAttachmentmust either be NULL or a VkAttachmentReference2 structure with an attachment value of VK_ATTACHMENT_UNUSED

VUID-VkSubpassDescription2-externalFormatResolve-09348

If externalFormatResolve is enabled, pResolveAttachments is not NULL, and any element of pResolveAttachments is not VK_ATTACHMENT_UNUSED and has a format of VK_FORMAT_UNDEFINED, elements of pInputAttachments referencing either a color attachment or resolve attachment used in this subpass must not include VK_IMAGE_ASPECT_PLANEiBIT for any index i in its aspectMask

Valid Usage (Implicit)

VUID-VkSubpassDescription2-sType-sType

sType must be VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2

VUID-VkSubpassDescription2-sType-unique

The sType value of each struct in the pNext chain must be unique

VUID-VkSubpassDescription2-pInputAttachments-parameter

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

VUID-VkSubpassDescription2-pColorAttachments-parameter

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

VUID-VkSubpassDescription2-pResolveAttachments-parameter

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

VUID-VkSubpassDescription2-pDepthStencilAttachment-parameter

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

VUID-VkSubpassDescription2-pPreserveAttachments-parameter

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