1// Copyright 2015-2024 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5[[renderpass]] 6= Render Pass 7 8<<drawing, Draw commands>> must: be recorded within a _render pass 9instance_. 10Each render pass instance defines a set of image resources, referred to as 11_attachments_, used during rendering. 12 13ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 14[open,refpage='vkCmdBeginRendering',desc='Begin a dynamic render pass instance',type='protos',alias='vkCmdBeginRenderingKHR'] 15-- 16To begin a render pass instance, call: 17 18ifdef::VK_VERSION_1_3[] 19include::{generated}/api/protos/vkCmdBeginRendering.adoc[] 20endif::VK_VERSION_1_3[] 21 22ifdef::VK_VERSION_1_3+VK_KHR_dynamic_rendering[or the equivalent command] 23 24ifdef::VK_KHR_dynamic_rendering[] 25include::{generated}/api/protos/vkCmdBeginRenderingKHR.adoc[] 26endif::VK_KHR_dynamic_rendering[] 27 28 * pname:commandBuffer is the command buffer in which to record the 29 command. 30 * pname:pRenderingInfo is a pointer to a slink:VkRenderingInfo structure 31 specifying details of the render pass instance to begin. 32 33After beginning a render pass instance, the command buffer is ready to 34record <<drawing,draw commands>>. 35 36If pname:pRenderingInfo->flags includes ename:VK_RENDERING_RESUMING_BIT then 37this render pass is resumed from a render pass instance that has been 38suspended earlier in <<synchronization-submission-order, submission order>>. 39 40.Valid Usage 41**** 42 * [[VUID-vkCmdBeginRendering-dynamicRendering-06446]] 43 The <<features-dynamicRendering, pname:dynamicRendering>> feature must: 44 be enabled 45 * [[VUID-vkCmdBeginRendering-commandBuffer-06068]] 46 If pname:commandBuffer is a secondary command buffer, 47ifdef::VK_EXT_nested_command_buffer[] 48 and the <<features-nestedCommandBuffer, pname:nestedCommandBuffer>> 49 feature is not enabled, 50endif::VK_EXT_nested_command_buffer[] 51 pname:pRenderingInfo->flags must: not include 52 ename:VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT 53**** 54 55include::{generated}/validity/protos/vkCmdBeginRendering.adoc[] 56-- 57 58[open,refpage='VkRenderingInfo',desc='Structure specifying render pass instance begin info',type='structs',alias='VkRenderingInfoKHR'] 59-- 60The sname:VkRenderingInfo structure is defined as: 61 62include::{generated}/api/structs/VkRenderingInfo.adoc[] 63 64ifdef::VK_KHR_dynamic_rendering[] 65or the equivalent 66 67include::{generated}/api/structs/VkRenderingInfoKHR.adoc[] 68endif::VK_KHR_dynamic_rendering[] 69 70 * pname:sType is a elink:VkStructureType value identifying this structure. 71 * pname:pNext is `NULL` or a pointer to a structure extending this 72 structure. 73 * pname:flags is a bitmask of elink:VkRenderingFlagBits. 74 * pname:renderArea is the render area that is affected by the render pass 75 instance. 76 * pname:layerCount is the number of layers rendered to in each attachment 77 when pname:viewMask is `0`. 78 * pname:viewMask is the view mask indicating the indices of attachment 79 layers that will be rendered when it is not `0`. 80 * pname:colorAttachmentCount is the number of elements in 81 pname:pColorAttachments. 82 * pname:pColorAttachments is a pointer to an array of 83 pname:colorAttachmentCount slink:VkRenderingAttachmentInfo structures 84 describing any color attachments used. 85 * pname:pDepthAttachment is a pointer to a slink:VkRenderingAttachmentInfo 86 structure describing a depth attachment. 87 * pname:pStencilAttachment is a pointer to a 88 slink:VkRenderingAttachmentInfo structure describing a stencil 89 attachment. 90 91ifdef::VK_KHR_multiview,VK_VERSION_1_1[] 92If pname:viewMask is not `0`, multiview is enabled. 93endif::VK_KHR_multiview,VK_VERSION_1_1[] 94 95ifdef::VK_KHR_device_group,VK_VERSION_1_1[] 96If there is an instance of slink:VkDeviceGroupRenderPassBeginInfo included 97in the pname:pNext chain and its pname:deviceRenderAreaCount member is not 98`0`, then pname:renderArea is ignored, and the render area is defined 99per-device by that structure. 100endif::VK_KHR_device_group,VK_VERSION_1_1[] 101 102ifdef::VK_QCOM_multiview_per_view_render_areas[] 103If multiview is enabled, and the <<features-multiview-per-view-render-areas, 104pname:multiviewPerViewRenderAreas>> feature is enabled, and there is an 105instance of slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM 106included in the pname:pNext chain with pname:perViewRenderAreaCount not 107equal to `0`, then the elements of 108slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM::pname:pPerViewRenderAreas 109override pname:renderArea and define a render area for each view. 110In this case, pname:renderArea must: be set to an area at least as large as 111the union of all the per-view render areas. 112endif::VK_QCOM_multiview_per_view_render_areas[] 113 114Each element of the pname:pColorAttachments array corresponds to an output 115location in the shader, i.e. if the shader declares an output variable 116decorated with a code:Location value of *X*, then it uses the attachment 117provided in pname:pColorAttachments[*X*]. 118If the pname:imageView member of any element of pname:pColorAttachments is 119dlink:VK_NULL_HANDLE, 120ifdef::VK_ANDROID_external_format_resolve[] 121and pname:resolveMode is not 122ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 123endif::VK_ANDROID_external_format_resolve[] 124writes to the corresponding location by a fragment are discarded. 125 126.Valid Usage 127**** 128 * [[VUID-VkRenderingInfo-viewMask-06069]] 129 If pname:viewMask is `0`, pname:layerCount must: not be `0` 130 * [[VUID-VkRenderingInfo-multisampledRenderToSingleSampled-06857]] 131 pname:imageView members of pname:pDepthAttachment, 132 pname:pStencilAttachment, and elements of pname:pColorAttachments that 133 are not dlink:VK_NULL_HANDLE must: have been created with the same 134 pname:sampleCount 135ifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_EXT_multisampled_render_to_single_sampled[] 136 , if none of the following are enabled: 137ifdef::VK_AMD_mixed_attachment_samples[] 138 ** The `apiext:VK_AMD_mixed_attachment_samples` extension 139endif::VK_AMD_mixed_attachment_samples[] 140ifdef::VK_NV_framebuffer_mixed_samples[] 141 ** The `apiext:VK_NV_framebuffer_mixed_samples` extension 142endif::VK_NV_framebuffer_mixed_samples[] 143ifdef::VK_EXT_multisampled_render_to_single_sampled[] 144 ** The <<features-multisampledRenderToSingleSampled, 145 pname:multisampledRenderToSingleSampled>> feature, 146endif::VK_EXT_multisampled_render_to_single_sampled[] 147endif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_EXT_multisampled_render_to_single_sampled[] 148 * [[VUID-VkRenderingInfo-imageView-09429]] 149 pname:imageView members of elements of pname:pColorAttachments that are 150 not dlink:VK_NULL_HANDLE must: have been created with the same 151 pname:sampleCount 152ifdef::VK_EXT_multisampled_render_to_single_sampled[] 153 , if the <<features-multisampledRenderToSingleSampled, 154 pname:multisampledRenderToSingleSampled>> feature is not enabled 155endif::VK_EXT_multisampled_render_to_single_sampled[] 156 * [[VUID-VkRenderingInfo-None-08994]] 157ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 158 If slink:VkDeviceGroupRenderPassBeginInfo::pname:deviceRenderAreaCount 159 is 0, 160endif::VK_VERSION_1_1,VK_KHR_device_group[] 161 pname:renderArea.extent.width must: be greater than 0 162 * [[VUID-VkRenderingInfo-None-08995]] 163ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 164 If slink:VkDeviceGroupRenderPassBeginInfo::pname:deviceRenderAreaCount 165 is 0, 166endif::VK_VERSION_1_1,VK_KHR_device_group[] 167 pname:renderArea.extent.height must: be greater than 0 168ifdef::VK_EXT_multisampled_render_to_single_sampled[] 169 * [[VUID-VkRenderingInfo-imageView-06858]] 170 If 171 <<subpass-multisampledrendertosinglesampled,multisampled-render-to-single-sampled>> 172 is enabled, then all attachments referenced by pname:imageView members 173 of pname:pDepthAttachment, pname:pStencilAttachment, and elements of 174 pname:pColorAttachments that are not dlink:VK_NULL_HANDLE must: have a 175 sample count that is either ename:VK_SAMPLE_COUNT_1_BIT or equal to 176 slink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples 177 * [[VUID-VkRenderingInfo-imageView-06859]] 178 If 179 <<subpass-multisampledrendertosinglesampled,multisampled-render-to-single-sampled>> 180 is enabled, then all attachments referenced by pname:imageView members 181 of pname:pDepthAttachment, pname:pStencilAttachment, and elements of 182 pname:pColorAttachments that are not dlink:VK_NULL_HANDLE and have a 183 sample count of ename:VK_SAMPLE_COUNT_1_BIT must: have been created with 184 ename:VK_IMAGE_CREATE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_BIT_EXT in 185 their slink:VkImageCreateInfo::pname:flags 186endif::VK_EXT_multisampled_render_to_single_sampled[] 187 * [[VUID-VkRenderingInfo-pNext-06077]] 188ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 189 If the pname:pNext chain does not contain 190 slink:VkDeviceGroupRenderPassBeginInfo or its 191 pname:deviceRenderAreaCount member is equal to 0, 192endif::VK_VERSION_1_1,VK_KHR_device_group[] 193 pname:renderArea.offset.x must: be greater than or equal to 0 194 * [[VUID-VkRenderingInfo-pNext-06078]] 195ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 196 If the pname:pNext chain does not contain 197 slink:VkDeviceGroupRenderPassBeginInfo or its 198 pname:deviceRenderAreaCount member is equal to 0, 199endif::VK_VERSION_1_1,VK_KHR_device_group[] 200 pname:renderArea.offset.y must: be greater than or equal to 0 201 * [[VUID-VkRenderingInfo-pNext-07815]] 202ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 203 If the pname:pNext chain does not contain 204 slink:VkDeviceGroupRenderPassBeginInfo or its 205 pname:deviceRenderAreaCount member is equal to 0, 206endif::VK_VERSION_1_1,VK_KHR_device_group[] 207 the sum of pname:renderArea.extent.width and pname:renderArea.offset.x 208 must: be less than or equal to 209 <<limits-maxFramebufferWidth,pname:maxFramebufferWidth>> 210 * [[VUID-VkRenderingInfo-pNext-07816]] 211ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 212 If the pname:pNext chain does not contain 213 slink:VkDeviceGroupRenderPassBeginInfo or its 214 pname:deviceRenderAreaCount member is equal to 0, 215endif::VK_VERSION_1_1,VK_KHR_device_group[] 216 the sum of pname:renderArea.extent.height and pname:renderArea.offset.y 217 must: be less than or equal to 218 <<limits-maxFramebufferWidth,pname:maxFramebufferHeight>> 219 * [[VUID-VkRenderingInfo-pNext-06079]] 220ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 221 If the pname:pNext chain does not contain 222 slink:VkDeviceGroupRenderPassBeginInfo or its 223 pname:deviceRenderAreaCount member is equal to 0, 224endif::VK_VERSION_1_1,VK_KHR_device_group[] 225 the width of the pname:imageView member of any element of 226 pname:pColorAttachments, pname:pDepthAttachment, or 227 pname:pStencilAttachment that is not dlink:VK_NULL_HANDLE must: be 228 greater than or equal to [eq]#pname:renderArea.offset.x {plus} 229 pname:renderArea.extent.width# 230 * [[VUID-VkRenderingInfo-pNext-06080]] 231ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 232 If the pname:pNext chain does not contain 233 slink:VkDeviceGroupRenderPassBeginInfo or its 234 pname:deviceRenderAreaCount member is equal to 0, 235endif::VK_VERSION_1_1,VK_KHR_device_group[] 236 the height of the pname:imageView member of any element of 237 pname:pColorAttachments, pname:pDepthAttachment, or 238 pname:pStencilAttachment that is not dlink:VK_NULL_HANDLE must: be 239 greater than or equal to [eq]#pname:renderArea.offset.y {plus} 240 pname:renderArea.extent.height# 241ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 242 * [[VUID-VkRenderingInfo-pNext-06083]] 243 If the pname:pNext chain contains 244 slink:VkDeviceGroupRenderPassBeginInfo, the width of the pname:imageView 245 member of any element of pname:pColorAttachments, 246 pname:pDepthAttachment, or pname:pStencilAttachment that is not 247 dlink:VK_NULL_HANDLE must: be greater than or equal to the sum of the 248 pname:offset.x and pname:extent.width members of each element of 249 pname:pDeviceRenderAreas 250 * [[VUID-VkRenderingInfo-pNext-06084]] 251 If the pname:pNext chain contains 252 slink:VkDeviceGroupRenderPassBeginInfo, the height of the 253 pname:imageView member of any element of pname:pColorAttachments, 254 pname:pDepthAttachment, or pname:pStencilAttachment that is not 255 dlink:VK_NULL_HANDLE must: be greater than or equal to the sum of the 256 pname:offset.y and pname:extent.height members of each element of 257 pname:pDeviceRenderAreas 258 * [[VUID-VkRenderingInfo-pDepthAttachment-06085]] 259 If neither pname:pDepthAttachment or pname:pStencilAttachment are `NULL` 260 and the pname:imageView member of either structure is not 261 dlink:VK_NULL_HANDLE, the pname:imageView member of each structure must: 262 be the same 263 * [[VUID-VkRenderingInfo-pDepthAttachment-06086]] 264 If neither pname:pDepthAttachment or pname:pStencilAttachment are 265 `NULL`, and the pname:resolveMode member of each is not 266 ename:VK_RESOLVE_MODE_NONE, the pname:resolveImageView member of each 267 structure must: be the same 268endif::VK_VERSION_1_1,VK_KHR_device_group[] 269 * [[VUID-VkRenderingInfo-colorAttachmentCount-06087]] 270 If pname:colorAttachmentCount is not `0` and the pname:imageView member 271 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, 272 that pname:imageView must: have been created with 273 ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT 274 * [[VUID-VkRenderingInfo-colorAttachmentCount-09476]] 275 If pname:colorAttachmentCount is not `0` and there is an element of 276 pname:pColorAttachments with 277ifdef::VK_ANDROID_external_format_resolve[] 278 either its pname:resolveMode member set to 279 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, or 280endif::VK_ANDROID_external_format_resolve[] 281 its pname:imageView member not dlink:VK_NULL_HANDLE, and its 282 pname:resolveMode member not set to ename:VK_RESOLVE_MODE_NONE, the 283 pname:resolveImageView member of that element of pname:pColorAttachments 284 must: have been created with ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT 285 * [[VUID-VkRenderingInfo-pDepthAttachment-06547]] 286 If pname:pDepthAttachment is not `NULL` and 287 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, 288 pname:pDepthAttachment->imageView must: have been created with a format 289 that includes a depth component 290 * [[VUID-VkRenderingInfo-pDepthAttachment-06088]] 291 If pname:pDepthAttachment is not `NULL` and 292 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, 293 pname:pDepthAttachment->imageView must: have been created with 294 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 295 * [[VUID-VkRenderingInfo-pDepthAttachment-09477]] 296 If pname:pDepthAttachment is not `NULL` and 297 pname:pDepthAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 298 pname:pDepthAttachment->resolveImageView must: have been created with 299 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 300 * [[VUID-VkRenderingInfo-pStencilAttachment-06548]] 301 If pname:pStencilAttachment is not `NULL` and 302 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, 303 pname:pStencilAttachment->imageView must: have been created with a 304 format that includes a stencil aspect 305 * [[VUID-VkRenderingInfo-pStencilAttachment-06089]] 306 If pname:pStencilAttachment is not `NULL` and 307 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, 308 pname:pStencilAttachment->imageView must: have been created with a 309 stencil usage including 310 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 311 * [[VUID-VkRenderingInfo-pStencilAttachment-09478]] 312 If pname:pStencilAttachment is not `NULL` and 313 pname:pStencilAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 314 pname:pStencilAttachment->resolveImageView must: have been created with 315 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 316 * [[VUID-VkRenderingInfo-colorAttachmentCount-06090]] 317 If pname:colorAttachmentCount is not `0` and the pname:imageView member 318 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, 319 the pname:layout member of that element of pname:pColorAttachments must: 320 not be ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or 321 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL 322 * [[VUID-VkRenderingInfo-colorAttachmentCount-06091]] 323 If pname:colorAttachmentCount is not `0` and the pname:imageView member 324 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, if 325 the pname:resolveMode member of that element of pname:pColorAttachments 326 is not ename:VK_RESOLVE_MODE_NONE, its pname:resolveImageLayout member 327 must: not be ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL or 328 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL 329 * [[VUID-VkRenderingInfo-pDepthAttachment-06092]] 330 If pname:pDepthAttachment is not `NULL` and 331 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, 332 pname:pDepthAttachment->layout must: not be 333 ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 334 * [[VUID-VkRenderingInfo-pDepthAttachment-06093]] 335 If pname:pDepthAttachment is not `NULL`, 336 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, and 337 pname:pDepthAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 338 pname:pDepthAttachment->resolveImageLayout must: not be 339 ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 340 * [[VUID-VkRenderingInfo-pStencilAttachment-06094]] 341 If pname:pStencilAttachment is not `NULL` and 342 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, 343 pname:pStencilAttachment->layout must: not be 344 ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 345 * [[VUID-VkRenderingInfo-pStencilAttachment-06095]] 346 If pname:pStencilAttachment is not `NULL`, 347 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, and 348 pname:pStencilAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 349 pname:pStencilAttachment->resolveImageLayout must: not be 350 ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 351ifdef::VK_KHR_maintenance2,VK_VERSION_1_1[] 352 * [[VUID-VkRenderingInfo-colorAttachmentCount-06096]] 353 If pname:colorAttachmentCount is not `0` and the pname:imageView member 354 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, 355 the pname:layout member of that element of pname:pColorAttachments must: 356 not be ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL 357 or ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL 358 * [[VUID-VkRenderingInfo-colorAttachmentCount-06097]] 359 If pname:colorAttachmentCount is not `0` and the pname:imageView member 360 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, if 361 the pname:resolveMode member of that element of pname:pColorAttachments 362 is not ename:VK_RESOLVE_MODE_NONE, its pname:resolveImageLayout member 363 must: not be 364 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL or 365 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL 366 * [[VUID-VkRenderingInfo-pDepthAttachment-06098]] 367 If pname:pDepthAttachment is not `NULL`, 368 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, and 369 pname:pDepthAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 370 pname:pDepthAttachment->resolveImageLayout must: not be 371 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL 372 * [[VUID-VkRenderingInfo-pStencilAttachment-06099]] 373 If pname:pStencilAttachment is not `NULL`, 374 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, and 375 pname:pStencilAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 376 pname:pStencilAttachment->resolveImageLayout must: not be 377 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL 378endif::VK_KHR_maintenance2,VK_VERSION_1_1[] 379ifdef::VK_KHR_separate_depth_stencil_layouts,VK_VERSION_1_2[] 380 * [[VUID-VkRenderingInfo-colorAttachmentCount-06100]] 381 If pname:colorAttachmentCount is not `0` and the pname:imageView member 382 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, 383 the pname:layout member of that element of pname:pColorAttachments must: 384 not be ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, 385 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, 386 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or 387 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL 388 * [[VUID-VkRenderingInfo-colorAttachmentCount-06101]] 389 If pname:colorAttachmentCount is not `0` and the pname:imageView member 390 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, if 391 the pname:resolveMode member of that element of pname:pColorAttachments 392 is not ename:VK_RESOLVE_MODE_NONE, its pname:resolveImageLayout member 393 must: not be ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, 394 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, 395 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or 396 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL 397 * [[VUID-VkRenderingInfo-pDepthAttachment-07732]] 398 If pname:pDepthAttachment is not `NULL` and 399 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, 400 pname:pDepthAttachment->layout must: not be 401 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or 402 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL 403 * [[VUID-VkRenderingInfo-pDepthAttachment-07733]] 404 If pname:pDepthAttachment is not `NULL`, 405 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, and 406 pname:pDepthAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 407 pname:pDepthAttachment->resolveImageLayout must: not be 408 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or 409 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL 410 * [[VUID-VkRenderingInfo-pStencilAttachment-07734]] 411 If pname:pStencilAttachment is not `NULL` and 412 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, 413 pname:pStencilAttachment->layout must: not be 414 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 415 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 416 * [[VUID-VkRenderingInfo-pStencilAttachment-07735]] 417 If pname:pStencilAttachment is not `NULL`, 418 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, and 419 pname:pStencilAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 420 pname:pStencilAttachment->resolveImageLayout must: not be 421 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 422 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 423endif::VK_KHR_separate_depth_stencil_layouts,VK_VERSION_1_2[] 424 * [[VUID-VkRenderingInfo-pDepthAttachment-06102]] 425 If pname:pDepthAttachment is not `NULL` and 426 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, 427 pname:pDepthAttachment->resolveMode must: be one of the bits set in 428 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:supportedDepthResolveModes 429 * [[VUID-VkRenderingInfo-pStencilAttachment-06103]] 430 If pname:pStencilAttachment is not `NULL` and 431 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, 432 pname:pStencilAttachment->resolveMode must: be one of the bits set in 433 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:supportedStencilResolveModes 434 * [[VUID-VkRenderingInfo-pDepthAttachment-06104]] 435 If pname:pDepthAttachment or pname:pStencilAttachment are both not 436 `NULL`, pname:pDepthAttachment->imageView and 437 pname:pStencilAttachment->imageView are both not dlink:VK_NULL_HANDLE, 438 and 439 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolveNone 440 is ename:VK_FALSE, the pname:resolveMode of both structures must: be the 441 same value 442 * [[VUID-VkRenderingInfo-pDepthAttachment-06105]] 443 If pname:pDepthAttachment or pname:pStencilAttachment are both not 444 `NULL`, pname:pDepthAttachment->imageView and 445 pname:pStencilAttachment->imageView are both not dlink:VK_NULL_HANDLE, 446 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolve 447 is ename:VK_FALSE, and the pname:resolveMode of neither structure is 448 ename:VK_RESOLVE_MODE_NONE, the pname:resolveMode of both structures 449 must: be the same value 450 * [[VUID-VkRenderingInfo-colorAttachmentCount-06106]] 451 pname:colorAttachmentCount must: be less than or equal to 452 slink:VkPhysicalDeviceLimits::pname:maxColorAttachments 453ifdef::VK_EXT_fragment_density_map[] 454 * [[VUID-VkRenderingInfo-imageView-06107]] 455 If the pname:imageView member of a 456 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 457 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, and the 458 <<features-fragmentDensityMapNonSubsampledImages, 459 pname:fragmentDensityMapNonSubsampledImages>> feature is not enabled, 460 valid pname:imageView and pname:resolveImageView members of 461 pname:pDepthAttachment, pname:pStencilAttachment, and each element of 462 pname:pColorAttachments must: be a slink:VkImageView created with 463 ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT 464ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 465 * [[VUID-VkRenderingInfo-imageView-06108]] 466 If the pname:imageView member of a 467 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 468 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, and pname:viewMask 469 is not `0`, pname:imageView must: have a pname:layerCount greater than 470 or equal to the index of the most significant bit in pname:viewMask 471 * [[VUID-VkRenderingInfo-imageView-06109]] 472 If the pname:imageView member of a 473 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 474 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, and pname:viewMask 475 is `0`, pname:imageView must: have a pname:layerCount equal to `1` 476endif::VK_VERSION_1_1,VK_KHR_multiview[] 477 * [[VUID-VkRenderingInfo-pNext-06112]] 478 If 479ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 480 the pname:pNext chain does not contain 481 slink:VkDeviceGroupRenderPassBeginInfo or its 482 pname:deviceRenderAreaCount member is equal to 0 and 483endif::VK_VERSION_1_1,VK_KHR_device_group[] 484 the pname:imageView member of a 485 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 486 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, pname:imageView 487 must: have a width greater than or equal to 488 latexmath:[\left\lceil{\frac{renderArea_{x}+renderArea_{width}}{maxFragmentDensityTexelSize_{width}}}\right\rceil] 489 * [[VUID-VkRenderingInfo-pNext-06114]] 490 If 491ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 492 the pname:pNext chain does not contain 493 slink:VkDeviceGroupRenderPassBeginInfo or its 494 pname:deviceRenderAreaCount member is equal to 0 and 495endif::VK_VERSION_1_1,VK_KHR_device_group[] 496 the pname:imageView member of a 497 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 498 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, pname:imageView 499 must: have a height greater than or equal to 500 latexmath:[\left\lceil{\frac{renderArea_{y}+renderArea_{height}}{maxFragmentDensityTexelSize_{height}}}\right\rceil] 501ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 502 * [[VUID-VkRenderingInfo-pNext-06113]] 503 If the pname:pNext chain contains a 504 slink:VkDeviceGroupRenderPassBeginInfo structure, its 505 pname:deviceRenderAreaCount member is not 0, and the pname:imageView 506 member of a slink:VkRenderingFragmentDensityMapAttachmentInfoEXT 507 structure included in the pname:pNext chain is not dlink:VK_NULL_HANDLE, 508 pname:imageView must: have a width greater than or equal to 509 latexmath:[\left\lceil{\frac{pDeviceRenderAreas_{x}+pDeviceRenderAreas_{width}}{maxFragmentDensityTexelSize_{width}}}\right\rceil] 510 for each element of pname:pDeviceRenderAreas 511 * [[VUID-VkRenderingInfo-pNext-06115]] 512 If the pname:pNext chain contains a 513 slink:VkDeviceGroupRenderPassBeginInfo structure, its 514 pname:deviceRenderAreaCount member is not 0, and the pname:imageView 515 member of a slink:VkRenderingFragmentDensityMapAttachmentInfoEXT 516 structure included in the pname:pNext chain is not dlink:VK_NULL_HANDLE, 517 pname:imageView must: have a height greater than or equal to 518 latexmath:[\left\lceil{\frac{pDeviceRenderAreas_{y}+pDeviceRenderAreas_{height}}{maxFragmentDensityTexelSize_{height}}}\right\rceil] 519 for each element of pname:pDeviceRenderAreas 520endif::VK_VERSION_1_1,VK_KHR_device_group[] 521 * [[VUID-VkRenderingInfo-imageView-06116]] 522 If the pname:imageView member of a 523 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 524 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, it must: not be 525 equal to the pname:imageView or pname:resolveImageView member of 526 pname:pDepthAttachment, pname:pStencilAttachment, or any element of 527 pname:pColorAttachments 528endif::VK_EXT_fragment_density_map[] 529ifdef::VK_KHR_fragment_shading_rate[] 530 * [[VUID-VkRenderingInfo-pNext-06119]] 531 If 532ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 533 the pname:pNext chain does not contain 534 slink:VkDeviceGroupRenderPassBeginInfo or its 535 pname:deviceRenderAreaCount member is equal to 0 and 536endif::VK_VERSION_1_1,VK_KHR_device_group[] 537 the pname:imageView member of a 538 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR structure included 539 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, pname:imageView 540 must: have a width greater than or equal to 541 latexmath:[\left\lceil{\frac{renderArea_{x}+renderArea_{width}}{shadingRateAttachmentTexelSize_{width}}}\right\rceil] 542 * [[VUID-VkRenderingInfo-pNext-06121]] 543 If 544ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 545 the pname:pNext chain does not contain 546 slink:VkDeviceGroupRenderPassBeginInfo or its 547 pname:deviceRenderAreaCount member is equal to 0 and 548endif::VK_VERSION_1_1,VK_KHR_device_group[] 549 the pname:imageView member of a 550 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR structure included 551 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, pname:imageView 552 must: have a height greater than or equal to 553 latexmath:[\left\lceil{\frac{renderArea_{y}+renderArea_{height}}{shadingRateAttachmentTexelSize_{height}}}\right\rceil] 554ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 555 * [[VUID-VkRenderingInfo-pNext-06120]] 556 If the pname:pNext chain contains a 557 slink:VkDeviceGroupRenderPassBeginInfo structure, its 558 pname:deviceRenderAreaCount member is not 0, and the pname:imageView 559 member of a slink:VkRenderingFragmentShadingRateAttachmentInfoKHR 560 structure included in the pname:pNext chain is not dlink:VK_NULL_HANDLE, 561 pname:imageView must: have a width greater than or equal to 562 latexmath:[\left\lceil{\frac{pDeviceRenderAreas_{x}+pDeviceRenderAreas_{width}}{shadingRateAttachmentTexelSize_{width}}}\right\rceil] 563 for each element of pname:pDeviceRenderAreas 564 * [[VUID-VkRenderingInfo-pNext-06122]] 565 If the pname:pNext chain contains a 566 slink:VkDeviceGroupRenderPassBeginInfo structure, its 567 pname:deviceRenderAreaCount member is not 0, and the pname:imageView 568 member of a slink:VkRenderingFragmentShadingRateAttachmentInfoKHR 569 structure included in the pname:pNext chain is not dlink:VK_NULL_HANDLE, 570 pname:imageView must: have a height greater than or equal to 571 latexmath:[\left\lceil{\frac{pDeviceRenderAreas_{y}+pDeviceRenderAreas_{height}}{shadingRateAttachmentTexelSize_{height}}}\right\rceil] 572 for each element of pname:pDeviceRenderAreas 573endif::VK_VERSION_1_1,VK_KHR_device_group[] 574 * [[VUID-VkRenderingInfo-layerCount-07817]] 575 pname:layerCount must: be less than or equal to 576 <<limits-maxFramebufferLayers, pname:maxFramebufferLayers>> 577 * [[VUID-VkRenderingInfo-imageView-06123]] 578 If the pname:imageView member of a 579 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR structure included 580 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, and pname:viewMask 581 is `0`, pname:imageView must: have a pname:layerCount that is either 582 equal to `1` or greater than or equal to pname:layerCount 583 * [[VUID-VkRenderingInfo-imageView-06124]] 584 If the pname:imageView member of a 585 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR structure included 586 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, and pname:viewMask 587 is not `0`, pname:imageView must: have a pname:layerCount that either 588 equal to `1` or greater than or equal to the index of the most 589 significant bit in pname:viewMask 590 * [[VUID-VkRenderingInfo-imageView-06125]] 591 If the pname:imageView member of a 592 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR structure included 593 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, it must: not be 594 equal to the pname:imageView or pname:resolveImageView member of 595 pname:pDepthAttachment, pname:pStencilAttachment, or any element of 596 pname:pColorAttachments 597ifdef::VK_EXT_fragment_density_map[] 598 * [[VUID-VkRenderingInfo-imageView-06126]] 599 If the pname:imageView member of a 600 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR structure included 601 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, it must: not be 602 equal to the pname:imageView member of a 603 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 604 in the pname:pNext chain 605endif::VK_EXT_fragment_density_map[] 606endif::VK_KHR_fragment_shading_rate[] 607 * [[VUID-VkRenderingInfo-multiview-06127]] 608 If the <<features-multiview, pname:multiview>> feature is not enabled, 609 pname:viewMask must: be `0` 610ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 611 * [[VUID-VkRenderingInfo-viewMask-06128]] 612 The index of the most significant bit in pname:viewMask must: be less 613 than <<limits-maxMultiviewViewCount, pname:maxMultiviewViewCount>> 614endif::VK_VERSION_1_1,VK_KHR_multiview[] 615ifdef::VK_QCOM_multiview_per_view_render_areas[] 616 * [[VUID-VkRenderingInfo-perViewRenderAreaCount-07857]] 617 If the pname:perViewRenderAreaCount member of a 618 slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM structure 619 included in the pname:pNext chain is not `0`, then the 620 <<features-multiview-per-view-render-areas, 621 pname:multiviewPerViewRenderAreas>> feature must: be enabled. 622 * [[VUID-VkRenderingInfo-perViewRenderAreaCount-07858]] 623 If the pname:perViewRenderAreaCount member of a 624 slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM structure 625 included in the pname:pNext chain is not `0`, then pname:renderArea 626 must: specify a render area that includes the union of all per view 627 render areas. 628endif::VK_QCOM_multiview_per_view_render_areas[] 629 * [[VUID-VkRenderingInfo-None-09044]] 630 Valid attachments specified by this structure must: not be bound to 631 memory locations that are bound to any other valid attachments specified 632 by this structure 633ifdef::VK_EXT_nested_command_buffer[] 634 * [[VUID-VkRenderingInfo-flags-09381]] 635 If pname:flags includes ename:VK_RENDERING_CONTENTS_INLINE_BIT_EXT then 636 the <<features-nestedCommandBuffer, pname:nestedCommandBuffer>> feature 637 must: be enabled 638endif::VK_EXT_nested_command_buffer[] 639ifdef::VK_ANDROID_external_format_resolve[] 640 * [[VUID-VkRenderingInfo-pDepthAttachment-09318]] 641 pname:pDepthAttachment->resolveMode must: not be 642 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID 643 * [[VUID-VkRenderingInfo-pStencilAttachment-09319]] 644 pname:pStencilAttachment->resolveMode must: not be 645 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID 646 * [[VUID-VkRenderingInfo-colorAttachmentCount-09320]] 647 If pname:colorAttachmentCount is not `1`, the pname:resolveMode member 648 of any element of pname:pColorAttachments must: not be 649 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID 650ifdef::VK_EXT_fragment_density_map[] 651 * [[VUID-VkRenderingInfo-resolveMode-09321]] 652 If the pname:resolveMode of any element of pname:pColorAttachments is 653 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 654 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT::pname:imageView 655 must: be dlink:VK_NULL_HANDLE 656endif::VK_EXT_fragment_density_map[] 657ifdef::VK_KHR_fragment_shading_rate[] 658 * [[VUID-VkRenderingInfo-resolveMode-09322]] 659 If the pname:resolveMode of any element of pname:pColorAttachments is 660 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 661 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR::pname:imageView 662 must: be dlink:VK_NULL_HANDLE 663endif::VK_KHR_fragment_shading_rate[] 664endif::VK_ANDROID_external_format_resolve[] 665ifdef::VK_ARM_render_pass_striped[] 666 If the pname:pNext chain contains a slink:VkRenderPassStripeBeginInfoARM 667 structure, the union of stripe areas defined by the elements of 668 slink:VkRenderPassStripeInfoARM::pname:pStripeInfos must: cover the 669 pname:renderArea 670endif::VK_ARM_render_pass_striped[] 671 * [[VUID-VkRenderingInfo-colorAttachmentCount-09479]] 672 If pname:colorAttachmentCount is not `0` and the pname:imageView member 673 of an element of pname:pColorAttachments is not dlink:VK_NULL_HANDLE, 674 that pname:imageView must: have been created with the 675 <<resources-image-views-identity-mappings,identity swizzle>> 676 * [[VUID-VkRenderingInfo-colorAttachmentCount-09480]] 677 If pname:colorAttachmentCount is not `0`, and there is an element of 678 pname:pColorAttachments with 679ifdef::VK_ANDROID_external_format_resolve[] 680 either its pname:resolveMode member set to 681 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, or 682endif::VK_ANDROID_external_format_resolve[] 683 its pname:imageView member not set to dlink:VK_NULL_HANDLE and its 684 pname:resolveMode member not set to ename:VK_RESOLVE_MODE_NONE, the 685 pname:resolveImageView member of that element of pname:pColorAttachments 686 must: have been created with the 687 <<resources-image-views-identity-mappings,identity swizzle>> 688 * [[VUID-VkRenderingInfo-pDepthAttachment-09481]] 689 If pname:pDepthAttachment is not `NULL` and 690 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, 691 pname:pDepthAttachment->imageView must: have been created with the 692 <<resources-image-views-identity-mappings,identity swizzle>> 693 * [[VUID-VkRenderingInfo-pDepthAttachment-09482]] 694 If pname:pDepthAttachment is not `NULL`, 695 pname:pDepthAttachment->imageView is not dlink:VK_NULL_HANDLE, and 696 pname:pDepthAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 697 pname:pDepthAttachment->resolveImageView must: have been created with 698 the <<resources-image-views-identity-mappings,identity swizzle>> 699 * [[VUID-VkRenderingInfo-pStencilAttachment-09483]] 700 If pname:pStencilAttachment is not `NULL` and 701 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, 702 pname:pStencilAttachment->imageView must: have been created with the 703 <<resources-image-views-identity-mappings,identity swizzle>> 704 * [[VUID-VkRenderingInfo-pStencilAttachment-09484]] 705 If pname:pStencilAttachment is not `NULL`, 706 pname:pStencilAttachment->imageView is not dlink:VK_NULL_HANDLE, and 707 pname:pStencilAttachment->resolveMode is not ename:VK_RESOLVE_MODE_NONE, 708 pname:pStencilAttachment->resolveImageView must: have been created with 709 the <<resources-image-views-identity-mappings,identity swizzle>> 710ifdef::VK_KHR_fragment_shading_rate[] 711 * [[VUID-VkRenderingInfo-imageView-09485]] 712 If the pname:imageView member of a 713 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR structure included 714 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, it must: have been 715 created with the <<resources-image-views-identity-mappings,identity 716 swizzle>> 717endif::VK_KHR_fragment_shading_rate[] 718ifdef::VK_EXT_fragment_density_map[] 719 * [[VUID-VkRenderingInfo-imageView-09486]] 720 If the pname:imageView member of a 721 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT structure included 722 in the pname:pNext chain is not dlink:VK_NULL_HANDLE, it must: have been 723 created with the <<resources-image-views-identity-mappings,identity 724 swizzle>> 725endif::VK_EXT_fragment_density_map[] 726**** 727 728include::{generated}/validity/structs/VkRenderingInfo.adoc[] 729-- 730 731[open,refpage='VkRenderingFlagBits',desc='Bitmask specifying additional properties of a dynamic render pass instance',type='enums',alias='VkRenderingFlagBitsKHR'] 732-- 733Bits which can: be set in slink:VkRenderingInfo::pname:flags describing 734additional properties of the render pass are: 735 736include::{generated}/api/enums/VkRenderingFlagBits.adoc[] 737 738ifdef::VK_KHR_dynamic_rendering[] 739or the equivalent 740 741include::{generated}/api/enums/VkRenderingFlagBitsKHR.adoc[] 742endif::VK_KHR_dynamic_rendering[] 743 744 * ename:VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT specifies that 745 draw calls for the render pass instance will be recorded in secondary 746 command buffers. 747ifdef::VK_EXT_nested_command_buffer[] 748 If the <<features-nestedCommandBuffer, pname:nestedCommandBuffer>> 749 feature is enabled, the draw calls can: come from both inline and 750 flink:vkCmdExecuteCommands. 751endif::VK_EXT_nested_command_buffer[] 752 * ename:VK_RENDERING_RESUMING_BIT specifies that the render pass instance 753 is resuming an earlier suspended render pass instance. 754 * ename:VK_RENDERING_SUSPENDING_BIT specifies that the render pass 755 instance will be suspended. 756ifdef::VK_EXT_legacy_dithering[] 757 * ename:VK_RENDERING_ENABLE_LEGACY_DITHERING_BIT_EXT specifies that 758 <<interfaces-legacy-dithering, Legacy Dithering>> is enabled for the 759 render pass instance. 760endif::VK_EXT_legacy_dithering[] 761ifdef::VK_EXT_nested_command_buffer[] 762 * ename:VK_RENDERING_CONTENTS_INLINE_BIT_EXT specifies that draw calls for 763 the render pass instance can: be recorded inline within the current 764 command buffer. 765 When the <<features-nestedCommandBuffer, pname:nestedCommandBuffer>> 766 feature is enabled this can: be combined with the 767 ename:VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT bit to allow 768 draw calls to be recorded both inline and in secondary command buffers. 769endif::VK_EXT_nested_command_buffer[] 770 771[[renderpass-suspension]] 772The contents of pname:pRenderingInfo must: match between suspended render 773pass instances and the render pass instances that resume them, other than 774the presence or absence of the ename:VK_RENDERING_RESUMING_BIT, 775ename:VK_RENDERING_SUSPENDING_BIT, and 776ename:VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT flags. 777No action or synchronization commands, or other render pass instances, are 778allowed between suspending and resuming render pass instances. 779-- 780 781[open,refpage='VkRenderingFlags',desc='Bitmask of VkRenderingFlagBits',type='flags',alias='VkRenderingFlagsKHR'] 782-- 783include::{generated}/api/flags/VkRenderingFlags.adoc[] 784 785ifdef::VK_KHR_dynamic_rendering[] 786or the equivalent 787 788include::{generated}/api/flags/VkRenderingFlagsKHR.adoc[] 789endif::VK_KHR_dynamic_rendering[] 790 791tname:VkRenderingFlags is a bitmask type for setting a mask of zero or more 792elink:VkRenderingFlagBits. 793-- 794 795[open,refpage='VkRenderingAttachmentInfo',desc='Structure specifying attachment information',type='structs',alias='VkRenderingAttachmentInfoKHR'] 796-- 797The sname:VkRenderingAttachmentInfo structure is defined as: 798 799include::{generated}/api/structs/VkRenderingAttachmentInfo.adoc[] 800 801ifdef::VK_KHR_dynamic_rendering[] 802or the equivalent 803 804include::{generated}/api/structs/VkRenderingAttachmentInfoKHR.adoc[] 805endif::VK_KHR_dynamic_rendering[] 806 807 * pname:sType is a elink:VkStructureType value identifying this structure. 808 * pname:pNext is `NULL` or a pointer to a structure extending this 809 structure. 810 * pname:imageView is the image view that will be used for rendering. 811 * pname:imageLayout is the layout that pname:imageView will be in during 812 rendering. 813 * pname:resolveMode is a elink:VkResolveModeFlagBits value defining how 814 data written to pname:imageView will be resolved into 815 pname:resolveImageView. 816 * pname:resolveImageView is an image view used to write resolved data at 817 the end of rendering. 818 * pname:resolveImageLayout is the layout that pname:resolveImageView will 819 be in during rendering. 820 * pname:loadOp is a elink:VkAttachmentLoadOp value defining the 821 <<renderpass-load-operations, load operation>> for the attachment. 822 * pname:storeOp is a elink:VkAttachmentStoreOp value defining the 823 <<renderpass-store-operations, store operation>> for the attachment. 824 * pname:clearValue is a slink:VkClearValue structure defining values used 825 to clear pname:imageView when pname:loadOp is 826 ename:VK_ATTACHMENT_LOAD_OP_CLEAR. 827 828Values in pname:imageView are loaded and stored according to the values of 829pname:loadOp and pname:storeOp, within the render area 830ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 831for each device 832endif::VK_VERSION_1_1,VK_KHR_device_group[] 833specified in slink:VkRenderingInfo. 834If pname:imageView is dlink:VK_NULL_HANDLE, 835ifdef::VK_ANDROID_external_format_resolve[] 836and pname:resolveMode is not 837ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 838endif::VK_ANDROID_external_format_resolve[] 839other members of this structure are ignored; writes to this attachment will 840be discarded, and no <<renderpass-load-operations, load>>, 841<<renderpass-store-operations, store>>, or <<renderpass-resolve-operations, 842multisample resolve>> operations will be performed. 843 844If pname:resolveMode is ename:VK_RESOLVE_MODE_NONE, then 845pname:resolveImageView is ignored. 846If pname:resolveMode is not ename:VK_RESOLVE_MODE_NONE, and 847pname:resolveImageView is not dlink:VK_NULL_HANDLE, a 848<<renderpass-resolve-operations, render pass multisample resolve operation>> 849is defined for the attachment subresource. 850ifdef::VK_ANDROID_external_format_resolve[] 851If pname:resolveMode is 852ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, and the 853<<limits-nullColorAttachmentWithExternalFormatResolve, 854pname:nullColorAttachmentWithExternalFormatResolve>> limit is ename:VK_TRUE, 855values are only undefined: once <<renderpass-load-operations, load 856operations>> have completed. 857endif::VK_ANDROID_external_format_resolve[] 858 859[NOTE] 860.Note 861==== 862The resolve mode and store operation are independent; it is valid to write 863both resolved and unresolved values, and equally valid to discard the 864unresolved values while writing the resolved ones. 865==== 866 867Store and resolve operations are only performed at the end of a render pass 868instance that does not specify the ename:VK_RENDERING_SUSPENDING_BIT_KHR 869flag. 870 871Load operations are only performed at the beginning of a render pass 872instance that does not specify the ename:VK_RENDERING_RESUMING_BIT_KHR flag. 873 874Image contents at the end of a suspended render pass instance remain defined 875for access by a resuming render pass instance. 876 877ifdef::VK_ANDROID_external_format_resolve[] 878If the <<limits-nullColorAttachmentWithExternalFormatResolve, 879pname:nullColorAttachmentWithExternalFormatResolve>> limit is ename:VK_TRUE, 880and pname:resolveMode is 881ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, values in the 882color attachment will be loaded from the resolve attachment at the start of 883rendering, and may: also be reloaded any time after a resolve occurs or the 884resolve attachment is written to; if this occurs it must: happen-before any 885writes to the color attachment are performed which happen-after the resolve 886that triggers this. 887If any color component in the external format is subsampled, values will be 888read from the nearest sample in the image when they are loaded. 889endif::VK_ANDROID_external_format_resolve[] 890 891 892.Valid Usage 893**** 894 * [[VUID-VkRenderingAttachmentInfo-imageView-06129]] 895 If pname:imageView is not dlink:VK_NULL_HANDLE and has a non-integer 896 color format, pname:resolveMode must: be ename:VK_RESOLVE_MODE_NONE or 897 ename:VK_RESOLVE_MODE_AVERAGE_BIT 898 * [[VUID-VkRenderingAttachmentInfo-imageView-06130]] 899 If pname:imageView is not dlink:VK_NULL_HANDLE and has an integer color 900 format, pname:resolveMode must: be ename:VK_RESOLVE_MODE_NONE or 901 ename:VK_RESOLVE_MODE_SAMPLE_ZERO_BIT 902 * [[VUID-VkRenderingAttachmentInfo-imageView-06861]] 903 pname:imageView must: not have a sample count of 904 ename:VK_SAMPLE_COUNT_1_BIT if all of the following hold: 905 ** pname:imageView is not dlink:VK_NULL_HANDLE 906 ** pname:resolveMode is not ename:VK_RESOLVE_MODE_NONE 907ifdef::VK_EXT_multisampled_render_to_single_sampled[] 908 ** the pname:pNext chain of slink:VkRenderingInfo does not include a 909 slink:VkMultisampledRenderToSingleSampledInfoEXT structure with the 910 pname:multisampledRenderToSingleSampledEnable field equal to 911 ename:VK_TRUE 912endif::VK_EXT_multisampled_render_to_single_sampled[] 913 * [[VUID-VkRenderingAttachmentInfo-imageView-06862]] 914 pname:resolveImageView must: not be dlink:VK_NULL_HANDLE if all of the 915 following hold: 916 ** pname:imageView is not dlink:VK_NULL_HANDLE 917 ** pname:resolveMode is not ename:VK_RESOLVE_MODE_NONE 918ifdef::VK_EXT_multisampled_render_to_single_sampled[] 919 ** the pname:pNext chain of slink:VkRenderingInfo does not include a 920 slink:VkMultisampledRenderToSingleSampledInfoEXT structure with the 921 pname:multisampledRenderToSingleSampledEnable field equal to 922 ename:VK_TRUE 923endif::VK_EXT_multisampled_render_to_single_sampled[] 924ifdef::VK_EXT_multisampled_render_to_single_sampled[] 925 * [[VUID-VkRenderingAttachmentInfo-imageView-06863]] 926 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:resolveMode is not 927 ename:VK_RESOLVE_MODE_NONE, the pname:pNext chain of 928 slink:VkRenderingInfo includes a 929 slink:VkMultisampledRenderToSingleSampledInfoEXT structure with the 930 pname:multisampledRenderToSingleSampledEnable field equal to 931 ename:VK_TRUE, and pname:imageView has a sample count of 932 ename:VK_SAMPLE_COUNT_1_BIT, pname:resolveImageView must: be 933 dlink:VK_NULL_HANDLE 934endif::VK_EXT_multisampled_render_to_single_sampled[] 935 * [[VUID-VkRenderingAttachmentInfo-imageView-06864]] 936 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:resolveImageView 937 is not dlink:VK_NULL_HANDLE, and pname:resolveMode is not 938 ename:VK_RESOLVE_MODE_NONE, pname:resolveImageView must: have a sample 939 count of ename:VK_SAMPLE_COUNT_1_BIT 940 * [[VUID-VkRenderingAttachmentInfo-imageView-06865]] 941 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:resolveImageView 942 is not dlink:VK_NULL_HANDLE, and pname:resolveMode is not 943 ename:VK_RESOLVE_MODE_NONE, pname:imageView and pname:resolveImageView 944 must: have the same elink:VkFormat 945 * [[VUID-VkRenderingAttachmentInfo-imageView-06135]] 946 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:imageLayout must: 947 not be ename:VK_IMAGE_LAYOUT_UNDEFINED, 948 ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 949 ename:VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, 950 ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, or 951 ename:VK_IMAGE_LAYOUT_PREINITIALIZED 952 * [[VUID-VkRenderingAttachmentInfo-imageView-06136]] 953 If pname:imageView is not dlink:VK_NULL_HANDLE and pname:resolveMode is 954 not ename:VK_RESOLVE_MODE_NONE, pname:resolveImageLayout must: not be 955 ename:VK_IMAGE_LAYOUT_UNDEFINED, 956 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, 957 ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 958 ename:VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, 959 ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, or 960 ename:VK_IMAGE_LAYOUT_PREINITIALIZED 961ifdef::VK_KHR_separate_depth_stencil_layouts,VK_VERSION_1_2[] 962 * [[VUID-VkRenderingAttachmentInfo-imageView-06137]] 963 If pname:imageView is not dlink:VK_NULL_HANDLE and pname:resolveMode is 964 not ename:VK_RESOLVE_MODE_NONE, pname:resolveImageLayout must: not be 965 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL or 966 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL 967endif::VK_KHR_separate_depth_stencil_layouts,VK_VERSION_1_2[] 968ifdef::VK_NV_shading_rate_image[] 969 * [[VUID-VkRenderingAttachmentInfo-imageView-06138]] 970 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:imageLayout must: 971 not be ename:VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV 972 * [[VUID-VkRenderingAttachmentInfo-imageView-06139]] 973 If pname:imageView is not dlink:VK_NULL_HANDLE and pname:resolveMode is 974 not ename:VK_RESOLVE_MODE_NONE, pname:resolveImageLayout must: not be 975 ename:VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV 976endif::VK_NV_shading_rate_image[] 977ifdef::VK_EXT_fragment_density_map[] 978 * [[VUID-VkRenderingAttachmentInfo-imageView-06140]] 979 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:imageLayout must: 980 not be ename:VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT 981 * [[VUID-VkRenderingAttachmentInfo-imageView-06141]] 982 If pname:imageView is not dlink:VK_NULL_HANDLE and pname:resolveMode is 983 not ename:VK_RESOLVE_MODE_NONE, pname:resolveImageLayout must: not be 984 ename:VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT 985endif::VK_EXT_fragment_density_map[] 986ifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 987 * [[VUID-VkRenderingAttachmentInfo-imageView-06142]] 988 If pname:imageView is not dlink:VK_NULL_HANDLE and pname:resolveMode is 989 not ename:VK_RESOLVE_MODE_NONE, pname:resolveImageLayout must: not be 990 ename:VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR 991endif::VK_VERSION_1_3,VK_KHR_synchronization2[] 992ifdef::VK_KHR_fragment_shading_rate[] 993 * [[VUID-VkRenderingAttachmentInfo-imageView-06143]] 994 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:imageLayout must: 995 not be 996 ename:VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR 997 * [[VUID-VkRenderingAttachmentInfo-imageView-06144]] 998 If pname:imageView is not dlink:VK_NULL_HANDLE and pname:resolveMode is 999 not ename:VK_RESOLVE_MODE_NONE, pname:resolveImageLayout must: not be 1000 ename:VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR 1001endif::VK_KHR_fragment_shading_rate[] 1002ifdef::VK_KHR_swapchain[] 1003 * [[VUID-VkRenderingAttachmentInfo-imageView-06145]] 1004 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:imageLayout must: 1005 not be ename:VK_IMAGE_LAYOUT_PRESENT_SRC_KHR 1006 * [[VUID-VkRenderingAttachmentInfo-imageView-06146]] 1007 If pname:imageView is not dlink:VK_NULL_HANDLE and pname:resolveMode is 1008 not ename:VK_RESOLVE_MODE_NONE, pname:resolveImageLayout must: not be 1009 ename:VK_IMAGE_LAYOUT_PRESENT_SRC_KHR 1010endif::VK_KHR_swapchain[] 1011ifdef::VK_ANDROID_external_format_resolve[] 1012 * [[VUID-VkRenderingAttachmentInfo-externalFormatResolve-09323]] 1013 If <<features-externalFormatResolve,pname:externalFormatResolve>> is not 1014 enabled, pname:resolveMode must: not be 1015 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID 1016 * [[VUID-VkRenderingAttachmentInfo-resolveMode-09324]] 1017 If pname:resolveMode is 1018 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 1019 pname:resolveImageView must: be a valid image view 1020 * [[VUID-VkRenderingAttachmentInfo-nullColorAttachmentWithExternalFormatResolve-09325]] 1021 If the <<limits-nullColorAttachmentWithExternalFormatResolve, 1022 pname:nullColorAttachmentWithExternalFormatResolve>> property is 1023 ename:VK_TRUE and pname:resolveMode is 1024 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 1025 pname:resolveImageView must: have been created with an image with a 1026 pname:samples value of ename:VK_SAMPLE_COUNT_1_BIT 1027 * [[VUID-VkRenderingAttachmentInfo-resolveMode-09326]] 1028 If pname:resolveMode is 1029 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 1030 pname:resolveImageView must: have been created with an external format 1031 specified by slink:VkExternalFormatANDROID 1032 * [[VUID-VkRenderingAttachmentInfo-resolveMode-09327]] 1033 If pname:resolveMode is 1034 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID, 1035 pname:resolveImageView must: have been created with a 1036 pname:subresourceRange.layerCount of `1` 1037 * [[VUID-VkRenderingAttachmentInfo-resolveMode-09328]] 1038 If pname:resolveMode is 1039 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID and 1040 <<limits-nullColorAttachmentWithExternalFormatResolve, 1041 pname:nullColorAttachmentWithExternalFormatResolve>> is ename:VK_TRUE, 1042 pname:imageView must: be dlink:VK_NULL_HANDLE 1043 * [[VUID-VkRenderingAttachmentInfo-resolveMode-09329]] 1044 If pname:resolveMode is 1045 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID and 1046 <<limits-nullColorAttachmentWithExternalFormatResolve, 1047 pname:nullColorAttachmentWithExternalFormatResolve>> is ename:VK_FALSE, 1048 pname:imageView must: be a valid slink:VkImageView 1049 * [[VUID-VkRenderingAttachmentInfo-resolveMode-09330]] 1050 If pname:resolveMode is 1051 ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID and 1052 <<limits-nullColorAttachmentWithExternalFormatResolve, 1053 pname:nullColorAttachmentWithExternalFormatResolve>> is ename:VK_FALSE, 1054 pname:imageView must: have a format equal to the value of 1055 slink:VkAndroidHardwareBufferFormatResolvePropertiesANDROID::pname:colorAttachmentFormat 1056 as returned by a call to 1057 flink:vkGetAndroidHardwareBufferPropertiesANDROID for the Android 1058 hardware buffer that was used to create pname:resolveImageView 1059endif::VK_ANDROID_external_format_resolve[] 1060**** 1061 1062include::{generated}/validity/structs/VkRenderingAttachmentInfo.adoc[] 1063-- 1064 1065ifdef::VK_KHR_fragment_shading_rate[] 1066[open,refpage='VkRenderingFragmentShadingRateAttachmentInfoKHR',desc='Structure specifying fragment shading rate attachment information',type='structs'] 1067-- 1068The sname:VkRenderingFragmentShadingRateAttachmentInfoKHR structure is 1069defined as: 1070 1071include::{generated}/api/structs/VkRenderingFragmentShadingRateAttachmentInfoKHR.adoc[] 1072 1073 * pname:sType is a elink:VkStructureType value identifying this structure. 1074 * pname:pNext is `NULL` or a pointer to a structure extending this 1075 structure. 1076 * pname:imageView is the image view that will be used as a fragment 1077 shading rate attachment. 1078 * pname:imageLayout is the layout that pname:imageView will be in during 1079 rendering. 1080 * pname:shadingRateAttachmentTexelSize specifies the number of pixels 1081 corresponding to each texel in pname:imageView. 1082 1083This structure can be included in the pname:pNext chain of 1084slink:VkRenderingInfo to define a 1085<<primsrast-fragment-shading-rate-attachment, fragment shading rate 1086attachment>>. 1087If pname:imageView is dlink:VK_NULL_HANDLE, or if this structure is not 1088specified, the implementation behaves as if a valid shading rate attachment 1089was specified with all texels specifying a single pixel per fragment. 1090 1091.Valid Usage 1092**** 1093 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06147]] 1094 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:layout must: be 1095 ename:VK_IMAGE_LAYOUT_GENERAL or 1096 ename:VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR 1097 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06148]] 1098 If pname:imageView is not dlink:VK_NULL_HANDLE, it must: have been 1099 created with 1100 ename:VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 1101 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06149]] 1102 If pname:imageView is not dlink:VK_NULL_HANDLE, 1103 pname:shadingRateAttachmentTexelSize.width must: be a power of two value 1104 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06150]] 1105 If pname:imageView is not dlink:VK_NULL_HANDLE, 1106 pname:shadingRateAttachmentTexelSize.width must: be less than or equal 1107 to <<limits-maxFragmentShadingRateAttachmentTexelSize, 1108 pname:maxFragmentShadingRateAttachmentTexelSize.width>> 1109 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06151]] 1110 If pname:imageView is not dlink:VK_NULL_HANDLE, 1111 pname:shadingRateAttachmentTexelSize.width must: be greater than or 1112 equal to <<limits-minFragmentShadingRateAttachmentTexelSize, 1113 pname:minFragmentShadingRateAttachmentTexelSize.width>> 1114 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06152]] 1115 If pname:imageView is not dlink:VK_NULL_HANDLE, 1116 pname:shadingRateAttachmentTexelSize.height must: be a power of two 1117 value 1118 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06153]] 1119 If pname:imageView is not dlink:VK_NULL_HANDLE, 1120 pname:shadingRateAttachmentTexelSize.height must: be less than or equal 1121 to <<limits-maxFragmentShadingRateAttachmentTexelSize, 1122 pname:maxFragmentShadingRateAttachmentTexelSize.height>> 1123 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06154]] 1124 If pname:imageView is not dlink:VK_NULL_HANDLE, 1125 pname:shadingRateAttachmentTexelSize.height must: be greater than or 1126 equal to <<limits-minFragmentShadingRateAttachmentTexelSize, 1127 pname:minFragmentShadingRateAttachmentTexelSize.height>> 1128 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06155]] 1129 If pname:imageView is not dlink:VK_NULL_HANDLE, the quotient of 1130 pname:shadingRateAttachmentTexelSize.width and 1131 pname:shadingRateAttachmentTexelSize.height must: be less than or equal 1132 to <<limits-maxFragmentShadingRateAttachmentTexelSizeAspectRatio, 1133 pname:maxFragmentShadingRateAttachmentTexelSizeAspectRatio>> 1134 * [[VUID-VkRenderingFragmentShadingRateAttachmentInfoKHR-imageView-06156]] 1135 If pname:imageView is not dlink:VK_NULL_HANDLE, the quotient of 1136 pname:shadingRateAttachmentTexelSize.height and 1137 pname:shadingRateAttachmentTexelSize.width must: be less than or equal 1138 to <<limits-maxFragmentShadingRateAttachmentTexelSizeAspectRatio, 1139 pname:maxFragmentShadingRateAttachmentTexelSizeAspectRatio>> 1140**** 1141 1142include::{generated}/validity/structs/VkRenderingFragmentShadingRateAttachmentInfoKHR.adoc[] 1143-- 1144endif::VK_KHR_fragment_shading_rate[] 1145 1146ifdef::VK_EXT_fragment_density_map[] 1147[open,refpage='VkRenderingFragmentDensityMapAttachmentInfoEXT',desc='Structure specifying fragment shading rate attachment information',type='structs'] 1148-- 1149The sname:VkRenderingFragmentDensityMapAttachmentInfoEXT structure is 1150defined as: 1151 1152include::{generated}/api/structs/VkRenderingFragmentDensityMapAttachmentInfoEXT.adoc[] 1153 1154 * pname:sType is a elink:VkStructureType value identifying this structure. 1155 * pname:pNext is `NULL` or a pointer to a structure extending this 1156 structure. 1157 * pname:imageView is the image view that will be used as a fragment 1158 density map attachment. 1159 * pname:imageLayout is the layout that pname:imageView will be in during 1160 rendering. 1161 1162This structure can be included in the pname:pNext chain of 1163slink:VkRenderingInfo to define a fragment density map. 1164If this structure is not included in the pname:pNext chain, pname:imageView 1165is treated as dlink:VK_NULL_HANDLE. 1166 1167.Valid Usage 1168**** 1169 * [[VUID-VkRenderingFragmentDensityMapAttachmentInfoEXT-imageView-06157]] 1170 If pname:imageView is not dlink:VK_NULL_HANDLE, pname:layout must: be 1171 ename:VK_IMAGE_LAYOUT_GENERAL or 1172 ename:VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT 1173 * [[VUID-VkRenderingFragmentDensityMapAttachmentInfoEXT-imageView-06158]] 1174 If pname:imageView is not dlink:VK_NULL_HANDLE, it must: have been 1175 created with ename:VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT 1176 * [[VUID-VkRenderingFragmentDensityMapAttachmentInfoEXT-imageView-06159]] 1177 If pname:imageView is not dlink:VK_NULL_HANDLE, it must: not have been 1178 created with ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT 1179 * [[VUID-VkRenderingFragmentDensityMapAttachmentInfoEXT-apiVersion-07908]] 1180 If 1181ifndef::VKSC_VERSION_1_0[] 1182ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 1183 apiext:VK_KHR_multiview is not enabled, 1184 slink:VkPhysicalDeviceProperties::pname:apiVersion is less than Vulkan 1185 1.1, and 1186endif::VK_VERSION_1_1,VK_KHR_multiview[] 1187endif::VKSC_VERSION_1_0[] 1188 pname:imageView is not dlink:VK_NULL_HANDLE, it must: have a 1189 pname:layerCount equal to `1` 1190**** 1191 1192include::{generated}/validity/structs/VkRenderingFragmentDensityMapAttachmentInfoEXT.adoc[] 1193-- 1194endif::VK_EXT_fragment_density_map[] 1195 1196ifdef::VK_KHR_maintenance5[] 1197[open,refpage='vkGetRenderingAreaGranularityKHR',desc='Returns the granularity for dynamic rendering optimal render area',type='protos'] 1198-- 1199To query the render area granularity for a render pass instance, call: 1200 1201include::{generated}/api/protos/vkGetRenderingAreaGranularityKHR.adoc[] 1202 1203 * pname:device is the logical device that owns the render pass instance. 1204 * pname:pRenderingAreaInfo is a pointer to a slink:VkRenderingAreaInfoKHR 1205 structure specifying details of the render pass instance to query the 1206 render area granularity for. 1207 * pname:pGranularity is a pointer to a slink:VkExtent2D structure in which 1208 the granularity is returned. 1209 1210The conditions leading to an optimal pname:renderArea are: 1211 1212 * the pname:offset.x member in pname:renderArea is a multiple of the 1213 pname:width member of the returned slink:VkExtent2D (the horizontal 1214 granularity). 1215 * the pname:offset.y member in pname:renderArea is a multiple of the 1216 pname:height member of the returned slink:VkExtent2D (the vertical 1217 granularity). 1218 * either the pname:extent.width member in pname:renderArea is a multiple 1219 of the horizontal granularity or pname:offset.x+pname:extent.width is 1220 equal to the pname:width of the pname:framebuffer in the 1221 slink:VkRenderPassBeginInfo. 1222 * either the pname:extent.height member in pname:renderArea is a multiple 1223 of the vertical granularity or pname:offset.y+pname:extent.height is 1224 equal to the pname:height of the pname:framebuffer in the 1225 slink:VkRenderPassBeginInfo. 1226 1227include::{generated}/validity/protos/vkGetRenderingAreaGranularityKHR.adoc[] 1228-- 1229 1230[open,refpage='VkRenderingAreaInfoKHR',desc='Structure describing rendering area granularity query info',type='structs'] 1231-- 1232The sname:VkRenderingAreaInfoKHR structure is defined as: 1233 1234include::{generated}/api/structs/VkRenderingAreaInfoKHR.adoc[] 1235 1236 * pname:sType is a elink:VkStructureType value identifying this structure. 1237 * pname:pNext is `NULL` or a pointer to a structure extending this 1238 structure. 1239 * pname:viewMask is the viewMask used for rendering. 1240 * pname:colorAttachmentCount is the number of entries in 1241 pname:pColorAttachmentFormats 1242 * pname:pColorAttachmentFormats is a pointer to an array of elink:VkFormat 1243 values defining the format of color attachments used in the render pass 1244 instance. 1245 * pname:depthAttachmentFormat is a elink:VkFormat value defining the 1246 format of the depth attachment used in the render pass instance. 1247 * pname:stencilAttachmentFormat is a elink:VkFormat value defining the 1248 format of the stencil attachment used in the render pass instance. 1249 1250include::{generated}/validity/structs/VkRenderingAreaInfoKHR.adoc[] 1251-- 1252endif::VK_KHR_maintenance5[] 1253 1254ifdef::VK_ARM_render_pass_striped[] 1255[open,refpage='VkRenderPassStripeBeginInfoARM',desc='Structure specifying striped rendering information',type='structs'] 1256-- 1257The sname:VkRenderPassStripeBeginInfoARM structure is defined as: 1258 1259include::{generated}/api/structs/VkRenderPassStripeBeginInfoARM.adoc[] 1260 1261 * pname:sType is a elink:VkStructureType value identifying this structure. 1262 * pname:pNext is `NULL` or a pointer to a structure extending this 1263 structure. 1264 * pname:stripeInfoCount is the number of stripes in this render pass 1265 instance 1266 * pname:pStripeInfos is a pointer to an array of pname:stripeInfoCount 1267 slink:VkRenderPassStripeInfoARM structures describing the stripes used 1268 by the render pass instance. 1269 1270This structure can be included in the pname:pNext chain of 1271slink:VkRenderPassBeginInfo 1272ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 1273or slink:VkRenderingInfo 1274endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 1275to define how the render pass instance is split into stripes. 1276 1277.Valid Usage 1278**** 1279 * [[VUID-VkRenderPassStripeBeginInfoARM-stripeInfoCount-09450]] 1280 pname:stripeInfoCount must: be less than or equal to 1281 sname:VkPhysicalDeviceRenderPassStripedPropertiesARM::pname:maxRenderPassStripes 1282 * [[VUID-VkRenderPassStripeBeginInfoARM-stripeArea-09451]] 1283 The pname:stripeArea defined by each element of pname:pStripeInfos must: 1284 not overlap the pname:stripeArea of any other element 1285**** 1286 1287include::{generated}/validity/structs/VkRenderPassStripeBeginInfoARM.adoc[] 1288-- 1289 1290[open,refpage='VkRenderPassStripeInfoARM',desc='Structure specifying per rendering stripe information',type='structs'] 1291-- 1292The sname:VkRenderPassStripeInfoARM structure is defined as: 1293 1294include::{generated}/api/structs/VkRenderPassStripeInfoARM.adoc[] 1295 1296 * pname:sType is a elink:VkStructureType value identifying this structure. 1297 * pname:pNext is `NULL` or a pointer to a structure extending this 1298 structure. 1299 * pname:stripeArea is the stripe area, and is described in more detail 1300 below. 1301 1302pname:stripeArea is the render area that is affected by this stripe of the 1303render pass instance. 1304It must: be a subregion of the pname:renderArea of the render pass instance. 1305 1306.Valid Usage 1307**** 1308 * [[VUID-VkRenderPassStripeInfoARM-stripeArea-09452]] 1309 pname:stripeArea.offset.x must: be a multiple of 1310 slink:VkPhysicalDeviceRenderPassStripedPropertiesARM::pname:renderPassStripeGranularity.width 1311 * [[VUID-VkRenderPassStripeInfoARM-stripeArea-09453]] 1312 pname:stripeArea.extent.width must: be a multiple of 1313 slink:VkPhysicalDeviceRenderPassStripedPropertiesARM::pname:renderPassStripeGranularity.width, 1314 or the sum of pname:stripeArea.offset.x and 1315 pname:stripeArea.extent.width must: be equal to the 1316 pname:renderArea.extent.width of the render pass instance 1317 * [[VUID-VkRenderPassStripeInfoARM-stripeArea-09454]] 1318 pname:stripeArea.offset.y must: be a multiple of 1319 slink:VkPhysicalDeviceRenderPassStripedPropertiesARM::pname:renderPassStripeGranularity.height 1320 * [[VUID-VkRenderPassStripeInfoARM-stripeArea-09455]] 1321 pname:stripeArea.extent.height must: be a multiple of 1322 slink:VkPhysicalDeviceRenderPassStripedPropertiesARM::pname:renderPassStripeGranularity.height, 1323 or the sum of pname:stripeArea.offset.y and 1324 pname:stripeArea.extent.height must: be equal to the 1325 pname:renderArea.extent.height of the render pass instance 1326**** 1327 1328include::{generated}/validity/structs/VkRenderPassStripeInfoARM.adoc[] 1329-- 1330endif::VK_ARM_render_pass_striped[] 1331 1332[open,refpage='vkCmdEndRendering',desc='End a dynamic render pass instance',type='protos',alias='vkCmdEndRenderingKHR'] 1333-- 1334To end a render pass instance, call: 1335 1336ifdef::VK_VERSION_1_3[] 1337include::{generated}/api/protos/vkCmdEndRendering.adoc[] 1338endif::VK_VERSION_1_3[] 1339 1340ifdef::VK_VERSION_1_3+VK_KHR_dynamic_rendering[or the equivalent command] 1341 1342ifdef::VK_KHR_dynamic_rendering[] 1343include::{generated}/api/protos/vkCmdEndRenderingKHR.adoc[] 1344endif::VK_KHR_dynamic_rendering[] 1345 1346 * pname:commandBuffer is the command buffer in which to record the 1347 command. 1348 1349If the value of pname:pRenderingInfo->flags used to begin this render pass 1350instance included ename:VK_RENDERING_SUSPENDING_BIT, then this render pass 1351is suspended and will be resumed later in 1352<<synchronization-submission-order, submission order>>. 1353 1354.Valid Usage 1355**** 1356 * [[VUID-vkCmdEndRendering-None-06161]] 1357 The current render pass instance must: have been begun with 1358 flink:vkCmdBeginRendering 1359 * [[VUID-vkCmdEndRendering-commandBuffer-06162]] 1360 The current render pass instance must: have been begun in 1361 pname:commandBuffer 1362ifdef::VK_EXT_transform_feedback[] 1363 * [[VUID-vkCmdEndRendering-None-06781]] 1364 This command must: not be recorded when transform feedback is active 1365endif::VK_EXT_transform_feedback[] 1366 * [[VUID-vkCmdEndRendering-None-06999]] 1367 If fname:vkCmdBeginQuery* was called within the render pass, the 1368 corresponding fname:vkCmdEndQuery* must: have been called subsequently 1369 within the same subpass 1370**** 1371 1372include::{generated}/validity/protos/vkCmdEndRendering.adoc[] 1373-- 1374 1375[NOTE] 1376.Note 1377==== 1378For more complex rendering graphs, it is possible to pre-define a static 1379_render pass_ object, which as well as allowing draw commands, allows the 1380definition of framebuffer-local dependencies between multiple subpasses. 1381These objects have a lot of setup cost compared to 1382flink:vkCmdBeginRendering, but use of subpass dependencies can confer 1383important performance benefits on some devices. 1384==== 1385 1386ifdef::VK_QCOM_tile_properties[] 1387[open,refpage='VkTilePropertiesQCOM',desc='Structure holding available tile properties',type='structs'] 1388-- 1389The sname:VkTilePropertiesQCOM structure is defined as: 1390 1391include::{generated}/api/structs/VkTilePropertiesQCOM.adoc[] 1392 1393 * pname:sType is a elink:VkStructureType value identifying this structure. 1394 * pname:pNext is `NULL` or a pointer to a structure extending this 1395 structure. 1396 * pname:tileSize is the dimensions of a tile, with width and height 1397 describing the width and height of a tile in pixels, and depth 1398 corresponding to the number of slices the tile spans. 1399 * pname:apronSize is the dimension of the apron. 1400 * pname:origin is the top-left corner of the first tile in attachment 1401 space. 1402 1403All tiles will be tightly packed around the first tile, with edges being 1404multiples of tile width and/or height from the origin. 1405 1406[NOTE] 1407.Note 1408==== 1409Reported value for pname:apronSize will be zero and its functionality will 1410be described in a future extension. 1411==== 1412 1413include::{generated}/validity/structs/VkTilePropertiesQCOM.adoc[] 1414-- 1415 1416[open,refpage='vkGetDynamicRenderingTilePropertiesQCOM',desc='Get the properties when using dynamic rendering',type='protos'] 1417-- 1418To query the tile properties when using dynamic rendering, call: 1419 1420include::{generated}/api/protos/vkGetDynamicRenderingTilePropertiesQCOM.adoc[] 1421 1422 * pname:device is a logical device associated with the render pass. 1423 * pname:pRenderingInfo is a pointer to the slink:VkRenderingInfo structure 1424 specifying details of the render pass instance in dynamic rendering. 1425 * pname:pProperties is a pointer to a slink:VkTilePropertiesQCOM structure 1426 in which the properties are returned. 1427 1428include::{generated}/validity/protos/vkGetDynamicRenderingTilePropertiesQCOM.adoc[] 1429-- 1430endif::VK_QCOM_tile_properties[] 1431 1432 1433== Render Pass Objects 1434 1435endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 1436 1437[open,refpage='VkRenderPass',desc='Opaque handle to a render pass object',type='handles'] 1438-- 1439A render pass object represents a collection of attachments, subpasses, and 1440dependencies between the subpasses, and describes how the attachments are 1441used over the course of the subpasses. 1442 1443Render passes are represented by sname:VkRenderPass handles: 1444 1445include::{generated}/api/handles/VkRenderPass.adoc[] 1446-- 1447 1448An _attachment description_ describes the properties of an attachment 1449including its format, sample count, and how its contents are treated at the 1450beginning and end of each render pass instance. 1451 1452[[renderpass-subpass]] 1453A _subpass_ represents a phase of rendering that reads and writes a subset 1454of the attachments in a render pass. 1455Rendering commands are recorded into a particular subpass of a render pass 1456instance. 1457 1458A _subpass description_ describes the subset of attachments that is involved 1459in the execution of a subpass. 1460Each subpass can: read from some attachments as _input attachments_, write 1461to some as _color attachments_ or _depth/stencil attachments_, 1462ifdef::VK_QCOM_render_pass_shader_resolve[] 1463perform _shader resolve operations_ to _color_attachments_ or 1464_depth/stencil_attachments_, 1465endif::VK_QCOM_render_pass_shader_resolve[] 1466and perform _multisample resolve operations_ to _resolve attachments_. 1467A subpass description can: also include a set of _preserve attachments_, 1468which are attachments that are not read or written by the subpass but whose 1469contents must: be preserved throughout the subpass. 1470 1471A subpass _uses an attachment_ if the attachment is a color, depth/stencil, 1472resolve, 1473ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1474depth/stencil resolve, 1475endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1476ifdef::VK_KHR_fragment_shading_rate[] 1477fragment shading rate, 1478endif::VK_KHR_fragment_shading_rate[] 1479or input attachment for that subpass (as determined by the 1480pname:pColorAttachments, pname:pDepthStencilAttachment, 1481pname:pResolveAttachments, 1482ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1483slink:VkSubpassDescriptionDepthStencilResolve::pname:pDepthStencilResolveAttachment, 1484endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 1485ifdef::VK_KHR_fragment_shading_rate[] 1486slink:VkFragmentShadingRateAttachmentInfoKHR::pname:pFragmentShadingRateAttachment->attachment, 1487endif::VK_KHR_fragment_shading_rate[] 1488and pname:pInputAttachments members of slink:VkSubpassDescription, 1489respectively). 1490A subpass does not use an attachment if that attachment is preserved by the 1491subpass. 1492The _first use of an attachment_ is in the lowest numbered subpass that uses 1493that attachment. 1494Similarly, the _last use of an attachment_ is in the highest numbered 1495subpass that uses that attachment. 1496 1497The subpasses in a render pass all render to the same dimensions, and 1498fragments for pixel (x,y,layer) in one subpass can: only read attachment 1499contents written by previous subpasses at that same (x,y,layer) location. 1500ifdef::VK_KHR_fragment_shading_rate,VK_NV_shading_rate,VK_EXT_fragment_density_map[] 1501For multi-pixel fragments, the pixel read from an input attachment is 1502selected from the pixels covered by that fragment in an 1503implementation-dependent manner. 1504However, this selection must: be made consistently for any fragment with the 1505same shading rate for the lifetime of the slink:VkDevice. 1506endif::VK_KHR_fragment_shading_rate,VK_NV_shading_rate,VK_EXT_fragment_density_map[] 1507 1508[NOTE] 1509.Note 1510==== 1511By describing a complete set of subpasses in advance, render passes provide 1512the implementation an opportunity to optimize the storage and transfer of 1513attachment data between subpasses. 1514 1515In practice, this means that subpasses with a simple framebuffer-space 1516dependency may: be merged into a single tiled rendering pass, keeping the 1517attachment data on-chip for the duration of a render pass instance. 1518However, it is also quite common for a render pass to only contain a single 1519subpass. 1520==== 1521 1522_Subpass dependencies_ describe <<synchronization-dependencies, execution 1523and memory dependencies>> between subpasses. 1524 1525A _subpass dependency chain_ is a sequence of subpass dependencies in a 1526render pass, where the source subpass of each subpass dependency (after the 1527first) equals the destination subpass of the previous dependency. 1528 1529Execution of subpasses may: overlap or execute out of order with regards to 1530other subpasses, unless otherwise enforced by an execution dependency. 1531Each subpass only respects <<synchronization-submission-order, submission 1532order>> for commands recorded in the same subpass, and the 1533flink:vkCmdBeginRenderPass and flink:vkCmdEndRenderPass commands that 1534delimit the render pass - commands within other subpasses are not included. 1535This affects most other <<synchronization-implicit, implicit ordering 1536guarantees>>. 1537 1538A render pass describes the structure of subpasses and attachments 1539independent of any specific image views for the attachments. 1540The specific image views that will be used for the attachments, and their 1541dimensions, are specified in sname:VkFramebuffer objects. 1542Framebuffers are created with respect to a specific render pass that the 1543framebuffer is compatible with (see <<renderpass-compatibility,Render Pass 1544Compatibility>>). 1545Collectively, a render pass and a framebuffer define the complete render 1546target state for one or more subpasses as well as the algorithmic 1547dependencies between the subpasses. 1548 1549The various pipeline stages of the drawing commands for a given subpass may: 1550execute concurrently and/or out of order, both within and across drawing 1551commands, whilst still respecting <<synchronization-pipeline-stages-order, 1552pipeline order>>. 1553However for a given (x,y,layer,sample) sample location, certain per-sample 1554operations are performed in <<primsrast-order,rasterization order>>. 1555 1556[open,refpage='VK_ATTACHMENT_UNUSED',desc='Unused attachment sentinel',type='consts'] 1557-- 1558ename:VK_ATTACHMENT_UNUSED is a constant indicating that a render pass 1559attachment is not used. 1560 1561include::{generated}/api/enums/VK_ATTACHMENT_UNUSED.adoc[] 1562-- 1563 1564 1565[[renderpass-creation]] 1566== Render Pass Creation 1567 1568[open,refpage='vkCreateRenderPass',desc='Create a new render pass object',type='protos'] 1569-- 1570:refpage: vkCreateRenderPass 1571:objectnameplural: render passes 1572:objectnamecamelcase: renderPass 1573:objectcount: 1 1574 1575To create a render pass, call: 1576 1577include::{generated}/api/protos/vkCreateRenderPass.adoc[] 1578 1579 * pname:device is the logical device that creates the render pass. 1580 * pname:pCreateInfo is a pointer to a slink:VkRenderPassCreateInfo 1581 structure describing the parameters of the render pass. 1582 * pname:pAllocator controls host memory allocation as described in the 1583 <<memory-allocation, Memory Allocation>> chapter. 1584 * pname:pRenderPass is a pointer to a slink:VkRenderPass handle in which 1585 the resulting render pass object is returned. 1586 1587include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 1588 1589ifdef::VKSC_VERSION_1_0[] 1590.Valid Usage 1591**** 1592include::{chapters}/commonvalidity/memory_reservation_request_count_common.adoc[] 1593 1594:uniqifier: subpasses 1595:combinedobjectnameplural: subpasses 1596:combinedparentobject: VkRenderPass 1597:combinedobjectcount: pname:pCreateInfo->subpassCount 1598:combinedobjectnamecamelcase: subpassDescription 1599include::{chapters}/commonvalidity/memory_reservation_request_count_combined_common.adoc[] 1600 1601:uniqifier: attachments 1602:combinedobjectnameplural: attachments 1603:combinedparentobject: VkRenderPass 1604:combinedobjectcount: pname:pCreateInfo->attachmentCount 1605:combinedobjectnamecamelcase: attachmentDescription 1606include::{chapters}/commonvalidity/memory_reservation_request_count_combined_common.adoc[] 1607**** 1608endif::VKSC_VERSION_1_0[] 1609 1610include::{generated}/validity/protos/vkCreateRenderPass.adoc[] 1611-- 1612 1613[open,refpage='VkRenderPassCreateInfo',desc='Structure specifying parameters of a newly created render pass',type='structs'] 1614-- 1615The sname:VkRenderPassCreateInfo structure is defined as: 1616 1617include::{generated}/api/structs/VkRenderPassCreateInfo.adoc[] 1618 1619 * pname:sType is a elink:VkStructureType value identifying this structure. 1620 * pname:pNext is `NULL` or a pointer to a structure extending this 1621 structure. 1622ifndef::VK_QCOM_render_pass_transform[] 1623 * pname:flags is reserved for future use. 1624endif::VK_QCOM_render_pass_transform[] 1625ifdef::VK_QCOM_render_pass_transform[] 1626 * pname:flags is a bitmask of elink:VkRenderPassCreateFlagBits 1627endif::VK_QCOM_render_pass_transform[] 1628 * pname:attachmentCount is the number of attachments used by this render 1629 pass. 1630 * pname:pAttachments is a pointer to an array of pname:attachmentCount 1631 slink:VkAttachmentDescription structures describing the attachments used 1632 by the render pass. 1633 * pname:subpassCount is the number of subpasses to create. 1634 * pname:pSubpasses is a pointer to an array of pname:subpassCount 1635 slink:VkSubpassDescription structures describing each subpass. 1636 * pname:dependencyCount is the number of memory dependencies between pairs 1637 of subpasses. 1638 * pname:pDependencies is a pointer to an array of pname:dependencyCount 1639 slink:VkSubpassDependency structures describing dependencies between 1640 pairs of subpasses. 1641 1642[NOTE] 1643.Note 1644==== 1645Care should be taken to avoid a data race here; if any subpasses access 1646attachments with overlapping memory locations, and one of those accesses is 1647a write, a subpass dependency needs to be included between them. 1648==== 1649 1650.Valid Usage 1651**** 1652 * [[VUID-VkRenderPassCreateInfo-attachment-00834]] 1653 If the pname:attachment member of any element of 1654 pname:pInputAttachments, pname:pColorAttachments, 1655 pname:pResolveAttachments or pname:pDepthStencilAttachment, or any 1656 element of pname:pPreserveAttachments in any element of pname:pSubpasses 1657 is not ename:VK_ATTACHMENT_UNUSED, then it must: be less than 1658 pname:attachmentCount 1659ifdef::VK_EXT_fragment_density_map[] 1660 * [[VUID-VkRenderPassCreateInfo-fragmentDensityMapAttachment-06471]] 1661 If the pNext chain includes a 1662 slink:VkRenderPassFragmentDensityMapCreateInfoEXT structure and the 1663 pname:fragmentDensityMapAttachment member is not 1664 ename:VK_ATTACHMENT_UNUSED, then pname:attachment must: be less than 1665 pname:attachmentCount 1666endif::VK_EXT_fragment_density_map[] 1667 * [[VUID-VkRenderPassCreateInfo-pAttachments-00836]] 1668 For any member of pname:pAttachments with a pname:loadOp equal to 1669 ename:VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment 1670 must: not specify a pname:layout equal to 1671 ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL or 1672 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL 1673 * [[VUID-VkRenderPassCreateInfo-pAttachments-02511]] 1674 For any member of pname:pAttachments with a pname:stencilLoadOp equal to 1675 ename:VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment 1676 must: not specify a pname:layout equal to 1677 ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL or 1678 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL 1679ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 1680 * [[VUID-VkRenderPassCreateInfo-pAttachments-01566]] 1681 For any member of pname:pAttachments with a pname:loadOp equal to 1682 ename:VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment 1683 must: not specify a pname:layout equal to 1684 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL 1685 * [[VUID-VkRenderPassCreateInfo-pAttachments-01567]] 1686 For any member of pname:pAttachments with a pname:stencilLoadOp equal to 1687 ename:VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment 1688 must: not specify a pname:layout equal to 1689 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL 1690 * [[VUID-VkRenderPassCreateInfo-pNext-01926]] 1691 If the pname:pNext chain includes a 1692 slink:VkRenderPassInputAttachmentAspectCreateInfo structure, the 1693 pname:subpass member of each element of its pname:pAspectReferences 1694 member must: be less than pname:subpassCount 1695 * [[VUID-VkRenderPassCreateInfo-pNext-01927]] 1696 If the pname:pNext chain includes a 1697 slink:VkRenderPassInputAttachmentAspectCreateInfo structure, the 1698 pname:inputAttachmentIndex member of each element of its 1699 pname:pAspectReferences member must: be less than the value of 1700 pname:inputAttachmentCount in the element of pname:pSubpasses identified 1701 by its pname:subpass member 1702 * [[VUID-VkRenderPassCreateInfo-pNext-01963]] 1703 If the pname:pNext chain includes a 1704 slink:VkRenderPassInputAttachmentAspectCreateInfo structure, for any 1705 element of the pname:pInputAttachments member of any element of 1706 pname:pSubpasses where the pname:attachment member is not 1707 ename:VK_ATTACHMENT_UNUSED, the pname:aspectMask member of the 1708 corresponding element of 1709 slink:VkRenderPassInputAttachmentAspectCreateInfo::pname:pAspectReferences 1710 must: only include aspects that are present in images of the format 1711 specified by the element of pname:pAttachments at pname:attachment 1712endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 1713ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 1714 * [[VUID-VkRenderPassCreateInfo-pNext-01928]] 1715 If the pname:pNext chain includes a 1716 slink:VkRenderPassMultiviewCreateInfo structure, and its 1717 pname:subpassCount member is not zero, that member must: be equal to the 1718 value of pname:subpassCount 1719 * [[VUID-VkRenderPassCreateInfo-pNext-01929]] 1720 If the pname:pNext chain includes a 1721 slink:VkRenderPassMultiviewCreateInfo structure, if its 1722 pname:dependencyCount member is not zero, it must: be equal to 1723 pname:dependencyCount 1724 * [[VUID-VkRenderPassCreateInfo-pNext-01930]] 1725 If the pname:pNext chain includes a 1726 slink:VkRenderPassMultiviewCreateInfo structure, for each non-zero 1727 element of pname:pViewOffsets, the pname:srcSubpass and pname:dstSubpass 1728 members of pname:pDependencies at the same index must: not be equal 1729 * [[VUID-VkRenderPassCreateInfo-pNext-02512]] 1730 If the pname:pNext chain includes a 1731 slink:VkRenderPassMultiviewCreateInfo structure, for any element of 1732 pname:pDependencies with a pname:dependencyFlags member that does not 1733 include ename:VK_DEPENDENCY_VIEW_LOCAL_BIT, the corresponding element of 1734 the pname:pViewOffsets member of that 1735 slink:VkRenderPassMultiviewCreateInfo instance must: be `0` 1736 * [[VUID-VkRenderPassCreateInfo-pNext-02513]] 1737 If the pname:pNext chain includes a 1738 slink:VkRenderPassMultiviewCreateInfo structure, elements of its 1739 pname:pViewMasks member must: either all be `0`, or all not be `0` 1740 * [[VUID-VkRenderPassCreateInfo-pNext-02514]] 1741 If the pname:pNext chain includes a 1742 slink:VkRenderPassMultiviewCreateInfo structure, and each element of its 1743 pname:pViewMasks member is `0`, the pname:dependencyFlags member of each 1744 element of pname:pDependencies must: not include 1745 ename:VK_DEPENDENCY_VIEW_LOCAL_BIT 1746 * [[VUID-VkRenderPassCreateInfo-pNext-02515]] 1747 If the pname:pNext chain includes a 1748 slink:VkRenderPassMultiviewCreateInfo structure, and each element of its 1749 pname:pViewMasks member is `0`, its pname:correlationMaskCount member 1750 must: be `0` 1751endif::VK_VERSION_1_1,VK_KHR_multiview[] 1752 * [[VUID-VkRenderPassCreateInfo-pDependencies-00837]] 1753 For any element of pname:pDependencies, if the pname:srcSubpass is not 1754 ename:VK_SUBPASS_EXTERNAL, all stage flags included in the 1755 pname:srcStageMask member of that dependency must: be a pipeline stage 1756 supported by the <<synchronization-pipeline-stages-types, pipeline>> 1757 identified by the pname:pipelineBindPoint member of the source subpass 1758 * [[VUID-VkRenderPassCreateInfo-pDependencies-00838]] 1759 For any element of pname:pDependencies, if the pname:dstSubpass is not 1760 ename:VK_SUBPASS_EXTERNAL, all stage flags included in the 1761 pname:dstStageMask member of that dependency must: be a pipeline stage 1762 supported by the <<synchronization-pipeline-stages-types, pipeline>> 1763 identified by the pname:pipelineBindPoint member of the destination 1764 subpass 1765 * [[VUID-VkRenderPassCreateInfo-pDependencies-06866]] 1766 For any element of pname:pDependencies, if its pname:srcSubpass is not 1767 ename:VK_SUBPASS_EXTERNAL, it must: be less than pname:subpassCount 1768 * [[VUID-VkRenderPassCreateInfo-pDependencies-06867]] 1769 For any element of pname:pDependencies, if its pname:dstSubpass is not 1770 ename:VK_SUBPASS_EXTERNAL, it must: be less than pname:subpassCount 1771ifdef::VKSC_VERSION_1_0[] 1772 * [[VUID-VkRenderPassCreateInfo-subpassCount-05050]] 1773 pname:subpassCount must: be less than or equal to 1774 <<limits-maxRenderPassSubpasses,maxRenderPassSubpasses>> 1775 * [[VUID-VkRenderPassCreateInfo-dependencyCount-05051]] 1776 pname:dependencyCount must: be less than or equal to 1777 <<limits-maxRenderPassDependencies,maxRenderPassDependencies>> 1778 * [[VUID-VkRenderPassCreateInfo-attachmentCount-05052]] 1779 pname:attachmentCount must: be less than or equal to 1780 <<limits-maxFramebufferAttachments,maxFramebufferAttachments>> 1781endif::VKSC_VERSION_1_0[] 1782**** 1783 1784include::{generated}/validity/structs/VkRenderPassCreateInfo.adoc[] 1785-- 1786 1787[open,refpage='VkRenderPassCreateFlagBits',desc='Bitmask specifying additional properties of a render pass',type='enums'] 1788-- 1789Bits which can: be set in slink:VkRenderPassCreateInfo::pname:flags, 1790describing additional properties of the render pass, are: 1791 1792include::{generated}/api/enums/VkRenderPassCreateFlagBits.adoc[] 1793 1794ifdef::VK_QCOM_render_pass_transform[] 1795 * ename:VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM specifies that the 1796 created render pass is compatible with 1797 <<vertexpostproc-renderpass-transform, render pass transform>>. 1798endif::VK_QCOM_render_pass_transform[] 1799 1800ifndef::VK_QCOM_render_pass_transform[] 1801[NOTE] 1802.Note 1803==== 1804All bits for this type are defined by extensions, and none of those 1805extensions are enabled in this build of the specification. 1806==== 1807endif::VK_QCOM_render_pass_transform[] 1808-- 1809 1810[open,refpage='VkRenderPassCreateFlags',desc='Bitmask of VkRenderPassCreateFlagBits',type='flags'] 1811-- 1812include::{generated}/api/flags/VkRenderPassCreateFlags.adoc[] 1813 1814tname:VkRenderPassCreateFlags is a bitmask type for setting a mask of zero 1815or more elink:VkRenderPassCreateFlagBits. 1816-- 1817 1818ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 1819[[renderpass-multiview]] 1820[open,refpage='VkRenderPassMultiviewCreateInfo',desc='Structure containing multiview information for all subpasses',type='structs'] 1821-- 1822If the slink:VkRenderPassCreateInfo::pname:pNext chain includes a 1823sname:VkRenderPassMultiviewCreateInfo structure, then that structure 1824includes an array of view masks, view offsets, and correlation masks for the 1825render pass. 1826 1827The sname:VkRenderPassMultiviewCreateInfo structure is defined as: 1828 1829include::{generated}/api/structs/VkRenderPassMultiviewCreateInfo.adoc[] 1830 1831ifdef::VK_KHR_multiview[] 1832or the equivalent 1833 1834include::{generated}/api/structs/VkRenderPassMultiviewCreateInfoKHR.adoc[] 1835endif::VK_KHR_multiview[] 1836 1837 * pname:sType is a elink:VkStructureType value identifying this structure. 1838 * pname:pNext is `NULL` or a pointer to a structure extending this 1839 structure. 1840 * pname:subpassCount is zero or the number of subpasses in the render 1841 pass. 1842 * pname:pViewMasks is a pointer to an array of pname:subpassCount view 1843 masks, where each mask is a bitfield of view indices describing which 1844 views rendering is broadcast to in each subpass, when multiview is 1845 enabled. 1846 If pname:subpassCount is zero, each view mask is treated as zero. 1847 * pname:dependencyCount is zero or the number of dependencies in the 1848 render pass. 1849 * pname:pViewOffsets is a pointer to an array of pname:dependencyCount 1850 view offsets, one for each dependency. 1851 If pname:dependencyCount is zero, each dependency's view offset is 1852 treated as zero. 1853 Each view offset controls which views in the source subpass the views in 1854 the destination subpass depend on. 1855 * pname:correlationMaskCount is zero or the number of correlation masks. 1856 * pname:pCorrelationMasks is a pointer to an array of 1857 pname:correlationMaskCount view masks indicating sets of views that may: 1858 be more efficient to render concurrently. 1859 1860When a subpass uses a non-zero view mask, _multiview_ functionality is 1861considered to be enabled. 1862Multiview is all-or-nothing for a render pass - that is, either all 1863subpasses must: have a non-zero view mask (though some subpasses may: have 1864only one view) or all must: be zero. 1865Multiview causes all drawing and clear commands in the subpass to behave as 1866if they were broadcast to each view, where a view is represented by one 1867layer of the framebuffer attachments. 1868All draws and clears are broadcast to each _view index_ whose bit is set in 1869the view mask. 1870The view index is provided in the code:ViewIndex shader input variable, and 1871color, depth/stencil, and input attachments all read/write the layer of the 1872framebuffer corresponding to the view index. 1873 1874If the view mask is zero for all subpasses, multiview is considered to be 1875disabled and all drawing commands execute normally, without this additional 1876broadcasting. 1877 1878Some implementations may: not support multiview in conjunction with 1879ifdef::VK_EXT_mesh_shader[<<features-multiview-mesh, mesh shaders>>,] 1880<<features-multiview-gs, geometry shaders>> or <<features-multiview-tess, 1881tessellation shaders>>. 1882 1883[[renderpass-multiview-view-local]] 1884When multiview is enabled, the ename:VK_DEPENDENCY_VIEW_LOCAL_BIT bit in a 1885dependency can: be used to express a view-local dependency, meaning that 1886each view in the destination subpass depends on a single view in the source 1887subpass. 1888Unlike pipeline barriers, a subpass dependency can: potentially have a 1889different view mask in the source subpass and the destination subpass. 1890If the dependency is view-local, then each view ([eq]#dstView#) in the 1891destination subpass depends on the view [eq]#dstView {plus} 1892pname:pViewOffsets[dependency]# in the source subpass. 1893If there is not such a view in the source subpass, then this dependency does 1894not affect that view in the destination subpass. 1895If the dependency is not view-local, then all views in the destination 1896subpass depend on all views in the source subpass, and the view offset is 1897ignored. 1898A non-zero view offset is not allowed in a self-dependency. 1899 1900The elements of pname:pCorrelationMasks are a set of masks of views 1901indicating that views in the same mask may: exhibit spatial coherency 1902between the views, making it more efficient to render them concurrently. 1903Correlation masks must: not have a functional effect on the results of the 1904multiview rendering. 1905 1906When multiview is enabled, at the beginning of each subpass all non-render 1907pass state is undefined:. 1908In particular, each time flink:vkCmdBeginRenderPass or 1909flink:vkCmdNextSubpass is called the graphics pipeline must: be bound, any 1910relevant descriptor sets or vertex/index buffers must: be bound, and any 1911relevant dynamic state or push constants must: be set before they are used. 1912 1913ifdef::VK_NVX_multiview_per_view_attributes[] 1914 1915A multiview subpass can: declare that its shaders will write per-view 1916attributes for all views in a single invocation, by setting the 1917ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX bit in the subpass 1918description. 1919The only supported per-view attributes are position and viewport mask, and 1920per-view position and viewport masks are written to output array variables 1921decorated with code:PositionPerViewNV and code:ViewportMaskPerViewNV, 1922respectively. 1923If `apiext:VK_NV_viewport_array2` is not supported and enabled, 1924code:ViewportMaskPerViewNV must: not be used. 1925Values written to elements of code:PositionPerViewNV and 1926code:ViewportMaskPerViewNV must: not depend on the code:ViewIndex. 1927The shader must: also write to an output variable decorated with 1928code:Position, and the value written to code:Position must: equal the value 1929written to code:PositionPerViewNV[code:ViewIndex]. 1930Similarly, if code:ViewportMaskPerViewNV is written to then the shader must: 1931also write to an output variable decorated with code:ViewportMaskNV, and the 1932value written to code:ViewportMaskNV must: equal the value written to 1933code:ViewportMaskPerViewNV[code:ViewIndex]. 1934Implementations will either use values taken from code:Position and 1935code:ViewportMaskNV and invoke the shader once for each view, or will use 1936values taken from code:PositionPerViewNV and code:ViewportMaskPerViewNV and 1937invoke the shader fewer times. 1938The values written to code:Position and code:ViewportMaskNV must: not depend 1939on the values written to code:PositionPerViewNV and 1940code:ViewportMaskPerViewNV, or vice versa (to allow compilers to eliminate 1941the unused outputs). 1942All attributes that do not have `*PerViewNV` counterparts must: not depend 1943on code:ViewIndex. 1944 1945Per-view attributes are all-or-nothing for a subpass. 1946That is, all pipelines compiled against a subpass that includes the 1947ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX bit must: write 1948per-view attributes to the `*PerViewNV[]` shader outputs, in addition to the 1949non-per-view (e.g. code:Position) outputs. 1950Pipelines compiled against a subpass that does not include this bit must: 1951not include the `*PerViewNV[]` outputs in their interfaces. 1952 1953endif::VK_NVX_multiview_per_view_attributes[] 1954 1955.Valid Usage 1956**** 1957 * [[VUID-VkRenderPassMultiviewCreateInfo-pCorrelationMasks-00841]] 1958 Each view index must: not be set in more than one element of 1959 pname:pCorrelationMasks 1960 * [[VUID-VkRenderPassMultiviewCreateInfo-multiview-06555]] 1961 If the <<features-multiview, pname:multiview>> feature is not enabled, 1962 each element of pname:pViewMasks must: be `0` 1963 * [[VUID-VkRenderPassMultiviewCreateInfo-pViewMasks-06697]] 1964 The index of the most significant bit in each element of 1965 pname:pViewMasks must: be less than <<limits-maxMultiviewViewCount, 1966 pname:maxMultiviewViewCount>> 1967**** 1968 1969include::{generated}/validity/structs/VkRenderPassMultiviewCreateInfo.adoc[] 1970-- 1971endif::VK_VERSION_1_1,VK_KHR_multiview[] 1972 1973ifdef::VK_NVX_multiview_per_view_attributes[] 1974ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 1975[open,refpage='VkMultiviewPerViewAttributesInfoNVX',desc='Structure specifying the multiview per-attribute properties',type='structs'] 1976-- 1977The sname:VkMultiviewPerViewAttributesInfoNVX structure is defined as: 1978 1979include::{generated}/api/structs/VkMultiviewPerViewAttributesInfoNVX.adoc[] 1980 1981 * pname:sType is a elink:VkStructureType value identifying this structure. 1982 * pname:pNext is `NULL` or a pointer to a structure extending this 1983 structure. 1984 * pname:perViewAttributes specifies that shaders compiled for this 1985 pipeline write the attributes for all views in a single invocation of 1986 each vertex processing stage. 1987 All pipelines executed within a render pass instance that includes this 1988 bit must: write per-view attributes to the `*PerViewNV[]` shader 1989 outputs, in addition to the non-per-view (e.g. code:Position) outputs. 1990 * pname:perViewAttributesPositionXOnly specifies that shaders compiled for 1991 this pipeline use per-view positions which only differ in value in the x 1992 component. 1993 Per-view viewport mask can: also be used. 1994 1995When dynamic render pass instances are being used, instead of specifying 1996ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX or 1997ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX in the subpass 1998description flags, the per-attribute properties of the render pass instance 1999must: be specified by the sname:VkMultiviewPerViewAttributesInfoNVX 2000structure Include the sname:VkMultiviewPerViewAttributesInfoNVX structure in 2001the pname:pNext chain of slink:VkGraphicsPipelineCreateInfo when creating a 2002graphics pipeline for dynamic rendering, slink:VkRenderingInfo when starting 2003a dynamic render pass instance, and slink:VkCommandBufferInheritanceInfo 2004when specifying the dynamic render pass instance parameters for secondary 2005command buffers. 2006 2007include::{generated}/validity/structs/VkMultiviewPerViewAttributesInfoNVX.adoc[] 2008-- 2009endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 2010endif::VK_NVX_multiview_per_view_attributes[] 2011 2012ifdef::VK_EXT_fragment_density_map[] 2013[[renderpass-fragmentdensitymapattachment]] 2014[open,refpage='VkRenderPassFragmentDensityMapCreateInfoEXT',desc='Structure containing fragment density map attachment for render pass',type='structs'] 2015-- 2016If the slink:VkRenderPassCreateInfo::pname:pNext chain includes a 2017sname:VkRenderPassFragmentDensityMapCreateInfoEXT structure, then that 2018structure includes a fragment density map attachment for the render pass. 2019 2020The sname:VkRenderPassFragmentDensityMapCreateInfoEXT structure is defined 2021as: 2022 2023include::{generated}/api/structs/VkRenderPassFragmentDensityMapCreateInfoEXT.adoc[] 2024 2025 * pname:sType is a elink:VkStructureType value identifying this structure. 2026 * pname:pNext is `NULL` or a pointer to a structure extending this 2027 structure. 2028 * pname:fragmentDensityMapAttachment is the fragment density map to use 2029 for the render pass. 2030 2031The fragment density map is read at an implementation-dependent time with 2032the following constraints determined by the attachment's image view 2033pname:flags: 2034 2035 * ename:VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DYNAMIC_BIT_EXT 2036 specifies that the fragment density map will be read by the device 2037 during ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT 2038ifdef::VK_EXT_fragment_density_map2[] 2039 * ename:VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DEFERRED_BIT_EXT 2040 specifies that the fragment density map will be read by the host during 2041 flink:vkEndCommandBuffer of the primary command buffer that the render 2042 pass is recorded into 2043endif::VK_EXT_fragment_density_map2[] 2044 * Otherwise the fragment density map will be read by the host during 2045 flink:vkCmdBeginRenderPass 2046 2047The fragment density map may: additionally be read by the device during 2048ename:VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT for any mode. 2049 2050If this structure is not present, it is as if 2051pname:fragmentDensityMapAttachment was given as ename:VK_ATTACHMENT_UNUSED. 2052 2053.Valid Usage 2054**** 2055 * [[VUID-VkRenderPassFragmentDensityMapCreateInfoEXT-fragmentDensityMapAttachment-02548]] 2056 If pname:fragmentDensityMapAttachment is not ename:VK_ATTACHMENT_UNUSED, 2057 pname:fragmentDensityMapAttachment must: not be an element of 2058 sname:VkSubpassDescription::pname:pInputAttachments, 2059 sname:VkSubpassDescription::pname:pColorAttachments, 2060 sname:VkSubpassDescription::pname:pResolveAttachments, 2061 sname:VkSubpassDescription::pname:pDepthStencilAttachment, or 2062 sname:VkSubpassDescription::pname:pPreserveAttachments for any subpass 2063 * [[VUID-VkRenderPassFragmentDensityMapCreateInfoEXT-fragmentDensityMapAttachment-02549]] 2064 If pname:fragmentDensityMapAttachment is not ename:VK_ATTACHMENT_UNUSED, 2065 pname:layout must: be equal to 2066 ename:VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT, or 2067 ename:VK_IMAGE_LAYOUT_GENERAL 2068 * [[VUID-VkRenderPassFragmentDensityMapCreateInfoEXT-fragmentDensityMapAttachment-02550]] 2069 If pname:fragmentDensityMapAttachment is not ename:VK_ATTACHMENT_UNUSED, 2070 pname:fragmentDensityMapAttachment must: reference an attachment with a 2071 pname:loadOp equal to ename:VK_ATTACHMENT_LOAD_OP_LOAD or 2072 ename:VK_ATTACHMENT_LOAD_OP_DONT_CARE 2073 * [[VUID-VkRenderPassFragmentDensityMapCreateInfoEXT-fragmentDensityMapAttachment-02551]] 2074 If pname:fragmentDensityMapAttachment is not ename:VK_ATTACHMENT_UNUSED, 2075 pname:fragmentDensityMapAttachment must: reference an attachment with a 2076 pname:storeOp equal to ename:VK_ATTACHMENT_STORE_OP_DONT_CARE 2077**** 2078 2079include::{generated}/validity/structs/VkRenderPassFragmentDensityMapCreateInfoEXT.adoc[] 2080-- 2081endif::VK_EXT_fragment_density_map[] 2082 2083[open,refpage='VkAttachmentDescription',desc='Structure specifying an attachment description',type='structs'] 2084-- 2085:refpage: VkAttachmentDescription 2086 2087The sname:VkAttachmentDescription structure is defined as: 2088 2089include::{generated}/api/structs/VkAttachmentDescription.adoc[] 2090 2091 * pname:flags is a bitmask of elink:VkAttachmentDescriptionFlagBits 2092 specifying additional properties of the attachment. 2093 * pname:format is a elink:VkFormat value specifying the format of the 2094 image view that will be used for the attachment. 2095 * pname:samples is a elink:VkSampleCountFlagBits value specifying the 2096 number of samples of the image. 2097 * pname:loadOp is a elink:VkAttachmentLoadOp value specifying how the 2098 contents of color and depth components of the attachment are treated at 2099 the beginning of the subpass where it is first used. 2100 * pname:storeOp is a elink:VkAttachmentStoreOp value specifying how the 2101 contents of color and depth components of the attachment are treated at 2102 the end of the subpass where it is last used. 2103 * pname:stencilLoadOp is a elink:VkAttachmentLoadOp value specifying how 2104 the contents of stencil components of the attachment are treated at the 2105 beginning of the subpass where it is first used. 2106 * pname:stencilStoreOp is a elink:VkAttachmentStoreOp value specifying how 2107 the contents of stencil components of the attachment are treated at the 2108 end of the last subpass where it is used. 2109 * pname:initialLayout is the layout the attachment image subresource will 2110 be in when a render pass instance begins. 2111 * pname:finalLayout is the layout the attachment image subresource will be 2112 transitioned to when a render pass instance ends. 2113 2114If the attachment uses a color format, then pname:loadOp and pname:storeOp 2115are used, and pname:stencilLoadOp and pname:stencilStoreOp are ignored. 2116If the format has depth and/or stencil components, pname:loadOp and 2117pname:storeOp apply only to the depth data, while pname:stencilLoadOp and 2118pname:stencilStoreOp define how the stencil data is handled. 2119pname:loadOp and pname:stencilLoadOp define the 2120<<renderpass-load-operations, load operations>> for the attachment. 2121pname:storeOp and pname:stencilStoreOp define the 2122<<renderpass-store-operations, store operations>> for the attachment. 2123If an attachment is not used by any subpass, pname:loadOp, pname:storeOp, 2124pname:stencilStoreOp, and pname:stencilLoadOp will be ignored for that 2125attachment, and no load or store ops will be performed. 2126However, any transition specified by pname:initialLayout and 2127pname:finalLayout will still be executed. 2128 2129[[renderpass-aliasing]] 2130If pname:flags includes ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT, then 2131the attachment is treated as if it shares physical memory with another 2132attachment in the same render pass. 2133This information limits the ability of the implementation to reorder certain 2134operations (like layout transitions and the pname:loadOp) such that it is 2135not improperly reordered against other uses of the same physical memory via 2136a different attachment. 2137This is described in more detail below. 2138 2139If a render pass uses multiple attachments that alias the same device 2140memory, those attachments must: each include the 2141ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT bit in their attachment 2142description flags. 2143Attachments aliasing the same memory occurs in multiple ways: 2144 2145 * Multiple attachments being assigned the same image view as part of 2146 framebuffer creation. 2147 * Attachments using distinct image views that correspond to the same image 2148 subresource of an image. 2149 * Attachments using views of distinct image subresources which are bound 2150 to overlapping memory ranges. 2151 2152[NOTE] 2153.Note 2154==== 2155Render passes must: include subpass dependencies (either directly or via a 2156subpass dependency chain) between any two subpasses that operate on the same 2157attachment or aliasing attachments and those subpass dependencies must: 2158include execution and memory dependencies separating uses of the aliases, if 2159at least one of those subpasses writes to one of the aliases. 2160These dependencies must: not include the ename:VK_DEPENDENCY_BY_REGION_BIT 2161if the aliases are views of distinct image subresources which overlap in 2162memory. 2163==== 2164 2165Multiple attachments that alias the same memory must: not be used in a 2166single subpass. 2167A given attachment index must: not be used multiple times in a single 2168subpass, with one exception: two subpass attachments can: use the same 2169attachment index if at least one use is as an input attachment and neither 2170use is as a resolve or preserve attachment. 2171In other words, the same view can: be used simultaneously as an input and 2172color or depth/stencil attachment, but must: not be used as multiple color 2173or depth/stencil attachments nor as resolve or preserve attachments. 2174 2175If a set of attachments alias each other, then all except the first to be 2176used in the render pass must: use an pname:initialLayout of 2177ename:VK_IMAGE_LAYOUT_UNDEFINED, since the earlier uses of the other aliases 2178make their contents undefined:. 2179Once an alias has been used and a different alias has been used after it, 2180the first alias must: not be used in any later subpasses. 2181However, an application can: assign the same image view to multiple aliasing 2182attachment indices, which allows that image view to be used multiple times 2183even if other aliases are used in between. 2184 2185[NOTE] 2186.Note 2187==== 2188Once an attachment needs the ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT 2189bit, there should: be no additional cost of introducing additional aliases, 2190and using these additional aliases may: allow more efficient clearing of the 2191attachments on multiple uses via ename:VK_ATTACHMENT_LOAD_OP_CLEAR. 2192==== 2193 2194.Valid Usage 2195**** 2196include::{chapters}/commonvalidity/attachment_description_common.adoc[] 2197 * [[VUID-VkAttachmentDescription-format-06698]] 2198 pname:format must: not be VK_FORMAT_UNDEFINED 2199 * [[VUID-VkAttachmentDescription-format-06700]] 2200 If pname:format includes a stencil component and pname:stencilLoadOp is 2201 ename:VK_ATTACHMENT_LOAD_OP_LOAD, then pname:initialLayout must: not be 2202 ename:VK_IMAGE_LAYOUT_UNDEFINED 2203 * [[VUID-VkAttachmentDescription-format-03292]] 2204 If pname:format is a depth/stencil format which includes only the 2205 stencil component, pname:initialLayout must: not be 2206 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 2207 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 2208 * [[VUID-VkAttachmentDescription-format-03293]] 2209 If pname:format is a depth/stencil format which includes only the 2210 stencil component, pname:finalLayout must: not be 2211 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 2212 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 2213 * [[VUID-VkAttachmentDescription-format-06242]] 2214 If pname:format is a depth/stencil format which includes both depth and 2215 stencil components, pname:initialLayout must: not be 2216 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 2217 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 2218 * [[VUID-VkAttachmentDescription-format-06243]] 2219 If pname:format is a depth/stencil format which includes both depth and 2220 stencil components, pname:finalLayout must: not be 2221 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 2222 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 2223**** 2224 2225include::{generated}/validity/structs/VkAttachmentDescription.adoc[] 2226-- 2227 2228[open,refpage='VkAttachmentDescriptionFlagBits',desc='Bitmask specifying additional properties of an attachment',type='enums'] 2229-- 2230Bits which can: be set in slink:VkAttachmentDescription::pname:flags, 2231describing additional properties of the attachment, are: 2232 2233include::{generated}/api/enums/VkAttachmentDescriptionFlagBits.adoc[] 2234 2235 * ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT specifies that the 2236 attachment aliases the same device memory as other attachments. 2237-- 2238 2239[open,refpage='VkAttachmentDescriptionFlags',desc='Bitmask of VkAttachmentDescriptionFlagBits',type='flags'] 2240-- 2241include::{generated}/api/flags/VkAttachmentDescriptionFlags.adoc[] 2242 2243tname:VkAttachmentDescriptionFlags is a bitmask type for setting a mask of 2244zero or more elink:VkAttachmentDescriptionFlagBits. 2245-- 2246 2247ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 2248[open,refpage='VkRenderPassInputAttachmentAspectCreateInfo',desc='Structure specifying, for a given subpass/input attachment pair, which aspect can: be read.',type='structs'] 2249-- 2250The sname:VkRenderPassInputAttachmentAspectCreateInfo structure is defined 2251as: 2252 2253include::{generated}/api/structs/VkRenderPassInputAttachmentAspectCreateInfo.adoc[] 2254 2255ifdef::VK_KHR_maintenance2[] 2256or the equivalent 2257 2258include::{generated}/api/structs/VkRenderPassInputAttachmentAspectCreateInfoKHR.adoc[] 2259endif::VK_KHR_maintenance2[] 2260 2261 * pname:sType is a elink:VkStructureType value identifying this structure. 2262 * pname:pNext is `NULL` or a pointer to a structure extending this 2263 structure. 2264 * pname:aspectReferenceCount is the number of elements in the 2265 pname:pAspectReferences array. 2266 * pname:pAspectReferences is a pointer to an array of 2267 pname:aspectReferenceCount slink:VkInputAttachmentAspectReference 2268 structures containing a mask describing which aspect(s) can: be accessed 2269 for a given input attachment within a given subpass. 2270 2271To specify which aspects of an input attachment can: be read, add a 2272slink:VkRenderPassInputAttachmentAspectCreateInfo structure to the 2273pname:pNext chain of the slink:VkRenderPassCreateInfo structure: 2274 2275An application can: access any aspect of an input attachment that does not 2276have a specified aspect mask in the pname:pAspectReferences array. 2277Otherwise, an application must: not access aspect(s) of an input attachment 2278other than those in its specified aspect mask. 2279 2280include::{generated}/validity/structs/VkRenderPassInputAttachmentAspectCreateInfo.adoc[] 2281-- 2282 2283[open,refpage='VkInputAttachmentAspectReference',desc='Structure specifying a subpass/input attachment pair and an aspect mask that can: be read.',type='structs'] 2284-- 2285The sname:VkInputAttachmentAspectReference structure is defined as: 2286 2287include::{generated}/api/structs/VkInputAttachmentAspectReference.adoc[] 2288 2289ifdef::VK_KHR_maintenance2[] 2290or the equivalent 2291 2292include::{generated}/api/structs/VkInputAttachmentAspectReferenceKHR.adoc[] 2293endif::VK_KHR_maintenance2[] 2294 2295 * pname:subpass is an index into the pname:pSubpasses array of the parent 2296 sname:VkRenderPassCreateInfo structure. 2297 * pname:inputAttachmentIndex is an index into the pname:pInputAttachments 2298 of the specified subpass. 2299 * pname:aspectMask is a mask of which aspect(s) can: be accessed within 2300 the specified subpass. 2301 2302This structure specifies an aspect mask for a specific input attachment of a 2303specific subpass in the render pass. 2304 2305pname:subpass and pname:inputAttachmentIndex index into the render pass as: 2306 2307[source,c] 2308---- 2309pCreateInfo->pSubpasses[subpass].pInputAttachments[inputAttachmentIndex] 2310---- 2311 2312.Valid Usage 2313**** 2314 * [[VUID-VkInputAttachmentAspectReference-aspectMask-01964]] 2315 pname:aspectMask must: not include ename:VK_IMAGE_ASPECT_METADATA_BIT 2316ifdef::VK_EXT_image_drm_format_modifier[] 2317 * [[VUID-VkInputAttachmentAspectReference-aspectMask-02250]] 2318 pname:aspectMask must: not include 2319 `VK_IMAGE_ASPECT_MEMORY_PLANE__{ibit}__BIT_EXT` for any index _i_ 2320endif::VK_EXT_image_drm_format_modifier[] 2321**** 2322 2323include::{generated}/validity/structs/VkInputAttachmentAspectReference.adoc[] 2324-- 2325endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 2326 2327[open,refpage='VkSubpassDescription',desc='Structure specifying a subpass description',type='structs'] 2328-- 2329:refpage: VkSubpassDescription 2330 2331The sname:VkSubpassDescription structure is defined as: 2332 2333include::{generated}/api/structs/VkSubpassDescription.adoc[] 2334 2335 * pname:flags is a bitmask of elink:VkSubpassDescriptionFlagBits 2336 specifying usage of the subpass. 2337 * pname:pipelineBindPoint is a elink:VkPipelineBindPoint value specifying 2338 the pipeline type supported for this subpass. 2339 * pname:inputAttachmentCount is the number of input attachments. 2340 * pname:pInputAttachments is a pointer to an array of 2341 slink:VkAttachmentReference structures defining the input attachments 2342 for this subpass and their layouts. 2343 * pname:colorAttachmentCount is the number of color attachments. 2344 * pname:pColorAttachments is a pointer to an array of 2345 pname:colorAttachmentCount slink:VkAttachmentReference structures 2346 defining the color attachments for this subpass and their layouts. 2347 * pname:pResolveAttachments is `NULL` or a pointer to an array of 2348 pname:colorAttachmentCount slink:VkAttachmentReference structures 2349 defining the resolve attachments for this subpass and their layouts. 2350 * pname:pDepthStencilAttachment is a pointer to a 2351 slink:VkAttachmentReference structure specifying the depth/stencil 2352 attachment for this subpass and its layout. 2353 * pname:preserveAttachmentCount is the number of preserved attachments. 2354 * pname:pPreserveAttachments is a pointer to an array of 2355 pname:preserveAttachmentCount render pass attachment indices identifying 2356 attachments that are not used by this subpass, but whose contents must: 2357 be preserved throughout the subpass. 2358 2359Each element of the pname:pInputAttachments array corresponds to an input 2360attachment index in a fragment shader, i.e. if a shader declares an image 2361variable decorated with a code:InputAttachmentIndex value of *X*, then it 2362uses the attachment provided in pname:pInputAttachments[*X*]. 2363Input attachments must: also be bound to the pipeline in a descriptor set. 2364If the pname:attachment member of any element of pname:pInputAttachments is 2365ename:VK_ATTACHMENT_UNUSED, the application must: not read from the 2366corresponding input attachment index. 2367Fragment shaders can: use subpass input variables to access the contents of 2368an input attachment at the fragment's (x, y, layer) framebuffer coordinates. 2369ifdef::VK_QCOM_render_pass_transform[] 2370Input attachments must: not be used by any subpasses within a render pass 2371that enables <<vertexpostproc-renderpass-transform, render pass transform>>. 2372endif::VK_QCOM_render_pass_transform[] 2373 2374Each element of the pname:pColorAttachments array corresponds to an output 2375location in the shader, i.e. if the shader declares an output variable 2376decorated with a code:Location value of *X*, then it uses the attachment 2377provided in pname:pColorAttachments[*X*]. 2378If the pname:attachment member of any element of pname:pColorAttachments is 2379ename:VK_ATTACHMENT_UNUSED, 2380ifdef::VK_EXT_color_write_enable[] 2381or if <<framebuffer-color-write-enable,Color Write Enable>> has been 2382disabled for the corresponding attachment index, 2383endif::VK_EXT_color_write_enable[] 2384then writes to the corresponding location by a fragment shader are 2385discarded. 2386 2387If 2388ifdef::VK_QCOM_render_pass_shader_resolve[] 2389pname:flags does not include 2390ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM, and if 2391endif::VK_QCOM_render_pass_shader_resolve[] 2392pname:pResolveAttachments is not `NULL`, each of its elements corresponds to 2393a color attachment (the element in pname:pColorAttachments at the same 2394index), and a <<renderpass-resolve-operations,multisample resolve 2395operation>> is defined for each attachment unless the resolve attachment 2396index is ename:VK_ATTACHMENT_UNUSED. 2397 2398ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 2399Similarly, if 2400ifdef::VK_QCOM_render_pass_shader_resolve[] 2401pname:flags does not include 2402ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM, and 2403endif::VK_QCOM_render_pass_shader_resolve[] 2404slink:VkSubpassDescriptionDepthStencilResolve::pname:pDepthStencilResolveAttachment 2405is not `NULL` and does not have the value ename:VK_ATTACHMENT_UNUSED, it 2406corresponds to the depth/stencil attachment in 2407pname:pDepthStencilAttachment, and 2408<<renderpass-resolve-operations,multisample resolve operation>> for depth 2409and stencil are defined by 2410slink:VkSubpassDescriptionDepthStencilResolve::pname:depthResolveMode and 2411slink:VkSubpassDescriptionDepthStencilResolve::pname:stencilResolveMode, 2412respectively. 2413If slink:VkSubpassDescriptionDepthStencilResolve::pname:depthResolveMode is 2414ename:VK_RESOLVE_MODE_NONE or the pname:pDepthStencilResolveAttachment does 2415not have a depth aspect, no resolve operation is performed for the depth 2416attachment. 2417If slink:VkSubpassDescriptionDepthStencilResolve::pname:stencilResolveMode 2418is ename:VK_RESOLVE_MODE_NONE or the pname:pDepthStencilResolveAttachment 2419does not have a stencil aspect, no resolve operation is performed for the 2420stencil attachment. 2421 2422ifdef::VK_EXT_sample_locations[] 2423If the image subresource range referenced by the depth/stencil attachment is 2424created with 2425ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT, then the 2426<<renderpass-resolve-operations,multisample resolve operation>> uses the 2427sample locations state specified in the pname:sampleLocationsInfo member of 2428the element of the 2429sname:VkRenderPassSampleLocationsBeginInfoEXT::pname:pPostSubpassSampleLocations 2430for the subpass. 2431endif::VK_EXT_sample_locations[] 2432 2433endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 2434 2435If pname:pDepthStencilAttachment is `NULL`, or if its attachment index is 2436ename:VK_ATTACHMENT_UNUSED, it indicates that no depth/stencil attachment 2437will be used in the subpass. 2438 2439[[renderpass-attachment-contents]] 2440The contents of an attachment within the render area become undefined: at 2441the start of a subpass *S* if all of the following conditions are true: 2442 2443 * The attachment is used as a color, depth/stencil, or resolve attachment 2444 in any subpass in the render pass. 2445 * There is a subpass *S~1~* that uses or preserves the attachment, and a 2446 subpass dependency from *S~1~* to *S*. 2447 * The attachment is not used or preserved in subpass *S*. 2448 2449ifdef::VK_QCOM_render_pass_shader_resolve[] 2450In addition, the contents of an attachment within the render area become 2451undefined: at the start of a subpass *S* if all of the following conditions 2452are true: 2453 2454 * ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM is set. 2455 * The attachment is used as a color or depth/stencil in the subpass. 2456endif::VK_QCOM_render_pass_shader_resolve[] 2457 2458Once the contents of an attachment become undefined: in subpass *S*, they 2459remain undefined: for subpasses in subpass dependency chains starting with 2460subpass *S* until they are written again. 2461However, they remain valid for subpasses in other subpass dependency chains 2462starting with subpass *S~1~* if those subpasses use or preserve the 2463attachment. 2464 2465.Valid Usage 2466**** 2467include::{chapters}/commonvalidity/subpass_description_common.adoc[] 2468 * [[VUID-VkSubpassDescription-pipelineBindPoint-04952]] 2469 pname:pipelineBindPoint must: be ename:VK_PIPELINE_BIND_POINT_GRAPHICS 2470ifdef::VK_HUAWEI_subpass_shading[] 2471 or ename:VK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEI 2472endif::VK_HUAWEI_subpass_shading[] 2473 * [[VUID-VkSubpassDescription-colorAttachmentCount-00845]] 2474 pname:colorAttachmentCount must: be less than or equal to 2475 sname:VkPhysicalDeviceLimits::pname:maxColorAttachments 2476 * [[VUID-VkSubpassDescription-loadOp-00846]] 2477 If the first use of an attachment in this render pass is as an input 2478 attachment, and the attachment is not also used as a color or 2479 depth/stencil attachment in the same subpass, then pname:loadOp must: 2480 not be ename:VK_ATTACHMENT_LOAD_OP_CLEAR 2481 * [[VUID-VkSubpassDescription-pResolveAttachments-00847]] 2482 If pname:pResolveAttachments is not `NULL`, for each resolve attachment 2483 that is not ename:VK_ATTACHMENT_UNUSED, the corresponding color 2484 attachment must: not be ename:VK_ATTACHMENT_UNUSED 2485 * [[VUID-VkSubpassDescription-pResolveAttachments-00848]] 2486 If pname:pResolveAttachments is not `NULL`, for each resolve attachment 2487 that is not ename:VK_ATTACHMENT_UNUSED, the corresponding color 2488 attachment must: not have a sample count of ename:VK_SAMPLE_COUNT_1_BIT 2489 * [[VUID-VkSubpassDescription-pResolveAttachments-00849]] 2490 If pname:pResolveAttachments is not `NULL`, each resolve attachment that 2491 is not ename:VK_ATTACHMENT_UNUSED must: have a sample count of 2492 ename:VK_SAMPLE_COUNT_1_BIT 2493 * [[VUID-VkSubpassDescription-pResolveAttachments-00850]] 2494 If pname:pResolveAttachments is not `NULL`, each resolve attachment that 2495 is not ename:VK_ATTACHMENT_UNUSED must: have the same elink:VkFormat as 2496 its corresponding color attachment 2497 * [[VUID-VkSubpassDescription-pColorAttachments-09430]] 2498 All attachments in pname:pColorAttachments that are not 2499 ename:VK_ATTACHMENT_UNUSED must: have the same sample count 2500 * [[VUID-VkSubpassDescription-pInputAttachments-02647]] 2501 All attachments in pname:pInputAttachments that are not 2502 ename:VK_ATTACHMENT_UNUSED must: have image formats whose 2503 <<potential-format-features, potential format features>> contain at 2504 least ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT or 2505 ename:VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT 2506 * [[VUID-VkSubpassDescription-pColorAttachments-02648]] 2507 All attachments in pname:pColorAttachments that are not 2508 ename:VK_ATTACHMENT_UNUSED must: have image formats whose 2509 <<potential-format-features, potential format features>> contain 2510 ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT 2511 * [[VUID-VkSubpassDescription-pResolveAttachments-02649]] 2512 All attachments in pname:pResolveAttachments that are not 2513 ename:VK_ATTACHMENT_UNUSED must: have image formats whose 2514 <<potential-format-features, potential format features>> contain 2515 ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT 2516 * [[VUID-VkSubpassDescription-pDepthStencilAttachment-02650]] 2517 If pname:pDepthStencilAttachment is not `NULL` and the attachment is not 2518 ename:VK_ATTACHMENT_UNUSED then it must: have an image format whose 2519 <<potential-format-features, potential format features>> contain 2520 ename:VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT 2521ifdef::VK_NV_linear_color_attachment[] 2522 * [[VUID-VkSubpassDescription-linearColorAttachment-06496]] 2523 If the <<features-linearColorAttachment, pname:linearColorAttachment>> 2524 feature is enabled and the image is created with 2525 ename:VK_IMAGE_TILING_LINEAR, all attachments in pname:pInputAttachments 2526 that are not ename:VK_ATTACHMENT_UNUSED must: have image formats whose 2527 <<potential-format-features, potential format features>> must: contain 2528 ename:VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV 2529 * [[VUID-VkSubpassDescription-linearColorAttachment-06497]] 2530 If the <<features-linearColorAttachment, pname:linearColorAttachment>> 2531 feature is enabled and the image is created with 2532 ename:VK_IMAGE_TILING_LINEAR, all attachments in pname:pColorAttachments 2533 that are not ename:VK_ATTACHMENT_UNUSED must: have image formats whose 2534 <<potential-format-features, potential format features>> must: contain 2535 ename:VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV 2536 * [[VUID-VkSubpassDescription-linearColorAttachment-06498]] 2537 If the <<features-linearColorAttachment, pname:linearColorAttachment>> 2538 feature is enabled and the image is created with 2539 ename:VK_IMAGE_TILING_LINEAR, all attachments in 2540 pname:pResolveAttachments that are not ename:VK_ATTACHMENT_UNUSED must: 2541 have image formats whose <<potential-format-features, potential format 2542 features>> must: contain 2543 ename:VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV 2544endif::VK_NV_linear_color_attachment[] 2545ifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 2546 * [[VUID-VkSubpassDescription-None-09431]] 2547 If either of the following is enabled: 2548ifdef::VK_AMD_mixed_attachment_samples[] 2549 ** The `apiext:VK_AMD_mixed_attachment_samples` extension 2550endif::VK_AMD_mixed_attachment_samples[] 2551ifdef::VK_NV_framebuffer_mixed_samples[] 2552 ** The `apiext:VK_NV_framebuffer_mixed_samples` extension 2553endif::VK_NV_framebuffer_mixed_samples[] 2554 2555+ 2556all attachments in pname:pColorAttachments that are not 2557ename:VK_ATTACHMENT_UNUSED must: have a sample count that is smaller than or 2558equal to the sample count of pname:pDepthStencilAttachment if it is not 2559ename:VK_ATTACHMENT_UNUSED 2560endif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 2561 * [[VUID-VkSubpassDescription-pDepthStencilAttachment-01418]] 2562 If pname:pDepthStencilAttachment is not ename:VK_ATTACHMENT_UNUSED and 2563 any attachments in pname:pColorAttachments are not 2564 ename:VK_ATTACHMENT_UNUSED, they must: have the same sample count 2565ifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 2566 , if none of the following are enabled: 2567ifdef::VK_AMD_mixed_attachment_samples[] 2568 ** The `apiext:VK_AMD_mixed_attachment_samples` extension 2569endif::VK_AMD_mixed_attachment_samples[] 2570ifdef::VK_NV_framebuffer_mixed_samples[] 2571 ** The `apiext:VK_NV_framebuffer_mixed_samples` extension 2572endif::VK_NV_framebuffer_mixed_samples[] 2573endif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 2574 * [[VUID-VkSubpassDescription-attachment-00853]] 2575 Each element of pname:pPreserveAttachments must: not be 2576 ename:VK_ATTACHMENT_UNUSED 2577 * [[VUID-VkSubpassDescription-pPreserveAttachments-00854]] 2578 Each element of pname:pPreserveAttachments must: not also be an element 2579 of any other member of the subpass description 2580 * [[VUID-VkSubpassDescription-layout-02519]] 2581 If any attachment is used by more than one slink:VkAttachmentReference 2582 member, then each use must: use the same pname:layout 2583ifdef::VK_NVX_multiview_per_view_attributes[] 2584 * [[VUID-VkSubpassDescription-flags-00856]] 2585 If pname:flags includes 2586 ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX, it must: 2587 also include ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX 2588endif::VK_NVX_multiview_per_view_attributes[] 2589ifdef::VK_QCOM_render_pass_shader_resolve[] 2590 * [[VUID-VkSubpassDescription-flags-03341]] 2591 If pname:flags includes 2592 ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM, and if 2593 pname:pResolveAttachments is not `NULL`, then each resolve attachment 2594 must: be ename:VK_ATTACHMENT_UNUSED 2595 * [[VUID-VkSubpassDescription-flags-03343]] 2596 If pname:flags includes 2597 ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM, then the subpass 2598 must: be the last subpass in a subpass dependency chain 2599endif::VK_QCOM_render_pass_shader_resolve[] 2600ifdef::VK_QCOM_render_pass_transform[] 2601 * [[VUID-VkSubpassDescription-pInputAttachments-02868]] 2602 If the render pass is created with 2603 ename:VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM each of the elements of 2604 pname:pInputAttachments must: be ename:VK_ATTACHMENT_UNUSED 2605endif::VK_QCOM_render_pass_transform[] 2606 * [[VUID-VkSubpassDescription-pDepthStencilAttachment-04438]] 2607 pname:pDepthStencilAttachment and pname:pColorAttachments must: not 2608 contain references to the same attachment 2609ifdef::VKSC_VERSION_1_0[] 2610 * [[VUID-VkSubpassDescription-inputAttachmentCount-05053]] 2611 pname:inputAttachmentCount must: be less than or equal to 2612 <<limits-maxSubpassInputAttachments,maxSubpassInputAttachments>> 2613 * [[VUID-VkSubpassDescription-preserveAttachmentCount-05054]] 2614 pname:preserveAttachmentCount must: be less than or equal to 2615 <<limits-maxSubpassPreserveAttachments,maxSubpassPreserveAttachments>> 2616endif::VKSC_VERSION_1_0[] 2617**** 2618 2619include::{generated}/validity/structs/VkSubpassDescription.adoc[] 2620-- 2621 2622[open,refpage='VkSubpassDescriptionFlagBits',desc='Bitmask specifying usage of a subpass',type='enums'] 2623-- 2624Bits which can: be set in slink:VkSubpassDescription::pname:flags, 2625specifying usage of the subpass, are: 2626 2627include::{generated}/api/enums/VkSubpassDescriptionFlagBits.adoc[] 2628 2629ifdef::VK_NVX_multiview_per_view_attributes[] 2630 * ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX specifies that 2631 shaders compiled for this subpass write the attributes for all views in 2632 a single invocation of each 2633 <<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 2634 stage>>. 2635 All pipelines compiled against a subpass that includes this bit must: 2636 write per-view attributes to the `*PerViewNV[]` shader outputs, in 2637 addition to the non-per-view (e.g. code:Position) outputs. 2638 * ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX specifies 2639 that shaders compiled for this subpass use per-view positions which only 2640 differ in value in the x component. 2641 Per-view viewport mask can: also be used. 2642endif::VK_NVX_multiview_per_view_attributes[] 2643ifdef::VK_QCOM_render_pass_shader_resolve[] 2644 * ename:VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM specifies that the 2645 framebuffer region is the fragment region, that is, the minimum region 2646 dependencies are by pixel rather than by sample, such that any fragment 2647 shader invocation can: access any sample associated with that fragment 2648 shader invocation. 2649 * ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM specifies that the 2650 subpass performs shader resolve operations. 2651endif::VK_QCOM_render_pass_shader_resolve[] 2652ifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 2653 * ename:VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_COLOR_ACCESS_BIT_EXT 2654 specifies that this subpass supports pipelines created with 2655 ename:VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT. 2656 * ename:VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT 2657 specifies that this subpass supports pipelines created with 2658 ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT. 2659 * ename:VK_SUBPASS_DESCRIPTION_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT 2660 specifies that this subpass supports pipelines created with 2661 ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT. 2662endif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 2663ifdef::VK_EXT_legacy_dithering[] 2664 * ename:VK_SUBPASS_DESCRIPTION_ENABLE_LEGACY_DITHERING_BIT_EXT specifies 2665 that <<interfaces-legacy-dithering, Legacy Dithering>> is enabled for 2666 this subpass. 2667endif::VK_EXT_legacy_dithering[] 2668 2669ifndef::VK_NVX_multiview_per_view_attributes,VK_QCOM_render_pass_shader_resolve[] 2670[NOTE] 2671.Note 2672==== 2673All bits for this type are defined by extensions, and none of those 2674extensions are enabled in this build of the specification. 2675==== 2676endif::VK_NVX_multiview_per_view_attributes,VK_QCOM_render_pass_shader_resolve[] 2677 2678ifdef::VK_QCOM_render_pass_shader_resolve[] 2679[NOTE] 2680.Note 2681==== 2682Shader resolve operations allow for custom resolve operations, but 2683overdrawing pixels may: have a performance and/or power cost. 2684Furthermore, since the content of any depth stencil attachment or color 2685attachment is undefined: at the beginning of a shader resolve subpass, any 2686depth testing, stencil testing, or blending operation which sources these 2687undefined: values also has undefined: result value. 2688==== 2689endif::VK_QCOM_render_pass_shader_resolve[] 2690-- 2691 2692[open,refpage='VkSubpassDescriptionFlags',desc='Bitmask of VkSubpassDescriptionFlagBits',type='flags'] 2693-- 2694include::{generated}/api/flags/VkSubpassDescriptionFlags.adoc[] 2695 2696tname:VkSubpassDescriptionFlags is a bitmask type for setting a mask of zero 2697or more elink:VkSubpassDescriptionFlagBits. 2698-- 2699 2700[open,refpage='VkAttachmentReference',desc='Structure specifying an attachment reference',type='structs'] 2701-- 2702:refpage: VkAttachmentReference 2703 2704The sname:VkAttachmentReference structure is defined as: 2705 2706include::{generated}/api/structs/VkAttachmentReference.adoc[] 2707 2708 * pname:attachment is either an integer value identifying an attachment at 2709 the corresponding index in 2710 slink:VkRenderPassCreateInfo::pname:pAttachments, or 2711 ename:VK_ATTACHMENT_UNUSED to signify that this attachment is not used. 2712 * pname:layout is a elink:VkImageLayout value specifying the layout the 2713 attachment uses during the subpass. 2714 2715.Valid Usage 2716**** 2717include::{chapters}/commonvalidity/attachment_reference_common.adoc[] 2718**** 2719 2720include::{generated}/validity/structs/VkAttachmentReference.adoc[] 2721-- 2722 2723[open,refpage='VK_SUBPASS_EXTERNAL',desc='Subpass index sentinel expanding synchronization scope outside a subpass',type='consts'] 2724-- 2725ename:VK_SUBPASS_EXTERNAL is a special subpass index value expanding 2726synchronization scope outside a subpass. 2727It is described in more detail by slink:VkSubpassDependency. 2728 2729include::{generated}/api/enums/VK_SUBPASS_EXTERNAL.adoc[] 2730-- 2731 2732[open,refpage='VkSubpassDependency',desc='Structure specifying a subpass dependency',type='structs'] 2733-- 2734:refpage: VkSubpassDependency 2735The sname:VkSubpassDependency structure is defined as: 2736 2737include::{generated}/api/structs/VkSubpassDependency.adoc[] 2738 2739 * pname:srcSubpass is the subpass index of the first subpass in the 2740 dependency, or ename:VK_SUBPASS_EXTERNAL. 2741 * pname:dstSubpass is the subpass index of the second subpass in the 2742 dependency, or ename:VK_SUBPASS_EXTERNAL. 2743 * pname:srcStageMask is a bitmask of elink:VkPipelineStageFlagBits 2744 specifying the <<synchronization-pipeline-stages-masks, source stage 2745 mask>>. 2746 * pname:dstStageMask is a bitmask of elink:VkPipelineStageFlagBits 2747 specifying the <<synchronization-pipeline-stages-masks, destination 2748 stage mask>> 2749 * pname:srcAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 2750 <<synchronization-access-masks, source access mask>>. 2751 * pname:dstAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 2752 <<synchronization-access-masks, destination access mask>>. 2753 * pname:dependencyFlags is a bitmask of elink:VkDependencyFlagBits. 2754 2755If pname:srcSubpass is equal to pname:dstSubpass then the 2756slink:VkSubpassDependency does not directly define a 2757<<synchronization-dependencies,dependency>>. 2758Instead, it enables pipeline barriers to be used in a render pass instance 2759within the identified subpass, where the scopes of one pipeline barrier 2760must: be a subset of those described by one subpass dependency. 2761Subpass dependencies specified in this way that include 2762<<synchronization-framebuffer-regions,framebuffer-space stages>> in the 2763pname:srcStageMask must: only include 2764<<synchronization-framebuffer-regions,framebuffer-space stages>> in 2765pname:dstStageMask, and must: include ename:VK_DEPENDENCY_BY_REGION_BIT. 2766ifdef::VK_KHR_multiview,VK_VERSION_1_1[] 2767When a subpass dependency is specified in this way for a subpass that has 2768more than one view in its view mask, its pname:dependencyFlags must: include 2769ename:VK_DEPENDENCY_VIEW_LOCAL_BIT. 2770endif::VK_KHR_multiview,VK_VERSION_1_1[] 2771 2772If pname:srcSubpass and pname:dstSubpass are not equal, when a render pass 2773instance which includes a subpass dependency is submitted to a queue, it 2774defines a <<synchronization-dependencies,dependency>> between the subpasses 2775identified by pname:srcSubpass and pname:dstSubpass. 2776 2777If pname:srcSubpass is equal to ename:VK_SUBPASS_EXTERNAL, the first 2778<<synchronization-dependencies-scopes, synchronization scope>> includes 2779commands that occur earlier in <<synchronization-submission-order,submission 2780order>> than the flink:vkCmdBeginRenderPass used to begin the render pass 2781instance. 2782Otherwise, the first set of commands includes all commands submitted as part 2783of the subpass instance identified by pname:srcSubpass and any 2784<<renderpass-load-operations, load>>, <<renderpass-store-operations, 2785store>>, or <<renderpass-resolve-operations, multisample resolve>> 2786operations on attachments used in pname:srcSubpass. 2787In either case, the first synchronization scope is limited to operations on 2788the pipeline stages determined by the 2789<<synchronization-pipeline-stages-masks, source stage mask>> specified by 2790pname:srcStageMask. 2791 2792If pname:dstSubpass is equal to ename:VK_SUBPASS_EXTERNAL, the second 2793<<synchronization-dependencies-scopes, synchronization scope>> includes 2794commands that occur later in <<synchronization-submission-order,submission 2795order>> than the flink:vkCmdEndRenderPass used to end the render pass 2796instance. 2797Otherwise, the second set of commands includes all commands submitted as 2798part of the subpass instance identified by pname:dstSubpass and any 2799<<renderpass-load-operations, load>>, <<renderpass-store-operations, 2800store>>, and <<renderpass-resolve-operations, multisample resolve>> 2801operations on attachments used in pname:dstSubpass. 2802In either case, the second synchronization scope is limited to operations on 2803the pipeline stages determined by the 2804<<synchronization-pipeline-stages-masks, destination stage mask>> specified 2805by pname:dstStageMask. 2806 2807The first <<synchronization-dependencies-access-scopes, access scope>> is 2808limited to accesses in the pipeline stages determined by the 2809<<synchronization-pipeline-stages-masks, source stage mask>> specified by 2810pname:srcStageMask. 2811It is also limited to access types in the <<synchronization-access-masks, 2812source access mask>> specified by pname:srcAccessMask. 2813 2814The second <<synchronization-dependencies-access-scopes, access scope>> is 2815limited to accesses in the pipeline stages determined by the 2816<<synchronization-pipeline-stages-masks, destination stage mask>> specified 2817by pname:dstStageMask. 2818It is also limited to access types in the <<synchronization-access-masks, 2819destination access mask>> specified by pname:dstAccessMask. 2820 2821The <<synchronization-dependencies-available-and-visible, availability and 2822visibility operations>> defined by a subpass dependency affect the execution 2823of <<renderpass-layout-transitions, image layout transitions>> within the 2824render pass. 2825 2826[NOTE] 2827.Note 2828==== 2829For non-attachment resources, the memory dependency expressed by subpass 2830dependency is nearly identical to that of a slink:VkMemoryBarrier (with 2831matching pname:srcAccessMask and pname:dstAccessMask parameters) submitted 2832as a part of a flink:vkCmdPipelineBarrier (with matching pname:srcStageMask 2833and pname:dstStageMask parameters). 2834The only difference being that its scopes are limited to the identified 2835subpasses rather than potentially affecting everything before and after. 2836 2837For attachments however, subpass dependencies work more like a 2838slink:VkImageMemoryBarrier defined similarly to the slink:VkMemoryBarrier 2839above, the queue family indices set to ename:VK_QUEUE_FAMILY_IGNORED, and 2840layouts as follows: 2841 2842 * The equivalent to pname:oldLayout is the attachment's layout according 2843 to the subpass description for pname:srcSubpass. 2844 * The equivalent to pname:newLayout is the attachment's layout according 2845 to the subpass description for pname:dstSubpass. 2846==== 2847 2848.Valid Usage 2849**** 2850:stageMaskName: srcStageMask 2851include::{chapters}/commonvalidity/stage_mask_common.adoc[] 2852 2853:stageMaskName: dstStageMask 2854include::{chapters}/commonvalidity/stage_mask_common.adoc[] 2855 2856 * [[VUID-VkSubpassDependency-srcSubpass-00864]] 2857 pname:srcSubpass must: be less than or equal to pname:dstSubpass, unless 2858 one of them is ename:VK_SUBPASS_EXTERNAL, to avoid cyclic dependencies 2859 and ensure a valid execution order 2860 * [[VUID-VkSubpassDependency-srcSubpass-00865]] 2861 pname:srcSubpass and pname:dstSubpass must: not both be equal to 2862 ename:VK_SUBPASS_EXTERNAL 2863 * [[VUID-VkSubpassDependency-srcSubpass-06809]] 2864 If pname:srcSubpass is equal to pname:dstSubpass and pname:srcStageMask 2865 includes a <<synchronization-framebuffer-regions,framebuffer-space 2866 stage>>, pname:dstStageMask must: only contain 2867 <<synchronization-framebuffer-regions, framebuffer-space stages>> 2868 * [[VUID-VkSubpassDependency-srcAccessMask-00868]] 2869 Any access flag included in pname:srcAccessMask must: be supported by 2870 one of the pipeline stages in pname:srcStageMask, as specified in the 2871 <<synchronization-access-types-supported, table of supported access 2872 types>> 2873 * [[VUID-VkSubpassDependency-dstAccessMask-00869]] 2874 Any access flag included in pname:dstAccessMask must: be supported by 2875 one of the pipeline stages in pname:dstStageMask, as specified in the 2876 <<synchronization-access-types-supported, table of supported access 2877 types>> 2878 * [[VUID-VkSubpassDependency-srcSubpass-02243]] 2879 If pname:srcSubpass equals pname:dstSubpass, and pname:srcStageMask and 2880 pname:dstStageMask both include a 2881 <<synchronization-framebuffer-regions,framebuffer-space stage>>, then 2882 pname:dependencyFlags must: include ename:VK_DEPENDENCY_BY_REGION_BIT 2883ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 2884 * [[VUID-VkSubpassDependency-dependencyFlags-02520]] 2885 If pname:dependencyFlags includes ename:VK_DEPENDENCY_VIEW_LOCAL_BIT, 2886 pname:srcSubpass must: not be equal to ename:VK_SUBPASS_EXTERNAL 2887 * [[VUID-VkSubpassDependency-dependencyFlags-02521]] 2888 If pname:dependencyFlags includes ename:VK_DEPENDENCY_VIEW_LOCAL_BIT, 2889 pname:dstSubpass must: not be equal to ename:VK_SUBPASS_EXTERNAL 2890 * [[VUID-VkSubpassDependency-srcSubpass-00872]] 2891 If pname:srcSubpass equals pname:dstSubpass and that subpass has more 2892 than one bit set in the view mask, then pname:dependencyFlags must: 2893 include ename:VK_DEPENDENCY_VIEW_LOCAL_BIT 2894endif::VK_VERSION_1_1,VK_KHR_multiview[] 2895**** 2896 2897include::{generated}/validity/structs/VkSubpassDependency.adoc[] 2898-- 2899 2900ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 2901 2902When multiview is enabled, the execution of the multiple views of one 2903subpass may: not occur simultaneously or even back-to-back, and rather may: 2904be interleaved with the execution of other subpasses. 2905The load and store operations apply to attachments on a per-view basis. 2906For example, an attachment using ename:VK_ATTACHMENT_LOAD_OP_CLEAR will have 2907each view cleared on first use, but the first use of one view may be 2908temporally distant from the first use of another view. 2909 2910[NOTE] 2911.Note 2912==== 2913A good mental model for multiview is to think of a multiview subpass as if 2914it were a collection of individual (per-view) subpasses that are logically 2915grouped together and described as a single multiview subpass in the API. 2916Similarly, a multiview attachment can be thought of like several individual 2917attachments that happen to be layers in a single image. 2918A view-local dependency between two multiview subpasses acts like a set of 2919one-to-one dependencies between corresponding pairs of per-view subpasses. 2920A view-global dependency between two multiview subpasses acts like a set of 2921[eq]#N {times} M# dependencies between all pairs of per-view subpasses in 2922the source and destination. 2923Thus, it is a more compact representation which also makes clear the 2924commonality and reuse that is present between views in a subpass. 2925This interpretation motivates the answers to questions like "`when does the 2926load op apply`" - it is on the first use of each view of an attachment, as 2927if each view was a separate attachment. 2928 2929The content of each view follows the description in 2930<<renderpass-attachment-contents, attachment content behavior>>. 2931In particular, if an attachment is preserved, all views within the 2932attachment are preserved. 2933==== 2934 2935endif::VK_VERSION_1_1,VK_KHR_multiview[] 2936 2937ifdef::VK_EXT_transform_feedback[] 2938If any two subpasses of a render pass activate transform feedback to the 2939same bound transform feedback buffers, a subpass dependency must: be 2940included (either directly or via some intermediate subpasses) between them. 2941endif::VK_EXT_transform_feedback[] 2942 2943ifdef::editing-notes[] 2944[NOTE] 2945.editing-note 2946==== 2947The following two alleged implicit dependencies are practically no-ops, as 2948the operations they describe are already guaranteed by semaphores and 2949submission order (so they are almost entirely no-ops on their own). 2950The *only* reason they exist is because it simplifies reasoning about where 2951<<renderpass-layout-transitions, automatic layout transitions>> happen. 2952Further rewrites of this chapter could potentially remove the need for 2953these. 2954==== 2955endif::editing-notes[] 2956 2957[[renderpass-implicit-dependencies]] 2958If there is no subpass dependency from ename:VK_SUBPASS_EXTERNAL to the 2959first subpass that uses an attachment, then an implicit subpass dependency 2960exists from ename:VK_SUBPASS_EXTERNAL to the first subpass it is used in. 2961The implicit subpass dependency only exists if there exists an automatic 2962layout transition away from pname:initialLayout. 2963The subpass dependency operates as if defined with the following parameters: 2964 2965[source,c] 2966---- 2967VkSubpassDependency implicitDependency = { 2968 .srcSubpass = VK_SUBPASS_EXTERNAL, 2969 .dstSubpass = firstSubpass, // First subpass attachment is used in 2970ifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 2971 .srcStageMask = VK_PIPELINE_STAGE_NONE, 2972endif::VK_VERSION_1_3,VK_KHR_synchronization2[] 2973ifndef::VK_VERSION_1_3,VK_KHR_synchronization2[] 2974 .srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 2975endif::VK_VERSION_1_3,VK_KHR_synchronization2[] 2976 .dstStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 2977 .srcAccessMask = 0, 2978 .dstAccessMask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT | 2979 VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | 2980 VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | 2981 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | 2982 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, 2983 .dependencyFlags = 0 2984}; 2985---- 2986 2987Similarly, if there is no subpass dependency from the last subpass that uses 2988an attachment to ename:VK_SUBPASS_EXTERNAL, then an implicit subpass 2989dependency exists from the last subpass it is used in to 2990ename:VK_SUBPASS_EXTERNAL. 2991The implicit subpass dependency only exists if there exists an automatic 2992layout transition into pname:finalLayout. 2993The subpass dependency operates as if defined with the following parameters: 2994 2995[source,c] 2996---- 2997VkSubpassDependency implicitDependency = { 2998 .srcSubpass = lastSubpass, // Last subpass attachment is used in 2999 .dstSubpass = VK_SUBPASS_EXTERNAL, 3000 .srcStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 3001ifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 3002 .dstStageMask = VK_PIPELINE_STAGE_NONE, 3003endif::VK_VERSION_1_3,VK_KHR_synchronization2[] 3004ifndef::VK_VERSION_1_3,VK_KHR_synchronization2[] 3005 .dstStageMask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 3006endif::VK_VERSION_1_3,VK_KHR_synchronization2[] 3007 .srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | 3008 VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, 3009 .dstAccessMask = 0, 3010 .dependencyFlags = 0 3011}; 3012---- 3013 3014[[renderpass-layout-transitions]] 3015As subpasses may: overlap or execute out of order with regards to other 3016subpasses unless a subpass dependency chain describes otherwise, the layout 3017transitions required between subpasses cannot: be known to an application. 3018Instead, an application provides the layout that each attachment must: be in 3019at the start and end of a render pass, and the layout it must: be in during 3020each subpass it is used in. 3021The implementation then must: execute layout transitions between subpasses 3022in order to guarantee that the images are in the layouts required by each 3023subpass, and in the final layout at the end of the render pass. 3024 3025Automatic layout transitions apply to the entire image subresource attached 3026to the framebuffer. 3027If 3028ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 3029multiview is not enabled and 3030endif::VK_VERSION_1_1,VK_KHR_multiview[] 3031the attachment is a view of a 1D or 2D image, the automatic layout 3032transitions apply to the number of layers specified by 3033slink:VkFramebufferCreateInfo::pname:layers. 3034ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 3035If multiview is enabled and the attachment is a view of a 1D or 2D image, 3036the automatic layout transitions apply to the layers corresponding to views 3037which are used by some subpass in the render pass, even if that subpass does 3038not reference the given attachment. 3039endif::VK_VERSION_1_1,VK_KHR_multiview[] 3040ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[] 3041If the attachment view is a 2D or 2D array view of a 3D image, even if the 3042attachment view only refers to a subset of the slices of the selected mip 3043level of the 3D image, automatic layout transitions apply to the entire 3044subresource referenced which is the entire mip level in this case. 3045endif::VK_VERSION_1_1,VK_KHR_maintenance1[] 3046 3047Automatic layout transitions away from the layout used in a subpass 3048happen-after the availability operations for all dependencies with that 3049subpass as the pname:srcSubpass. 3050 3051Automatic layout transitions into the layout used in a subpass happen-before 3052the visibility operations for all dependencies with that subpass as the 3053pname:dstSubpass. 3054 3055Automatic layout transitions away from pname:initialLayout happen-after the 3056availability operations for all dependencies with a pname:srcSubpass equal 3057to ename:VK_SUBPASS_EXTERNAL, where pname:dstSubpass uses the attachment 3058that will be transitioned. 3059For attachments created with ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT, 3060automatic layout transitions away from pname:initialLayout happen-after the 3061availability operations for all dependencies with a pname:srcSubpass equal 3062to ename:VK_SUBPASS_EXTERNAL, where pname:dstSubpass uses any aliased 3063attachment. 3064 3065Automatic layout transitions into pname:finalLayout happen-before the 3066visibility operations for all dependencies with a pname:dstSubpass equal to 3067ename:VK_SUBPASS_EXTERNAL, where pname:srcSubpass uses the attachment that 3068will be transitioned. 3069For attachments created with ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT, 3070automatic layout transitions into pname:finalLayout happen-before the 3071visibility operations for all dependencies with a pname:dstSubpass equal to 3072ename:VK_SUBPASS_EXTERNAL, where pname:srcSubpass uses any aliased 3073attachment. 3074 3075ifdef::VK_EXT_sample_locations[] 3076 3077The image layout of the depth aspect of a depth/stencil attachment referring 3078to an image created with 3079ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT is dependent 3080on the last sample locations used to render to the attachment, thus 3081automatic layout transitions use the sample locations state specified in 3082slink:VkRenderPassSampleLocationsBeginInfoEXT. 3083 3084Automatic layout transitions of an attachment referring to a depth/stencil 3085image created with 3086ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT use the 3087sample locations the image subresource range referenced by the attachment 3088was last rendered with. 3089If the current render pass does not use the attachment as a depth/stencil 3090attachment in any subpass that happens-before, the automatic layout 3091transition uses the sample locations state specified in the 3092pname:sampleLocationsInfo member of the element of the 3093sname:VkRenderPassSampleLocationsBeginInfoEXT::pname:pAttachmentInitialSampleLocations 3094array for which the pname:attachmentIndex member equals the attachment index 3095of the attachment, if one is specified. 3096Otherwise, the automatic layout transition uses the sample locations state 3097specified in the pname:sampleLocationsInfo member of the element of the 3098sname:VkRenderPassSampleLocationsBeginInfoEXT::pname:pPostSubpassSampleLocations 3099array for which the pname:subpassIndex member equals the index of the 3100subpass that last used the attachment as a depth/stencil attachment, if one 3101is specified. 3102 3103If no sample locations state has been specified for an automatic layout 3104transition performed on an attachment referring to a depth/stencil image 3105created with ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT 3106the contents of the depth aspect of the depth/stencil attachment become 3107undefined: as if the layout of the attachment was transitioned from the 3108ename:VK_IMAGE_LAYOUT_UNDEFINED layout. 3109 3110endif::VK_EXT_sample_locations[] 3111 3112If two subpasses use the same attachment, and both subpasses use the 3113attachment in a read-only layout, no subpass dependency needs to be 3114specified between those subpasses. 3115If an implementation treats those layouts separately, it must: insert an 3116implicit subpass dependency between those subpasses to separate the uses in 3117each layout. 3118The subpass dependency operates as if defined with the following parameters: 3119 3120[source,c] 3121---- 3122// Used for input attachments 3123VkPipelineStageFlags inputAttachmentStages = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; 3124VkAccessFlags inputAttachmentDstAccess = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; 3125 3126// Used for depth/stencil attachments 3127VkPipelineStageFlags depthStencilAttachmentStages = VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT; 3128VkAccessFlags depthStencilAttachmentDstAccess = VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; 3129 3130VkSubpassDependency implicitDependency = { 3131 .srcSubpass = firstSubpass; 3132 .dstSubpass = secondSubpass; 3133 .srcStageMask = inputAttachmentStages | depthStencilAttachmentStages; 3134 .dstStageMask = inputAttachmentStages | depthStencilAttachmentStages; 3135 .srcAccessMask = 0; 3136 .dstAccessMask = inputAttachmentDstAccess | depthStencilAttachmentDstAccess; 3137 .dependencyFlags = 0; 3138}; 3139---- 3140 3141 3142ifdef::VK_EXT_attachment_feedback_loop_dynamic_state[] 3143When 3144ifdef::VK_EXT_shader_object[drawing using <<shaders-objects, shader objects>>,] 3145ifdef::VK_EXT_shader_object[or when] 3146the graphics pipeline is created with 3147ename:VK_DYNAMIC_STATE_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT set in 3148slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates, the 3149application must: specify which types of attachments that are written to 3150during a render pass will also be accessed as non-attachments in the render 3151pass. 3152 3153[open,refpage='vkCmdSetAttachmentFeedbackLoopEnableEXT',desc='Specify whether attachment feedback loops are enabled dynamically on a command buffer',type='protos'] 3154-- 3155:refpage: vkCmdSetAttachmentFeedbackLoopEnableEXT 3156 3157To <<pipelines-dynamic-state, dynamically set>> whether a pipeline can: 3158access a resource as a non-attachment while it is also used as an attachment 3159that is written to, call: 3160 3161include::{generated}/api/protos/vkCmdSetAttachmentFeedbackLoopEnableEXT.adoc[] 3162 3163 * pname:commandBuffer is the command buffer into which the command will be 3164 recorded. 3165 * pname:aspectMask specifies the types of attachments for which feedback 3166 loops will be enabled. 3167 Attachment types whose aspects are not included in pname:aspectMask will 3168 have feedback loops disabled. 3169 3170For attachments that are written to in a render pass, only attachments with 3171the aspects specified in pname:aspectMask can: be accessed as 3172non-attachments by subsequent <<drawing, drawing commands>>. 3173 3174.Valid Usage 3175**** 3176 * [[VUID-vkCmdSetAttachmentFeedbackLoopEnableEXT-attachmentFeedbackLoopDynamicState-08862]] 3177 The <<features-attachmentFeedbackLoopDynamicState, 3178 pname:attachmentFeedbackLoopDynamicState>> feature must: be enabled 3179 * [[VUID-vkCmdSetAttachmentFeedbackLoopEnableEXT-aspectMask-08863]] 3180 pname:aspectMask must: only include ename:VK_IMAGE_ASPECT_NONE, 3181 ename:VK_IMAGE_ASPECT_COLOR_BIT, ename:VK_IMAGE_ASPECT_DEPTH_BIT, and 3182 ename:VK_IMAGE_ASPECT_STENCIL_BIT 3183 * [[VUID-vkCmdSetAttachmentFeedbackLoopEnableEXT-attachmentFeedbackLoopLayout-08864]] 3184 If the <<features-attachmentFeedbackLoopLayout, 3185 pname:attachmentFeedbackLoopLayout>> feature is not enabled, 3186 pname:aspectMask must: be ename:VK_IMAGE_ASPECT_NONE 3187**** 3188 3189include::{generated}/validity/protos/vkCmdSetAttachmentFeedbackLoopEnableEXT.adoc[] 3190-- 3191endif::VK_EXT_attachment_feedback_loop_dynamic_state[] 3192ifdef::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 3193A more extensible version of render pass creation is also defined below. 3194 3195[open,refpage='vkCreateRenderPass2',desc='Create a new render pass object',type='protos',alias='vkCreateRenderPass2KHR'] 3196-- 3197 3198:refpage: vkCreateRenderPass2 3199:objectnameplural: render passes 3200:objectnamecamelcase: renderPass 3201:objectcount: 1 3202 3203To create a render pass, call: 3204 3205ifdef::VK_VERSION_1_2[] 3206include::{generated}/api/protos/vkCreateRenderPass2.adoc[] 3207endif::VK_VERSION_1_2[] 3208 3209ifdef::VK_VERSION_1_2+VK_KHR_create_renderpass2[or the equivalent command] 3210 3211ifdef::VK_KHR_create_renderpass2[] 3212include::{generated}/api/protos/vkCreateRenderPass2KHR.adoc[] 3213endif::VK_KHR_create_renderpass2[] 3214 3215 * pname:device is the logical device that creates the render pass. 3216 * pname:pCreateInfo is a pointer to a slink:VkRenderPassCreateInfo2 3217 structure describing the parameters of the render pass. 3218 * pname:pAllocator controls host memory allocation as described in the 3219 <<memory-allocation, Memory Allocation>> chapter. 3220 * pname:pRenderPass is a pointer to a slink:VkRenderPass handle in which 3221 the resulting render pass object is returned. 3222 3223This command is functionally identical to flink:vkCreateRenderPass, but 3224includes extensible sub-structures that include pname:sType and pname:pNext 3225parameters, allowing them to be more easily extended. 3226 3227include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 3228 3229ifdef::VKSC_VERSION_1_0[] 3230.Valid Usage 3231**** 3232include::{chapters}/commonvalidity/memory_reservation_request_count_common.adoc[] 3233 3234:uniqifier: subpasses 3235:combinedobjectnameplural: subpasses 3236:combinedparentobject: VkRenderPass 3237:combinedobjectcount: pname:pCreateInfo->subpassCount 3238:combinedobjectnamecamelcase: subpassDescription 3239include::{chapters}/commonvalidity/memory_reservation_request_count_combined_common.adoc[] 3240 3241:uniqifier: attachments 3242:combinedobjectnameplural: attachments 3243:combinedparentobject: VkRenderPass 3244:combinedobjectcount: pname:pCreateInfo->attachmentCount 3245:combinedobjectnamecamelcase: attachmentDescription 3246include::{chapters}/commonvalidity/memory_reservation_request_count_combined_common.adoc[] 3247**** 3248endif::VKSC_VERSION_1_0[] 3249 3250include::{generated}/validity/protos/vkCreateRenderPass2.adoc[] 3251-- 3252 3253[open,refpage='VkRenderPassCreateInfo2',desc='Structure specifying parameters of a newly created render pass',type='structs',alias='VkRenderPassCreateInfo2KHR'] 3254-- 3255The sname:VkRenderPassCreateInfo2 structure is defined as: 3256 3257include::{generated}/api/structs/VkRenderPassCreateInfo2.adoc[] 3258 3259ifdef::VK_KHR_create_renderpass2[] 3260or the equivalent 3261 3262include::{generated}/api/structs/VkRenderPassCreateInfo2KHR.adoc[] 3263endif::VK_KHR_create_renderpass2[] 3264 3265 * pname:sType is a elink:VkStructureType value identifying this structure. 3266 * pname:pNext is `NULL` or a pointer to a structure extending this 3267 structure. 3268 * pname:flags is reserved for future use. 3269 * pname:attachmentCount is the number of attachments used by this render 3270 pass. 3271 * pname:pAttachments is a pointer to an array of pname:attachmentCount 3272 slink:VkAttachmentDescription2 structures describing the attachments 3273 used by the render pass. 3274 * pname:subpassCount is the number of subpasses to create. 3275 * pname:pSubpasses is a pointer to an array of pname:subpassCount 3276 slink:VkSubpassDescription2 structures describing each subpass. 3277 * pname:dependencyCount is the number of dependencies between pairs of 3278 subpasses. 3279 * pname:pDependencies is a pointer to an array of pname:dependencyCount 3280 slink:VkSubpassDependency2 structures describing dependencies between 3281 pairs of subpasses. 3282 * pname:correlatedViewMaskCount is the number of correlation masks. 3283 * pname:pCorrelatedViewMasks is a pointer to an array of view masks 3284 indicating sets of views that may: be more efficient to render 3285 concurrently. 3286 3287Parameters defined by this structure with the same name as those in 3288slink:VkRenderPassCreateInfo have the identical effect to those parameters; 3289the child structures are variants of those used in 3290slink:VkRenderPassCreateInfo which add pname:sType and pname:pNext 3291parameters, allowing them to be extended. 3292 3293If the slink:VkSubpassDescription2::pname:viewMask member of any element of 3294pname:pSubpasses is not zero, _multiview_ functionality is considered to be 3295enabled for this render pass. 3296 3297pname:correlatedViewMaskCount and pname:pCorrelatedViewMasks have the same 3298effect as slink:VkRenderPassMultiviewCreateInfo::pname:correlationMaskCount 3299and slink:VkRenderPassMultiviewCreateInfo::pname:pCorrelationMasks, 3300respectively. 3301 3302.Valid Usage 3303**** 3304 * [[VUID-VkRenderPassCreateInfo2-None-03049]] 3305 If any two subpasses operate on attachments with overlapping ranges of 3306 the same sname:VkDeviceMemory object, and at least one subpass writes to 3307 that area of sname:VkDeviceMemory, a subpass dependency must: be 3308 included (either directly or via some intermediate subpasses) between 3309 them 3310 * [[VUID-VkRenderPassCreateInfo2-attachment-03050]] 3311 If the pname:attachment member of any element of 3312 pname:pInputAttachments, pname:pColorAttachments, 3313 pname:pResolveAttachments or pname:pDepthStencilAttachment, or the 3314 attachment indexed by any element of pname:pPreserveAttachments in any 3315 element of pname:pSubpasses is bound to a range of a 3316 sname:VkDeviceMemory object that overlaps with any other attachment in 3317 any subpass (including the same subpass), the 3318 sname:VkAttachmentDescription2 structures describing them must: include 3319 ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT in pname:flags 3320 * [[VUID-VkRenderPassCreateInfo2-attachment-03051]] 3321 If the pname:attachment member of any element of 3322 pname:pInputAttachments, pname:pColorAttachments, 3323 pname:pResolveAttachments or pname:pDepthStencilAttachment, or any 3324 element of pname:pPreserveAttachments in any element of pname:pSubpasses 3325 is not ename:VK_ATTACHMENT_UNUSED, then it must: be less than 3326 pname:attachmentCount 3327ifdef::VK_EXT_fragment_density_map[] 3328 * [[VUID-VkRenderPassCreateInfo2-fragmentDensityMapAttachment-06472]] 3329 If the pNext chain includes a 3330 slink:VkRenderPassFragmentDensityMapCreateInfoEXT structure and the 3331 pname:fragmentDensityMapAttachment member is not 3332 ename:VK_ATTACHMENT_UNUSED, then pname:attachment must: be less than 3333 pname:attachmentCount 3334endif::VK_EXT_fragment_density_map[] 3335ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 3336 * [[VUID-VkRenderPassCreateInfo2-pSubpasses-06473]] 3337 If the pname:pSubpasses pNext chain includes a 3338 slink:VkSubpassDescriptionDepthStencilResolve structure and the 3339 pname:pDepthStencilResolveAttachment member is not `NULL` and does not 3340 have the value ename:VK_ATTACHMENT_UNUSED, then pname:attachment must: 3341 be less than pname:attachmentCount 3342endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 3343 * [[VUID-VkRenderPassCreateInfo2-pAttachments-02522]] 3344 For any member of pname:pAttachments with a pname:loadOp equal to 3345 ename:VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment 3346 must: not specify a pname:layout equal to 3347 ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 3348 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, or 3349 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL 3350 * [[VUID-VkRenderPassCreateInfo2-pAttachments-02523]] 3351 For any member of pname:pAttachments with a pname:stencilLoadOp equal to 3352 ename:VK_ATTACHMENT_LOAD_OP_CLEAR, the first use of that attachment 3353 must: not specify a pname:layout equal to 3354 ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, 3355 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, or 3356 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL 3357 * [[VUID-VkRenderPassCreateInfo2-pDependencies-03054]] 3358 For any element of pname:pDependencies, if the pname:srcSubpass is not 3359 ename:VK_SUBPASS_EXTERNAL, all stage flags included in the 3360 pname:srcStageMask member of that dependency must: be a pipeline stage 3361 supported by the <<synchronization-pipeline-stages-types, pipeline>> 3362 identified by the pname:pipelineBindPoint member of the source subpass 3363 * [[VUID-VkRenderPassCreateInfo2-pDependencies-03055]] 3364 For any element of pname:pDependencies, if the pname:dstSubpass is not 3365 ename:VK_SUBPASS_EXTERNAL, all stage flags included in the 3366 pname:dstStageMask member of that dependency must: be a pipeline stage 3367 supported by the <<synchronization-pipeline-stages-types, pipeline>> 3368 identified by the pname:pipelineBindPoint member of the destination 3369 subpass 3370 * [[VUID-VkRenderPassCreateInfo2-pCorrelatedViewMasks-03056]] 3371 The set of bits included in any element of pname:pCorrelatedViewMasks 3372 must: not overlap with the set of bits included in any other element of 3373 pname:pCorrelatedViewMasks 3374 * [[VUID-VkRenderPassCreateInfo2-viewMask-03057]] 3375 If the slink:VkSubpassDescription2::pname:viewMask member of all 3376 elements of pname:pSubpasses is `0`, pname:correlatedViewMaskCount must: 3377 be `0` 3378 * [[VUID-VkRenderPassCreateInfo2-viewMask-03058]] 3379 The slink:VkSubpassDescription2::pname:viewMask member of all elements 3380 of pname:pSubpasses must: either all be `0`, or all not be `0` 3381 * [[VUID-VkRenderPassCreateInfo2-viewMask-03059]] 3382 If the slink:VkSubpassDescription2::pname:viewMask member of all 3383 elements of pname:pSubpasses is `0`, the pname:dependencyFlags member of 3384 any element of pname:pDependencies must: not include 3385 ename:VK_DEPENDENCY_VIEW_LOCAL_BIT 3386 * [[VUID-VkRenderPassCreateInfo2-pDependencies-03060]] 3387 For any element of pname:pDependencies where its pname:srcSubpass member 3388 equals its pname:dstSubpass member, if the pname:viewMask member of the 3389 corresponding element of pname:pSubpasses includes more than one bit, 3390 its pname:dependencyFlags member must: include 3391 ename:VK_DEPENDENCY_VIEW_LOCAL_BIT 3392 * [[VUID-VkRenderPassCreateInfo2-attachment-02525]] 3393 If the pname:attachment member of any element of the 3394 pname:pInputAttachments member of any element of pname:pSubpasses is not 3395 ename:VK_ATTACHMENT_UNUSED, the pname:aspectMask member of that element 3396 of pname:pInputAttachments must: only include aspects that are present 3397 in images of the format specified by the element of pname:pAttachments 3398 specified by pname:attachment 3399 * [[VUID-VkRenderPassCreateInfo2-srcSubpass-02526]] 3400 The pname:srcSubpass member of each element of pname:pDependencies must: 3401 be less than pname:subpassCount 3402 * [[VUID-VkRenderPassCreateInfo2-dstSubpass-02527]] 3403 The pname:dstSubpass member of each element of pname:pDependencies must: 3404 be less than pname:subpassCount 3405ifdef::VK_KHR_fragment_shading_rate[] 3406 * [[VUID-VkRenderPassCreateInfo2-pAttachments-04585]] 3407 If any element of pname:pAttachments is used as a fragment shading rate 3408 attachment in any subpass, it must: not be used as any other attachment 3409 in the render pass 3410 * [[VUID-VkRenderPassCreateInfo2-pAttachments-09387]] 3411 If any element of pname:pAttachments is used as a fragment shading rate 3412 attachment, the pname:loadOp for that attachment must: not be 3413 ename:VK_ATTACHMENT_LOAD_OP_CLEAR 3414ifdef::VK_QCOM_render_pass_transform[] 3415 * [[VUID-VkRenderPassCreateInfo2-flags-04521]] 3416 If pname:flags includes ename:VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM, 3417 an element of pname:pSubpasses includes an instance of 3418 slink:VkFragmentShadingRateAttachmentInfoKHR in its pname:pNext chain, 3419 and the pname:pFragmentShadingRateAttachment member of that structure is 3420 not equal to `NULL`, the pname:attachment member of 3421 pname:pFragmentShadingRateAttachment must: be ename:VK_ATTACHMENT_UNUSED 3422endif::VK_QCOM_render_pass_transform[] 3423 * [[VUID-VkRenderPassCreateInfo2-pAttachments-04586]] 3424 If any element of pname:pAttachments is used as a fragment shading rate 3425 attachment in any subpass, it must: have an image format whose 3426 <<potential-format-features, potential format features>> contain 3427 ename:VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 3428endif::VK_KHR_fragment_shading_rate[] 3429ifdef::VK_QCOM_render_pass_shader_resolve[] 3430 * [[VUID-VkRenderPassCreateInfo2-rasterizationSamples-04905]] 3431 If the pipeline is being created with fragment shader state, and the 3432 `apiext:VK_QCOM_render_pass_shader_resolve extension` is enabled, and if 3433 subpass has any input attachments, and if the subpass description 3434 contains ename:VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM, then the 3435 sample count of the input attachments must: equal 3436 pname:rasterizationSamples 3437 * [[VUID-VkRenderPassCreateInfo2-sampleShadingEnable-04906]] 3438 If the pipeline is being created with fragment shader state, and the 3439 `apiext:VK_QCOM_render_pass_shader_resolve` extension is enabled, and if 3440 the subpass description contains 3441 ename:VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM, then 3442 pname:sampleShadingEnable must: be false 3443 * [[VUID-VkRenderPassCreateInfo2-flags-04907]] 3444 If pname:flags includes 3445 ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM, and if 3446 pname:pResolveAttachments is not `NULL`, then each resolve attachment 3447 must: be ename:VK_ATTACHMENT_UNUSED 3448 * [[VUID-VkRenderPassCreateInfo2-flags-04908]] 3449 If pname:flags includes 3450 ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM, and if 3451 pname:pDepthStencilResolveAttachment is not `NULL`, then the 3452 depth/stencil resolve attachment must: be ename:VK_ATTACHMENT_UNUSED 3453 * [[VUID-VkRenderPassCreateInfo2-flags-04909]] 3454 If pname:flags includes 3455 ename:VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM, then the subpass 3456 must: be the last subpass in a subpass dependency chain 3457endif::VK_QCOM_render_pass_shader_resolve[] 3458ifdef::VKSC_VERSION_1_0[] 3459 * [[VUID-VkRenderPassCreateInfo2-subpassCount-05055]] 3460 pname:subpassCount must: be less than or equal to 3461 <<limits-maxRenderPassSubpasses,maxRenderPassSubpasses>> 3462 * [[VUID-VkRenderPassCreateInfo2-dependencyCount-05056]] 3463 pname:dependencyCount must: be less than or equal to 3464 <<limits-maxRenderPassDependencies,maxRenderPassDependencies>> 3465 * [[VUID-VkRenderPassCreateInfo2-attachmentCount-05057]] 3466 pname:attachmentCount must: be less than or equal to 3467 <<limits-maxFramebufferAttachments,maxFramebufferAttachments>> 3468endif::VKSC_VERSION_1_0[] 3469ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3470 * [[VUID-VkRenderPassCreateInfo2-attachment-06244]] 3471 If the pname:attachment member of the pname:pDepthStencilAttachment 3472 member of an element of pname:pSubpasses is not 3473 ename:VK_ATTACHMENT_UNUSED, the pname:layout member of that same 3474 structure is either ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 3475 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, and the pname:pNext chain 3476 of that structure does not include a 3477 slink:VkAttachmentReferenceStencilLayout structure, then the element of 3478 pname:pAttachments with an index equal to pname:attachment must: not 3479 have a pname:format that includes both depth and stencil components 3480 * [[VUID-VkRenderPassCreateInfo2-attachment-06245]] 3481 If the pname:attachment member of the pname:pDepthStencilAttachment 3482 member of an element of pname:pSubpasses is not 3483 ename:VK_ATTACHMENT_UNUSED and the pname:layout member of that same 3484 structure is either ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or 3485 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL, then the element of 3486 pname:pAttachments with an index equal to pname:attachment must: have a 3487 pname:format that includes only a stencil component 3488 * [[VUID-VkRenderPassCreateInfo2-attachment-06246]] 3489 If the pname:attachment member of the pname:pDepthStencilAttachment 3490 member of an element of pname:pSubpasses is not 3491 ename:VK_ATTACHMENT_UNUSED and the pname:layout member of that same 3492 structure is either ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 3493 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, then the element of 3494 pname:pAttachments with an index equal to pname:attachment must: not 3495 have a pname:format that includes only a stencil component 3496endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3497ifdef::VK_ANDROID_external_format_resolve[] 3498ifdef::VK_EXT_fragment_density_map[] 3499 * [[VUID-VkRenderPassCreateInfo2-pResolveAttachments-09331]] 3500 If any element of pname:pResolveAttachments of any element of 3501 pname:pSubpasses references an attachment description with a format of 3502 ename:VK_FORMAT_UNDEFINED, 3503 slink:VkRenderPassFragmentDensityMapCreateInfoEXT::pname:fragmentDensityMapAttachment->attachment 3504 must: be ename:VK_ATTACHMENT_UNUSED 3505endif::VK_EXT_fragment_density_map[] 3506endif::VK_ANDROID_external_format_resolve[] 3507**** 3508 3509include::{generated}/validity/structs/VkRenderPassCreateInfo2.adoc[] 3510-- 3511 3512[open,refpage='VkAttachmentDescription2',desc='Structure specifying an attachment description',type='structs',alias='VkAttachmentDescription2KHR'] 3513-- 3514:refpage: VkAttachmentDescription2 3515 3516The sname:VkAttachmentDescription2 structure is defined as: 3517 3518include::{generated}/api/structs/VkAttachmentDescription2.adoc[] 3519 3520ifdef::VK_KHR_create_renderpass2[] 3521or the equivalent 3522 3523include::{generated}/api/structs/VkAttachmentDescription2KHR.adoc[] 3524endif::VK_KHR_create_renderpass2[] 3525 3526 * pname:sType is a elink:VkStructureType value identifying this structure. 3527 * pname:pNext is `NULL` or a pointer to a structure extending this 3528 structure. 3529 * pname:flags is a bitmask of elink:VkAttachmentDescriptionFlagBits 3530 specifying additional properties of the attachment. 3531 * pname:format is a elink:VkFormat value specifying the format of the 3532 image that will be used for the attachment. 3533 * pname:samples is a elink:VkSampleCountFlagBits value specifying the 3534 number of samples of the image. 3535 * pname:loadOp is a elink:VkAttachmentLoadOp value specifying how the 3536 contents of color and depth components of the attachment are treated at 3537 the beginning of the subpass where it is first used. 3538 * pname:storeOp is a elink:VkAttachmentStoreOp value specifying how the 3539 contents of color and depth components of the attachment are treated at 3540 the end of the subpass where it is last used. 3541 * pname:stencilLoadOp is a elink:VkAttachmentLoadOp value specifying how 3542 the contents of stencil components of the attachment are treated at the 3543 beginning of the subpass where it is first used. 3544 * pname:stencilStoreOp is a elink:VkAttachmentStoreOp value specifying how 3545 the contents of stencil components of the attachment are treated at the 3546 end of the last subpass where it is used. 3547 * pname:initialLayout is the layout the attachment image subresource will 3548 be in when a render pass instance begins. 3549 * pname:finalLayout is the layout the attachment image subresource will be 3550 transitioned to when a render pass instance ends. 3551 3552Parameters defined by this structure with the same name as those in 3553slink:VkAttachmentDescription have the identical effect to those parameters. 3554 3555ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3556If the <<features-separateDepthStencilLayouts, 3557pname:separateDepthStencilLayouts>> feature is enabled, and pname:format is 3558a depth/stencil format, pname:initialLayout and pname:finalLayout can: be 3559set to a layout that only specifies the layout of the depth aspect. 3560 3561If the pname:pNext chain includes a 3562slink:VkAttachmentDescriptionStencilLayout structure, then the 3563pname:stencilInitialLayout and pname:stencilFinalLayout members specify the 3564initial and final layouts of the stencil aspect of a depth/stencil format, 3565and pname:initialLayout and pname:finalLayout only apply to the depth 3566aspect. 3567For depth-only formats, the slink:VkAttachmentDescriptionStencilLayout 3568structure is ignored. 3569For stencil-only formats, the initial and final layouts of the stencil 3570aspect are taken from the slink:VkAttachmentDescriptionStencilLayout 3571structure if present, or pname:initialLayout and pname:finalLayout if not 3572present. 3573 3574If pname:format is a depth/stencil format, and either pname:initialLayout or 3575pname:finalLayout does not specify a layout for the stencil aspect, then the 3576application must: specify the initial and final layouts of the stencil 3577aspect by including a slink:VkAttachmentDescriptionStencilLayout structure 3578in the pname:pNext chain. 3579 3580endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3581 3582ifdef::VK_KHR_fragment_shading_rate[] 3583pname:loadOp and pname:storeOp are ignored for fragment shading rate 3584attachments. 3585No access to the shading rate attachment is performed in pname:loadOp and 3586pname:storeOp. 3587Instead, access to 3588ename:VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR is performed 3589as fragments are rasterized. 3590endif::VK_KHR_fragment_shading_rate[] 3591 3592.Valid Usage 3593**** 3594include::{chapters}/commonvalidity/attachment_description_common.adoc[] 3595 * [[VUID-VkAttachmentDescription2-pNext-06704]] 3596 If 3597ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3598 the pname:pNext chain does not include a 3599 slink:VkAttachmentDescriptionStencilLayout structure, 3600endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3601 pname:format includes a stencil component, and pname:stencilLoadOp is 3602 ename:VK_ATTACHMENT_LOAD_OP_LOAD, then pname:initialLayout must: not be 3603 ename:VK_IMAGE_LAYOUT_UNDEFINED 3604ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3605 * [[VUID-VkAttachmentDescription2-pNext-06705]] 3606 If the pname:pNext chain includes a 3607 slink:VkAttachmentDescriptionStencilLayout structure, pname:format 3608 includes a stencil component, and pname:stencilLoadOp is 3609 ename:VK_ATTACHMENT_LOAD_OP_LOAD, then 3610 slink:VkAttachmentDescriptionStencilLayout::pname:stencilInitialLayout 3611 must: not be ename:VK_IMAGE_LAYOUT_UNDEFINED 3612 * [[VUID-VkAttachmentDescription2-format-06249]] 3613 If pname:format is a depth/stencil format which includes both depth and 3614 stencil components, and pname:initialLayout is 3615 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 3616 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, the pname:pNext chain 3617 must: include a slink:VkAttachmentDescriptionStencilLayout structure 3618 * [[VUID-VkAttachmentDescription2-format-06250]] 3619 If pname:format is a depth/stencil format which includes both depth and 3620 stencil components, and pname:finalLayout is 3621 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 3622 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, the pname:pNext chain 3623 must: include a slink:VkAttachmentDescriptionStencilLayout structure 3624 * [[VUID-VkAttachmentDescription2-format-06247]] 3625 If the pname:pNext chain does not include a 3626 slink:VkAttachmentDescriptionStencilLayout structure and pname:format 3627 only includes a stencil component, pname:initialLayout must: not be 3628 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 3629 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 3630 * [[VUID-VkAttachmentDescription2-format-06248]] 3631 If the pname:pNext chain does not include a 3632 slink:VkAttachmentDescriptionStencilLayout structure and pname:format 3633 only includes a stencil component, pname:finalLayout must: not be 3634 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL or 3635 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL 3636endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3637 * [[VUID-VkAttachmentDescription2-format-09332]] 3638ifdef::VK_ANDROID_external_format_resolve[] 3639 If <<features-externalFormatResolve,pname:externalFormatResolve>> is not 3640 enabled, 3641endif::VK_ANDROID_external_format_resolve[] 3642 pname:format must: not be ename:VK_FORMAT_UNDEFINED 3643ifdef::VK_ANDROID_external_format_resolve[] 3644 * [[VUID-VkAttachmentDescription2-format-09334]] 3645 If pname:format is ename:VK_FORMAT_UNDEFINED, there must: be a 3646 slink:VkExternalFormatANDROID structure in the pname:pNext chain with a 3647 pname:externalFormat that is not equal to `0` 3648endif::VK_ANDROID_external_format_resolve[] 3649**** 3650 3651include::{generated}/validity/structs/VkAttachmentDescription2.adoc[] 3652-- 3653 3654ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3655[open,refpage='VkAttachmentDescriptionStencilLayout',desc='Structure specifying an attachment description',type='structs',alias='VkAttachmentDescriptionStencilLayoutKHR'] 3656-- 3657The sname:VkAttachmentDescriptionStencilLayout structure is defined as: 3658 3659include::{generated}/api/structs/VkAttachmentDescriptionStencilLayout.adoc[] 3660 3661ifdef::VK_KHR_separate_depth_stencil_layouts[] 3662or the equivalent 3663 3664include::{generated}/api/structs/VkAttachmentDescriptionStencilLayoutKHR.adoc[] 3665endif::VK_KHR_separate_depth_stencil_layouts[] 3666 3667 * pname:sType is a elink:VkStructureType value identifying this structure. 3668 * pname:pNext is `NULL` or a pointer to a structure extending this 3669 structure. 3670 * pname:stencilInitialLayout is the layout the stencil aspect of the 3671 attachment image subresource will be in when a render pass instance 3672 begins. 3673 * pname:stencilFinalLayout is the layout the stencil aspect of the 3674 attachment image subresource will be transitioned to when a render pass 3675 instance ends. 3676 3677.Valid Usage 3678**** 3679 * [[VUID-VkAttachmentDescriptionStencilLayout-stencilInitialLayout-03308]] 3680 pname:stencilInitialLayout must: not be 3681 ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, 3682 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, 3683 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, 3684 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, 3685 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, 3686 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or 3687 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL 3688 * [[VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03309]] 3689 pname:stencilFinalLayout must: not be 3690 ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, 3691 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, 3692 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, 3693 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, 3694 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, 3695 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, or 3696 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL 3697 * [[VUID-VkAttachmentDescriptionStencilLayout-stencilFinalLayout-03310]] 3698 pname:stencilFinalLayout must: not be ename:VK_IMAGE_LAYOUT_UNDEFINED or 3699 ename:VK_IMAGE_LAYOUT_PREINITIALIZED 3700**** 3701 3702include::{generated}/validity/structs/VkAttachmentDescriptionStencilLayout.adoc[] 3703-- 3704endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3705 3706[open,refpage='VkSubpassDescription2',desc='Structure specifying a subpass description',type='structs',alias='VkSubpassDescription2KHR'] 3707-- 3708:refpage: VkSubpassDescription2 3709 3710The sname:VkSubpassDescription2 structure is defined as: 3711 3712include::{generated}/api/structs/VkSubpassDescription2.adoc[] 3713 3714ifdef::VK_KHR_create_renderpass2[] 3715or the equivalent 3716 3717include::{generated}/api/structs/VkSubpassDescription2KHR.adoc[] 3718endif::VK_KHR_create_renderpass2[] 3719 3720 * pname:sType is a elink:VkStructureType value identifying this structure. 3721 * pname:pNext is `NULL` or a pointer to a structure extending this 3722 structure. 3723 * pname:flags is a bitmask of elink:VkSubpassDescriptionFlagBits 3724 specifying usage of the subpass. 3725 * pname:pipelineBindPoint is a elink:VkPipelineBindPoint value specifying 3726 the pipeline type supported for this subpass. 3727 * pname:viewMask is a bitfield of view indices describing which views 3728 rendering is broadcast to in this subpass, when multiview is enabled. 3729 * pname:inputAttachmentCount is the number of input attachments. 3730 * pname:pInputAttachments is a pointer to an array of 3731 slink:VkAttachmentReference2 structures defining the input attachments 3732 for this subpass and their layouts. 3733 * pname:colorAttachmentCount is the number of color attachments. 3734 * pname:pColorAttachments is a pointer to an array of 3735 pname:colorAttachmentCount slink:VkAttachmentReference2 structures 3736 defining the color attachments for this subpass and their layouts. 3737 * pname:pResolveAttachments is `NULL` or a pointer to an array of 3738 pname:colorAttachmentCount slink:VkAttachmentReference2 structures 3739 defining the resolve attachments for this subpass and their layouts. 3740 * pname:pDepthStencilAttachment is a pointer to a 3741 slink:VkAttachmentReference2 structure specifying the depth/stencil 3742 attachment for this subpass and its layout. 3743 * pname:preserveAttachmentCount is the number of preserved attachments. 3744 * pname:pPreserveAttachments is a pointer to an array of 3745 pname:preserveAttachmentCount render pass attachment indices identifying 3746 attachments that are not used by this subpass, but whose contents must: 3747 be preserved throughout the subpass. 3748 3749Parameters defined by this structure with the same name as those in 3750slink:VkSubpassDescription have the identical effect to those parameters. 3751 3752pname:viewMask has the same effect for the described subpass as 3753slink:VkRenderPassMultiviewCreateInfo::pname:pViewMasks has on each 3754corresponding subpass. 3755 3756ifdef::VK_KHR_fragment_shading_rate[] 3757If a slink:VkFragmentShadingRateAttachmentInfoKHR structure is included in 3758the pname:pNext chain, pname:pFragmentShadingRateAttachment is not `NULL`, 3759and its pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, the 3760identified attachment defines a fragment shading rate attachment for that 3761subpass. 3762endif::VK_KHR_fragment_shading_rate[] 3763 3764ifdef::VK_ANDROID_external_format_resolve[] 3765If any element of pname:pResolveAttachments is an image specified with an 3766slink:VkExternalFormatANDROID, values in the corresponding color attachment 3767will be resolved to the resolve attachment in the same manner as specified 3768for <<VkResolveModeFlagBits, 3769ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID>>. 3770 3771If the <<limits-nullColorAttachmentWithExternalFormatResolve, 3772pname:nullColorAttachmentWithExternalFormatResolve>> limit is ename:VK_TRUE, 3773values in the color attachment will be loaded from the resolve attachment at 3774the start of rendering, and may: also be reloaded any time after a resolve 3775occurs or the resolve attachment is written to; if this occurs it must: 3776happen-before any writes to the color attachment are performed which 3777happen-after the resolve that triggers this. 3778If any color component in the external format is subsampled, values will be 3779read from the nearest sample in the image when they are loaded. 3780If the color attachment is also used as an input attachment, the same 3781behavior applies. 3782 3783Setting the color attachment to ename:VK_ATTACHMENT_UNUSED when an external 3784resolve attachment is used and the 3785<<limits-nullColorAttachmentWithExternalFormatResolve, 3786pname:nullColorAttachmentWithExternalFormatResolve>> limit is ename:VK_TRUE 3787will not result in color attachment writes to be discarded for that 3788attachment. 3789 3790When <<limits-nullColorAttachmentWithExternalFormatResolve, 3791pname:nullColorAttachmentWithExternalFormatResolve>> is ename:VK_TRUE, the 3792color output from the subpass can still be read via an input attachment; but 3793the application cannot bind an image view for the color attachment as there 3794is no such image view bound. 3795Instead to access the data as an input attachment applications can: use the 3796resolve attachment in its place - using the resolve attachment image for the 3797descriptor, and setting the corresponding element of pname:pInputAttachments 3798to the index of the resolve attachment. 3799 3800Loads or input attachment reads from the resolve attachment are performed as 3801if using a slink:VkSamplerYcbcrConversionCreateInfo with the following 3802parameters: 3803 3804[source,c] 3805---- 3806VkSamplerYcbcrConversionCreateInfo createInfo = { 3807 .sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO, 3808 .pNext = NULL, 3809 .format = VK_FORMAT_UNDEFINED, 3810 .ycbcrModel = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY, 3811 .ycbcrRange = VK_SAMPLER_YCBCR_RANGE_ITU_FULL, 3812 .components = { 3813 .r = VK_COMPONENT_SWIZZLE_B 3814 .g = VK_COMPONENT_SWIZZLE_R 3815 .b = VK_COMPONENT_SWIZZLE_G 3816 .a = VK_COMPONENT_SWIZZLE_IDENTITY}, 3817 .xChromaOffset = properties.chromaOffsetX, 3818 .yChromaOffset = properties.chromaOffsetY, 3819 .chromaFilter = VK_FILTER_NEAREST, 3820 .forceExplicitReconstruction = ... }; 3821---- 3822 3823where `properties` is equal to 3824slink:VkPhysicalDeviceExternalFormatResolvePropertiesANDROID returned by the 3825device and `forceExplicitReconstruction` is effectively ignored as the 3826ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY model is used. 3827The applied swizzle is the same effective swizzle that would be applied by 3828the ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY model, but no 3829range expansion is applied. 3830endif::VK_ANDROID_external_format_resolve[] 3831 3832.Valid Usage 3833**** 3834include::{chapters}/commonvalidity/subpass_description_common.adoc[] 3835ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3836 * [[VUID-VkSubpassDescription2-attachment-06251]] 3837 If the pname:attachment member of pname:pDepthStencilAttachment is not 3838 ename:VK_ATTACHMENT_UNUSED and its pname:pNext chain includes a 3839 slink:VkAttachmentReferenceStencilLayout structure, the pname:layout 3840 member of pname:pDepthStencilAttachment must: not be 3841 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL or 3842 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL 3843endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 3844 * [[VUID-VkSubpassDescription2-pipelineBindPoint-04953]] 3845 pname:pipelineBindPoint must: be ename:VK_PIPELINE_BIND_POINT_GRAPHICS 3846ifdef::VK_HUAWEI_subpass_shading[] 3847 or ename:VK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEI 3848endif::VK_HUAWEI_subpass_shading[] 3849 * [[VUID-VkSubpassDescription2-colorAttachmentCount-03063]] 3850 pname:colorAttachmentCount must: be less than or equal to 3851 sname:VkPhysicalDeviceLimits::pname:maxColorAttachments 3852 * [[VUID-VkSubpassDescription2-loadOp-03064]] 3853 If the first use of an attachment in this render pass is as an input 3854 attachment, and the attachment is not also used as a color or 3855 depth/stencil attachment in the same subpass, then pname:loadOp must: 3856 not be ename:VK_ATTACHMENT_LOAD_OP_CLEAR 3857ifndef::VK_ANDROID_external_format_resolve[] 3858 * [[VUID-VkSubpassDescription2-pResolveAttachments-03065]] 3859 If pname:pResolveAttachments is not `NULL`, for each resolve attachment 3860 that does not have the value ename:VK_ATTACHMENT_UNUSED, the 3861 corresponding color attachment must: not have the value 3862 ename:VK_ATTACHMENT_UNUSED 3863 * [[VUID-VkSubpassDescription2-pResolveAttachments-03066]] 3864 If pname:pResolveAttachments is not `NULL`, for each resolve attachment 3865 that is not ename:VK_ATTACHMENT_UNUSED, the corresponding color 3866 attachment must: not have a sample count of ename:VK_SAMPLE_COUNT_1_BIT 3867 * [[VUID-VkSubpassDescription2-pResolveAttachments-03068]] 3868 Each element of pname:pResolveAttachments must: have the same 3869 elink:VkFormat as its corresponding color attachment 3870endif::VK_ANDROID_external_format_resolve[] 3871 * [[VUID-VkSubpassDescription2-pResolveAttachments-03067]] 3872 If pname:pResolveAttachments is not `NULL`, each resolve attachment that 3873 is not ename:VK_ATTACHMENT_UNUSED must: have a sample count of 3874 ename:VK_SAMPLE_COUNT_1_BIT 3875ifdef::VK_ANDROID_external_format_resolve[] 3876 * [[VUID-VkSubpassDescription2-externalFormatResolve-09335]] 3877 If <<features-externalFormatResolve,pname:externalFormatResolve>> is not 3878 enabled and pname:pResolveAttachments is not `NULL`, for each resolve 3879 attachment that does not have the value ename:VK_ATTACHMENT_UNUSED, the 3880 corresponding color attachment must: not have the value 3881 ename:VK_ATTACHMENT_UNUSED 3882 * [[VUID-VkSubpassDescription2-nullColorAttachmentWithExternalFormatResolve-09336]] 3883 If the <<limits-nullColorAttachmentWithExternalFormatResolve, 3884 pname:nullColorAttachmentWithExternalFormatResolve>> property is 3885 ename:VK_FALSE and pname:pResolveAttachments is not `NULL`, for each 3886 resolve attachment that has a format of ename:VK_FORMAT_UNDEFINED, the 3887 corresponding color attachment must: not have the value 3888 ename:VK_ATTACHMENT_UNUSED 3889 * [[VUID-VkSubpassDescription2-nullColorAttachmentWithExternalFormatResolve-09337]] 3890 If the <<limits-nullColorAttachmentWithExternalFormatResolve, 3891 pname:nullColorAttachmentWithExternalFormatResolve>> property is 3892 ename:VK_TRUE and pname:pResolveAttachments is not `NULL`, for each 3893 resolve attachment that has a format of ename:VK_FORMAT_UNDEFINED, the 3894 corresponding color attachment must: have the value 3895 ename:VK_ATTACHMENT_UNUSED 3896 * [[VUID-VkSubpassDescription2-externalFormatResolve-09338]] 3897 If <<features-externalFormatResolve,pname:externalFormatResolve>> is not 3898 enabled and pname:pResolveAttachments is not `NULL`, for each resolve 3899 attachment that is not ename:VK_ATTACHMENT_UNUSED, the corresponding 3900 color attachment must: not have a sample count of 3901 ename:VK_SAMPLE_COUNT_1_BIT 3902 * [[VUID-VkSubpassDescription2-externalFormatResolve-09339]] 3903 If <<features-externalFormatResolve,pname:externalFormatResolve>> is not 3904 enabled, each element of pname:pResolveAttachments must: have the same 3905 elink:VkFormat as its corresponding color attachment 3906endif::VK_ANDROID_external_format_resolve[] 3907ifdef::VK_EXT_multisampled_render_to_single_sampled[] 3908 * [[VUID-VkSubpassDescription2-multisampledRenderToSingleSampled-06869]] 3909 If the <<features-multisampledRenderToSingleSampled, 3910 pname:multisampledRenderToSingleSampled>> feature is not enabled, all 3911 attachments in pname:pColorAttachments that are not 3912 ename:VK_ATTACHMENT_UNUSED must: have the same sample count 3913endif::VK_EXT_multisampled_render_to_single_sampled[] 3914 * [[VUID-VkSubpassDescription2-pInputAttachments-02897]] 3915 All attachments in pname:pInputAttachments that are not 3916 ename:VK_ATTACHMENT_UNUSED 3917ifdef::VK_ANDROID_external_format_resolve[] 3918 and any of the following is true: 3919 ** the <<features-externalFormatResolve, pname:externalFormatResolve>> 3920 feature is not enabled 3921 ** the <<limits-nullColorAttachmentWithExternalFormatResolve, 3922 pname:nullColorAttachmentWithExternalFormatResolve>> property is 3923 ename:VK_FALSE 3924 ** does not have a non-zero value of 3925 slink:VkExternalFormatANDROID::pname:externalFormat 3926endif::VK_ANDROID_external_format_resolve[] 3927 3928+ 3929must: have image formats whose <<potential-format-features, potential format 3930 features>> contain at least ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT 3931 or ename:VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT 3932 * [[VUID-VkSubpassDescription2-pColorAttachments-02898]] 3933 All attachments in pname:pColorAttachments that are not 3934 ename:VK_ATTACHMENT_UNUSED must: have image formats whose 3935 <<potential-format-features, potential format features>> contain 3936 ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT 3937ifndef::VK_ANDROID_external_format_resolve[] 3938 * [[VUID-VkSubpassDescription2-pResolveAttachments-02899]] 3939 All attachments in pname:pResolveAttachments that are not 3940 ename:VK_ATTACHMENT_UNUSED must: have image formats whose 3941 <<potential-format-features, potential format features>> contain 3942 ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT 3943endif::VK_ANDROID_external_format_resolve[] 3944ifdef::VK_ANDROID_external_format_resolve[] 3945 * [[VUID-VkSubpassDescription2-pResolveAttachments-09343]] 3946 All attachments in pname:pResolveAttachments that are not 3947 ename:VK_ATTACHMENT_UNUSED and do not have an image format of 3948 ename:VK_FORMAT_UNDEFINED must: have image formats whose 3949 <<potential-format-features, potential format features>> contain 3950 ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT 3951endif::VK_ANDROID_external_format_resolve[] 3952 * [[VUID-VkSubpassDescription2-pDepthStencilAttachment-02900]] 3953 If pname:pDepthStencilAttachment is not `NULL` and the attachment is not 3954 ename:VK_ATTACHMENT_UNUSED then it must: have an image format whose 3955 <<potential-format-features, potential format features>> contain 3956 ename:VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT 3957ifdef::VK_NV_linear_color_attachment[] 3958 * [[VUID-VkSubpassDescription2-linearColorAttachment-06499]] 3959 If the <<features-linearColorAttachment, pname:linearColorAttachment>> 3960 feature is enabled and the image is created with 3961 ename:VK_IMAGE_TILING_LINEAR, all attachments in pname:pInputAttachments 3962 that are not ename:VK_ATTACHMENT_UNUSED must: have image formats whose 3963 <<potential-format-features, potential format features>> must: contain 3964 ename:VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV 3965 * [[VUID-VkSubpassDescription2-linearColorAttachment-06500]] 3966 If the <<features-linearColorAttachment, pname:linearColorAttachment>> 3967 feature is enabled and the image is created with 3968 ename:VK_IMAGE_TILING_LINEAR, all attachments in pname:pColorAttachments 3969 that are not ename:VK_ATTACHMENT_UNUSED must: have image formats whose 3970 <<potential-format-features, potential format features>> must: contain 3971 ename:VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV 3972 * [[VUID-VkSubpassDescription2-linearColorAttachment-06501]] 3973 If the <<features-linearColorAttachment, pname:linearColorAttachment>> 3974 feature is enabled and the image is created with 3975 ename:VK_IMAGE_TILING_LINEAR, all attachments in 3976 pname:pResolveAttachments that are not ename:VK_ATTACHMENT_UNUSED must: 3977 have image formats whose <<potential-format-features, potential format 3978 features>> must: contain 3979 ename:VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV 3980endif::VK_NV_linear_color_attachment[] 3981ifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 3982 * [[VUID-VkSubpassDescription2-None-09456]] 3983 If either of the following is enabled: 3984ifdef::VK_AMD_mixed_attachment_samples[] 3985 ** The `apiext:VK_AMD_mixed_attachment_samples` extension 3986endif::VK_AMD_mixed_attachment_samples[] 3987ifdef::VK_NV_framebuffer_mixed_samples[] 3988 ** The `apiext:VK_NV_framebuffer_mixed_samples` extension 3989endif::VK_NV_framebuffer_mixed_samples[] 3990 3991+ 3992all attachments in pname:pColorAttachments that are not 3993ename:VK_ATTACHMENT_UNUSED must: have a sample count that is smaller than or 3994equal to the sample count of pname:pDepthStencilAttachment if it is not 3995ename:VK_ATTACHMENT_UNUSED 3996endif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 3997ifdef::VK_EXT_multisampled_render_to_single_sampled[] 3998 * [[VUID-VkSubpassDescription2-pNext-06870]] 3999 If the pname:pNext chain includes a 4000 slink:VkMultisampledRenderToSingleSampledInfoEXT structure with 4001 pname:multisampledRenderToSingleSampledEnable equal to ename:VK_TRUE, 4002 then all attachments in pname:pColorAttachments and 4003 pname:pDepthStencilAttachment that are not ename:VK_ATTACHMENT_UNUSED 4004 must: have a sample count that is either ename:VK_SAMPLE_COUNT_1_BIT or 4005 equal to 4006 slink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples 4007 * [[VUID-VkSubpassDescription2-pNext-06871]] 4008 If the pname:pNext chain includes a 4009 slink:VkMultisampledRenderToSingleSampledInfoEXT structure with 4010 pname:multisampledRenderToSingleSampledEnable equal to ename:VK_TRUE, 4011 and pname:pDepthStencilAttachment is not `NULL`, does not have the value 4012 ename:VK_ATTACHMENT_UNUSED, and has a sample count of 4013 ename:VK_SAMPLE_COUNT_1_BIT, the pname:pNext chain must: also include a 4014 slink:VkSubpassDescriptionDepthStencilResolve structure with 4015 pname:pDepthStencilResolveAttachment that is either `NULL` or has the 4016 value ename:VK_ATTACHMENT_UNUSED 4017endif::VK_EXT_multisampled_render_to_single_sampled[] 4018 * [[VUID-VkSubpassDescription2-multisampledRenderToSingleSampled-06872]] 4019 All attachments in pname:pDepthStencilAttachment or 4020 pname:pColorAttachments that are not ename:VK_ATTACHMENT_UNUSED must: 4021 have the same sample count 4022ifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_EXT_multisampled_render_to_single_sampled[] 4023 , if none of the following are enabled: 4024ifdef::VK_AMD_mixed_attachment_samples[] 4025 ** The `apiext:VK_AMD_mixed_attachment_samples` extension 4026endif::VK_AMD_mixed_attachment_samples[] 4027ifdef::VK_NV_framebuffer_mixed_samples[] 4028 ** The `apiext:VK_NV_framebuffer_mixed_samples` extension 4029endif::VK_NV_framebuffer_mixed_samples[] 4030ifdef::VK_EXT_multisampled_render_to_single_sampled[] 4031 ** The <<features-multisampledRenderToSingleSampled, 4032 pname:multisampledRenderToSingleSampled>> feature, 4033endif::VK_EXT_multisampled_render_to_single_sampled[] 4034endif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_EXT_multisampled_render_to_single_sampled[] 4035 * [[VUID-VkSubpassDescription2-attachment-03073]] 4036 Each element of pname:pPreserveAttachments must: not be 4037 ename:VK_ATTACHMENT_UNUSED 4038 * [[VUID-VkSubpassDescription2-pPreserveAttachments-03074]] 4039 Each element of pname:pPreserveAttachments must: not also be an element 4040 of any other member of the subpass description 4041 * [[VUID-VkSubpassDescription2-layout-02528]] 4042 If any attachment is used by more than one slink:VkAttachmentReference2 4043 member, then each use must: use the same pname:layout 4044ifdef::VK_NVX_multiview_per_view_attributes[] 4045 * [[VUID-VkSubpassDescription2-flags-03076]] 4046 If pname:flags includes 4047 ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX, it must: 4048 also include ename:VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX 4049endif::VK_NVX_multiview_per_view_attributes[] 4050 * [[VUID-VkSubpassDescription2-attachment-02799]] 4051 If the pname:attachment member of any element of pname:pInputAttachments 4052 is not ename:VK_ATTACHMENT_UNUSED, then the pname:aspectMask member 4053 must: be a valid combination of elink:VkImageAspectFlagBits 4054 * [[VUID-VkSubpassDescription2-attachment-02800]] 4055 If the pname:attachment member of any element of pname:pInputAttachments 4056 is not ename:VK_ATTACHMENT_UNUSED, then the pname:aspectMask member 4057 must: not be `0` 4058 * [[VUID-VkSubpassDescription2-attachment-02801]] 4059 If the pname:attachment member of any element of pname:pInputAttachments 4060 is not ename:VK_ATTACHMENT_UNUSED, then the pname:aspectMask member 4061 must: not include ename:VK_IMAGE_ASPECT_METADATA_BIT 4062ifdef::VK_EXT_image_drm_format_modifier[] 4063 * [[VUID-VkSubpassDescription2-attachment-04563]] 4064 If the pname:attachment member of any element of pname:pInputAttachments 4065 is not ename:VK_ATTACHMENT_UNUSED, then the pname:aspectMask member 4066 must: not include `VK_IMAGE_ASPECT_MEMORY_PLANE__{ibit}__BIT_EXT` for 4067 any index _i_ 4068endif::VK_EXT_image_drm_format_modifier[] 4069 * [[VUID-VkSubpassDescription2-pDepthStencilAttachment-04440]] 4070 An attachment must: not be used in both pname:pDepthStencilAttachment 4071 and pname:pColorAttachments 4072ifdef::VKSC_VERSION_1_0[] 4073 * [[VUID-VkSubpassDescription2-inputAttachmentCount-05058]] 4074 pname:inputAttachmentCount must: be less than or equal to 4075 <<limits-maxSubpassInputAttachments,maxSubpassInputAttachments>> 4076 * [[VUID-VkSubpassDescription2-preserveAttachmentCount-05059]] 4077 pname:preserveAttachmentCount must: be less than or equal to 4078 <<limits-maxSubpassPreserveAttachments,maxSubpassPreserveAttachments>> 4079endif::VKSC_VERSION_1_0[] 4080ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 4081 * [[VUID-VkSubpassDescription2-multiview-06558]] 4082 If the <<features-multiview, pname:multiview>> feature is not enabled, 4083 pname:viewMask must: be `0` 4084 * [[VUID-VkSubpassDescription2-viewMask-06706]] 4085 The index of the most significant bit in pname:viewMask must: be less 4086 than <<limits-maxMultiviewViewCount, pname:maxMultiviewViewCount>> 4087endif::VK_VERSION_1_1,VK_KHR_multiview[] 4088ifdef::VK_ANDROID_external_format_resolve[] 4089 * [[VUID-VkSubpassDescription2-externalFormatResolve-09344]] 4090 If <<features-externalFormatResolve,pname:externalFormatResolve>> is 4091 enabled, pname:pResolveAttachments is not `NULL`, and 4092 pname:colorAttachmentCount is not `1`, any element of 4093 pname:pResolveAttachments that is not `VK_ATTACHMENT_UNUSED`, must: not 4094 have a format of ename:VK_FORMAT_UNDEFINED 4095 * [[VUID-VkSubpassDescription2-externalFormatResolve-09345]] 4096 If <<features-externalFormatResolve,pname:externalFormatResolve>> is 4097 enabled, pname:pResolveAttachments is not `NULL`, any element of 4098 pname:pResolveAttachments is not ename:VK_ATTACHMENT_UNUSED and has a 4099 format of ename:VK_FORMAT_UNDEFINED, and the corresponding element of 4100 pname:pColorAttachments is not ename:VK_ATTACHMENT_UNUSED, the color 4101 attachment must: have a pname:samples value of `1` 4102 * [[VUID-VkSubpassDescription2-externalFormatResolve-09346]] 4103 If <<features-externalFormatResolve,pname:externalFormatResolve>> is 4104 enabled, pname:pResolveAttachments is not `NULL`, and any element of 4105 pname:pResolveAttachments is not ename:VK_ATTACHMENT_UNUSED and has a 4106 format of ename:VK_FORMAT_UNDEFINED, pname:viewMask must: be `0` 4107ifdef::VK_KHR_fragment_shading_rate[] 4108 * [[VUID-VkSubpassDescription2-externalFormatResolve-09347]] 4109 If <<features-externalFormatResolve,pname:externalFormatResolve>> is 4110 enabled, pname:pResolveAttachments is not `NULL`, and any element of 4111 pname:pResolveAttachments is not ename:VK_ATTACHMENT_UNUSED and has a 4112 format of ename:VK_FORMAT_UNDEFINED, 4113 slink:VkFragmentShadingRateAttachmentInfoKHR::pname:pFragmentShadingRateAttachment 4114 must: either be `NULL` or a slink:VkAttachmentReference2 structure with 4115 a pname:attachment value of ename:VK_ATTACHMENT_UNUSED 4116endif::VK_KHR_fragment_shading_rate[] 4117 * [[VUID-VkSubpassDescription2-externalFormatResolve-09348]] 4118 If <<features-externalFormatResolve,pname:externalFormatResolve>> is 4119 enabled, pname:pResolveAttachments is not `NULL`, and any element of 4120 pname:pResolveAttachments is not ename:VK_ATTACHMENT_UNUSED and has a 4121 format of ename:VK_FORMAT_UNDEFINED, elements of pname:pInputAttachments 4122 referencing either a color attachment or resolve attachment used in this 4123 subpass must: not include `VK_IMAGE_ASPECT_PLANE__{ibit}__BIT` for any 4124 index _i_ in its pname:aspectMask 4125endif::VK_ANDROID_external_format_resolve[] 4126**** 4127 4128include::{generated}/validity/structs/VkSubpassDescription2.adoc[] 4129-- 4130 4131ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 4132[open,refpage='VkSubpassDescriptionDepthStencilResolve',desc='Structure specifying depth/stencil resolve operations for a subpass',type='structs',alias='VkSubpassDescriptionDepthStencilResolveKHR'] 4133-- 4134The sname:VkSubpassDescriptionDepthStencilResolve structure is defined as: 4135 4136include::{generated}/api/structs/VkSubpassDescriptionDepthStencilResolve.adoc[] 4137 4138ifdef::VK_KHR_depth_stencil_resolve[] 4139or the equivalent 4140 4141include::{generated}/api/structs/VkSubpassDescriptionDepthStencilResolveKHR.adoc[] 4142endif::VK_KHR_depth_stencil_resolve[] 4143 4144 * pname:sType is a elink:VkStructureType value identifying this structure. 4145 * pname:pNext is `NULL` or a pointer to a structure extending this 4146 structure. 4147 * pname:depthResolveMode is a elink:VkResolveModeFlagBits value describing 4148 the depth resolve mode. 4149 * pname:stencilResolveMode is a elink:VkResolveModeFlagBits value 4150 describing the stencil resolve mode. 4151 * pname:pDepthStencilResolveAttachment is `NULL` or a pointer to a 4152 slink:VkAttachmentReference2 structure defining the depth/stencil 4153 resolve attachment for this subpass and its layout. 4154 4155If the pname:pNext chain of slink:VkSubpassDescription2 includes a 4156sname:VkSubpassDescriptionDepthStencilResolve structure, then that structure 4157describes <<renderpass-resolve-operations, multisample resolve operations>> 4158for the depth/stencil attachment in a subpass. 4159If this structure is not included in the pname:pNext chain of 4160slink:VkSubpassDescription2, or if it is and either 4161pname:pDepthStencilResolveAttachment is `NULL` or its attachment index is 4162ename:VK_ATTACHMENT_UNUSED, it indicates that no depth/stencil resolve 4163attachment will be used in the subpass. 4164 4165.Valid Usage 4166**** 4167 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03177]] 4168 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4169 the value ename:VK_ATTACHMENT_UNUSED, pname:pDepthStencilAttachment 4170 must: not be `NULL` or have the value ename:VK_ATTACHMENT_UNUSED 4171 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03179]] 4172 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4173 the value ename:VK_ATTACHMENT_UNUSED, pname:pDepthStencilAttachment 4174 must: not have a sample count of ename:VK_SAMPLE_COUNT_1_BIT 4175 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03180]] 4176 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4177 the value ename:VK_ATTACHMENT_UNUSED, 4178 pname:pDepthStencilResolveAttachment must: have a sample count of 4179 ename:VK_SAMPLE_COUNT_1_BIT 4180 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-02651]] 4181 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4182 the value ename:VK_ATTACHMENT_UNUSED then it must: have an image format 4183 whose <<potential-format-features, potential format features>> contain 4184 ename:VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT 4185 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03181]] 4186 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4187 the value ename:VK_ATTACHMENT_UNUSED and elink:VkFormat of 4188 pname:pDepthStencilResolveAttachment has a depth component, then the 4189 elink:VkFormat of pname:pDepthStencilAttachment must: have a depth 4190 component with the same number of bits and <<formats-numericformat, 4191 numeric format>> 4192 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03182]] 4193 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4194 the value ename:VK_ATTACHMENT_UNUSED, and elink:VkFormat of 4195 pname:pDepthStencilResolveAttachment has a stencil component, then the 4196 elink:VkFormat of pname:pDepthStencilAttachment must: have a stencil 4197 component with the same number of bits and <<formats-numericformat, 4198 numeric format>> 4199 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03178]] 4200 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4201 the value ename:VK_ATTACHMENT_UNUSED, pname:depthResolveMode and 4202 pname:stencilResolveMode must: not both be ename:VK_RESOLVE_MODE_NONE 4203 * [[VUID-VkSubpassDescriptionDepthStencilResolve-depthResolveMode-03183]] 4204 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4205 the value ename:VK_ATTACHMENT_UNUSED and the elink:VkFormat of 4206 pname:pDepthStencilResolveAttachment has a depth component, then the 4207 value of pname:depthResolveMode must: be one of the bits set in 4208 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:supportedDepthResolveModes 4209 or ename:VK_RESOLVE_MODE_NONE 4210 * [[VUID-VkSubpassDescriptionDepthStencilResolve-stencilResolveMode-03184]] 4211 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4212 the value ename:VK_ATTACHMENT_UNUSED and the elink:VkFormat of 4213 pname:pDepthStencilResolveAttachment has a stencil component, then the 4214 value of pname:stencilResolveMode must: be one of the bits set in 4215 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:supportedStencilResolveModes 4216 or ename:VK_RESOLVE_MODE_NONE 4217 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03185]] 4218 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4219 the value ename:VK_ATTACHMENT_UNUSED, the elink:VkFormat of 4220 pname:pDepthStencilResolveAttachment has both depth and stencil 4221 components, 4222 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolve 4223 is ename:VK_FALSE, and 4224 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolveNone 4225 is ename:VK_FALSE, then the values of pname:depthResolveMode and 4226 pname:stencilResolveMode must: be identical 4227 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pDepthStencilResolveAttachment-03186]] 4228 If pname:pDepthStencilResolveAttachment is not `NULL` and does not have 4229 the value ename:VK_ATTACHMENT_UNUSED, the elink:VkFormat of 4230 pname:pDepthStencilResolveAttachment has both depth and stencil 4231 components, 4232 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolve 4233 is ename:VK_FALSE and 4234 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolveNone 4235 is ename:VK_TRUE, then the values of pname:depthResolveMode and 4236 pname:stencilResolveMode must: be identical or one of them must: be 4237 ename:VK_RESOLVE_MODE_NONE 4238ifdef::VK_EXT_multisampled_render_to_single_sampled[] 4239 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06873]] 4240 If the pname:pNext chain of slink:VkSubpassDescription2 includes a 4241 sname:VkMultisampledRenderToSingleSampledInfoEXT structure, the 4242 pname:multisampledRenderToSingleSampledEnable field is ename:VK_TRUE, 4243 and pname:pDepthStencilAttachment is not `NULL` and does not have the 4244 value ename:VK_ATTACHMENT_UNUSED, pname:depthResolveMode and 4245 pname:stencilResolveMode must: not both be ename:VK_RESOLVE_MODE_NONE 4246 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06874]] 4247 If the pname:pNext chain of slink:VkSubpassDescription2 includes a 4248 sname:VkMultisampledRenderToSingleSampledInfoEXT structure whose 4249 pname:multisampledRenderToSingleSampledEnable field is ename:VK_TRUE, 4250 and pname:pDepthStencilAttachment is not `NULL`, does not have the value 4251 ename:VK_ATTACHMENT_UNUSED, and has a elink:VkFormat that has a depth 4252 component, then the value of pname:depthResolveMode must: be one of the 4253 bits set in 4254 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:supportedDepthResolveModes 4255 or ename:VK_RESOLVE_MODE_NONE 4256 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06875]] 4257 If the pname:pNext chain of slink:VkSubpassDescription2 includes a 4258 sname:VkMultisampledRenderToSingleSampledInfoEXT structure whose 4259 pname:multisampledRenderToSingleSampledEnable field is ename:VK_TRUE, 4260 and pname:pDepthStencilAttachment is not `NULL`, does not have the value 4261 ename:VK_ATTACHMENT_UNUSED, and has a elink:VkFormat with a stencil 4262 component, then the value of pname:stencilResolveMode must: be one of 4263 the bits set in 4264 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:supportedStencilResolveModes 4265 or ename:VK_RESOLVE_MODE_NONE 4266 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06876]] 4267 If the pname:pNext chain of slink:VkSubpassDescription2 includes a 4268 sname:VkMultisampledRenderToSingleSampledInfoEXT structure whose 4269 pname:multisampledRenderToSingleSampledEnable field is ename:VK_TRUE, 4270 pname:pDepthStencilAttachment is not `NULL`, does not have the value 4271 ename:VK_ATTACHMENT_UNUSED, and has a elink:VkFormat with both depth and 4272 stencil components, and both 4273 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolve 4274 and 4275 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolveNone 4276 are ename:VK_FALSE, then the values of pname:depthResolveMode and 4277 pname:stencilResolveMode must: be identical 4278 * [[VUID-VkSubpassDescriptionDepthStencilResolve-pNext-06877]] 4279 If the pname:pNext chain of slink:VkSubpassDescription2 includes a 4280 sname:VkMultisampledRenderToSingleSampledInfoEXT structure whose 4281 pname:multisampledRenderToSingleSampledEnable field is ename:VK_TRUE, 4282 pname:pDepthStencilAttachment is not `NULL`, does not have the value 4283 ename:VK_ATTACHMENT_UNUSED, and has a elink:VkFormat with both depth and 4284 stencil components, 4285 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolve 4286 is ename:VK_FALSE, and 4287 slink:VkPhysicalDeviceDepthStencilResolveProperties::pname:independentResolveNone 4288 is ename:VK_TRUE, then the values of pname:depthResolveMode and 4289 pname:stencilResolveMode must: be identical or one of them must: be 4290 ename:VK_RESOLVE_MODE_NONE 4291endif::VK_EXT_multisampled_render_to_single_sampled[] 4292**** 4293 4294include::{generated}/validity/structs/VkSubpassDescriptionDepthStencilResolve.adoc[] 4295-- 4296endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 4297 4298 4299ifdef::VK_KHR_fragment_shading_rate[] 4300[open,refpage='VkFragmentShadingRateAttachmentInfoKHR',desc='Structure specifying a fragment shading rate attachment for a subpass',type='structs'] 4301-- 4302The sname:VkFragmentShadingRateAttachmentInfoKHR structure is defined as: 4303 4304include::{generated}/api/structs/VkFragmentShadingRateAttachmentInfoKHR.adoc[] 4305 4306 * pname:sType is a elink:VkStructureType value identifying this structure. 4307 * pname:pNext is `NULL` or a pointer to a structure extending this 4308 structure. 4309 * pname:pFragmentShadingRateAttachment is `NULL` or a pointer to a 4310 slink:VkAttachmentReference2 structure defining the fragment shading 4311 rate attachment for this subpass. 4312 * pname:shadingRateAttachmentTexelSize specifies the size of the portion 4313 of the framebuffer corresponding to each texel in 4314 pname:pFragmentShadingRateAttachment. 4315 4316If no shading rate attachment is specified, or if this structure is not 4317specified, the implementation behaves as if a valid shading rate attachment 4318was specified with all texels specifying a single pixel per fragment. 4319 4320.Valid Usage 4321**** 4322 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04524]] 4323 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4324 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, its 4325 pname:layout member must: be equal to ename:VK_IMAGE_LAYOUT_GENERAL or 4326 ename:VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR 4327 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04525]] 4328 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4329 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, 4330 pname:shadingRateAttachmentTexelSize.width must: be a power of two value 4331 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04526]] 4332 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4333 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, 4334 pname:shadingRateAttachmentTexelSize.width must: be less than or equal 4335 to <<limits-maxFragmentShadingRateAttachmentTexelSize, 4336 pname:maxFragmentShadingRateAttachmentTexelSize.width>> 4337 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04527]] 4338 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4339 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, 4340 pname:shadingRateAttachmentTexelSize.width must: be greater than or 4341 equal to <<limits-minFragmentShadingRateAttachmentTexelSize, 4342 pname:minFragmentShadingRateAttachmentTexelSize.width>> 4343 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04528]] 4344 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4345 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, 4346 pname:shadingRateAttachmentTexelSize.height must: be a power of two 4347 value 4348 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04529]] 4349 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4350 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, 4351 pname:shadingRateAttachmentTexelSize.height must: be less than or equal 4352 to <<limits-maxFragmentShadingRateAttachmentTexelSize, 4353 pname:maxFragmentShadingRateAttachmentTexelSize.height>> 4354 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04530]] 4355 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4356 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, 4357 pname:shadingRateAttachmentTexelSize.height must: be greater than or 4358 equal to <<limits-minFragmentShadingRateAttachmentTexelSize, 4359 pname:minFragmentShadingRateAttachmentTexelSize.height>> 4360 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04531]] 4361 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4362 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, the quotient 4363 of pname:shadingRateAttachmentTexelSize.width and 4364 pname:shadingRateAttachmentTexelSize.height must: be less than or equal 4365 to <<limits-maxFragmentShadingRateAttachmentTexelSizeAspectRatio, 4366 pname:maxFragmentShadingRateAttachmentTexelSizeAspectRatio>> 4367 * [[VUID-VkFragmentShadingRateAttachmentInfoKHR-pFragmentShadingRateAttachment-04532]] 4368 If pname:pFragmentShadingRateAttachment is not `NULL` and its 4369 pname:attachment member is not ename:VK_ATTACHMENT_UNUSED, the quotient 4370 of pname:shadingRateAttachmentTexelSize.height and 4371 pname:shadingRateAttachmentTexelSize.width must: be less than or equal 4372 to <<limits-maxFragmentShadingRateAttachmentTexelSizeAspectRatio, 4373 pname:maxFragmentShadingRateAttachmentTexelSizeAspectRatio>> 4374**** 4375 4376include::{generated}/validity/structs/VkFragmentShadingRateAttachmentInfoKHR.adoc[] 4377-- 4378endif::VK_KHR_fragment_shading_rate[] 4379 4380ifdef::VK_EXT_multisampled_render_to_single_sampled[] 4381[[subpass-multisampledrendertosinglesampled]] 4382[open,refpage='VkMultisampledRenderToSingleSampledInfoEXT',desc='Structure containing info for multisampled rendering to single-sampled attachments in a subpass',type='structs'] 4383-- 4384If the pname:pNext chain of slink:VkSubpassDescription2 4385ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo] 4386includes a sname:VkMultisampledRenderToSingleSampledInfoEXT structure, then 4387that structure describes how multisampled rendering is performed on single 4388sampled attachments in that subpass. 4389 4390The sname:VkMultisampledRenderToSingleSampledInfoEXT structure is defined 4391as: 4392 4393include::{generated}/api/structs/VkMultisampledRenderToSingleSampledInfoEXT.adoc[] 4394 4395 * pname:sType is a elink:VkStructureType value identifying this structure. 4396 * pname:pNext is `NULL` or a pointer to a structure extending this 4397 structure. 4398 * pname:multisampledRenderToSingleSampledEnable controls whether 4399 multisampled rendering to single-sampled attachments is performed as 4400 described <<multisampled-render-to-single-sampled, below>>. 4401 * pname:rasterizationSamples is a elink:VkSampleCountFlagBits specifying 4402 the number of samples used in rasterization. 4403 4404.Valid Usage 4405**** 4406 * [[VUID-VkMultisampledRenderToSingleSampledInfoEXT-rasterizationSamples-06878]] 4407 The value of pname:rasterizationSamples must: not be 4408 ename:VK_SAMPLE_COUNT_1_BIT 4409ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 4410 * [[VUID-VkMultisampledRenderToSingleSampledInfoEXT-pNext-06880]] 4411 If added to the pname:pNext chain of slink:VkRenderingInfo, each 4412 pname:imageView member of any element of 4413 slink:VkRenderingInfo::pname:pColorAttachments, 4414 slink:VkRenderingInfo::pname:pDepthAttachment, or 4415 slink:VkRenderingInfo::pname:pStencilAttachment that is not 4416 dlink:VK_NULL_HANDLE must: have a format that supports the sample count 4417 specified in pname:rasterizationSamples 4418endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 4419**** 4420 4421include::{generated}/validity/structs/VkMultisampledRenderToSingleSampledInfoEXT.adoc[] 4422-- 4423 4424[[multisampled-render-to-single-sampled]] 4425If the pname:pNext chain of slink:VkSubpassDescription2 4426ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo] 4427includes a slink:VkMultisampledRenderToSingleSampledInfoEXT structure whose 4428pname:multisampledRenderToSingleSampledEnable field is ename:VK_TRUE, the 4429graphics pipelines must: have 4430slink:VkGraphicsPipelineCreateInfo::pname:rasterizationSamples equal to 4431slink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples, 4432and the subpass attachments can: have a sample count of 4433ename:VK_SAMPLE_COUNT_1_BIT. 4434For attachments with a sample count of ename:VK_SAMPLE_COUNT_1_BIT, 4435multisampled rendering is performed to an intermediate multisampled image 4436with 4437slink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples 4438samples, implicitly allocated by the implementation for the duration of the 4439subpass. 4440For such attachments: 4441 4442 * If pname:loadOp equals to ename:VK_ATTACHMENT_LOAD_OP_LOAD, samples of 4443 the implicit image are initialized by replicating the value from the 4444 corresponding pixel in the attachment. 4445 * If pname:storeOp or pname:stencilStoreOp is equal to 4446 ename:VK_ATTACHMENT_STORE_OP_STORE, the implicit image is implicitly 4447 resolved prior to storage in the attachment. 4448 4449Memory constraints due to high primitive counts may: result in an implicit 4450split of the subpass. 4451This is the equivalent of partial rasterization of geometry in a render pass 4452that ends in pname:storeOp and pname:stencilStoreOp equal to 4453ename:VK_ATTACHMENT_STORE_OP_STORE, followed by another render pass with 4454pname:loadOp and pname:stencilLoadOp equal to 4455ename:VK_ATTACHMENT_LOAD_OP_LOAD with appropriate barriers in between. 4456When slink:VkMultisampledRenderToSingleSampledInfoEXT is used, the 4457implementation is allowed to resolve attachments with a sample count of 4458ename:VK_SAMPLE_COUNT_1_BIT and lose multisampled data on such splits. 4459The implementation may: similarly split the render pass at subpass 4460boundaries even if they use the same value for 4461slink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples. 4462endif::VK_EXT_multisampled_render_to_single_sampled[] 4463 4464[open,refpage='VkAttachmentReference2',desc='Structure specifying an attachment reference',type='structs',alias='VkAttachmentReference2KHR'] 4465-- 4466:refpage: VkAttachmentReference2 4467 4468The sname:VkAttachmentReference2 structure is defined as: 4469 4470include::{generated}/api/structs/VkAttachmentReference2.adoc[] 4471 4472ifdef::VK_KHR_create_renderpass2[] 4473or the equivalent 4474 4475include::{generated}/api/structs/VkAttachmentReference2KHR.adoc[] 4476endif::VK_KHR_create_renderpass2[] 4477 4478 * pname:sType is a elink:VkStructureType value identifying this structure. 4479 * pname:pNext is `NULL` or a pointer to a structure extending this 4480 structure. 4481 * pname:attachment is either an integer value identifying an attachment at 4482 the corresponding index in 4483 slink:VkRenderPassCreateInfo2::pname:pAttachments, or 4484 ename:VK_ATTACHMENT_UNUSED to signify that this attachment is not used. 4485 * pname:layout is a elink:VkImageLayout value specifying the layout the 4486 attachment uses during the subpass. 4487 * pname:aspectMask is a mask of which aspect(s) can: be accessed within 4488 the specified subpass as an input attachment. 4489 4490Parameters defined by this structure with the same name as those in 4491slink:VkAttachmentReference have the identical effect to those parameters. 4492 4493pname:aspectMask is ignored when this structure is used to describe anything 4494other than an input attachment reference. 4495 4496ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 4497If the <<features-separateDepthStencilLayouts, 4498pname:separateDepthStencilLayouts>> feature is enabled, and pname:attachment 4499has a depth/stencil format, pname:layout can: be set to a layout that only 4500specifies the layout of the depth aspect. 4501 4502If pname:layout only specifies the layout of the depth aspect of the 4503attachment, the layout of the stencil aspect is specified by the 4504pname:stencilLayout member of a slink:VkAttachmentReferenceStencilLayout 4505structure included in the pname:pNext chain. 4506Otherwise, pname:layout describes the layout for all relevant image aspects. 4507endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 4508 4509.Valid Usage 4510**** 4511include::{chapters}/commonvalidity/attachment_reference_common.adoc[] 4512**** 4513 4514include::{generated}/validity/structs/VkAttachmentReference2.adoc[] 4515-- 4516 4517ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 4518[open,refpage='VkAttachmentReferenceStencilLayout',desc='Structure specifying an attachment description',type='structs',alias='VkAttachmentReferenceStencilLayoutKHR'] 4519-- 4520The sname:VkAttachmentReferenceStencilLayout structure is defined as: 4521 4522include::{generated}/api/structs/VkAttachmentReferenceStencilLayout.adoc[] 4523 4524ifdef::VK_KHR_separate_depth_stencil_layouts[] 4525or the equivalent 4526 4527include::{generated}/api/structs/VkAttachmentReferenceStencilLayoutKHR.adoc[] 4528endif::VK_KHR_separate_depth_stencil_layouts[] 4529 4530 * pname:sType is a elink:VkStructureType value identifying this structure. 4531 * pname:pNext is `NULL` or a pointer to a structure extending this 4532 structure. 4533 * pname:stencilLayout is a elink:VkImageLayout value specifying the layout 4534 the stencil aspect of the attachment uses during the subpass. 4535 4536.Valid Usage 4537**** 4538 * [[VUID-VkAttachmentReferenceStencilLayout-stencilLayout-03318]] 4539 pname:stencilLayout must: not be ename:VK_IMAGE_LAYOUT_UNDEFINED, 4540 ename:VK_IMAGE_LAYOUT_PREINITIALIZED, 4541 ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, 4542 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, 4543 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, 4544 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, 4545 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, 4546 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, 4547 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, or 4548 ename:VK_IMAGE_LAYOUT_PRESENT_SRC_KHR 4549**** 4550 4551include::{generated}/validity/structs/VkAttachmentReferenceStencilLayout.adoc[] 4552-- 4553endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 4554 4555[open,refpage='VkSubpassDependency2',desc='Structure specifying a subpass dependency',type='structs',alias='VkSubpassDependency2KHR'] 4556-- 4557:refpage: VkSubpassDependency2 4558The sname:VkSubpassDependency2 structure is defined as: 4559 4560include::{generated}/api/structs/VkSubpassDependency2.adoc[] 4561 4562ifdef::VK_KHR_create_renderpass2[] 4563or the equivalent 4564 4565include::{generated}/api/structs/VkSubpassDependency2KHR.adoc[] 4566endif::VK_KHR_create_renderpass2[] 4567 4568 * pname:sType is a elink:VkStructureType value identifying this structure. 4569 * pname:pNext is `NULL` or a pointer to a structure extending this 4570 structure. 4571 * pname:srcSubpass is the subpass index of the first subpass in the 4572 dependency, or ename:VK_SUBPASS_EXTERNAL. 4573 * pname:dstSubpass is the subpass index of the second subpass in the 4574 dependency, or ename:VK_SUBPASS_EXTERNAL. 4575 * pname:srcStageMask is a bitmask of elink:VkPipelineStageFlagBits 4576 specifying the <<synchronization-pipeline-stages-masks, source stage 4577 mask>>. 4578 * pname:dstStageMask is a bitmask of elink:VkPipelineStageFlagBits 4579 specifying the <<synchronization-pipeline-stages-masks, destination 4580 stage mask>> 4581 * pname:srcAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 4582 <<synchronization-access-masks, source access mask>>. 4583 * pname:dstAccessMask is a bitmask of elink:VkAccessFlagBits specifying a 4584 <<synchronization-access-masks, destination access mask>>. 4585 * pname:dependencyFlags is a bitmask of elink:VkDependencyFlagBits. 4586 * pname:viewOffset controls which views in the source subpass the views in 4587 the destination subpass depend on. 4588 4589Parameters defined by this structure with the same name as those in 4590slink:VkSubpassDependency have the identical effect to those parameters. 4591 4592pname:viewOffset has the same effect for the described subpass dependency as 4593slink:VkRenderPassMultiviewCreateInfo::pname:pViewOffsets has on each 4594corresponding subpass dependency. 4595 4596ifdef::VK_VERSION_1_3,VK_KHR_synchronization2[] 4597If a slink:VkMemoryBarrier2 is included in the pname:pNext chain, 4598pname:srcStageMask, pname:dstStageMask, pname:srcAccessMask, and 4599pname:dstAccessMask parameters are ignored. 4600The synchronization and access scopes instead are defined by the parameters 4601of slink:VkMemoryBarrier2. 4602endif::VK_VERSION_1_3,VK_KHR_synchronization2[] 4603 4604.Valid Usage 4605**** 4606:stageMaskName: srcStageMask 4607include::{chapters}/commonvalidity/stage_mask_common.adoc[] 4608 4609:stageMaskName: dstStageMask 4610include::{chapters}/commonvalidity/stage_mask_common.adoc[] 4611 4612 * [[VUID-VkSubpassDependency2-srcSubpass-03084]] 4613 pname:srcSubpass must: be less than or equal to pname:dstSubpass, unless 4614 one of them is ename:VK_SUBPASS_EXTERNAL, to avoid cyclic dependencies 4615 and ensure a valid execution order 4616 * [[VUID-VkSubpassDependency2-srcSubpass-03085]] 4617 pname:srcSubpass and pname:dstSubpass must: not both be equal to 4618 ename:VK_SUBPASS_EXTERNAL 4619 * [[VUID-VkSubpassDependency2-srcSubpass-06810]] 4620 If pname:srcSubpass is equal to pname:dstSubpass and pname:srcStageMask 4621 includes a <<synchronization-framebuffer-regions,framebuffer-space 4622 stage>>, pname:dstStageMask must: only contain 4623 <<synchronization-framebuffer-regions, framebuffer-space stages>> 4624 * [[VUID-VkSubpassDependency2-srcAccessMask-03088]] 4625 Any access flag included in pname:srcAccessMask must: be supported by 4626 one of the pipeline stages in pname:srcStageMask, as specified in the 4627 <<synchronization-access-types-supported, table of supported access 4628 types>> 4629 * [[VUID-VkSubpassDependency2-dstAccessMask-03089]] 4630 Any access flag included in pname:dstAccessMask must: be supported by 4631 one of the pipeline stages in pname:dstStageMask, as specified in the 4632 <<synchronization-access-types-supported, table of supported access 4633 types>> 4634 * [[VUID-VkSubpassDependency2-dependencyFlags-03090]] 4635 If pname:dependencyFlags includes ename:VK_DEPENDENCY_VIEW_LOCAL_BIT, 4636 pname:srcSubpass must: not be equal to ename:VK_SUBPASS_EXTERNAL 4637 * [[VUID-VkSubpassDependency2-dependencyFlags-03091]] 4638 If pname:dependencyFlags includes ename:VK_DEPENDENCY_VIEW_LOCAL_BIT, 4639 pname:dstSubpass must: not be equal to ename:VK_SUBPASS_EXTERNAL 4640 * [[VUID-VkSubpassDependency2-srcSubpass-02245]] 4641 If pname:srcSubpass equals pname:dstSubpass, and pname:srcStageMask and 4642 pname:dstStageMask both include a 4643 <<synchronization-framebuffer-regions,framebuffer-space stage>>, then 4644 pname:dependencyFlags must: include ename:VK_DEPENDENCY_BY_REGION_BIT 4645 * [[VUID-VkSubpassDependency2-viewOffset-02530]] 4646 If pname:viewOffset is not equal to `0`, pname:srcSubpass must: not be 4647 equal to pname:dstSubpass 4648 * [[VUID-VkSubpassDependency2-dependencyFlags-03092]] 4649 If pname:dependencyFlags does not include 4650 ename:VK_DEPENDENCY_VIEW_LOCAL_BIT, pname:viewOffset must: be `0` 4651**** 4652 4653include::{generated}/validity/structs/VkSubpassDependency2.adoc[] 4654-- 4655endif::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 4656 4657[open,refpage='vkDestroyRenderPass',desc='Destroy a render pass object',type='protos'] 4658-- 4659To destroy a render pass, call: 4660 4661include::{generated}/api/protos/vkDestroyRenderPass.adoc[] 4662 4663 * pname:device is the logical device that destroys the render pass. 4664 * pname:renderPass is the handle of the render pass to destroy. 4665 * pname:pAllocator controls host memory allocation as described in the 4666 <<memory-allocation, Memory Allocation>> chapter. 4667 4668.Valid Usage 4669**** 4670 * [[VUID-vkDestroyRenderPass-renderPass-00873]] 4671 All submitted commands that refer to pname:renderPass must: have 4672 completed execution 4673ifndef::VKSC_VERSION_1_0[] 4674 * [[VUID-vkDestroyRenderPass-renderPass-00874]] 4675 If sname:VkAllocationCallbacks were provided when pname:renderPass was 4676 created, a compatible set of callbacks must: be provided here 4677 * [[VUID-vkDestroyRenderPass-renderPass-00875]] 4678 If no sname:VkAllocationCallbacks were provided when pname:renderPass 4679 was created, pname:pAllocator must: be `NULL` 4680endif::VKSC_VERSION_1_0[] 4681**** 4682 4683include::{generated}/validity/protos/vkDestroyRenderPass.adoc[] 4684-- 4685 4686 4687[[renderpass-compatibility]] 4688== Render Pass Compatibility 4689 4690Framebuffers and graphics pipelines are created based on a specific render 4691pass object. 4692They must: only be used with that render pass object, or one compatible with 4693it. 4694 4695Two attachment references are compatible if they have matching format and 4696sample count, or are both ename:VK_ATTACHMENT_UNUSED or the pointer that 4697would contain the reference is `NULL`. 4698 4699Two arrays of attachment references are compatible if all corresponding 4700pairs of attachments are compatible. 4701If the arrays are of different lengths, attachment references not present in 4702the smaller array are treated as ename:VK_ATTACHMENT_UNUSED. 4703 4704Two render passes are compatible if their corresponding color, input, 4705resolve, and depth/stencil attachment references are compatible and if they 4706are otherwise identical except for: 4707 4708 * Initial and final image layout in attachment descriptions 4709 * Load and store operations in attachment descriptions 4710 * Image layout in attachment references 4711 4712As an additional special case, if two render passes have a single subpass, 4713the resolve attachment reference 4714ifdef::VK_KHR_depth_stencil_resolve[] 4715and depth/stencil resolve mode 4716endif::VK_KHR_depth_stencil_resolve[] 4717compatibility requirements are ignored. 4718 4719A framebuffer is compatible with a render pass if it was created using the 4720same render pass or a compatible render pass. 4721 4722 4723== Framebuffers 4724 4725[open,refpage='VkFramebuffer',desc='Opaque handle to a framebuffer object',type='handles'] 4726-- 4727Render passes operate in conjunction with _framebuffers_. 4728Framebuffers represent a collection of specific memory attachments that a 4729render pass instance uses. 4730 4731Framebuffers are represented by sname:VkFramebuffer handles: 4732 4733include::{generated}/api/handles/VkFramebuffer.adoc[] 4734-- 4735 4736[open,refpage='vkCreateFramebuffer',desc='Create a new framebuffer object',type='protos'] 4737-- 4738:refpage: vkCreateFramebuffer 4739:objectnameplural: framebuffers 4740:objectnamecamelcase: framebuffer 4741:objectcount: 1 4742 4743To create a framebuffer, call: 4744 4745include::{generated}/api/protos/vkCreateFramebuffer.adoc[] 4746 4747 * pname:device is the logical device that creates the framebuffer. 4748 * pname:pCreateInfo is a pointer to a slink:VkFramebufferCreateInfo 4749 structure describing additional information about framebuffer creation. 4750 * pname:pAllocator controls host memory allocation as described in the 4751 <<memory-allocation, Memory Allocation>> chapter. 4752 * pname:pFramebuffer is a pointer to a slink:VkFramebuffer handle in which 4753 the resulting framebuffer object is returned. 4754 4755include::{chapters}/commonvalidity/no_dynamic_allocations_common.adoc[] 4756 4757.Valid Usage 4758**** 4759 * [[VUID-vkCreateFramebuffer-pCreateInfo-02777]] 4760 If pname:pCreateInfo->flags does not include 4761 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, and pname:attachmentCount is 4762 not `0`, each element of pname:pCreateInfo->pAttachments must: have been 4763 created on pname:device 4764include::{chapters}/commonvalidity/memory_reservation_request_count_common.adoc[] 4765**** 4766 4767include::{generated}/validity/protos/vkCreateFramebuffer.adoc[] 4768-- 4769 4770[open,refpage='VkFramebufferCreateInfo',desc='Structure specifying parameters of a newly created framebuffer',type='structs'] 4771-- 4772The sname:VkFramebufferCreateInfo structure is defined as: 4773 4774include::{generated}/api/structs/VkFramebufferCreateInfo.adoc[] 4775 4776 * pname:sType is a elink:VkStructureType value identifying this structure. 4777 * pname:pNext is `NULL` or a pointer to a structure extending this 4778 structure. 4779 * pname:flags is a bitmask of elink:VkFramebufferCreateFlagBits 4780 * pname:renderPass is a render pass defining what render passes the 4781 framebuffer will be compatible with. 4782 See <<renderpass-compatibility,Render Pass Compatibility>> for details. 4783 * pname:attachmentCount is the number of attachments. 4784 * pname:pAttachments is a pointer to an array of slink:VkImageView 4785 handles, each of which will be used as the corresponding attachment in a 4786 render pass instance. 4787ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 4788 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, this 4789 parameter is ignored. 4790endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 4791 * pname:width, pname:height and pname:layers define the dimensions of the 4792 framebuffer. 4793ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 4794 If the render pass uses multiview, then pname:layers must: be one and 4795 each attachment requires a number of layers that is greater than the 4796 maximum bit index set in the view mask in the subpasses in which it is 4797 used. 4798endif::VK_VERSION_1_1,VK_KHR_multiview[] 4799 4800[[renderpass-noattachments]] 4801It is legal for a subpass to use no color or depth/stencil attachments, 4802either because it has no attachment references or because all of them are 4803ename:VK_ATTACHMENT_UNUSED. 4804This kind of subpass can: use shader side effects such as image stores and 4805atomics to produce an output. 4806In this case, the subpass continues to use the pname:width, pname:height, 4807and pname:layers of the framebuffer to define the dimensions of the 4808rendering area, and the pname:rasterizationSamples from each pipeline's 4809slink:VkPipelineMultisampleStateCreateInfo to define the number of samples 4810used in rasterization; however, if 4811slink:VkPhysicalDeviceFeatures::pname:variableMultisampleRate is 4812ename:VK_FALSE, then all pipelines to be bound with the subpass must: have 4813the same value for 4814slink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples. 4815In all such cases, pname:rasterizationSamples must: be a valid 4816elink:VkSampleCountFlagBits value that is set in 4817slink:VkPhysicalDeviceLimits::pname:framebufferNoAttachmentsSampleCounts. 4818 4819.Valid Usage 4820**** 4821 * [[VUID-VkFramebufferCreateInfo-attachmentCount-00876]] 4822 pname:attachmentCount must: be equal to the attachment count specified 4823 in pname:renderPass 4824 * [[VUID-VkFramebufferCreateInfo-flags-02778]] 4825 If pname:flags does not include 4826 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT and pname:attachmentCount is 4827 not `0`, pname:pAttachments must: be a valid pointer to an array of 4828 pname:attachmentCount valid slink:VkImageView handles 4829 * [[VUID-VkFramebufferCreateInfo-pAttachments-00877]] 4830 If pname:flags does not include 4831 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4832 pname:pAttachments that is used as a color attachment or resolve 4833 attachment by pname:renderPass must: have been created with a 4834 pname:usage value including ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT 4835 * [[VUID-VkFramebufferCreateInfo-pAttachments-02633]] 4836 If pname:flags does not include 4837 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4838 pname:pAttachments that is used as a depth/stencil attachment by 4839 pname:renderPass must: have been created with a pname:usage value 4840 including ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 4841ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 4842 * [[VUID-VkFramebufferCreateInfo-pAttachments-02634]] 4843 If pname:flags does not include 4844 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4845 pname:pAttachments that is used as a depth/stencil resolve attachment by 4846 pname:renderPass must: have been created with a pname:usage value 4847 including ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 4848endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 4849 * [[VUID-VkFramebufferCreateInfo-pAttachments-00879]] 4850 If pname:renderpass is not dlink:VK_NULL_HANDLE, pname:flags does not 4851 include ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4852 pname:pAttachments that is used as an input attachment by 4853 pname:renderPass must: have been created with a pname:usage value 4854 including ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT 4855ifdef::VK_EXT_fragment_density_map[] 4856 * [[VUID-VkFramebufferCreateInfo-pAttachments-02552]] 4857 Each element of pname:pAttachments that is used as a fragment density 4858 map attachment by pname:renderPass must: not have been created with a 4859 pname:flags value including ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT 4860 * [[VUID-VkFramebufferCreateInfo-renderPass-02553]] 4861 If pname:renderPass has a fragment density map attachment and the 4862 <<features-fragmentDensityMapNonSubsampledImages, 4863 pname:fragmentDensityMapNonSubsampledImages>> feature is not enabled, 4864 each element of pname:pAttachments must: have been created with a 4865 pname:flags value including ename:VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT 4866 unless that element is the fragment density map attachment 4867ifdef::VK_QCOM_fragment_density_map_offset[] 4868 * [[VUID-VkFramebufferCreateInfo-renderPass-06502]] 4869 If pname:renderPass was created with 4870 <<renderpass-fragmentdensitymapoffsets,fragment density map offsets>> 4871 other than [eq]#(0,0)#, each element of pname:pAttachments must: have 4872 been created with a pname:flags value including 4873 ename:VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM 4874endif::VK_QCOM_fragment_density_map_offset[] 4875endif::VK_EXT_fragment_density_map[] 4876 * [[VUID-VkFramebufferCreateInfo-pAttachments-00880]] 4877 If pname:flags does not include 4878 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4879 pname:pAttachments must: have been created with a elink:VkFormat value 4880 that matches the elink:VkFormat specified by the corresponding 4881 sname:VkAttachmentDescription in pname:renderPass 4882 * [[VUID-VkFramebufferCreateInfo-pAttachments-00881]] 4883 If pname:flags does not include 4884 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4885 pname:pAttachments must: have been created with a pname:samples value 4886 that matches the pname:samples value specified by the corresponding 4887 sname:VkAttachmentDescription in pname:renderPass 4888 * [[VUID-VkFramebufferCreateInfo-flags-04533]] 4889 If pname:flags does not include 4890 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4891 pname:pAttachments that is used as an input, color, resolve, or 4892 depth/stencil attachment by pname:renderPass must: have been created 4893 with a slink:VkImageCreateInfo::pname:extent.width greater than or equal 4894 to pname:width 4895 * [[VUID-VkFramebufferCreateInfo-flags-04534]] 4896 If pname:flags does not include 4897 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4898 pname:pAttachments that is used as an input, color, resolve, or 4899 depth/stencil attachment by pname:renderPass must: have been created 4900 with a slink:VkImageCreateInfo::pname:extent.height greater than or 4901 equal to pname:height 4902 * [[VUID-VkFramebufferCreateInfo-flags-04535]] 4903 If pname:flags does not include 4904 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4905 pname:pAttachments that is used as an input, color, resolve, or 4906 depth/stencil attachment by pname:renderPass must: have been created 4907 with a slink:VkImageViewCreateInfo::pname:subresourceRange.layerCount 4908 greater than or equal to pname:layers 4909ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 4910 * [[VUID-VkFramebufferCreateInfo-renderPass-04536]] 4911 If pname:renderPass was specified with non-zero view masks, each element 4912 of pname:pAttachments that is used as an input, color, resolve, or 4913 depth/stencil attachment by pname:renderPass must: have a 4914 pname:layerCount greater than the index of the most significant bit set 4915 in any of those view masks 4916endif::VK_VERSION_1_1,VK_KHR_multiview[] 4917ifdef::VK_EXT_fragment_density_map[] 4918 * [[VUID-VkFramebufferCreateInfo-renderPass-02746]] 4919 Each element of pname:pAttachments that is referenced by 4920 pname:fragmentDensityMapAttachment must: have a pname:layerCount equal 4921 to `1` 4922ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 4923 or if pname:renderPass was specified with non-zero view masks, greater 4924 than the index of the most significant bit set in any of those view 4925 masks 4926endif::VK_VERSION_1_1,VK_KHR_multiview[] 4927 * [[VUID-VkFramebufferCreateInfo-pAttachments-02555]] 4928 If pname:flags does not include 4929 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, an element of 4930 pname:pAttachments that is referenced by 4931 pname:fragmentDensityMapAttachment must: have a width at least as large 4932 as 4933 latexmath:[\left\lceil{\frac{width}{maxFragmentDensityTexelSize_{width}}}\right\rceil] 4934 * [[VUID-VkFramebufferCreateInfo-pAttachments-02556]] 4935 If pname:flags does not include 4936 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, an element of 4937 pname:pAttachments that is referenced by 4938 pname:fragmentDensityMapAttachment must: have a height at least as large 4939 as 4940 latexmath:[\left\lceil{\frac{height}{maxFragmentDensityTexelSize_{height}}}\right\rceil] 4941endif::VK_EXT_fragment_density_map[] 4942ifdef::VK_KHR_fragment_shading_rate[] 4943ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 4944 * [[VUID-VkFramebufferCreateInfo-flags-04537]] 4945 If pname:flags does not include 4946 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, and pname:renderPass was 4947 specified with non-zero view masks, each element of pname:pAttachments 4948 that is used as a <<primsrast-fragment-shading-rate-attachment,fragment 4949 shading rate attachment>> by pname:renderPass must: have a 4950 pname:layerCount that is either `1`, or greater than the index of the 4951 most significant bit set in any of those view masks 4952 * [[VUID-VkFramebufferCreateInfo-flags-04538]] 4953 If pname:flags does not include 4954 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, and pname:renderPass was not 4955 specified with non-zero view masks, each element of pname:pAttachments 4956 that is used as a <<primsrast-fragment-shading-rate-attachment,fragment 4957 shading rate attachment>> by pname:renderPass must: have a 4958 pname:layerCount that is either `1`, or greater than pname:layers 4959 * [[VUID-VkFramebufferCreateInfo-renderPass-08921]] 4960 If pname:renderPass was specified with non-zero view masks, each element 4961 of pname:pAttachments that is used as a 4962 <<primsrast-fragment-shading-rate-attachment,fragment shading rate 4963 attachment>> must: have a pname:layerCount equal to `1` or greater than 4964 the index of the most significant bit set in any of those view masks 4965endif::VK_VERSION_1_1,VK_KHR_multiview[] 4966 * [[VUID-VkFramebufferCreateInfo-flags-04539]] 4967 If pname:flags does not include 4968 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, an element of 4969 pname:pAttachments that is used as a 4970 <<primsrast-fragment-shading-rate-attachment, fragment shading rate 4971 attachment>> must: have a width at least as large as 4972 [eq]#{lceil}pname:width / code:texelWidth{rceil}#, where code:texelWidth 4973 is the largest value of pname:shadingRateAttachmentTexelSize.width in a 4974 slink:VkFragmentShadingRateAttachmentInfoKHR which references that 4975 attachment 4976 * [[VUID-VkFramebufferCreateInfo-flags-04540]] 4977 If pname:flags does not include 4978 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, an element of 4979 pname:pAttachments that is used as a 4980 <<primsrast-fragment-shading-rate-attachment, fragment shading rate 4981 attachment>> must: have a height at least as large as 4982 [eq]#{lceil}pname:height / code:texelHeight{rceil}#, where 4983 code:texelHeight is the largest value of 4984 pname:shadingRateAttachmentTexelSize.height in a 4985 slink:VkFragmentShadingRateAttachmentInfoKHR which references that 4986 attachment 4987endif::VK_KHR_fragment_shading_rate[] 4988 * [[VUID-VkFramebufferCreateInfo-pAttachments-00883]] 4989 If pname:flags does not include 4990 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4991 pname:pAttachments must: only specify a single mip level 4992 * [[VUID-VkFramebufferCreateInfo-pAttachments-00884]] 4993 If pname:flags does not include 4994 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 4995 pname:pAttachments must: have been created with the identity swizzle 4996 * [[VUID-VkFramebufferCreateInfo-width-00885]] 4997 pname:width must: be greater than `0` 4998 * [[VUID-VkFramebufferCreateInfo-width-00886]] 4999 pname:width must: be less than or equal to <<limits-maxFramebufferWidth, 5000 pname:maxFramebufferWidth>> 5001 * [[VUID-VkFramebufferCreateInfo-height-00887]] 5002 pname:height must: be greater than `0` 5003 * [[VUID-VkFramebufferCreateInfo-height-00888]] 5004 pname:height must: be less than or equal to 5005 <<limits-maxFramebufferHeight, pname:maxFramebufferHeight>> 5006 * [[VUID-VkFramebufferCreateInfo-layers-00889]] 5007 pname:layers must: be greater than `0` 5008 * [[VUID-VkFramebufferCreateInfo-layers-00890]] 5009 pname:layers must: be less than or equal to 5010 <<limits-maxFramebufferLayers, pname:maxFramebufferLayers>> 5011ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 5012 * [[VUID-VkFramebufferCreateInfo-renderPass-02531]] 5013 If pname:renderPass was specified with non-zero view masks, pname:layers 5014 must: be `1` 5015endif::VK_VERSION_1_1,VK_KHR_multiview[] 5016ifdef::VK_VERSION_1_1,VK_KHR_maintenance1[] 5017 * [[VUID-VkFramebufferCreateInfo-pAttachments-00891]] 5018 If pname:flags does not include 5019 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 5020 pname:pAttachments that is a 2D or 2D array image view taken from a 3D 5021 image must: not be a depth/stencil format 5022endif::VK_VERSION_1_1,VK_KHR_maintenance1[] 5023ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5024 * [[VUID-VkFramebufferCreateInfo-flags-03189]] 5025 If the <<features-imagelessFramebuffer, pname:imagelessFramebuffer>> 5026 feature is not enabled, pname:flags must: not include 5027 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT 5028 * [[VUID-VkFramebufferCreateInfo-flags-03190]] 5029 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5030 pname:pNext chain must: include a 5031 slink:VkFramebufferAttachmentsCreateInfo structure 5032 * [[VUID-VkFramebufferCreateInfo-flags-03191]] 5033 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5034 pname:attachmentImageInfoCount member of a 5035 slink:VkFramebufferAttachmentsCreateInfo structure in the pname:pNext 5036 chain must: be equal to either zero or pname:attachmentCount 5037 * [[VUID-VkFramebufferCreateInfo-flags-04541]] 5038 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5039 pname:width member of any element of the pname:pAttachmentImageInfos 5040 member of a slink:VkFramebufferAttachmentsCreateInfo structure in the 5041 pname:pNext chain that is used as an input, color, resolve or 5042 depth/stencil attachment in pname:renderPass must: be greater than or 5043 equal to pname:width 5044 * [[VUID-VkFramebufferCreateInfo-flags-04542]] 5045 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5046 pname:height member of any element of the pname:pAttachmentImageInfos 5047 member of a slink:VkFramebufferAttachmentsCreateInfo structure in the 5048 pname:pNext chain that is used as an input, color, resolve or 5049 depth/stencil attachment in pname:renderPass must: be greater than or 5050 equal to pname:height 5051ifdef::VK_EXT_fragment_density_map[] 5052 * [[VUID-VkFramebufferCreateInfo-flags-03196]] 5053 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5054 pname:width member of any element of the pname:pAttachmentImageInfos 5055 member of a slink:VkFramebufferAttachmentsCreateInfo structure in the 5056 pname:pNext chain that is referenced by 5057 slink:VkRenderPassFragmentDensityMapCreateInfoEXT::pname:fragmentDensityMapAttachment 5058 in pname:renderPass must: be greater than or equal to 5059 latexmath:[\left\lceil{\frac{width}{maxFragmentDensityTexelSize_{width}}}\right\rceil] 5060 * [[VUID-VkFramebufferCreateInfo-flags-03197]] 5061 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5062 pname:height member of any element of the pname:pAttachmentImageInfos 5063 member of a slink:VkFramebufferAttachmentsCreateInfo structure included 5064 in the pname:pNext chain that is referenced by 5065 slink:VkRenderPassFragmentDensityMapCreateInfoEXT::pname:fragmentDensityMapAttachment 5066 in pname:renderPass must: be greater than or equal to 5067 latexmath:[\left\lceil{\frac{height}{maxFragmentDensityTexelSize_{height}}}\right\rceil] 5068endif::VK_EXT_fragment_density_map[] 5069ifdef::VK_KHR_fragment_shading_rate[] 5070 * [[VUID-VkFramebufferCreateInfo-flags-04543]] 5071 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5072 pname:width member of any element of the pname:pAttachmentImageInfos 5073 member of a slink:VkFramebufferAttachmentsCreateInfo structure in the 5074 pname:pNext chain that is used as a 5075 <<primsrast-fragment-shading-rate-attachment, fragment shading rate 5076 attachment>> must: be greater than or equal to [eq]#{lceil}pname:width / 5077 code:texelWidth{rceil}#, where code:texelWidth is the largest value of 5078 pname:shadingRateAttachmentTexelSize.width in a 5079 slink:VkFragmentShadingRateAttachmentInfoKHR which references that 5080 attachment 5081 * [[VUID-VkFramebufferCreateInfo-flags-04544]] 5082 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5083 pname:height member of any element of the pname:pAttachmentImageInfos 5084 member of a slink:VkFramebufferAttachmentsCreateInfo structure in the 5085 pname:pNext chain that is used as a 5086 <<primsrast-fragment-shading-rate-attachment, fragment shading rate 5087 attachment>> must: be greater than or equal to [eq]#{lceil}pname:height 5088 / code:texelHeight{rceil}#, where code:texelHeight is the largest value 5089 of pname:shadingRateAttachmentTexelSize.height in a 5090 slink:VkFragmentShadingRateAttachmentInfoKHR which references that 5091 attachment 5092 * [[VUID-VkFramebufferCreateInfo-flags-04545]] 5093 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5094 pname:layerCount member of any element of the 5095 pname:pAttachmentImageInfos member of a 5096 slink:VkFramebufferAttachmentsCreateInfo structure in the pname:pNext 5097 chain that is used as a <<primsrast-fragment-shading-rate-attachment, 5098 fragment shading rate attachment>> must: be either `1`, or greater than 5099 or equal to pname:layers 5100 * [[VUID-VkFramebufferCreateInfo-flags-04587]] 5101 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT and 5102 pname:renderPass was specified with non-zero view masks, each element of 5103 pname:pAttachments that is used as a 5104 <<primsrast-fragment-shading-rate-attachment,fragment shading rate 5105 attachment>> by pname:renderPass must: have a pname:layerCount that is 5106 either `1`, or greater than the index of the most significant bit set in 5107 any of those view masks 5108endif::VK_KHR_fragment_shading_rate[] 5109ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 5110 * [[VUID-VkFramebufferCreateInfo-renderPass-03198]] 5111 If multiview is enabled for pname:renderPass and pname:flags includes 5112 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the pname:layerCount member 5113 of any element of the pname:pAttachmentImageInfos member of a 5114 slink:VkFramebufferAttachmentsCreateInfo structure included in the 5115 pname:pNext chain used as an input, color, resolve, or depth/stencil 5116 attachment in pname:renderPass must: be greater than the maximum bit 5117 index set in the view mask in the subpasses in which it is used in 5118 pname:renderPass 5119endif::VK_VERSION_1_1,VK_KHR_multiview[] 5120 * [[VUID-VkFramebufferCreateInfo-renderPass-04546]] 5121 If 5122ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 5123 multiview is not enabled for pname:renderPass and 5124endif::VK_VERSION_1_1,VK_KHR_multiview[] 5125 pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5126 pname:layerCount member of any element of the 5127 pname:pAttachmentImageInfos member of a 5128 slink:VkFramebufferAttachmentsCreateInfo structure included in the 5129 pname:pNext chain used as an input, color, resolve, or depth/stencil 5130 attachment in pname:renderPass must: be greater than or equal to 5131 pname:layers 5132 * [[VUID-VkFramebufferCreateInfo-flags-03201]] 5133 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5134 pname:usage member of any element of the pname:pAttachmentImageInfos 5135 member of a slink:VkFramebufferAttachmentsCreateInfo structure included 5136 in the pname:pNext chain that refers to an attachment used as a color 5137 attachment or resolve attachment by pname:renderPass must: include 5138 ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT 5139 * [[VUID-VkFramebufferCreateInfo-flags-03202]] 5140 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5141 pname:usage member of any element of the pname:pAttachmentImageInfos 5142 member of a slink:VkFramebufferAttachmentsCreateInfo structure included 5143 in the pname:pNext chain that refers to an attachment used as a 5144 depth/stencil attachment by pname:renderPass must: include 5145 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5146ifdef::VK_KHR_depth_stencil_resolve[] 5147 * [[VUID-VkFramebufferCreateInfo-flags-03203]] 5148 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5149 pname:usage member of any element of the pname:pAttachmentImageInfos 5150 member of a slink:VkFramebufferAttachmentsCreateInfo structure included 5151 in the pname:pNext chain that refers to an attachment used as a 5152 depth/stencil resolve attachment by pname:renderPass must: include 5153 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5154endif::VK_KHR_depth_stencil_resolve[] 5155 * [[VUID-VkFramebufferCreateInfo-flags-03204]] 5156 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5157 pname:usage member of any element of the pname:pAttachmentImageInfos 5158 member of a slink:VkFramebufferAttachmentsCreateInfo structure included 5159 in the pname:pNext chain that refers to an attachment used as an input 5160 attachment by pname:renderPass must: include 5161 ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT 5162 * [[VUID-VkFramebufferCreateInfo-flags-03205]] 5163 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, at 5164 least one element of the pname:pViewFormats member of any element of the 5165 pname:pAttachmentImageInfos member of a 5166 slink:VkFramebufferAttachmentsCreateInfo structure included in the 5167 pname:pNext chain must: be equal to the corresponding value of 5168 slink:VkAttachmentDescription::pname:format used to create 5169 pname:renderPass 5170endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5171 * [[VUID-VkFramebufferCreateInfo-flags-04113]] 5172 If pname:flags does not include 5173 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 5174 pname:pAttachments must: have been created with 5175 slink:VkImageViewCreateInfo::pname:viewType not equal to 5176 ename:VK_IMAGE_VIEW_TYPE_3D 5177ifdef::VK_KHR_fragment_shading_rate[] 5178 * [[VUID-VkFramebufferCreateInfo-flags-04548]] 5179 If pname:flags does not include 5180 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of 5181 pname:pAttachments that is used as a fragment shading rate attachment by 5182 pname:renderPass must: have been created with a pname:usage value 5183 including ename:VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 5184ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5185 * [[VUID-VkFramebufferCreateInfo-flags-04549]] 5186 If pname:flags includes ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the 5187 pname:usage member of any element of the pname:pAttachmentImageInfos 5188 member of a slink:VkFramebufferAttachmentsCreateInfo structure included 5189 in the pname:pNext chain that refers to an attachment used as a fragment 5190 shading rate attachment by pname:renderPass must: include 5191 ename:VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 5192endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5193endif::VK_KHR_fragment_shading_rate[] 5194ifdef::VKSC_VERSION_1_0[] 5195 * [[VUID-VkFramebufferCreateInfo-attachmentCount-05060]] 5196 pname:attachmentCount must: be less than or equal to 5197 <<limits-maxFramebufferAttachments,maxFramebufferAttachments>> 5198endif::VKSC_VERSION_1_0[] 5199ifdef::VK_EXT_multisampled_render_to_single_sampled[] 5200 * [[VUID-VkFramebufferCreateInfo-samples-06881]] 5201 If 5202 <<subpass-multisampledrendertosinglesampled,multisampled-render-to-single-sampled>> 5203 is enabled for any subpass, all color, depth/stencil and input 5204 attachments used in that subpass which have 5205 sname:VkAttachmentDescription::pname:samples or 5206 sname:VkAttachmentDescription2::pname:samples equal to 5207 ename:VK_SAMPLE_COUNT_1_BIT must: have been created with 5208 ename:VK_IMAGE_CREATE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_BIT_EXT in 5209 their slink:VkImageCreateInfo::pname:flags 5210 * [[VUID-VkFramebufferCreateInfo-samples-07009]] 5211 If 5212 <<subpass-multisampledrendertosinglesampled,multisampled-render-to-single-sampled>> 5213 is enabled for any subpass, all color, depth/stencil and input 5214 attachments used in that subpass which have 5215 sname:VkAttachmentDescription::pname:samples or 5216 sname:VkAttachmentDescription2::pname:samples equal to 5217 ename:VK_SAMPLE_COUNT_1_BIT must: have a format that supports the sample 5218 count specified in 5219 slink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples 5220endif::VK_EXT_multisampled_render_to_single_sampled[] 5221ifdef::VK_ANDROID_external_format_resolve[] 5222 * [[VUID-VkFramebufferCreateInfo-nullColorAttachmentWithExternalFormatResolve-09349]] 5223 If the <<limits-nullColorAttachmentWithExternalFormatResolve, 5224 pname:nullColorAttachmentWithExternalFormatResolve>> is ename:VK_FALSE, 5225ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5226 and pname:flags does not include 5227 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, 5228endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5229 the format of the color attachment for each subpass in pname:renderPass 5230 that includes an external format image as a resolve attachment must: 5231 have a format equal to the value of 5232 slink:VkAndroidHardwareBufferFormatResolvePropertiesANDROID::pname:colorAttachmentFormat 5233 as returned by a call to 5234 flink:vkGetAndroidHardwareBufferPropertiesANDROID for the Android 5235 hardware buffer that was used to create the image view use as its 5236 resolve attachment 5237 * [[VUID-VkFramebufferCreateInfo-pAttachments-09350]] 5238 If 5239ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5240 pname:flags does not include ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, 5241 then if 5242endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5243 an element of pname:pAttachments has a format of 5244 ename:VK_FORMAT_UNDEFINED, it must: have been created with a 5245 slink:VkExternalFormatANDROID::pname:externalFormat value identical to 5246 that provided in the slink:VkExternalFormatANDROID::pname:externalFormat 5247 specified by the corresponding slink:VkAttachmentDescription2 in 5248 pname:renderPass 5249endif::VK_ANDROID_external_format_resolve[] 5250**** 5251 5252include::{generated}/validity/structs/VkFramebufferCreateInfo.adoc[] 5253-- 5254 5255ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5256[open,refpage='VkFramebufferAttachmentsCreateInfo',desc='Structure specifying parameters of images that will be used with a framebuffer',type='structs',alias='VkFramebufferAttachmentsCreateInfo'] 5257-- 5258The sname:VkFramebufferAttachmentsCreateInfo structure is defined as: 5259 5260include::{generated}/api/structs/VkFramebufferAttachmentsCreateInfo.adoc[] 5261 5262ifdef::VK_KHR_imageless_framebuffer[] 5263or the equivalent 5264 5265include::{generated}/api/structs/VkFramebufferAttachmentsCreateInfoKHR.adoc[] 5266endif::VK_KHR_imageless_framebuffer[] 5267 5268 * pname:sType is a elink:VkStructureType value identifying this structure. 5269 * pname:pNext is `NULL` or a pointer to a structure extending this 5270 structure. 5271 * pname:attachmentImageInfoCount is the number of attachments being 5272 described. 5273 * pname:pAttachmentImageInfos is a pointer to an array of 5274 slink:VkFramebufferAttachmentImageInfo structures, each structure 5275 describing a number of parameters of the corresponding attachment in a 5276 render pass instance. 5277 5278include::{generated}/validity/structs/VkFramebufferAttachmentsCreateInfo.adoc[] 5279-- 5280 5281[open,refpage='VkFramebufferAttachmentImageInfo',desc='Structure specifying parameters of an image that will be used with a framebuffer',type='structs',alias='VkFramebufferAttachmentImageInfoKHR'] 5282-- 5283The sname:VkFramebufferAttachmentImageInfo structure is defined as: 5284 5285include::{generated}/api/structs/VkFramebufferAttachmentImageInfo.adoc[] 5286 5287ifdef::VK_KHR_imageless_framebuffer[] 5288or the equivalent 5289 5290include::{generated}/api/structs/VkFramebufferAttachmentImageInfoKHR.adoc[] 5291endif::VK_KHR_imageless_framebuffer[] 5292 5293 * pname:sType is a elink:VkStructureType value identifying this structure. 5294 * pname:pNext is `NULL` or a pointer to a structure extending this 5295 structure. 5296 * pname:flags is a bitmask of elink:VkImageCreateFlagBits, matching the 5297 value of slink:VkImageCreateInfo::pname:flags used to create an image 5298 that will be used with this framebuffer. 5299 * pname:usage is a bitmask of elink:VkImageUsageFlagBits, matching the 5300 value of slink:VkImageCreateInfo::pname:usage used to create an image 5301 used with this framebuffer. 5302 * pname:width is the width of the image view used for rendering. 5303 * pname:height is the height of the image view used for rendering. 5304 * pname:layerCount is the number of array layers of the image view used 5305 for rendering. 5306 * pname:viewFormatCount is the number of entries in the pname:pViewFormats 5307 array, matching the value of 5308 slink:VkImageFormatListCreateInfo::pname:viewFormatCount used to create 5309 an image used with this framebuffer. 5310 * pname:pViewFormats is a pointer to an array of elink:VkFormat values 5311 specifying all of the formats which can: be used when creating views of 5312 the image, matching the value of 5313 slink:VkImageFormatListCreateInfo::pname:pViewFormats used to create an 5314 image used with this framebuffer. 5315 5316Images that can: be used with the framebuffer when beginning a render pass, 5317as specified by slink:VkRenderPassAttachmentBeginInfo, must: be created with 5318parameters that are identical to those specified here. 5319 5320 5321include::{generated}/validity/structs/VkFramebufferAttachmentImageInfo.adoc[] 5322-- 5323endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5324 5325 5326[open,refpage='VkFramebufferCreateFlagBits',desc='Bitmask specifying framebuffer properties',type='enums'] 5327-- 5328Bits which can: be set in slink:VkFramebufferCreateInfo::pname:flags, 5329specifying options for framebuffers, are: 5330 5331include::{generated}/api/enums/VkFramebufferCreateFlagBits.adoc[] 5332 5333ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5334 * ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT specifies that image views are 5335 not specified, and only attachment compatibility information will be 5336 provided via a slink:VkFramebufferAttachmentImageInfo structure. 5337endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5338 5339ifndef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5340[NOTE] 5341.Note 5342==== 5343All bits for this type are defined by extensions, and none of those 5344extensions are enabled in this build of the specification. 5345==== 5346endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 5347-- 5348 5349[open,refpage='VkFramebufferCreateFlags',desc='Bitmask of VkFramebufferCreateFlagBits',type='flags'] 5350-- 5351include::{generated}/api/flags/VkFramebufferCreateFlags.adoc[] 5352 5353tname:VkFramebufferCreateFlags is a bitmask type for setting a mask of zero 5354or more elink:VkFramebufferCreateFlagBits. 5355-- 5356 5357[open,refpage='vkDestroyFramebuffer',desc='Destroy a framebuffer object',type='protos'] 5358-- 5359To destroy a framebuffer, call: 5360 5361include::{generated}/api/protos/vkDestroyFramebuffer.adoc[] 5362 5363 * pname:device is the logical device that destroys the framebuffer. 5364 * pname:framebuffer is the handle of the framebuffer to destroy. 5365 * pname:pAllocator controls host memory allocation as described in the 5366 <<memory-allocation, Memory Allocation>> chapter. 5367 5368.Valid Usage 5369**** 5370 * [[VUID-vkDestroyFramebuffer-framebuffer-00892]] 5371 All submitted commands that refer to pname:framebuffer must: have 5372 completed execution 5373ifndef::VKSC_VERSION_1_0[] 5374 * [[VUID-vkDestroyFramebuffer-framebuffer-00893]] 5375 If sname:VkAllocationCallbacks were provided when pname:framebuffer was 5376 created, a compatible set of callbacks must: be provided here 5377 * [[VUID-vkDestroyFramebuffer-framebuffer-00894]] 5378 If no sname:VkAllocationCallbacks were provided when pname:framebuffer 5379 was created, pname:pAllocator must: be `NULL` 5380endif::VKSC_VERSION_1_0[] 5381**** 5382 5383include::{generated}/validity/protos/vkDestroyFramebuffer.adoc[] 5384-- 5385 5386 5387[[renderpass-load-operations]] 5388== Render Pass Load Operations 5389 5390Render pass load operations define the initial values of an attachment 5391during a render pass instance. 5392 5393Load operations for attachments with a depth/stencil format execute in the 5394ename:VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT pipeline stage. 5395Load operations for attachments with a color format execute in the 5396ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage. 5397The load operation for each sample in an attachment happens-before any 5398recorded command which accesses the sample in that render pass instance via 5399that attachment or an alias. 5400 5401[NOTE] 5402.Note 5403==== 5404Because load operations always happen first, external synchronization with 5405attachment access only needs to synchronize the load operations with 5406previous commands; not the operations within the render pass instance. 5407ifdef::VK_EXT_load_store_op_none[] 5408This does not apply when using ename:VK_ATTACHMENT_LOAD_OP_NONE_EXT. 5409endif::VK_EXT_load_store_op_none[] 5410==== 5411 5412Load operations only update values within the defined render area for the 5413render pass instance. 5414However, any writes performed by a load operation (as defined by its access 5415masks) to a given attachment may: read and write back any memory locations 5416within the image subresource bound for that attachment. 5417For depth/stencil images, writes to one aspect may: also result in 5418read-modify-write operations for the other aspect. 5419ifdef::VK_EXT_attachment_feedback_loop_layout[] 5420If the subresource is in the 5421ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT layout, 5422implementations must: not access pixels outside of the render area. 5423endif::VK_EXT_attachment_feedback_loop_layout[] 5424 5425[NOTE] 5426.Note 5427==== 5428As entire subresources could be accessed by load operations, applications 5429cannot safely access values outside of the render area during a render pass 5430instance when a load operation that modifies values is used. 5431==== 5432 5433[open,refpage='VkAttachmentLoadOp',desc='Specify how contents of an attachment are initialized at the beginning of a subpass',type='enums'] 5434-- 5435Load operations that can: be used for a render pass are: 5436 5437include::{generated}/api/enums/VkAttachmentLoadOp.adoc[] 5438 5439 * ename:VK_ATTACHMENT_LOAD_OP_LOAD specifies that the previous contents of 5440 the image within the render area will be preserved as the initial 5441 values. 5442 For attachments with a depth/stencil format, this uses the access type 5443 ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT. 5444 For attachments with a color format, this uses the access type 5445 ename:VK_ACCESS_COLOR_ATTACHMENT_READ_BIT. 5446 * ename:VK_ATTACHMENT_LOAD_OP_CLEAR specifies that the contents within the 5447 render area will be cleared to a uniform value, which is specified when 5448 a render pass instance is begun. 5449 For attachments with a depth/stencil format, this uses the access type 5450 ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT. 5451 For attachments with a color format, this uses the access type 5452 ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT. 5453 * ename:VK_ATTACHMENT_LOAD_OP_DONT_CARE specifies that the previous 5454 contents within the area need not be preserved; the contents of the 5455 attachment will be undefined: inside the render area. 5456 For attachments with a depth/stencil format, this uses the access type 5457 ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT. 5458 For attachments with a color format, this uses the access type 5459 ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT. 5460ifdef::VK_EXT_load_store_op_none[] 5461 * ename:VK_ATTACHMENT_LOAD_OP_NONE_EXT specifies that the previous 5462 contents of the image will be undefined: inside the render pass. 5463 No access type is used as the image is not accessed. 5464endif::VK_EXT_load_store_op_none[] 5465-- 5466 5467[[renderpass-precision]] 5468During a render pass instance, input and color attachments with color 5469formats that have a component size of 8, 16, or 32 bits must: be represented 5470in the attachment's format throughout the instance. 5471Attachments with other floating- or fixed-point color formats, or with depth 5472components may: be represented in a format with a precision higher than the 5473attachment format, but must: be represented with the same range. 5474When such a component is loaded via the pname:loadOp, it will be converted 5475into an implementation-dependent format used by the render pass. 5476Such components must: be converted from the render pass format, to the 5477format of the attachment, before they are resolved or stored at the end of a 5478render pass instance via pname:storeOp. 5479Conversions occur as described in <<fundamentals-numerics,Numeric 5480Representation and Computation>> and <<fundamentals-fixedconv, Fixed-Point 5481Data Conversions>>. 5482 5483 5484[[renderpass-store-operations]] 5485== Render Pass Store Operations 5486 5487Render pass store operations define how values written to an attachment 5488during a render pass instance are stored to memory. 5489 5490Store operations for attachments with a depth/stencil format execute in the 5491ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT pipeline stage. 5492Store operations for attachments with a color format execute in the 5493ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage. 5494The store operation for each sample in an attachment happens-after any 5495recorded command which accesses the sample via that attachment or an alias. 5496 5497[NOTE] 5498.Note 5499==== 5500Because store operations always happen after other accesses in a render pass 5501instance, external synchronization with attachment access in an earlier 5502render pass only needs to synchronize with the store operations; not the 5503operations within the render pass instance. 5504ifdef::VK_VERSION_1_3,VK_EXT_load_store_op_none,VK_KHR_dynamic_rendering,VK_QCOM_render_pass_store_ops[] 5505This does not apply when using ename:VK_ATTACHMENT_STORE_OP_NONE. 5506endif::VK_VERSION_1_3,VK_EXT_load_store_op_none,VK_KHR_dynamic_rendering,VK_QCOM_render_pass_store_ops[] 5507==== 5508 5509 5510Store operations only update values within the defined render area for the 5511render pass instance. 5512However, any writes performed by a store operation (as defined by its access 5513masks) to a given attachment may: read and write back any memory locations 5514within the image subresource bound for that attachment. 5515For depth/stencil images writes to one aspect may: also result in 5516read-modify-write operations for the other aspect. 5517ifdef::VK_EXT_attachment_feedback_loop_layout[] 5518If the subresource is in the 5519ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT layout, 5520implementations must: not access pixels outside of the render area. 5521endif::VK_EXT_attachment_feedback_loop_layout[] 5522 5523[NOTE] 5524.Note 5525==== 5526As entire subresources could be accessed by store operations, applications 5527cannot safely access values outside of the render area via aliased resources 5528during a render pass instance when a store operation that modifies values is 5529used. 5530==== 5531 5532[open,refpage='VkAttachmentStoreOp',desc='Specify how contents of an attachment are stored to memory at the end of a subpass',type='enums'] 5533-- 5534Possible values of slink:VkAttachmentDescription::pname:storeOp and 5535pname:stencilStoreOp, specifying how the contents of the attachment are 5536treated, are: 5537 5538include::{generated}/api/enums/VkAttachmentStoreOp.adoc[] 5539 5540 * ename:VK_ATTACHMENT_STORE_OP_STORE specifies the contents generated 5541 during the render pass and within the render area are written to memory. 5542 For attachments with a depth/stencil format, this uses the access type 5543 ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT. 5544 For attachments with a color format, this uses the access type 5545 ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT. 5546 * ename:VK_ATTACHMENT_STORE_OP_DONT_CARE specifies the contents within the 5547 render area are not needed after rendering, and may: be discarded; the 5548 contents of the attachment will be undefined: inside the render area. 5549 For attachments with a depth/stencil format, this uses the access type 5550 ename:VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT. 5551 For attachments with a color format, this uses the access type 5552 ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT. 5553ifdef::VK_VERSION_1_3,VK_EXT_load_store_op_none,VK_KHR_dynamic_rendering,VK_QCOM_render_pass_store_ops[] 5554 * ename:VK_ATTACHMENT_STORE_OP_NONE specifies the contents within the 5555 render area are not accessed by the store operation as long as no values 5556 are written to the attachment during the render pass. 5557 If values are written during the render pass, this behaves identically 5558 to ename:VK_ATTACHMENT_STORE_OP_DONT_CARE and with matching access 5559 semantics. 5560endif::VK_VERSION_1_3,VK_EXT_load_store_op_none,VK_KHR_dynamic_rendering,VK_QCOM_render_pass_store_ops[] 5561 5562[NOTE] 5563.Note 5564==== 5565ename:VK_ATTACHMENT_STORE_OP_DONT_CARE can: cause contents generated during 5566previous render passes to be discarded before reaching memory, even if no 5567write to the attachment occurs during the current render pass. 5568==== 5569-- 5570 5571 5572[[renderpass-resolve-operations]] 5573== Render Pass Multisample Resolve Operations 5574 5575Render pass multisample resolve operations combine sample values from a 5576single pixel in a multisample attachment and store the result to the 5577corresponding pixel in a single sample attachment. 5578 5579Multisample resolve operations for attachments execute in the 5580ename:VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT pipeline stage. 5581A final resolve operation for all pixels in the render area happens-after 5582any recorded command which writes a pixel via the multisample attachment to 5583be resolved or an explicit alias of it in the subpass that it is specified. 5584Any single sample attachment specified for use in a multisample resolve 5585operation may: have its contents modified at any point once rendering begins 5586for the render pass instance. 5587Reads from the multisample attachment can be synchronized with 5588ename:VK_ACCESS_COLOR_ATTACHMENT_READ_BIT. 5589Access to the single sample attachment can be synchronized with 5590ename:VK_ACCESS_COLOR_ATTACHMENT_READ_BIT and 5591ename:VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT. 5592ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 5593These pipeline stage and access types are used whether the attachments are 5594color or depth/stencil attachments. 5595endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 5596 5597When using render pass objects, a subpass dependency specified with the 5598above pipeline stages and access flags will ensure synchronization with 5599multisample resolve operations for any attachments that were last accessed 5600by that subpass. 5601This allows later subpasses to read resolved values as input attachments. 5602 5603Resolve operations only update values within the defined render area for the 5604render pass instance. 5605However, any writes performed by a resolve operation (as defined by its 5606access masks) to a given attachment may: read and write back any memory 5607locations within the image subresource bound for that attachment. 5608For depth/stencil images writes to one aspect may: also result in 5609read-modify-write operations for the other aspect. 5610ifdef::VK_EXT_attachment_feedback_loop_layout[] 5611If the subresource is in the 5612ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT layout, 5613implementations must: not access pixels outside of the render area. 5614endif::VK_EXT_attachment_feedback_loop_layout[] 5615 5616[NOTE] 5617.Note 5618==== 5619As entire subresources could be accessed by multisample resolve operations, 5620applications cannot safely access values outside of the render area via 5621aliased resources during a render pass instance when a multisample resolve 5622operation is performed. 5623==== 5624 5625ifndef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 5626The average value of samples for a given pixel in the multisample attachment 5627is taken and written to the single sample attachment. 5628endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 5629 5630ifdef::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 5631[open,refpage='VkResolveModeFlagBits',desc='Bitmask indicating supported depth and stencil resolve modes',type='enums',alias='VkResolveModeFlagBitsKHR'] 5632-- 5633Multisample values in a multisample attachment are combined according to the 5634resolve mode used: 5635 5636include::{generated}/api/enums/VkResolveModeFlagBits.adoc[] 5637 5638ifdef::VK_KHR_depth_stencil_resolve[] 5639or the equivalent 5640 5641include::{generated}/api/enums/VkResolveModeFlagBitsKHR.adoc[] 5642endif::VK_KHR_depth_stencil_resolve[] 5643 5644 * ename:VK_RESOLVE_MODE_NONE indicates that no resolve operation is done. 5645 * ename:VK_RESOLVE_MODE_SAMPLE_ZERO_BIT indicates that result of the 5646 resolve operation is equal to the value of sample 0. 5647 * ename:VK_RESOLVE_MODE_AVERAGE_BIT indicates that result of the resolve 5648 operation is the average of the sample values. 5649 * ename:VK_RESOLVE_MODE_MIN_BIT indicates that result of the resolve 5650 operation is the minimum of the sample values. 5651 * ename:VK_RESOLVE_MODE_MAX_BIT indicates that result of the resolve 5652 operation is the maximum of the sample values. 5653ifdef::VK_ANDROID_external_format_resolve[] 5654 * ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID indicates that 5655 rather than a multisample resolve, a single sampled color attachment 5656 will be downsampled into a {YCbCr} format image specified by an external 5657 Android format. 5658 Unlike other resolve modes, implementations can resolve multiple times 5659 during rendering, or even bypass writing to the color attachment 5660 altogether, as long as the final value is resolved to the resolve 5661 attachment. 5662 Values in the [eq]#G#, [eq]#B#, and [eq]#R# channels of the color 5663 attachment will be written to the [eq]#Y#, [eq]#C~B~#, and [eq]#C~R~# 5664 channels of the external format image, respectively. 5665 Chroma values are calculated as if sampling with a linear filter from 5666 the color attachment at full rate, at the location the chroma values sit 5667 according to 5668 slink:VkPhysicalDeviceExternalFormatResolvePropertiesANDROID::pname:chromaOffsetX, 5669 slink:VkPhysicalDeviceExternalFormatResolvePropertiesANDROID::pname:chromaOffsetY, 5670 and the chroma sample rate of the resolved image. 5671endif::VK_ANDROID_external_format_resolve[] 5672 5673If no resolve mode is otherwise specified, ename:VK_RESOLVE_MODE_AVERAGE_BIT 5674is used. 5675 5676ifdef::VK_ANDROID_external_format_resolve[] 5677[NOTE] 5678.Note 5679==== 5680No range compression or {YCbCr} model conversion is performed by 5681ename:VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID; applications have 5682to do these conversions themselves. 5683Value outputs are expected to match those that would be read through a 5684<<textures-sampler-YCbCr-conversion-modelconversion, {YCbCr} sampler using 5685ename:VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY>>. 5686The color space that the values should be in is defined by the platform and 5687is not exposed via Vulkan. 5688==== 5689endif::VK_ANDROID_external_format_resolve[] 5690-- 5691 5692[open,refpage='VkResolveModeFlags',desc='Bitmask of VkResolveModeFlagBits',type='flags',alias='VkResolveModeFlagsKHR'] 5693-- 5694include::{generated}/api/flags/VkResolveModeFlags.adoc[] 5695 5696ifdef::VK_KHR_depth_stencil_resolve[] 5697or the equivalent 5698 5699include::{generated}/api/flags/VkResolveModeFlagsKHR.adoc[] 5700endif::VK_KHR_depth_stencil_resolve[] 5701 5702tname:VkResolveModeFlags is a bitmask type for setting a mask of zero or 5703more elink:VkResolveModeFlagBits. 5704-- 5705endif::VK_VERSION_1_2,VK_KHR_depth_stencil_resolve[] 5706 5707 5708[[renderpass-commands]] 5709== Render Pass Commands 5710 5711An application records the commands for a render pass instance one subpass 5712at a time, by beginning a render pass instance, iterating over the subpasses 5713to record commands for that subpass, and then ending the render pass 5714instance. 5715 5716[open,refpage='vkCmdBeginRenderPass',desc='Begin a new render pass',type='protos'] 5717-- 5718To begin a render pass instance, call: 5719 5720include::{generated}/api/protos/vkCmdBeginRenderPass.adoc[] 5721 5722 * pname:commandBuffer is the command buffer in which to record the 5723 command. 5724 * pname:pRenderPassBegin is a pointer to a slink:VkRenderPassBeginInfo 5725 structure specifying the render pass to begin an instance of, and the 5726 framebuffer the instance uses. 5727 * pname:contents is a elink:VkSubpassContents value specifying how the 5728 commands in the first subpass will be provided. 5729 5730After beginning a render pass instance, the command buffer is ready to 5731record the commands for the first subpass of that render pass. 5732 5733.Valid Usage 5734**** 5735 * [[VUID-vkCmdBeginRenderPass-initialLayout-00895]] 5736 If any of the pname:initialLayout or pname:finalLayout member of the 5737 sname:VkAttachmentDescription structures or the pname:layout member of 5738 the sname:VkAttachmentReference structures specified when creating the 5739 render pass specified in the pname:renderPass member of 5740 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 5741 then the corresponding attachment image view of the framebuffer 5742 specified in the pname:framebuffer member of pname:pRenderPassBegin 5743 must: have been created with a pname:usage value including 5744 ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT 5745 * [[VUID-vkCmdBeginRenderPass-initialLayout-01758]] 5746 If any of the pname:initialLayout or pname:finalLayout member of the 5747 sname:VkAttachmentDescription structures or the pname:layout member of 5748 the sname:VkAttachmentReference structures specified when creating the 5749 render pass specified in the pname:renderPass member of 5750 pname:pRenderPassBegin is 5751ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 5752 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, 5753 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, 5754endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 5755 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, or 5756 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL then the 5757 corresponding attachment image view of the framebuffer specified in the 5758 pname:framebuffer member of pname:pRenderPassBegin must: have been 5759 created with a pname:usage value including 5760 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5761ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 5762ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 5763 * [[VUID-vkCmdBeginRenderPass-initialLayout-02842]] 5764 If any of the pname:initialLayout or pname:finalLayout member of the 5765 sname:VkAttachmentDescription structures or the pname:layout member of 5766 the sname:VkAttachmentReference structures specified when creating the 5767 render pass specified in the pname:renderPass member of 5768 pname:pRenderPassBegin is 5769 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or 5770 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, 5771 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or 5772 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL then the corresponding 5773 attachment image view of the framebuffer specified in the 5774 pname:framebuffer member of pname:pRenderPassBegin must: have been 5775 created with a pname:usage value including 5776 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5777 * [[VUID-vkCmdBeginRenderPass-stencilInitialLayout-02843]] 5778 If any of the pname:stencilInitialLayout or pname:stencilFinalLayout 5779 member of the sname:VkAttachmentDescriptionStencilLayout structures or 5780 the pname:stencilLayout member of the 5781 sname:VkAttachmentReferenceStencilLayout structures specified when 5782 creating the render pass specified in the pname:renderPass member of 5783 pname:pRenderPassBegin is 5784 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or 5785 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL then the corresponding 5786 attachment image view of the framebuffer specified in the 5787 pname:framebuffer member of pname:pRenderPassBegin must: have been 5788 created with a pname:usage value including 5789 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5790endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 5791endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 5792 * [[VUID-vkCmdBeginRenderPass-initialLayout-00897]] 5793 If any of the pname:initialLayout or pname:finalLayout member of the 5794 sname:VkAttachmentDescription structures or the pname:layout member of 5795 the sname:VkAttachmentReference structures specified when creating the 5796 render pass specified in the pname:renderPass member of 5797 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL 5798 then the corresponding attachment image view of the framebuffer 5799 specified in the pname:framebuffer member of pname:pRenderPassBegin 5800 must: have been created with a pname:usage value including 5801 ename:VK_IMAGE_USAGE_SAMPLED_BIT or 5802 ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT 5803 * [[VUID-vkCmdBeginRenderPass-initialLayout-00898]] 5804 If any of the pname:initialLayout or pname:finalLayout member of the 5805 sname:VkAttachmentDescription structures or the pname:layout member of 5806 the sname:VkAttachmentReference structures specified when creating the 5807 render pass specified in the pname:renderPass member of 5808 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL 5809 then the corresponding attachment image view of the framebuffer 5810 specified in the pname:framebuffer member of pname:pRenderPassBegin 5811 must: have been created with a pname:usage value including 5812 ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT 5813 * [[VUID-vkCmdBeginRenderPass-initialLayout-00899]] 5814 If any of the pname:initialLayout or pname:finalLayout member of the 5815 sname:VkAttachmentDescription structures or the pname:layout member of 5816 the sname:VkAttachmentReference structures specified when creating the 5817 render pass specified in the pname:renderPass member of 5818 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL 5819 then the corresponding attachment image view of the framebuffer 5820 specified in the pname:framebuffer member of pname:pRenderPassBegin 5821 must: have been created with a pname:usage value including 5822 ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT 5823 * [[VUID-vkCmdBeginRenderPass-initialLayout-00900]] 5824 If the pname:initialLayout member of any of the 5825 sname:VkAttachmentDescription structures specified when creating the 5826 render pass specified in the pname:renderPass member of 5827 pname:pRenderPassBegin is not ename:VK_IMAGE_LAYOUT_UNDEFINED, then each 5828 such pname:initialLayout must: be equal to the current layout of the 5829 corresponding attachment image subresource of the framebuffer specified 5830 in the pname:framebuffer member of pname:pRenderPassBegin 5831 * [[VUID-vkCmdBeginRenderPass-srcStageMask-06451]] 5832 The pname:srcStageMask members of any element of the pname:pDependencies 5833 member of slink:VkRenderPassCreateInfo used to create pname:renderPass 5834 must: be supported by the capabilities of the queue family identified by 5835 the pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 5836 used to create the command pool which pname:commandBuffer was allocated 5837 from 5838 * [[VUID-vkCmdBeginRenderPass-dstStageMask-06452]] 5839 The pname:dstStageMask members of any element of the pname:pDependencies 5840 member of slink:VkRenderPassCreateInfo used to create pname:renderPass 5841 must: be supported by the capabilities of the queue family identified by 5842 the pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 5843 used to create the command pool which pname:commandBuffer was allocated 5844 from 5845 * [[VUID-vkCmdBeginRenderPass-framebuffer-02532]] 5846 For any attachment in pname:framebuffer that is used by pname:renderPass 5847 and is bound to memory locations that are also bound to another 5848 attachment used by pname:renderPass, and if at least one of those uses 5849 causes either attachment to be written to, both attachments must: have 5850 had the ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT set 5851 * [[VUID-vkCmdBeginRenderPass-framebuffer-09045]] 5852 If any attachments specified in pname:framebuffer are used by 5853 pname:renderPass and are bound to overlapping memory locations, there 5854 must: be only one that is used as a color attachment, depth/stencil, or 5855 resolve attachment in any subpass 5856ifdef::VK_EXT_attachment_feedback_loop_layout[] 5857 * [[VUID-vkCmdBeginRenderPass-initialLayout-07000]] 5858 If any of the pname:initialLayout or pname:finalLayout member of the 5859 sname:VkAttachmentDescription structures or the pname:layout member of 5860 the sname:VkAttachmentReference structures specified when creating the 5861 render pass specified in the pname:renderPass member of 5862 pname:pRenderPassBegin is 5863 ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT then the 5864 corresponding attachment image view of the framebuffer specified in the 5865 pname:framebuffer member of pname:pRenderPassBegin must: have been 5866 created with a pname:usage value including either the 5867 ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT or 5868 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT and either the 5869 ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT or 5870 ename:VK_IMAGE_USAGE_SAMPLED_BIT usage bits 5871 * [[VUID-vkCmdBeginRenderPass-initialLayout-07001]] 5872 If any of the pname:initialLayout or pname:finalLayout member of the 5873 sname:VkAttachmentDescription structures or the pname:layout member of 5874 the sname:VkAttachmentReference structures specified when creating the 5875 render pass specified in the pname:renderPass member of 5876 pname:pRenderPassBegin is 5877 ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT then the 5878 corresponding attachment image view of the framebuffer specified in the 5879 pname:framebuffer member of pname:pRenderPassBegin must: have been 5880 created with a pname:usage value the 5881 ename:VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT usage bit 5882endif::VK_EXT_attachment_feedback_loop_layout[] 5883**** 5884 5885include::{generated}/validity/protos/vkCmdBeginRenderPass.adoc[] 5886-- 5887 5888ifdef::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 5889[open,refpage='vkCmdBeginRenderPass2',desc='Begin a new render pass',type='protos',alias='vkCmdBeginRenderPass2KHR'] 5890-- 5891Alternatively to begin a render pass, call: 5892 5893ifdef::VK_VERSION_1_2[] 5894include::{generated}/api/protos/vkCmdBeginRenderPass2.adoc[] 5895endif::VK_VERSION_1_2[] 5896 5897ifdef::VK_VERSION_1_2+VK_KHR_create_renderpass2[or the equivalent command] 5898 5899ifdef::VK_KHR_create_renderpass2[] 5900include::{generated}/api/protos/vkCmdBeginRenderPass2KHR.adoc[] 5901endif::VK_KHR_create_renderpass2[] 5902 5903 * pname:commandBuffer is the command buffer in which to record the 5904 command. 5905 * pname:pRenderPassBegin is a pointer to a slink:VkRenderPassBeginInfo 5906 structure specifying the render pass to begin an instance of, and the 5907 framebuffer the instance uses. 5908 * pname:pSubpassBeginInfo is a pointer to a slink:VkSubpassBeginInfo 5909 structure containing information about the subpass which is about to 5910 begin rendering. 5911 5912After beginning a render pass instance, the command buffer is ready to 5913record the commands for the first subpass of that render pass. 5914 5915.Valid Usage 5916**** 5917 * [[VUID-vkCmdBeginRenderPass2-framebuffer-02779]] 5918 Both the pname:framebuffer and pname:renderPass members of 5919 pname:pRenderPassBegin must: have been created on the same 5920 slink:VkDevice that pname:commandBuffer was allocated on 5921 * [[VUID-vkCmdBeginRenderPass2-initialLayout-03094]] 5922 If any of the pname:initialLayout or pname:finalLayout member of the 5923 sname:VkAttachmentDescription structures or the pname:layout member of 5924 the sname:VkAttachmentReference structures specified when creating the 5925 render pass specified in the pname:renderPass member of 5926 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL 5927 then the corresponding attachment image view of the framebuffer 5928 specified in the pname:framebuffer member of pname:pRenderPassBegin 5929 must: have been created with a pname:usage value including 5930 ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT 5931 * [[VUID-vkCmdBeginRenderPass2-initialLayout-03096]] 5932 If any of the pname:initialLayout or pname:finalLayout member of the 5933 sname:VkAttachmentDescription structures or the pname:layout member of 5934 the sname:VkAttachmentReference structures specified when creating the 5935 render pass specified in the pname:renderPass member of 5936 pname:pRenderPassBegin is 5937 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, 5938 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, 5939 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, or 5940 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL then the 5941 corresponding attachment image view of the framebuffer specified in the 5942 pname:framebuffer member of pname:pRenderPassBegin must: have been 5943 created with a pname:usage value including 5944 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5945ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 5946 * [[VUID-vkCmdBeginRenderPass2-initialLayout-02844]] 5947 If any of the pname:initialLayout or pname:finalLayout member of the 5948 sname:VkAttachmentDescription structures or the pname:layout member of 5949 the sname:VkAttachmentReference structures specified when creating the 5950 render pass specified in the pname:renderPass member of 5951 pname:pRenderPassBegin is 5952 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, or 5953 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, 5954 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or 5955 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL then the corresponding 5956 attachment image view of the framebuffer specified in the 5957 pname:framebuffer member of pname:pRenderPassBegin must: have been 5958 created with a pname:usage value including 5959 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5960 * [[VUID-vkCmdBeginRenderPass2-stencilInitialLayout-02845]] 5961 If any of the pname:stencilInitialLayout or pname:stencilFinalLayout 5962 member of the sname:VkAttachmentDescriptionStencilLayout structures or 5963 the pname:stencilLayout member of the 5964 sname:VkAttachmentReferenceStencilLayout structures specified when 5965 creating the render pass specified in the pname:renderPass member of 5966 pname:pRenderPassBegin is 5967 ename:VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, or 5968 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL then the corresponding 5969 attachment image view of the framebuffer specified in the 5970 pname:framebuffer member of pname:pRenderPassBegin must: have been 5971 created with a pname:usage value including 5972 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT 5973endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 5974 * [[VUID-vkCmdBeginRenderPass2-initialLayout-03097]] 5975 If any of the pname:initialLayout or pname:finalLayout member of the 5976 sname:VkAttachmentDescription structures or the pname:layout member of 5977 the sname:VkAttachmentReference structures specified when creating the 5978 render pass specified in the pname:renderPass member of 5979 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL 5980 then the corresponding attachment image view of the framebuffer 5981 specified in the pname:framebuffer member of pname:pRenderPassBegin 5982 must: have been created with a pname:usage value including 5983 ename:VK_IMAGE_USAGE_SAMPLED_BIT or 5984 ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT 5985 * [[VUID-vkCmdBeginRenderPass2-initialLayout-03098]] 5986 If any of the pname:initialLayout or pname:finalLayout member of the 5987 sname:VkAttachmentDescription structures or the pname:layout member of 5988 the sname:VkAttachmentReference structures specified when creating the 5989 render pass specified in the pname:renderPass member of 5990 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL 5991 then the corresponding attachment image view of the framebuffer 5992 specified in the pname:framebuffer member of pname:pRenderPassBegin 5993 must: have been created with a pname:usage value including 5994 ename:VK_IMAGE_USAGE_TRANSFER_SRC_BIT 5995 * [[VUID-vkCmdBeginRenderPass2-initialLayout-03099]] 5996 If any of the pname:initialLayout or pname:finalLayout member of the 5997 sname:VkAttachmentDescription structures or the pname:layout member of 5998 the sname:VkAttachmentReference structures specified when creating the 5999 render pass specified in the pname:renderPass member of 6000 pname:pRenderPassBegin is ename:VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL 6001 then the corresponding attachment image view of the framebuffer 6002 specified in the pname:framebuffer member of pname:pRenderPassBegin 6003 must: have been created with a pname:usage value including 6004 ename:VK_IMAGE_USAGE_TRANSFER_DST_BIT 6005 * [[VUID-vkCmdBeginRenderPass2-initialLayout-03100]] 6006 If the pname:initialLayout member of any of the 6007 sname:VkAttachmentDescription structures specified when creating the 6008 render pass specified in the pname:renderPass member of 6009 pname:pRenderPassBegin is not ename:VK_IMAGE_LAYOUT_UNDEFINED, then each 6010 such pname:initialLayout must: be equal to the current layout of the 6011 corresponding attachment image subresource of the framebuffer specified 6012 in the pname:framebuffer member of pname:pRenderPassBegin 6013 * [[VUID-vkCmdBeginRenderPass2-srcStageMask-06453]] 6014 The pname:srcStageMask members of any element of the pname:pDependencies 6015 member of slink:VkRenderPassCreateInfo used to create pname:renderPass 6016 must: be supported by the capabilities of the queue family identified by 6017 the pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 6018 used to create the command pool which pname:commandBuffer was allocated 6019 from 6020 * [[VUID-vkCmdBeginRenderPass2-dstStageMask-06454]] 6021 The pname:dstStageMask members of any element of the pname:pDependencies 6022 member of slink:VkRenderPassCreateInfo used to create pname:renderPass 6023 must: be supported by the capabilities of the queue family identified by 6024 the pname:queueFamilyIndex member of the slink:VkCommandPoolCreateInfo 6025 used to create the command pool which pname:commandBuffer was allocated 6026 from 6027 * [[VUID-vkCmdBeginRenderPass2-framebuffer-02533]] 6028 For any attachment in pname:framebuffer that is used by pname:renderPass 6029 and is bound to memory locations that are also bound to another 6030 attachment used by pname:renderPass, and if at least one of those uses 6031 causes either attachment to be written to, both attachments must: have 6032 had the ename:VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT set 6033 * [[VUID-vkCmdBeginRenderPass2-framebuffer-09046]] 6034 If any attachments specified in pname:framebuffer are used by 6035 pname:renderPass and are bound to overlapping memory locations, there 6036 must: be only one that is used as a color attachment, depth/stencil, or 6037 resolve attachment in any subpass 6038ifdef::VK_EXT_attachment_feedback_loop_layout[] 6039 * [[VUID-vkCmdBeginRenderPass2-initialLayout-07002]] 6040 If any of the pname:initialLayout or pname:finalLayout member of the 6041 sname:VkAttachmentDescription structures or the pname:layout member of 6042 the sname:VkAttachmentReference structures specified when creating the 6043 render pass specified in the pname:renderPass member of 6044 pname:pRenderPassBegin is 6045 ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT then the 6046 corresponding attachment image view of the framebuffer specified in the 6047 pname:framebuffer member of pname:pRenderPassBegin must: have been 6048 created with a pname:usage value including either the 6049 ename:VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT or 6050 ename:VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT and either the 6051 ename:VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT or 6052 ename:VK_IMAGE_USAGE_SAMPLED_BIT usage bits 6053 * [[VUID-vkCmdBeginRenderPass2-initialLayout-07003]] 6054 If any of the pname:initialLayout or pname:finalLayout member of the 6055 sname:VkAttachmentDescription structures or the pname:layout member of 6056 the sname:VkAttachmentReference structures specified when creating the 6057 render pass specified in the pname:renderPass member of 6058 pname:pRenderPassBegin is 6059 ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT then the 6060 corresponding attachment image view of the framebuffer specified in the 6061 pname:framebuffer member of pname:pRenderPassBegin must: have been 6062 created with a pname:usage value the 6063 ename:VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT usage bit 6064endif::VK_EXT_attachment_feedback_loop_layout[] 6065**** 6066 6067include::{generated}/validity/protos/vkCmdBeginRenderPass2.adoc[] 6068-- 6069endif::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 6070 6071[open,refpage='VkRenderPassBeginInfo',desc='Structure specifying render pass begin information',type='structs'] 6072-- 6073The sname:VkRenderPassBeginInfo structure is defined as: 6074 6075include::{generated}/api/structs/VkRenderPassBeginInfo.adoc[] 6076 6077 * pname:sType is a elink:VkStructureType value identifying this structure. 6078 * pname:pNext is `NULL` or a pointer to a structure extending this 6079 structure. 6080 * pname:renderPass is the render pass to begin an instance of. 6081 * pname:framebuffer is the framebuffer containing the attachments that are 6082 used with the render pass. 6083 * pname:renderArea is the render area that is affected by the render pass 6084 instance, and is described in more detail below. 6085 * pname:clearValueCount is the number of elements in pname:pClearValues. 6086 * pname:pClearValues is a pointer to an array of pname:clearValueCount 6087 slink:VkClearValue structures containing clear values for each 6088 attachment, if the attachment uses a pname:loadOp value of 6089 ename:VK_ATTACHMENT_LOAD_OP_CLEAR or if the attachment has a 6090 depth/stencil format and uses a pname:stencilLoadOp value of 6091 ename:VK_ATTACHMENT_LOAD_OP_CLEAR. 6092 The array is indexed by attachment number. 6093 Only elements corresponding to cleared attachments are used. 6094 Other elements of pname:pClearValues are ignored. 6095 6096pname:renderArea is the render area that is affected by the render pass 6097instance. 6098The effects of attachment load, store and multisample resolve operations are 6099restricted to the pixels whose x and y coordinates fall within the render 6100area on all attachments. 6101The render area extends to all layers of pname:framebuffer. 6102The application must: ensure (using scissor if necessary) that all rendering 6103is contained within the render area. 6104ifndef::VK_QCOM_render_pass_transform[] 6105The render area must: be contained within the framebuffer dimensions. 6106endif::VK_QCOM_render_pass_transform[] 6107ifdef::VK_QCOM_render_pass_transform[] 6108The render area, after any transform specified by 6109slink:VkRenderPassTransformBeginInfoQCOM::pname:transform is applied, must: 6110be contained within the framebuffer dimensions. 6111endif::VK_QCOM_render_pass_transform[] 6112 6113ifdef::VK_QCOM_render_pass_transform[] 6114If <<vertexpostproc-renderpass-transform, render pass transform>> is 6115enabled, then pname:renderArea must: equal the framebuffer pre-transformed 6116dimensions. 6117After pname:renderArea has been transformed by 6118slink:VkRenderPassTransformBeginInfoQCOM::pname:transform, the resulting 6119render area must: be equal to the framebuffer dimensions. 6120endif::VK_QCOM_render_pass_transform[] 6121 6122ifdef::VK_QCOM_multiview_per_view_render_areas[] 6123If multiview is enabled in pname:renderPass, and 6124<<features-multiview-per-view-render-areas, 6125pname:multiviewPerViewRenderAreas>> feature is enabled, and there is an 6126instance of slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM 6127included in the pname:pNext chain with pname:perViewRenderAreaCount not 6128equal to `0`, then the elements of 6129slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM::pname:pPerViewRenderAreas 6130override pname:renderArea and define a render area for each view. 6131In this case, pname:renderArea must: be set to an area at least as large as 6132the union of all the per-view render areas. 6133endif::VK_QCOM_multiview_per_view_render_areas[] 6134 6135ifdef::VK_HUAWEI_subpass_shading[] 6136If the <<features-subpassShading, pname:subpassShading>> feature is enabled, 6137then pname:renderArea must: equal the framebuffer dimensions. 6138endif::VK_HUAWEI_subpass_shading[] 6139 6140[NOTE] 6141.Note 6142==== 6143There may: be a performance cost for using a render area smaller than the 6144framebuffer, unless it matches the render area granularity for the render 6145pass. 6146==== 6147 6148.Valid Usage 6149**** 6150 * [[VUID-VkRenderPassBeginInfo-clearValueCount-00902]] 6151 pname:clearValueCount must: be greater than the largest attachment index 6152 in pname:renderPass specifying a pname:loadOp (or pname:stencilLoadOp, 6153 if the attachment has a depth/stencil format) of 6154 ename:VK_ATTACHMENT_LOAD_OP_CLEAR 6155 * [[VUID-VkRenderPassBeginInfo-clearValueCount-04962]] 6156 If pname:clearValueCount is not `0`, pname:pClearValues must: be a valid 6157 pointer to an array of pname:clearValueCount slink:VkClearValue unions 6158 * [[VUID-VkRenderPassBeginInfo-renderPass-00904]] 6159 pname:renderPass must: be <<renderpass-compatibility,compatible>> with 6160 the pname:renderPass member of the slink:VkFramebufferCreateInfo 6161 structure specified when creating pname:framebuffer 6162 * [[VUID-VkRenderPassBeginInfo-None-08996]] 6163ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6164 If the pname:pNext chain does not contain 6165 slink:VkDeviceGroupRenderPassBeginInfo or its 6166 pname:deviceRenderAreaCount member is equal to 0, 6167endif::VK_VERSION_1_1,VK_KHR_device_group[] 6168 pname:renderArea.extent.width must: be greater than 0 6169 * [[VUID-VkRenderPassBeginInfo-None-08997]] 6170ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6171 If the pname:pNext chain does not contain 6172 slink:VkDeviceGroupRenderPassBeginInfo or its 6173 pname:deviceRenderAreaCount member is equal to 0, 6174endif::VK_VERSION_1_1,VK_KHR_device_group[] 6175 pname:renderArea.extent.height must: be greater than 0 6176 * [[VUID-VkRenderPassBeginInfo-pNext-02850]] 6177ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6178 If the pname:pNext chain does not contain 6179 slink:VkDeviceGroupRenderPassBeginInfo or its 6180 pname:deviceRenderAreaCount member is equal to 0, 6181endif::VK_VERSION_1_1,VK_KHR_device_group[] 6182 pname:renderArea.offset.x must: be greater than or equal to 0 6183 * [[VUID-VkRenderPassBeginInfo-pNext-02851]] 6184ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6185 If the pname:pNext chain does not contain 6186 slink:VkDeviceGroupRenderPassBeginInfo or its 6187 pname:deviceRenderAreaCount member is equal to 0, 6188endif::VK_VERSION_1_1,VK_KHR_device_group[] 6189 pname:renderArea.offset.y must: be greater than or equal to 0 6190 * [[VUID-VkRenderPassBeginInfo-pNext-02852]] 6191ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6192 If the pname:pNext chain does not contain 6193 slink:VkDeviceGroupRenderPassBeginInfo or its 6194 pname:deviceRenderAreaCount member is equal to 0, 6195endif::VK_VERSION_1_1,VK_KHR_device_group[] 6196 [eq]#pname:renderArea.offset.x {plus} pname:renderArea.extent.width# 6197 must: be less than or equal to 6198 slink:VkFramebufferCreateInfo::pname:width the pname:framebuffer was 6199 created with 6200 * [[VUID-VkRenderPassBeginInfo-pNext-02853]] 6201ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6202 If the pname:pNext chain does not contain 6203 slink:VkDeviceGroupRenderPassBeginInfo or its 6204 pname:deviceRenderAreaCount member is equal to 0, 6205endif::VK_VERSION_1_1,VK_KHR_device_group[] 6206 [eq]#pname:renderArea.offset.y {plus} pname:renderArea.extent.height# 6207 must: be less than or equal to 6208 slink:VkFramebufferCreateInfo::pname:height the pname:framebuffer was 6209 created with 6210ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6211 * [[VUID-VkRenderPassBeginInfo-pNext-02856]] 6212 If the pname:pNext chain contains 6213 slink:VkDeviceGroupRenderPassBeginInfo, [eq]#pname:offset.x {plus} 6214 pname:extent.width# of each element of pname:pDeviceRenderAreas must: be 6215 less than or equal to slink:VkFramebufferCreateInfo::pname:width the 6216 pname:framebuffer was created with 6217 * [[VUID-VkRenderPassBeginInfo-pNext-02857]] 6218 If the pname:pNext chain contains 6219 slink:VkDeviceGroupRenderPassBeginInfo, [eq]#pname:offset.y {plus} 6220 pname:extent.height# of each element of pname:pDeviceRenderAreas must: 6221 be less than or equal to slink:VkFramebufferCreateInfo::pname:height the 6222 pname:framebuffer was created with 6223endif::VK_VERSION_1_1,VK_KHR_device_group[] 6224ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 6225 * [[VUID-VkRenderPassBeginInfo-framebuffer-03207]] 6226 If pname:framebuffer was created with a 6227 slink:VkFramebufferCreateInfo::pname:flags value that did not include 6228 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, and the pname:pNext chain 6229 includes a slink:VkRenderPassAttachmentBeginInfo structure, its 6230 pname:attachmentCount must: be zero 6231 * [[VUID-VkRenderPassBeginInfo-framebuffer-03208]] 6232 If pname:framebuffer was created with a 6233 slink:VkFramebufferCreateInfo::pname:flags value that included 6234 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, the pname:attachmentCount of 6235 a slink:VkRenderPassAttachmentBeginInfo structure included in the 6236 pname:pNext chain must: be equal to the value of 6237 slink:VkFramebufferAttachmentsCreateInfo::pname:attachmentImageInfoCount 6238 used to create pname:framebuffer 6239 * [[VUID-VkRenderPassBeginInfo-framebuffer-02780]] 6240 If pname:framebuffer was created with a 6241 slink:VkFramebufferCreateInfo::pname:flags value that included 6242 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6243 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6244 structure included in the pname:pNext chain must: have been created on 6245 the same slink:VkDevice as pname:framebuffer and pname:renderPass 6246 * [[VUID-VkRenderPassBeginInfo-framebuffer-03209]] 6247 If pname:framebuffer was created with a 6248 slink:VkFramebufferCreateInfo::pname:flags value that included 6249 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6250 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6251 structure included in the pname:pNext chain must: be a slink:VkImageView 6252 of an image created with a value of slink:VkImageCreateInfo::pname:flags 6253 equal to the pname:flags member of the corresponding element of 6254 slink:VkFramebufferAttachmentsCreateInfo::pname:pAttachmentImageInfos 6255 used to create pname:framebuffer 6256 * [[VUID-VkRenderPassBeginInfo-framebuffer-04627]] 6257 If pname:framebuffer was created with a 6258 slink:VkFramebufferCreateInfo::pname:flags value that included 6259 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6260 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6261 structure included in the pname:pNext chain must: be a slink:VkImageView 6262 with <<resources-image-inherited-usage, an inherited usage>> equal to 6263 the pname:usage member of the corresponding element of 6264 slink:VkFramebufferAttachmentsCreateInfo::pname:pAttachmentImageInfos 6265 used to create pname:framebuffer 6266 * [[VUID-VkRenderPassBeginInfo-framebuffer-03211]] 6267 If pname:framebuffer was created with a 6268 slink:VkFramebufferCreateInfo::pname:flags value that included 6269 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6270 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6271 structure included in the pname:pNext chain must: be a slink:VkImageView 6272 with a width equal to the pname:width member of the corresponding 6273 element of 6274 slink:VkFramebufferAttachmentsCreateInfo::pname:pAttachmentImageInfos 6275 used to create pname:framebuffer 6276 * [[VUID-VkRenderPassBeginInfo-framebuffer-03212]] 6277 If pname:framebuffer was created with a 6278 slink:VkFramebufferCreateInfo::pname:flags value that included 6279 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6280 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6281 structure included in the pname:pNext chain must: be a slink:VkImageView 6282 with a height equal to the pname:height member of the corresponding 6283 element of 6284 slink:VkFramebufferAttachmentsCreateInfo::pname:pAttachmentImageInfos 6285 used to create pname:framebuffer 6286 * [[VUID-VkRenderPassBeginInfo-framebuffer-03213]] 6287 If pname:framebuffer was created with a 6288 slink:VkFramebufferCreateInfo::pname:flags value that included 6289 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6290 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6291 structure included in the pname:pNext chain must: be a slink:VkImageView 6292 of an image created with a value of 6293 slink:VkImageViewCreateInfo::pname:subresourceRange.layerCount equal to 6294 the pname:layerCount member of the corresponding element of 6295 slink:VkFramebufferAttachmentsCreateInfo::pname:pAttachmentImageInfos 6296 used to create pname:framebuffer 6297 * [[VUID-VkRenderPassBeginInfo-framebuffer-03214]] 6298 If pname:framebuffer was created with a 6299 slink:VkFramebufferCreateInfo::pname:flags value that included 6300 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6301 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6302 structure included in the pname:pNext chain must: be a slink:VkImageView 6303 of an image created with a value of 6304 slink:VkImageFormatListCreateInfo::pname:viewFormatCount equal to the 6305 pname:viewFormatCount member of the corresponding element of 6306 slink:VkFramebufferAttachmentsCreateInfo::pname:pAttachmentImageInfos 6307 used to create pname:framebuffer 6308 * [[VUID-VkRenderPassBeginInfo-framebuffer-03215]] 6309 If pname:framebuffer was created with a 6310 slink:VkFramebufferCreateInfo::pname:flags value that included 6311 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6312 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6313 structure included in the pname:pNext chain must: be a slink:VkImageView 6314 of an image created with a set of elements in 6315 slink:VkImageFormatListCreateInfo::pname:pViewFormats equal to the set 6316 of elements in the pname:pViewFormats member of the corresponding 6317 element of 6318 slink:VkFramebufferAttachmentsCreateInfo::pname:pAttachmentImageInfos 6319 used to create pname:framebuffer 6320 * [[VUID-VkRenderPassBeginInfo-framebuffer-03216]] 6321 If pname:framebuffer was created with a 6322 slink:VkFramebufferCreateInfo::pname:flags value that included 6323 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6324 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6325 structure included in the pname:pNext chain must: be a slink:VkImageView 6326 of an image created with a value of 6327 slink:VkImageViewCreateInfo::pname:format equal to the corresponding 6328 value of slink:VkAttachmentDescription::pname:format in pname:renderPass 6329ifdef::VK_ANDROID_external_format_resolve[] 6330 * [[VUID-VkRenderPassBeginInfo-framebuffer-09353]] 6331 If pname:framebuffer was created with a 6332 slink:VkFramebufferCreateInfo::pname:flags value that included 6333 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, and the 6334 <<limits-nullColorAttachmentWithExternalFormatResolve, 6335 pname:nullColorAttachmentWithExternalFormatResolve>> is ename:VK_FALSE, 6336 the format of the color attachment for each subpass that includes an 6337 external format image as a resolve attachment must: have a format equal 6338 to the value of 6339 slink:VkAndroidHardwareBufferFormatResolvePropertiesANDROID::pname:colorAttachmentFormat 6340 as returned by a call to 6341 flink:vkGetAndroidHardwareBufferPropertiesANDROID for the Android 6342 hardware buffer that was used to create the image view use as its 6343 resolve attachment 6344 * [[VUID-VkRenderPassBeginInfo-framebuffer-09354]] 6345 If pname:framebuffer was created with a 6346 slink:VkFramebufferCreateInfo::pname:flags value that included 6347 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6348 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6349 structure included in the pname:pNext chain must: be a slink:VkImageView 6350 of an image created with a value of 6351 slink:VkExternalFormatANDROID::pname:externalFormat equal to 6352 slink:VkExternalFormatANDROID::pname:externalFormat in the pname:pNext 6353 chain of the corresponding slink:VkAttachmentDescription2 structure used 6354 to create pname:renderPass 6355endif::VK_ANDROID_external_format_resolve[] 6356 * [[VUID-VkRenderPassBeginInfo-framebuffer-09047]] 6357 If pname:framebuffer was created with a 6358 slink:VkFramebufferCreateInfo::pname:flags value that included 6359 ename:VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, each element of the 6360 pname:pAttachments member of a slink:VkRenderPassAttachmentBeginInfo 6361 structure included in the pname:pNext chain must: be a slink:VkImageView 6362 of an image created with a value of 6363 slink:VkImageCreateInfo::pname:samples equal to the corresponding value 6364 of slink:VkAttachmentDescription::pname:samples in pname:renderPass 6365ifdef::VK_EXT_multisampled_render_to_single_sampled[] 6366 , or ename:VK_SAMPLE_COUNT_1_BIT if pname:renderPass was created with 6367 slink:VkMultisampledRenderToSingleSampledInfoEXT structure in the 6368 pname:pNext chain with pname:multisampledRenderToSingleSampledEnable 6369 equal to ename:VK_TRUE 6370endif::VK_EXT_multisampled_render_to_single_sampled[] 6371endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 6372ifdef::VK_QCOM_render_pass_transform[] 6373 * [[VUID-VkRenderPassBeginInfo-pNext-02869]] 6374 If the pname:pNext chain includes 6375 slink:VkRenderPassTransformBeginInfoQCOM, pname:renderArea.offset must: 6376 equal [eq]#(0,0)# 6377 * [[VUID-VkRenderPassBeginInfo-pNext-02870]] 6378 If the pname:pNext chain includes 6379 slink:VkRenderPassTransformBeginInfoQCOM, pname:renderArea.extent 6380 transformed by slink:VkRenderPassTransformBeginInfoQCOM::pname:transform 6381 must: equal the pname:framebuffer dimensions 6382endif::VK_QCOM_render_pass_transform[] 6383ifdef::VK_QCOM_multiview_per_view_render_areas[] 6384 * [[VUID-VkRenderPassBeginInfo-perViewRenderAreaCount-07859]] 6385 If the pname:perViewRenderAreaCount member of a 6386 slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM structure 6387 included in the pname:pNext chain is not `0`, then the 6388 <<features-multiview-per-view-render-areas, 6389 pname:multiviewPerViewRenderAreas>> feature must: be enabled. 6390 * [[VUID-VkRenderPassBeginInfo-perViewRenderAreaCount-07860]] 6391 If the pname:perViewRenderAreaCount member of a 6392 slink:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM structure 6393 included in the pname:pNext chain is not `0`, then pname:renderArea 6394 must: specify a render area that includes the union of all per view 6395 render areas. 6396endif::VK_QCOM_multiview_per_view_render_areas[] 6397ifdef::VK_ARM_render_pass_striped[] 6398 If the pname:pNext chain contains a slink:VkRenderPassStripeBeginInfoARM 6399 structure, the union of stripe areas defined by the elements of 6400 slink:VkRenderPassStripeInfoARM::pname:pStripeInfos must: cover the 6401 pname:renderArea 6402endif::VK_ARM_render_pass_striped[] 6403**** 6404 6405include::{generated}/validity/structs/VkRenderPassBeginInfo.adoc[] 6406-- 6407 6408ifdef::VK_EXT_sample_locations[] 6409[open,refpage='VkRenderPassSampleLocationsBeginInfoEXT',desc='Structure specifying sample locations to use for the layout transition of custom sample locations compatible depth/stencil attachments',type='structs'] 6410-- 6411The image layout of the depth aspect of a depth/stencil attachment referring 6412to an image created with 6413ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT is dependent 6414on the last sample locations used to render to the image subresource, thus 6415preserving the contents of such depth/stencil attachments across subpass 6416boundaries requires the application to specify these sample locations 6417whenever a layout transition of the attachment may: occur. 6418This information can: be provided by adding a 6419sname:VkRenderPassSampleLocationsBeginInfoEXT structure to the pname:pNext 6420chain of sname:VkRenderPassBeginInfo. 6421 6422The sname:VkRenderPassSampleLocationsBeginInfoEXT structure is defined as: 6423 6424include::{generated}/api/structs/VkRenderPassSampleLocationsBeginInfoEXT.adoc[] 6425 6426 * pname:sType is a elink:VkStructureType value identifying this structure. 6427 * pname:pNext is `NULL` or a pointer to a structure extending this 6428 structure. 6429 * pname:attachmentInitialSampleLocationsCount is the number of elements in 6430 the pname:pAttachmentInitialSampleLocations array. 6431 * pname:pAttachmentInitialSampleLocations is a pointer to an array of 6432 pname:attachmentInitialSampleLocationsCount 6433 slink:VkAttachmentSampleLocationsEXT structures specifying the 6434 attachment indices and their corresponding sample location state. 6435 Each element of pname:pAttachmentInitialSampleLocations can: specify the 6436 sample location state to use in the automatic layout transition 6437 performed to transition a depth/stencil attachment from the initial 6438 layout of the attachment to the image layout specified for the 6439 attachment in the first subpass using it. 6440 * pname:postSubpassSampleLocationsCount is the number of elements in the 6441 pname:pPostSubpassSampleLocations array. 6442 * pname:pPostSubpassSampleLocations is a pointer to an array of 6443 pname:postSubpassSampleLocationsCount slink:VkSubpassSampleLocationsEXT 6444 structures specifying the subpass indices and their corresponding sample 6445 location state. 6446 Each element of pname:pPostSubpassSampleLocations can: specify the 6447 sample location state to use in the automatic layout transition 6448 performed to transition the depth/stencil attachment used by the 6449 specified subpass to the image layout specified in a dependent subpass 6450 or to the final layout of the attachment in case the specified subpass 6451 is the last subpass using that attachment. 6452 In addition, if 6453 slink:VkPhysicalDeviceSampleLocationsPropertiesEXT::pname:variableSampleLocations 6454 is ename:VK_FALSE, each element of pname:pPostSubpassSampleLocations 6455 must: specify the sample location state that matches the sample 6456 locations used by all pipelines that will be bound to a command buffer 6457 during the specified subpass. 6458 If pname:variableSampleLocations is ename:VK_TRUE, the sample locations 6459 used for rasterization do not depend on 6460 pname:pPostSubpassSampleLocations. 6461 6462include::{generated}/validity/structs/VkRenderPassSampleLocationsBeginInfoEXT.adoc[] 6463-- 6464 6465[open,refpage='VkAttachmentSampleLocationsEXT',desc='Structure specifying the sample locations state to use in the initial layout transition of attachments',type='structs'] 6466-- 6467The sname:VkAttachmentSampleLocationsEXT structure is defined as: 6468 6469include::{generated}/api/structs/VkAttachmentSampleLocationsEXT.adoc[] 6470 6471 * pname:attachmentIndex is the index of the attachment for which the 6472 sample locations state is provided. 6473 * pname:sampleLocationsInfo is the sample locations state to use for the 6474 layout transition of the given attachment from the initial layout of the 6475 attachment to the image layout specified for the attachment in the first 6476 subpass using it. 6477 6478If the image referenced by the framebuffer attachment at index 6479pname:attachmentIndex was not created with 6480ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT then the 6481values specified in pname:sampleLocationsInfo are ignored. 6482 6483.Valid Usage 6484**** 6485 * [[VUID-VkAttachmentSampleLocationsEXT-attachmentIndex-01531]] 6486 pname:attachmentIndex must: be less than the pname:attachmentCount 6487 specified in slink:VkRenderPassCreateInfo the render pass specified by 6488 slink:VkRenderPassBeginInfo::pname:renderPass was created with 6489**** 6490 6491include::{generated}/validity/structs/VkAttachmentSampleLocationsEXT.adoc[] 6492-- 6493 6494[open,refpage='VkSubpassSampleLocationsEXT',desc='Structure specifying the sample locations state to use for layout transitions of attachments performed after a given subpass',type='structs'] 6495-- 6496The sname:VkSubpassSampleLocationsEXT structure is defined as: 6497 6498include::{generated}/api/structs/VkSubpassSampleLocationsEXT.adoc[] 6499 6500 * pname:subpassIndex is the index of the subpass for which the sample 6501 locations state is provided. 6502 * pname:sampleLocationsInfo is the sample locations state to use for the 6503 layout transition of the depth/stencil attachment away from the image 6504 layout the attachment is used with in the subpass specified in 6505 pname:subpassIndex. 6506 6507If the image referenced by the depth/stencil attachment used in the subpass 6508identified by pname:subpassIndex was not created with 6509ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT or if the 6510subpass does not use a depth/stencil attachment, and 6511slink:VkPhysicalDeviceSampleLocationsPropertiesEXT::pname:variableSampleLocations 6512is ename:VK_TRUE then the values specified in pname:sampleLocationsInfo are 6513ignored. 6514 6515.Valid Usage 6516**** 6517 * [[VUID-VkSubpassSampleLocationsEXT-subpassIndex-01532]] 6518 pname:subpassIndex must: be less than the pname:subpassCount specified 6519 in slink:VkRenderPassCreateInfo the render pass specified by 6520 slink:VkRenderPassBeginInfo::pname:renderPass was created with 6521**** 6522 6523include::{generated}/validity/structs/VkSubpassSampleLocationsEXT.adoc[] 6524-- 6525endif::VK_EXT_sample_locations[] 6526 6527ifdef::VK_QCOM_render_pass_transform[] 6528[open,refpage='VkRenderPassTransformBeginInfoQCOM',desc='Structure describing transform parameters of a render pass instance',type='structs'] 6529-- 6530To begin a render pass instance with <<vertexpostproc-renderpass-transform, 6531render pass transform>> enabled, add the 6532slink:VkRenderPassTransformBeginInfoQCOM to the pname:pNext chain of 6533slink:VkRenderPassBeginInfo structure passed to the 6534flink:vkCmdBeginRenderPass command specifying the render pass transform. 6535 6536The sname:VkRenderPassTransformBeginInfoQCOM structure is defined as: 6537 6538include::{generated}/api/structs/VkRenderPassTransformBeginInfoQCOM.adoc[] 6539 6540 * pname:sType is a elink:VkStructureType value identifying this structure. 6541 * pname:pNext is `NULL` or a pointer to a structure extending this 6542 structure. 6543 * pname:transform is a elink:VkSurfaceTransformFlagBitsKHR value 6544 describing the transform to be applied to rasterization. 6545 6546.Valid Usage 6547**** 6548 * [[VUID-VkRenderPassTransformBeginInfoQCOM-transform-02871]] 6549 pname:transform must: be ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, 6550 ename:VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR, 6551 ename:VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, or 6552 ename:VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR 6553 * [[VUID-VkRenderPassTransformBeginInfoQCOM-flags-02872]] 6554 The pname:renderpass must: have been created with 6555 slink:VkRenderPassCreateInfo::pname:flags containing 6556 ename:VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM 6557**** 6558 6559include::{generated}/validity/structs/VkRenderPassTransformBeginInfoQCOM.adoc[] 6560-- 6561endif::VK_QCOM_render_pass_transform[] 6562 6563ifdef::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 6564[open,refpage='VkSubpassBeginInfo',desc='Structure specifying subpass begin information',type='structs',alias='VkSubpassBeginInfoKHR'] 6565-- 6566The sname:VkSubpassBeginInfo structure is defined as: 6567 6568include::{generated}/api/structs/VkSubpassBeginInfo.adoc[] 6569 6570ifdef::VK_KHR_create_renderpass2[] 6571or the equivalent 6572 6573include::{generated}/api/structs/VkSubpassBeginInfoKHR.adoc[] 6574endif::VK_KHR_create_renderpass2[] 6575 6576 * pname:sType is a elink:VkStructureType value identifying this structure. 6577 * pname:pNext is `NULL` or a pointer to a structure extending this 6578 structure. 6579 * pname:contents is a elink:VkSubpassContents value specifying how the 6580 commands in the next subpass will be provided. 6581 6582ifdef::VK_EXT_nested_command_buffer[] 6583.Valid Usage 6584**** 6585 * [[VUID-VkSubpassBeginInfo-contents-09382]] 6586 If pname:contents is 6587 ename:VK_SUBPASS_CONTENTS_INLINE_AND_SECONDARY_COMMAND_BUFFERS_EXT, then 6588 <<features-nestedCommandBuffer, pname:nestedCommandBuffer>> must: be 6589 enabled 6590**** 6591endif::VK_EXT_nested_command_buffer[] 6592 6593include::{generated}/validity/structs/VkSubpassBeginInfo.adoc[] 6594 6595-- 6596endif::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 6597 6598[open,refpage='VkSubpassContents',desc='Specify how commands in the first subpass of a render pass are provided',type='enums'] 6599-- 6600Possible values of flink:vkCmdBeginRenderPass::pname:contents, specifying 6601how the commands in the first subpass will be provided, are: 6602 6603include::{generated}/api/enums/VkSubpassContents.adoc[] 6604 6605 * ename:VK_SUBPASS_CONTENTS_INLINE specifies that the contents of the 6606 subpass will be recorded inline in the primary command buffer, and 6607 secondary command buffers must: not be executed within the subpass. 6608 * ename:VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS specifies that the 6609 contents are recorded in secondary command buffers that will be called 6610 from the primary command buffer, and flink:vkCmdExecuteCommands is the 6611 only valid command in the command buffer until flink:vkCmdNextSubpass or 6612 flink:vkCmdEndRenderPass. 6613ifdef::VK_EXT_nested_command_buffer[] 6614 * ename:VK_SUBPASS_CONTENTS_INLINE_AND_SECONDARY_COMMAND_BUFFERS_EXT 6615 specifies that the contents of the subpass can: be recorded both inline 6616 and in secondary command buffers executed from this command buffer with 6617 flink:vkCmdExecuteCommands. 6618endif::VK_EXT_nested_command_buffer[] 6619-- 6620 6621ifdef::VK_VERSION_1_1,VK_KHR_device_group[] 6622[open,refpage='VkDeviceGroupRenderPassBeginInfo',desc='Set the initial device mask and render areas for a render pass instance',type='structs'] 6623-- 6624If the pname:pNext chain of slink:VkRenderPassBeginInfo 6625ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo] 6626includes a sname:VkDeviceGroupRenderPassBeginInfo structure, then that 6627structure includes a device mask and set of render areas for the render pass 6628instance. 6629 6630The sname:VkDeviceGroupRenderPassBeginInfo structure is defined as: 6631 6632include::{generated}/api/structs/VkDeviceGroupRenderPassBeginInfo.adoc[] 6633 6634ifdef::VK_KHR_device_group[] 6635or the equivalent 6636 6637include::{generated}/api/structs/VkDeviceGroupRenderPassBeginInfoKHR.adoc[] 6638endif::VK_KHR_device_group[] 6639 6640 * pname:sType is a elink:VkStructureType value identifying this structure. 6641 * pname:pNext is `NULL` or a pointer to a structure extending this 6642 structure. 6643 * pname:deviceMask is the device mask for the render pass instance. 6644 * pname:deviceRenderAreaCount is the number of elements in the 6645 pname:pDeviceRenderAreas array. 6646 * pname:pDeviceRenderAreas is a pointer to an array of slink:VkRect2D 6647 structures defining the render area for each physical device. 6648 6649The pname:deviceMask serves several purposes. 6650It is an upper bound on the set of physical devices that can: be used during 6651the render pass instance, and the initial device mask when the render pass 6652instance begins. 6653In addition, commands transitioning to the next subpass in a render pass 6654instance and commands ending the render pass instance, and, accordingly 6655render pass <<renderpass-load-operations, load>>, 6656<<renderpass-store-operations, store>>, and <<renderpass-resolve-operations, 6657multisample resolve>> operations and subpass dependencies corresponding to 6658the render pass instance, are executed on the physical devices included in 6659the device mask provided here. 6660 6661If pname:deviceRenderAreaCount is not zero, then the elements of 6662pname:pDeviceRenderAreas override the value of 6663slink:VkRenderPassBeginInfo::pname:renderArea, and provide a render area 6664specific to each physical device. 6665These render areas serve the same purpose as 6666slink:VkRenderPassBeginInfo::pname:renderArea, including controlling the 6667region of attachments that are cleared by ename:VK_ATTACHMENT_LOAD_OP_CLEAR 6668and that are resolved into resolve attachments. 6669 6670If this structure is not present, the render pass instance's device mask is 6671the value of slink:VkDeviceGroupCommandBufferBeginInfo::pname:deviceMask. 6672If this structure is not present or if pname:deviceRenderAreaCount is zero, 6673slink:VkRenderPassBeginInfo::pname:renderArea is used for all physical 6674devices. 6675 6676.Valid Usage 6677**** 6678 * [[VUID-VkDeviceGroupRenderPassBeginInfo-deviceMask-00905]] 6679 pname:deviceMask must: be a valid device mask value 6680 * [[VUID-VkDeviceGroupRenderPassBeginInfo-deviceMask-00906]] 6681 pname:deviceMask must: not be zero 6682 * [[VUID-VkDeviceGroupRenderPassBeginInfo-deviceMask-00907]] 6683 pname:deviceMask must: be a subset of the command buffer's initial 6684 device mask 6685 * [[VUID-VkDeviceGroupRenderPassBeginInfo-deviceRenderAreaCount-00908]] 6686 pname:deviceRenderAreaCount must: either be zero or equal to the number 6687 of physical devices in the logical device 6688 * [[VUID-VkDeviceGroupRenderPassBeginInfo-offset-06166]] 6689 The pname:offset.x member of any element of pname:pDeviceRenderAreas 6690 must: be greater than or equal to 0 6691 * [[VUID-VkDeviceGroupRenderPassBeginInfo-offset-06167]] 6692 The pname:offset.y member of any element of pname:pDeviceRenderAreas 6693 must: be greater than or equal to 0 6694 * [[VUID-VkDeviceGroupRenderPassBeginInfo-offset-06168]] 6695 The sum of the pname:offset.x and pname:extent.width members of any 6696 element of pname:pDeviceRenderAreas must: be less than or equal to 6697 <<limits-maxFramebufferWidth, pname:maxFramebufferWidth>> 6698 * [[VUID-VkDeviceGroupRenderPassBeginInfo-offset-06169]] 6699 The sum of the pname:offset.y and pname:extent.height members of any 6700 element of pname:pDeviceRenderAreas must: be less than or equal to 6701 <<limits-maxFramebufferHeight, pname:maxFramebufferHeight>> 6702 * [[VUID-VkDeviceGroupRenderPassBeginInfo-extent-08998]] 6703 The pname:extent.width member of any element of pname:pDeviceRenderAreas 6704 must: be greater than 0 6705 * [[VUID-VkDeviceGroupRenderPassBeginInfo-extent-08999]] 6706 The pname:extent.height member of any element of 6707 pname:pDeviceRenderAreas must: be greater than 0 6708**** 6709 6710include::{generated}/validity/structs/VkDeviceGroupRenderPassBeginInfo.adoc[] 6711-- 6712endif::VK_VERSION_1_1,VK_KHR_device_group[] 6713 6714ifdef::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 6715[open,refpage='VkRenderPassAttachmentBeginInfo',desc='Structure specifying images to be used as framebuffer attachments',type='structs',alias='VkRenderPassAttachmentBeginInfoKHR'] 6716-- 6717The sname:VkRenderPassAttachmentBeginInfo structure is defined as: 6718 6719include::{generated}/api/structs/VkRenderPassAttachmentBeginInfo.adoc[] 6720 6721ifdef::VK_KHR_imageless_framebuffer[] 6722or the equivalent 6723 6724include::{generated}/api/structs/VkRenderPassAttachmentBeginInfoKHR.adoc[] 6725endif::VK_KHR_imageless_framebuffer[] 6726 6727 * pname:sType is a elink:VkStructureType value identifying this structure. 6728 * pname:pNext is `NULL` or a pointer to a structure extending this 6729 structure. 6730 * pname:attachmentCount is the number of attachments. 6731 * pname:pAttachments is a pointer to an array of sname:VkImageView 6732 handles, each of which will be used as the corresponding attachment in 6733 the render pass instance. 6734 6735.Valid Usage 6736**** 6737 * [[VUID-VkRenderPassAttachmentBeginInfo-pAttachments-03218]] 6738 Each element of pname:pAttachments must: only specify a single mip level 6739 * [[VUID-VkRenderPassAttachmentBeginInfo-pAttachments-03219]] 6740 Each element of pname:pAttachments must: have been created with the 6741 <<resources-image-views-identity-mappings,identity swizzle>> 6742 * [[VUID-VkRenderPassAttachmentBeginInfo-pAttachments-04114]] 6743 Each element of pname:pAttachments must: have been created with 6744 slink:VkImageViewCreateInfo::pname:viewType not equal to 6745 ename:VK_IMAGE_VIEW_TYPE_3D 6746ifdef::VK_EXT_multisampled_render_to_single_sampled[] 6747 * [[VUID-VkRenderPassAttachmentBeginInfo-pAttachments-07010]] 6748 If 6749 <<subpass-multisampledrendertosinglesampled,multisampled-render-to-single-sampled>> 6750 is enabled for any subpass, all element of pname:pAttachments which have 6751 a sample count equal to ename:VK_SAMPLE_COUNT_1_BIT must: have a format 6752 that supports the sample count specified in 6753 slink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples 6754endif::VK_EXT_multisampled_render_to_single_sampled[] 6755**** 6756 6757include::{generated}/validity/structs/VkRenderPassAttachmentBeginInfo.adoc[] 6758-- 6759endif::VK_VERSION_1_2,VK_KHR_imageless_framebuffer[] 6760 6761ifdef::VK_QCOM_multiview_per_view_render_areas[] 6762[open,refpage='VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM',desc='Set the multiview per view render areas for a render pass instance',type='structs'] 6763-- 6764If a render pass instance enables multiview and if the 6765<<features-multiview-per-view-render-areas,pname:multiviewPerViewRenderAreas>> 6766feature is enabled, the 6767sname:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM structure can: be 6768included in the pname:pNext chain of slink:VkRenderPassBeginInfo 6769ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo] 6770 6771The sname:VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM structure is 6772defined as: 6773 6774include::{generated}/api/structs/VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM.adoc[] 6775 6776 * pname:sType is a elink:VkStructureType value identifying this structure. 6777 * pname:pNext is `NULL` or a pointer to a structure extending this 6778 structure. 6779 * pname:perViewRenderAreaCount is the number of elements in the 6780 pname:pPerViewRenderAreas array. 6781 * pname:pPerViewRenderAreas is a pointer to an array of slink:VkRect2D 6782 structures defining the render area for each view. 6783 6784If pname:perViewRenderAreaCount is not zero, then the elements of 6785pname:pPerViewRenderAreas override the value of 6786slink:VkRenderPassBeginInfo::pname:renderArea 6787ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo::pname:renderArea] 6788and define per-view render areas for the individual views of a multiview 6789render pass. 6790The render area for the view with _view index_ `i` is specified by 6791pname:pPerViewRenderAreas[i]. 6792 6793The per-view render areas define per-view regions of attachments that are 6794loaded, stored, and resolved according to the pname:loadOp, pname:storeOp, 6795and pname:resolveMode values of the render pass instance. 6796When per-view render areas are defined, the value of 6797slink:VkRenderPassBeginInfo::pname:renderArea 6798ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo::pname:renderArea] 6799must: be set to a render area that includes the union of all per-view render 6800areas, may: be used by the implementation for optimizations, but does not 6801affect loads, stores, or resolves. 6802 6803If this structure is present and if pname:perViewRenderAreaCount is not 6804zero, then pname:perViewRenderAreaCount must: be at least least one greater 6805than the most significant bit set in any any element of 6806slink:VkRenderPassMultiviewCreateInfo::pname:pViewMasks. 6807ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo::pname:viewMask] 6808 6809If this structure is not present or if pname:perViewRenderAreaCount is zero, 6810slink:VkRenderPassBeginInfo::pname:renderArea 6811ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo::pname:renderArea] 6812is used for all views. 6813 6814.Valid Usage 6815**** 6816 * [[VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07861]] 6817 The pname:offset.x member of any element of pname:pPerViewRenderAreas 6818 must: be greater than or equal to 0 6819 * [[VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07862]] 6820 The pname:offset.y member of any element of pname:pPerViewRenderAreas 6821 must: be greater than or equal to 0 6822 * [[VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07863]] 6823 The sum of the pname:offset.x and pname:extent.width members of any 6824 element of pname:pPerViewRenderAreas must: be less than or equal to 6825 <<limits-maxFramebufferWidth, pname:maxFramebufferWidth>> 6826 * [[VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-offset-07864]] 6827 The sum of the pname:offset.y and pname:extent.height members of any 6828 element of pname:pPerViewRenderAreas must: be less than or equal to 6829 <<limits-maxFramebufferHeight, pname:maxFramebufferHeight>> 6830 * [[VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-pNext-07865]] 6831 If this structure is in the pname:pNext chain of 6832 slink:VkRenderPassBeginInfo and if the render pass object included an 6833 element in slink:VkRenderPassMultiviewCreateInfo::pname:pViewMasks that 6834 set bit `n`, then pname:perViewRenderAreaCount must: be at least equal 6835 to `n+1`. 6836ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 6837 * [[VUID-VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM-pNext-07866]] 6838 If this structure is in the pname:pNext chain of slink:VkRenderingInfo 6839 and if slink:VkRenderingInfo::pname:viewMask set bit `n`, then 6840 pname:perViewRenderAreaCount must: be at least equal to `n+1`. 6841endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 6842**** 6843 6844include::{generated}/validity/structs/VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM.adoc[] 6845-- 6846endif::VK_QCOM_multiview_per_view_render_areas[] 6847 6848 6849[open,refpage='vkGetRenderAreaGranularity',desc='Returns the granularity for optimal render area',type='protos'] 6850-- 6851To query the render area granularity, call: 6852 6853include::{generated}/api/protos/vkGetRenderAreaGranularity.adoc[] 6854 6855 * pname:device is the logical device that owns the render pass. 6856 * pname:renderPass is a handle to a render pass. 6857 * pname:pGranularity is a pointer to a slink:VkExtent2D structure in which 6858 the granularity is returned. 6859 6860The conditions leading to an optimal pname:renderArea are: 6861 6862 * the pname:offset.x member in pname:renderArea is a multiple of the 6863 pname:width member of the returned slink:VkExtent2D (the horizontal 6864 granularity). 6865 * the pname:offset.y member in pname:renderArea is a multiple of the 6866 pname:height member of the returned slink:VkExtent2D (the vertical 6867 granularity). 6868 * either the pname:extent.width member in pname:renderArea is a multiple 6869 of the horizontal granularity or pname:offset.x+pname:extent.width is 6870 equal to the pname:width of the pname:framebuffer in the 6871 slink:VkRenderPassBeginInfo. 6872 * either the pname:extent.height member in pname:renderArea is a multiple 6873 of the vertical granularity or pname:offset.y+pname:extent.height is 6874 equal to the pname:height of the pname:framebuffer in the 6875 slink:VkRenderPassBeginInfo. 6876 6877Subpass dependencies are not affected by the render area, and apply to the 6878entire image subresources attached to the framebuffer as specified in the 6879description of <<renderpass-layout-transitions,automatic layout 6880transitions>>. 6881Similarly, pipeline barriers are valid even if their effect extends outside 6882the render area. 6883 6884include::{generated}/validity/protos/vkGetRenderAreaGranularity.adoc[] 6885-- 6886 6887[open,refpage='vkCmdNextSubpass',desc='Transition to the next subpass of a render pass',type='protos'] 6888-- 6889To transition to the next subpass in the render pass instance after 6890recording the commands for a subpass, call: 6891 6892include::{generated}/api/protos/vkCmdNextSubpass.adoc[] 6893 6894 * pname:commandBuffer is the command buffer in which to record the 6895 command. 6896 * pname:contents specifies how the commands in the next subpass will be 6897 provided, in the same fashion as the corresponding parameter of 6898 flink:vkCmdBeginRenderPass. 6899 6900The subpass index for a render pass begins at zero when 6901fname:vkCmdBeginRenderPass is recorded, and increments each time 6902fname:vkCmdNextSubpass is recorded. 6903 6904After transitioning to the next subpass, the application can: record the 6905commands for that subpass. 6906 6907.Valid Usage 6908**** 6909 * [[VUID-vkCmdNextSubpass-None-00909]] 6910 The current subpass index must: be less than the number of subpasses in 6911 the render pass minus one 6912ifdef::VK_EXT_transform_feedback[] 6913 * [[VUID-vkCmdNextSubpass-None-02349]] 6914 This command must: not be recorded when transform feedback is active 6915endif::VK_EXT_transform_feedback[] 6916**** 6917 6918include::{generated}/validity/protos/vkCmdNextSubpass.adoc[] 6919-- 6920 6921ifdef::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 6922[open,refpage='vkCmdNextSubpass2',desc='Transition to the next subpass of a render pass',type='protos',alias='vkCmdNextSubpass2KHR'] 6923-- 6924To transition to the next subpass in the render pass instance after 6925recording the commands for a subpass, call: 6926 6927ifdef::VK_VERSION_1_2[] 6928include::{generated}/api/protos/vkCmdNextSubpass2.adoc[] 6929endif::VK_VERSION_1_2[] 6930 6931ifdef::VK_VERSION_1_2+VK_KHR_create_renderpass2[or the equivalent command] 6932 6933ifdef::VK_KHR_create_renderpass2[] 6934include::{generated}/api/protos/vkCmdNextSubpass2KHR.adoc[] 6935endif::VK_KHR_create_renderpass2[] 6936 6937 * pname:commandBuffer is the command buffer in which to record the 6938 command. 6939 * pname:pSubpassBeginInfo is a pointer to a slink:VkSubpassBeginInfo 6940 structure containing information about the subpass which is about to 6941 begin rendering. 6942 * pname:pSubpassEndInfo is a pointer to a slink:VkSubpassEndInfo structure 6943 containing information about how the previous subpass will be ended. 6944 6945fname:vkCmdNextSubpass2 is semantically identical to flink:vkCmdNextSubpass, 6946except that it is extensible, and that pname:contents is provided as part of 6947an extensible structure instead of as a flat parameter. 6948 6949.Valid Usage 6950**** 6951 * [[VUID-vkCmdNextSubpass2-None-03102]] 6952 The current subpass index must: be less than the number of subpasses in 6953 the render pass minus one 6954ifdef::VK_EXT_transform_feedback[] 6955 * [[VUID-vkCmdNextSubpass2-None-02350]] 6956 This command must: not be recorded when transform feedback is active 6957endif::VK_EXT_transform_feedback[] 6958**** 6959 6960include::{generated}/validity/protos/vkCmdNextSubpass2.adoc[] 6961-- 6962endif::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 6963 6964[open,refpage='vkCmdEndRenderPass',desc='End the current render pass',type='protos'] 6965-- 6966To record a command to end a render pass instance after recording the 6967commands for the last subpass, call: 6968 6969include::{generated}/api/protos/vkCmdEndRenderPass.adoc[] 6970 6971 * pname:commandBuffer is the command buffer in which to end the current 6972 render pass instance. 6973 6974Ending a render pass instance performs any multisample resolve operations on 6975the final subpass. 6976 6977.Valid Usage 6978**** 6979 * [[VUID-vkCmdEndRenderPass-None-00910]] 6980 The current subpass index must: be equal to the number of subpasses in 6981 the render pass minus one 6982ifdef::VK_EXT_transform_feedback[] 6983 * [[VUID-vkCmdEndRenderPass-None-02351]] 6984 This command must: not be recorded when transform feedback is active 6985endif::VK_EXT_transform_feedback[] 6986ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 6987 * [[VUID-vkCmdEndRenderPass-None-06170]] 6988 The current render pass instance must: not have been begun with 6989 flink:vkCmdBeginRendering 6990endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 6991 * [[VUID-vkCmdEndRenderPass-None-07004]] 6992 If fname:vkCmdBeginQuery* was called within a subpass of the render 6993 pass, the corresponding fname:vkCmdEndQuery* must: have been called 6994 subsequently within the same subpass 6995**** 6996 6997include::{generated}/validity/protos/vkCmdEndRenderPass.adoc[] 6998-- 6999 7000ifdef::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 7001[open,refpage='vkCmdEndRenderPass2',desc='End the current render pass',type='protos',alias='vkCmdEndRenderPass2KHR'] 7002-- 7003To record a command to end a render pass instance after recording the 7004commands for the last subpass, call: 7005 7006ifdef::VK_VERSION_1_2[] 7007include::{generated}/api/protos/vkCmdEndRenderPass2.adoc[] 7008endif::VK_VERSION_1_2[] 7009 7010ifdef::VK_VERSION_1_2+VK_KHR_create_renderpass2[or the equivalent command] 7011 7012ifdef::VK_KHR_create_renderpass2[] 7013include::{generated}/api/protos/vkCmdEndRenderPass2KHR.adoc[] 7014endif::VK_KHR_create_renderpass2[] 7015 7016 * pname:commandBuffer is the command buffer in which to end the current 7017 render pass instance. 7018 * pname:pSubpassEndInfo is a pointer to a slink:VkSubpassEndInfo structure 7019 containing information about how the last subpass will be ended. 7020 7021fname:vkCmdEndRenderPass2 is semantically identical to 7022flink:vkCmdEndRenderPass, except that it is extensible. 7023 7024.Valid Usage 7025**** 7026 * [[VUID-vkCmdEndRenderPass2-None-03103]] 7027 The current subpass index must: be equal to the number of subpasses in 7028 the render pass minus one 7029ifdef::VK_EXT_transform_feedback[] 7030 * [[VUID-vkCmdEndRenderPass2-None-02352]] 7031 This command must: not be recorded when transform feedback is active 7032endif::VK_EXT_transform_feedback[] 7033ifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 7034 * [[VUID-vkCmdEndRenderPass2-None-06171]] 7035 The current render pass instance must: not have been begun with 7036 flink:vkCmdBeginRendering 7037endif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 7038 * [[VUID-vkCmdEndRenderPass2-None-07005]] 7039 If fname:vkCmdBeginQuery* was called within a subpass of the render 7040 pass, the corresponding fname:vkCmdEndQuery* must: have been called 7041 subsequently within the same subpass 7042**** 7043 7044include::{generated}/validity/protos/vkCmdEndRenderPass2.adoc[] 7045-- 7046 7047[open,refpage='VkSubpassEndInfo',desc='Structure specifying subpass end information',type='structs',alias='VkSubpassEndInfoKHR'] 7048-- 7049The sname:VkSubpassEndInfo structure is defined as: 7050 7051include::{generated}/api/structs/VkSubpassEndInfo.adoc[] 7052 7053ifdef::VK_KHR_create_renderpass2[] 7054or the equivalent 7055 7056include::{generated}/api/structs/VkSubpassEndInfoKHR.adoc[] 7057endif::VK_KHR_create_renderpass2[] 7058 7059 * pname:sType is a elink:VkStructureType value identifying this structure. 7060 * pname:pNext is `NULL` or a pointer to a structure extending this 7061 structure. 7062 7063include::{generated}/validity/structs/VkSubpassEndInfo.adoc[] 7064-- 7065 7066ifdef::VK_QCOM_fragment_density_map_offset[] 7067[open,refpage='VkSubpassFragmentDensityMapOffsetEndInfoQCOM',desc='Structure specifying fragment density map offset subpass end information',type='structs'] 7068-- 7069[[renderpass-fragmentdensitymapoffsets]] 7070If the slink:VkSubpassEndInfo::pname:pNext chain includes a 7071sname:VkSubpassFragmentDensityMapOffsetEndInfoQCOM structure, then that 7072structure includes an array of fragment density map offsets per layer for 7073the render pass. 7074 7075The sname:VkSubpassFragmentDensityMapOffsetEndInfoQCOM structure is defined 7076as: 7077 7078include::{generated}/api/structs/VkSubpassFragmentDensityMapOffsetEndInfoQCOM.adoc[] 7079 7080 * pname:sType is a elink:VkStructureType value identifying this structure. 7081 * pname:pNext is `NULL` or a pointer to a structure extending this 7082 structure. 7083 * pname:fragmentDensityOffsetCount is the number of offsets being 7084 specified. 7085 * pname:pFragmentDensityOffsets is a pointer to an array of 7086 slink:VkOffset2D structs, each of which describes the offset per layer. 7087 7088The array elements are given per pname:layer as defined by 7089<<fragmentdensitymap-fetch-density-value,Fetch Density Value>>, where 7090[eq]#index = layer#. 7091Each [eq]#(x,y)# offset is in framebuffer pixels and shifts the fetch of the 7092fragment density map by that amount. 7093Offsets can be positive or negative. 7094 7095Offset values specified for any subpass that is not the last subpass in the 7096render pass are ignored. 7097If the slink:VkSubpassEndInfo::pname:pNext chain for the last subpass of a 7098render pass does not include 7099sname:VkSubpassFragmentDensityMapOffsetEndInfoQCOM, or if 7100pname:fragmentDensityOffsetCount is zero, then the offset [eq]#(0,0)# is 7101used for <<fragmentdensitymap-fetch-density-value,Fetch Density Value>>. 7102 7103.Valid Usage 7104**** 7105 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-fragmentDensityMapOffsets-06503]] 7106 If the <<features-fragmentDensityMapOffsets, 7107 pname:fragmentDensityMapOffsets>> feature is not enabled or fragment 7108 density map is not enabled in the render pass, 7109 pname:fragmentDensityOffsetCount must: equal `0` 7110 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-fragmentDensityMapAttachment-06504]] 7111 If sname:VkSubpassDescription::pname:fragmentDensityMapAttachment is not 7112 is not ename:VK_ATTACHMENT_UNUSED and was not created with 7113 ename:VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM, 7114 pname:fragmentDensityOffsetCount must: equal `0` 7115 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-pDepthStencilAttachment-06505]] 7116 If sname:VkSubpassDescription::pname:pDepthStencilAttachment is not is 7117 not ename:VK_ATTACHMENT_UNUSED and was not created with 7118 ename:VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM, 7119 pname:fragmentDensityOffsetCount must: equal `0` 7120 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-pInputAttachments-06506]] 7121 If any element of sname:VkSubpassDescription::pname:pInputAttachments is 7122 not is not ename:VK_ATTACHMENT_UNUSED and was not created with 7123 ename:VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM, 7124 pname:fragmentDensityOffsetCount must: equal `0` 7125 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-pColorAttachments-06507]] 7126 If any element of sname:VkSubpassDescription::pname:pColorAttachments is 7127 not is not ename:VK_ATTACHMENT_UNUSED and was not created with 7128 ename:VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM, 7129 pname:fragmentDensityOffsetCount must: equal `0` 7130 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-pResolveAttachments-06508]] 7131 If any element of sname:VkSubpassDescription::pname:pResolveAttachments 7132 is not is not ename:VK_ATTACHMENT_UNUSED and was not created with 7133 ename:VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM, 7134 pname:fragmentDensityOffsetCount must: equal `0` 7135 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-pPreserveAttachments-06509]] 7136 If any element of sname:VkSubpassDescription::pname:pPreserveAttachments 7137 is not is not ename:VK_ATTACHMENT_UNUSED and was not created with 7138 ename:VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM, 7139 pname:fragmentDensityOffsetCount must: equal `0` 7140 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-fragmentDensityOffsetCount-06510]] 7141 If pname:fragmentDensityOffsetCount is not `0` and multiview is enabled 7142 for the render pass, pname:fragmentDensityOffsetCount must: equal the 7143 pname:layerCount that was specified in creating the fragment density map 7144 attachment view 7145 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-fragmentDensityOffsetCount-06511]] 7146 If pname:fragmentDensityOffsetCount is not `0` and multiview is not 7147 enabled for the render pass, pname:fragmentDensityOffsetCount must: 7148 equal `1` 7149 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-x-06512]] 7150 The pname:x component of each element of pname:pFragmentDensityOffsets 7151 must: be an integer multiple of 7152 pname:fragmentDensityOffsetGranularity.width 7153 * [[VUID-VkSubpassFragmentDensityMapOffsetEndInfoQCOM-y-06513]] 7154 The pname:y component of each element of pname:pFragmentDensityOffsets 7155 must: be an integer multiple of 7156 pname:fragmentDensityOffsetGranularity.height 7157**** 7158 7159include::{generated}/validity/structs/VkSubpassFragmentDensityMapOffsetEndInfoQCOM.adoc[] 7160-- 7161endif::VK_QCOM_fragment_density_map_offset[] 7162endif::VK_VERSION_1_2,VK_KHR_create_renderpass2[] 7163 7164ifdef::VK_EXT_subpass_merge_feedback[] 7165include::{chapters}/VK_EXT_subpass_merge_feedback/renderpass.adoc[] 7166endif::VK_EXT_subpass_merge_feedback[] 7167 7168 7169 7170== Common Render Pass Data Races (Informative) 7171 7172Due to the complexity of how rendering is performed, there are several ways 7173an application can accidentally introduce a data race, usually by doing 7174something that may seem benign but actually cannot be supported. 7175This section indicates a number of the more common cases as guidelines to 7176help avoid them. 7177 7178 7179=== Sampling From a Read-only Attachment 7180 7181Vulkan includes read-only layouts for depth/stencil images, that allow the 7182images to be both read during a render pass for the purposes of 7183depth/stencil tests, and read as a non-attachment. 7184 7185However, because ename:VK_ATTACHMENT_STORE_OP_STORE and 7186ename:VK_ATTACHMENT_STORE_OP_DONT_CARE may perform write operations, even if 7187no recorded command writes to an attachment, reading from an image while 7188also using it as an attachment with these store operations can result in a 7189data race. 7190If the reads from the non-attachment are performed in a fragment shader 7191where the accessed samples match those covered by the fragment shader, no 7192data race will occur as store operations are guaranteed to operate after 7193fragment shader execution for the set of samples the fragment covers. 7194Notably, input attachments can also be used for this case. 7195Reading other samples or in any other shader stage can result in unexpected 7196behavior due to the potential for a data race, and validation errors should 7197be generated for doing so. 7198In practice, many applications have shipped reading samples outside of the 7199covered fragment without any observable issue, but there is no guarantee 7200that this will always work, and it is not advisable to rely on this in new 7201or re-worked code bases. 7202ifdef::VK_VERSION_1_3,VK_EXT_load_store_op_none,VK_QCOM_render_pass_store_ops,VK_KHR_dynamic_rendering[] 7203As ename:VK_ATTACHMENT_STORE_OP_NONE is guaranteed to perform no writes, 7204applications wishing to read an image as both an attachment and a 7205non-attachment should make use of this store operation, coupled with a load 7206operation that also performs no writes. 7207endif::VK_VERSION_1_3,VK_EXT_load_store_op_none,VK_QCOM_render_pass_store_ops,VK_KHR_dynamic_rendering[] 7208 7209 7210=== Non-overlapping Access Between Resources 7211 7212When relying on non-overlapping accesses between attachments and other 7213resources, it is important to note that <<renderpass-load-operations, load>> 7214and <<renderpass-store-operations, store>> operations have fairly wide 7215alignment requirements - potentially affecting entire subresources and 7216adjacent depth/stencil aspects. 7217This makes it invalid to access a non-attachment subresource that is 7218simultaneously being used as an attachment where either access performs a 7219write operation. 7220 7221ifdef::VK_EXT_attachment_feedback_loop_layout[] 7222The only exception to this is if a subresource is in the 7223ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT image layout, in 7224which case the overlap is defined to occur at a per-pixel granularity, and 7225applications can read data from pixels outside the render area without 7226introducing a data race. 7227endif::VK_EXT_attachment_feedback_loop_layout[] 7228 7229 7230=== Depth/Stencil and Input Attachments 7231 7232When rendering to only the depth OR stencil aspect of an image, an input 7233attachment accessing the other aspect will 7234ifndef::VK_KHR_maintenance2[] 7235always result in a data race. 7236endif::VK_KHR_maintenance2[] 7237ifdef::VK_KHR_maintenance2[] 7238not cause a data race only under very specific conditions. 7239To avoid a data race, the aspect not being written must be in a read-only 7240layout, and writes to it must be disabled in the draw state. 7241For example, to read from stencil while writing depth, the attachment must 7242be in ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL (or 7243equivalent), and the stencil write mask must be set to 0. 7244Similarly to read from depth while writing stencil, the attachment must be 7245in ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL (or 7246equivalent), and depth write enable must be set to ename:VK_FALSE. 7247endif::VK_KHR_maintenance2[] 7248 7249 7250=== Synchronization Options 7251 7252There are several synchronization options available to synchronize between 7253accesses to resources within a render pass. 7254Some of the options are outlined below: 7255 7256 * A slink:VkSubpassDependency in a render pass object can synchronize 7257 attachment writes and <<renderpass-resolve-operations, multisample 7258 resolve operations>> from a prior subpass for subsequent input 7259 attachment reads. 7260 * A flink:vkCmdPipelineBarrier inside a subpass can synchronize prior 7261 attachment writes in the subpass with subsequent input attachment reads. 7262ifdef::VK_EXT_attachment_feedback_loop_layout[] 7263 * A flink:vkCmdPipelineBarrier inside a subpass can synchronize prior 7264 attachment writes in the subpass with subsequent non-attachment reads if 7265 the attachment is in the 7266 ename:VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT image layout. 7267endif::VK_EXT_attachment_feedback_loop_layout[] 7268ifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 7269 * If a subresource is used as a color and input attachment, and the 7270 pipeline performing the read was created with 7271 ename:VK_PIPELINE_COLOR_BLEND_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_BIT_EXT 7272 * If a subresource is used as a depth and input attachment, and the 7273 pipeline performing the read was created with 7274 ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT 7275 * If a subresource is used as a stencil and input attachment, and the 7276 pipeline performing the read was created with 7277 ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT 7278endif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 7279ifdef::VK_EXT_fragment_shader_interlock[] 7280 * If a subresource is used as two separate non-attachment resources, 7281 writes to a pixel or individual sample in a fragment shader can be 7282 synchronized with access to the same pixel or sample in another fragment 7283 shader by using one of the <<shaders-scope-fragment-interlock, fragment 7284 interlock>> execution modes. 7285endif::VK_EXT_fragment_shader_interlock[] 7286