C Specification
The VkSubpassDescription2
structure is defined as:
// Provided by VK_VERSION_1_2
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
// Provided by VK_KHR_create_renderpass2
typedef VkSubpassDescription2 VkSubpassDescription2KHR;
Members
-
sType
is a VkStructureType value identifying this structure. -
pNext
isNULL
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 ofcolorAttachmentCount
VkAttachmentReference2 structures defining the color attachments for this subpass and their layouts. -
pResolveAttachments
isNULL
or a pointer to an array ofcolorAttachmentCount
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 ofpreserveAttachmentCount
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.
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:
VkSamplerYcbcrConversionCreateInfo createInfo = {
.sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO,
.pNext = NULL,
.format = VK_FORMAT_UNDEFINED,
.ycbcrModel = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY,
.ycbcrRange = VK_SAMPLER_YCBCR_RANGE_ITU_FULL,
.components = {
.r = VK_COMPONENT_SWIZZLE_B
.g = VK_COMPONENT_SWIZZLE_R
.b = VK_COMPONENT_SWIZZLE_G
.a = VK_COMPONENT_SWIZZLE_IDENTITY},
.xChromaOffset = properties.chromaOffsetX,
.yChromaOffset = properties.chromaOffsetY,
.chromaFilter = ename:VK_FILTER_NEAREST,
.forceExplicitReconstruction = ... };
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.
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.