VkSubpassDescription(3)
C Specification
TheVkSubpassDescription structure is defined as:
| This functionality is superseded byVulkan Version 1.2. SeeLegacy Functionality for more information. |
// Provided by VK_VERSION_1_0typedef struct VkSubpassDescription { VkSubpassDescriptionFlags flags; VkPipelineBindPoint pipelineBindPoint; uint32_t inputAttachmentCount; const VkAttachmentReference* pInputAttachments; uint32_t colorAttachmentCount; const VkAttachmentReference* pColorAttachments; const VkAttachmentReference* pResolveAttachments; const VkAttachmentReference* pDepthStencilAttachment; uint32_t preserveAttachmentCount; const uint32_t* pPreserveAttachments;} VkSubpassDescription;Members
flagsis a bitmask ofVkSubpassDescriptionFlagBitsspecifying usage of the subpass.pipelineBindPointis aVkPipelineBindPoint value specifyingthe pipeline type supported for this subpass.inputAttachmentCountis the number of input attachments.pInputAttachmentsis a pointer to an array ofVkAttachmentReference structures defining the input attachmentsfor this subpass and their layouts.colorAttachmentCountis the number of color attachments.pColorAttachmentsis a pointer to an array ofcolorAttachmentCountVkAttachmentReference structuresdefining the color attachments for this subpass and their layouts.pResolveAttachmentsisNULLor a pointer to an array ofcolorAttachmentCountVkAttachmentReference structuresdefining the resolve attachments for this subpass and their layouts.pDepthStencilAttachmentis a pointer to aVkAttachmentReference structure specifying the depth/stencilattachment for this subpass and its layout.preserveAttachmentCountis the number of preserved attachments.pPreserveAttachmentsis a pointer to an array ofpreserveAttachmentCountrender pass attachment indices identifyingattachments that are not used by this subpass, but whose contentsmustbe preserved throughout the subpass.
Description
Each element of thepInputAttachments array corresponds to an inputattachment index in a fragment shader, i.e. if a shader declares an imagevariable decorated with aInputAttachmentIndex value ofX, then ituses the attachment provided inpInputAttachments[X].Input attachmentsmust also be bound to the pipeline in a descriptor set.If theattachment member of any element ofpInputAttachments isVK_ATTACHMENT_UNUSED, the applicationmust not read from thecorresponding input attachment index.Fragment shaderscan use subpass input variables to access the contents ofan input attachment at the fragment’s(xf,yf) framebuffercoordinates and layer.Input attachmentsmust not be used by any subpasses within a render passthat enablesrender pass transform.
Each element of thepColorAttachments array corresponds to an outputlocation in the shader, i.e. if the shader declares an output variabledecorated with aLocation value ofX, then it uses the attachmentprovided inpColorAttachments[X].If theattachment member of any element ofpColorAttachments isVK_ATTACHMENT_UNUSED,or ifColor Write Enable has beendisabled for the corresponding attachment index,then writes to the corresponding location by a fragment shader arediscarded.
Ifflags does not includeVK_SUBPASS_DESCRIPTION_CUSTOM_RESOLVE_BIT_EXT, and ifpResolveAttachments is notNULL, each of its elements corresponds toa color attachment (the element inpColorAttachments at the sameindex), and amultisample resolve operation is defined for each attachment unless the resolve attachmentindex isVK_ATTACHMENT_UNUSED.
Similarly, ifflags does not includeVK_SUBPASS_DESCRIPTION_CUSTOM_RESOLVE_BIT_EXT, andVkSubpassDescriptionDepthStencilResolve::pDepthStencilResolveAttachmentis notNULL and does not have the valueVK_ATTACHMENT_UNUSED, itcorresponds to the depth/stencil attachment inpDepthStencilAttachment, andmultisample resolve operation for depthand stencil are defined byVkSubpassDescriptionDepthStencilResolve::depthResolveMode andVkSubpassDescriptionDepthStencilResolve::stencilResolveMode,respectively.IfVkSubpassDescriptionDepthStencilResolve::depthResolveMode isVK_RESOLVE_MODE_NONE or thepDepthStencilResolveAttachment doesnot have a depth aspect, no resolve operation is performed for the depthattachment.IfVkSubpassDescriptionDepthStencilResolve::stencilResolveModeisVK_RESOLVE_MODE_NONE or thepDepthStencilResolveAttachmentdoes not have a stencil aspect, no resolve operation is performed for thestencil attachment.
If the image subresource range referenced by the depth/stencil attachment iscreated withVK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT, then themultisample resolve operation uses thesample locations state specified in thesampleLocationsInfo member ofthe element of theVkRenderPassSampleLocationsBeginInfoEXT::pPostSubpassSampleLocationsfor the subpass.
IfpDepthStencilAttachment isNULL, or if its attachment index isVK_ATTACHMENT_UNUSED, it indicates that no depth/stencil attachmentwill be used in the subpass.
Following this call, if thecustomResolvefeature is enabled the fragment areamay be reduced to(1,1) if afragment density map is attached to the render pass.If this occurs, reads of input attachmentsmay return the value for theoriginal larger fragment containing the smaller fragment or use the newfragment area.
The contents of an attachment within the render area becomeundefined atthe start of a subpassS if all of the following conditions are true:
The attachment is used as a color, depth/stencil, or resolve attachmentin any subpass in the render pass.
There is a subpassS1 that uses or preserves the attachment, and asubpass dependency fromS1 toS.
The attachment is not used or preserved in subpassS.
In addition, the contents of an attachment within the render area becomeundefined at the start of a subpassS if all of the following conditionsare true:
The attachment is used as a color or depth/stencil in the subpass.
For color attachments, this operation will be performed in theVK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage, with anyimage accesses performed viaVK_ACCESS_INPUT_ATTACHMENT_READ_BIT,VK_ACCESS_COLOR_ATTACHMENT_READ_BIT, andVK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT.For depth/stencil attachments, this operationmay be performed in eithertheVK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT orVK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT pipeline stage, with anyimage accesses performed viaVK_ACCESS_INPUT_ATTACHMENT_READ_BIT,VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT, andVK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT.
Once the contents of an attachment becomeundefined in subpassS, theyremainundefined for subpasses in subpass dependency chains starting withsubpassS until they are written again.However, they remain valid for subpasses in other subpass dependency chainsstarting with subpassS1 if all subpasses in each chain use or preservethe attachment.
If a subpass has multiple dependency chains where some of the chainspreserve the attachment, and others do not, the contents of the attachmentareundefined for that subpass. |
VUID-VkSubpassDescription-attachment-06912
If theattachmentmember of an element ofpInputAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL orVK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMALVUID-VkSubpassDescription-attachment-06913
If theattachmentmember of an element ofpColorAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL orVK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALVUID-VkSubpassDescription-attachment-06914
If theattachmentmember of an element ofpResolveAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL orVK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALVUID-VkSubpassDescription-attachment-06915
If theattachmentmember ofpDepthStencilAttachmentis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL orVK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMALVUID-VkSubpassDescription-attachment-06916
If theattachmentmember of an element ofpColorAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL orVK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMALVUID-VkSubpassDescription-attachment-06917
If theattachmentmember of an element ofpResolveAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL orVK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMALVUID-VkSubpassDescription-attachment-06918
If theattachmentmember of an element ofpInputAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL orVK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMALVUID-VkSubpassDescription-attachment-06919
If theattachmentmember of an element ofpColorAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL,VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL,VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, orVK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMALVUID-VkSubpassDescription-attachment-06920
If theattachmentmember of an element ofpResolveAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL,VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL,VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, orVK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMALVUID-VkSubpassDescription-attachment-06921
If theattachmentmember of an element ofpInputAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHRVUID-VkSubpassDescription-attachment-06922
If theattachmentmember of an element ofpColorAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHRVUID-VkSubpassDescription-attachment-06923
If theattachmentmember of an element ofpResolveAttachmentsis notVK_ATTACHMENT_UNUSED, itslayoutmembermust not beVK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHRVUID-VkSubpassDescription-flags-10683
IfflagsincludesVK_SUBPASS_DESCRIPTION_TILE_SHADING_APRON_BIT_QCOM, the renderpassmust have been created with aVkRenderPassTileShadingCreateInfoQCOM::tileApronSizegreaterthan(0,0)VUID-VkSubpassDescription-inputAttachmentCount-12293
inputAttachmentCountmust be less than or equal tomaxPerStageDescriptorInputAttachmentsVUID-VkSubpassDescription-colorAttachmentCount-00845
colorAttachmentCountmust be less than or equal tomaxColorAttachmentsVUID-VkSubpassDescription-loadOp-00846
If the first use of an attachment in this render pass is as an inputattachment, and the attachment is not also used as a color ordepth/stencil attachment in the same subpass, thenloadOpmustnot beVK_ATTACHMENT_LOAD_OP_CLEARVUID-VkSubpassDescription-pipelineBindPoint-04952
pipelineBindPointmust beVK_PIPELINE_BIND_POINT_GRAPHICSorVK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEIVUID-VkSubpassDescription-pResolveAttachments-00847
IfpResolveAttachmentsis notNULL, for each resolve attachmentthat is notVK_ATTACHMENT_UNUSED, the corresponding colorattachmentmust not beVK_ATTACHMENT_UNUSEDVUID-VkSubpassDescription-pResolveAttachments-00848
IfpResolveAttachmentsis notNULL, for each resolve attachmentthat is notVK_ATTACHMENT_UNUSED, the corresponding colorattachmentmust not have a sample count ofVK_SAMPLE_COUNT_1_BITVUID-VkSubpassDescription-pResolveAttachments-00849
IfpResolveAttachmentsis notNULL, each resolve attachment thatis notVK_ATTACHMENT_UNUSEDmust have a sample count ofVK_SAMPLE_COUNT_1_BITVUID-VkSubpassDescription-pResolveAttachments-00850
IfpResolveAttachmentsis notNULL, each resolve attachment thatis notVK_ATTACHMENT_UNUSEDmust have the sameVkFormat asits corresponding color attachmentVUID-VkSubpassDescription-pColorAttachments-09430
All attachments inpColorAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have the same sample countVUID-VkSubpassDescription-pInputAttachments-02647
All attachments inpInputAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have image formats whosepotential format features contain atleastVK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT orVK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BITVUID-VkSubpassDescription-pColorAttachments-02648
All attachments inpColorAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have image formats whosepotential format features containVK_FORMAT_FEATURE_COLOR_ATTACHMENT_BITVUID-VkSubpassDescription-pResolveAttachments-02649
All attachments inpResolveAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have image formats whosepotential format features containVK_FORMAT_FEATURE_COLOR_ATTACHMENT_BITVUID-VkSubpassDescription-pDepthStencilAttachment-02650
IfpDepthStencilAttachmentis notNULLand the attachment is notVK_ATTACHMENT_UNUSED then itmust have an image format whosepotential format features containVK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BITVUID-VkSubpassDescription-linearColorAttachment-06496
If thelinearColorAttachmentfeature is enabled and the image is created withVK_IMAGE_TILING_LINEAR, all attachments inpInputAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have image formats whosepotential format featuresmust containVK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NVVUID-VkSubpassDescription-linearColorAttachment-06497
If thelinearColorAttachmentfeature is enabled and the image is created withVK_IMAGE_TILING_LINEAR, all attachments inpColorAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have image formats whosepotential format featuresmust containVK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NVVUID-VkSubpassDescription-linearColorAttachment-06498
If thelinearColorAttachmentfeature is enabled and the image is created withVK_IMAGE_TILING_LINEAR, all attachments inpResolveAttachmentsthat are notVK_ATTACHMENT_UNUSEDmusthave image formats whosepotential format featuresmust containVK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NVVUID-VkSubpassDescription-None-09431
If either of the following is enabled:The
VK_AMD_mixed_attachment_samplesextensionThe
VK_NV_framebuffer_mixed_samplesextension
all attachments in
pColorAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have a sample count that is smaller than orequal to the sample count ofpDepthStencilAttachmentif it is notVK_ATTACHMENT_UNUSEDVUID-VkSubpassDescription-pDepthStencilAttachment-01418
If none of the following are enabled:The
VK_AMD_mixed_attachment_samplesextensionThe
VK_NV_framebuffer_mixed_samplesextension
all attachments in
pDepthStencilAttachmentandpColorAttachmentsthat are notVK_ATTACHMENT_UNUSEDmust have the same sample countVUID-VkSubpassDescription-attachment-00853
Each element ofpPreserveAttachmentsmust not beVK_ATTACHMENT_UNUSEDVUID-VkSubpassDescription-pPreserveAttachments-00854
Each element ofpPreserveAttachmentsmust not also be an elementof any other member of the subpass descriptionVUID-VkSubpassDescription-layout-02519
If any attachment is used by more than oneVkAttachmentReferencemember, then each usemust use the samelayoutVUID-VkSubpassDescription-flags-00856
IfflagsincludesVK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX, itmustalso includeVK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVXVUID-VkSubpassDescription-flags-03341
IfflagsincludesVK_SUBPASS_DESCRIPTION_CUSTOM_RESOLVE_BIT_EXT, and ifpResolveAttachmentsis notNULL, then each resolve attachmentmust beVK_ATTACHMENT_UNUSEDVUID-VkSubpassDescription-flags-03343
IfflagsincludesVK_SUBPASS_DESCRIPTION_CUSTOM_RESOLVE_BIT_EXT, then the subpassmust be the last subpass in a subpass dependency chainVUID-VkSubpassDescription-pInputAttachments-02868
If the render pass is created withVK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM each of the elements ofpInputAttachmentsmust beVK_ATTACHMENT_UNUSEDVUID-VkSubpassDescription-pDepthStencilAttachment-04438
pDepthStencilAttachmentandpColorAttachmentsmust notcontain references to the same attachment
VUID-VkSubpassDescription-flags-parameter
flagsmust be a valid combination ofVkSubpassDescriptionFlagBits valuesVUID-VkSubpassDescription-pipelineBindPoint-parameter
pipelineBindPointmust be a validVkPipelineBindPoint valueVUID-VkSubpassDescription-pInputAttachments-parameter
IfinputAttachmentCountis not0,pInputAttachmentsmust be a valid pointer to an array ofinputAttachmentCountvalidVkAttachmentReference structuresVUID-VkSubpassDescription-pColorAttachments-parameter
IfcolorAttachmentCountis not0,pColorAttachmentsmust be a valid pointer to an array ofcolorAttachmentCountvalidVkAttachmentReference structuresVUID-VkSubpassDescription-pResolveAttachments-parameter
IfcolorAttachmentCountis not0, andpResolveAttachmentsis notNULL,pResolveAttachmentsmust be a valid pointer to an array ofcolorAttachmentCountvalidVkAttachmentReference structuresVUID-VkSubpassDescription-pDepthStencilAttachment-parameter
IfpDepthStencilAttachmentis notNULL,pDepthStencilAttachmentmust be a valid pointer to a validVkAttachmentReference structureVUID-VkSubpassDescription-pPreserveAttachments-parameter
IfpreserveAttachmentCountis not0,pPreserveAttachmentsmust be a valid pointer to an array ofpreserveAttachmentCountuint32_tvalues
Document Notes
For more information, see theVulkan Specification.
This page is extracted from the Vulkan Specification.Fixes and changes should be made to the Specification, not directly.