1// Copyright 2019-2021 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5// Common Valid Usage 6// Common to all drawing commands 7include::{chapters}/commonvalidity/draw_dispatch_common.txt[] 8 * [[VUID-{refpage}-renderPass-02684]] 9 The current render pass must: be <<renderpass-compatibility,compatible>> 10 with the pname:renderPass member of the 11 sname:VkGraphicsPipelineCreateInfo structure specified when creating the 12 sname:VkPipeline bound to ename:VK_PIPELINE_BIND_POINT_GRAPHICS 13 * [[VUID-{refpage}-subpass-02685]] 14 The subpass index of the current render pass must: be equal to the 15 pname:subpass member of the sname:VkGraphicsPipelineCreateInfo structure 16 specified when creating the sname:VkPipeline bound to 17 ename:VK_PIPELINE_BIND_POINT_GRAPHICS 18 * [[VUID-{refpage}-None-02686]] 19 Every input attachment used by the current subpass must: be bound to the 20 pipeline via a descriptor set 21 * [[VUID-{refpage}-None-04584]] 22 Image subresources used as attachments in the current render pass must: 23 not be accessed in any way other than as an attachment by this command, 24 except for cases involving read-only access to depth/stencil attachments 25 as described in the <<renderpass-attachment-nonattachment, Render Pass>> 26 chapter 27ifdef::VK_VERSION_1_1,VK_KHR_multiview[] 28 * [[VUID-{refpage}-maxMultiviewInstanceIndex-02688]] 29 If the draw is recorded in a render pass instance with multiview 30 enabled, the maximum instance index must: be less than or equal to 31 slink:VkPhysicalDeviceMultiviewProperties::pname:maxMultiviewInstanceIndex 32endif::VK_VERSION_1_1,VK_KHR_multiview[] 33ifdef::VK_EXT_sample_locations[] 34 * [[VUID-{refpage}-sampleLocationsEnable-02689]] 35 If the bound graphics pipeline was created with 36 slink:VkPipelineSampleLocationsStateCreateInfoEXT::pname:sampleLocationsEnable 37 set to ename:VK_TRUE and the current subpass has a depth/stencil 38 attachment, then that attachment must: have been created with the 39 ename:VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT bit set 40endif::VK_EXT_sample_locations[] 41ifdef::VK_EXT_extended_dynamic_state[] 42 * [[VUID-{refpage}-viewportCount-03417]] 43 If the bound graphics pipeline state was created with the 44 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic state enabled, 45 but not the ename:VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT dynamic state 46 enabled, then flink:vkCmdSetViewportWithCountEXT must: have been called 47 in the current command buffer prior to this drawing command, and the 48 pname:viewportCount parameter of fname:vkCmdSetViewportWithCountEXT 49 must: match the 50 sname:VkPipelineViewportStateCreateInfo::pname:scissorCount of the 51 pipeline 52 * [[VUID-{refpage}-scissorCount-03418]] 53 If the bound graphics pipeline state was created with the 54 ename:VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT dynamic state enabled, but 55 not the ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic state 56 enabled, then flink:vkCmdSetScissorWithCountEXT must: have been called 57 in the current command buffer prior to this drawing command, and the 58 pname:scissorCount parameter of fname:vkCmdSetScissorWithCountEXT must: 59 match the sname:VkPipelineViewportStateCreateInfo::pname:viewportCount 60 of the pipeline 61 * [[VUID-{refpage}-viewportCount-03419]] 62 If the bound graphics pipeline state was created with both the 63 ename:VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT and 64 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic states enabled 65 then both flink:vkCmdSetViewportWithCountEXT and 66 flink:vkCmdSetScissorWithCountEXT must: have been called in the current 67 command buffer prior to this drawing command, and the 68 pname:viewportCount parameter of fname:vkCmdSetViewportWithCountEXT 69 must: match the pname:scissorCount parameter of 70 fname:vkCmdSetScissorWithCountEXT 71ifdef::VK_NV_clip_space_w_scaling[] 72 * [[VUID-{refpage}-viewportCount-04137]] 73 If the bound graphics pipeline state was created with the 74 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic state enabled, 75 but not the ename:VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV dynamic state 76 enabled, then the bound graphics pipeline must: have been created with 77 slink:VkPipelineViewportWScalingStateCreateInfoNV::pname:viewportCount 78 greater or equal to the pname:viewportCount parameter in the last call 79 to flink:vkCmdSetViewportWithCountEXT 80 * [[VUID-{refpage}-viewportCount-04138]] 81 If the bound graphics pipeline state was created with the 82 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT and 83 ename:VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV dynamic states enabled then 84 the pname:viewportCount parameter in the last call to 85 flink:vkCmdSetViewportWScalingNV must: be greater than or equal to the 86 pname:viewportCount parameter in the last call to 87 flink:vkCmdSetViewportWithCountEXT 88endif::VK_NV_clip_space_w_scaling[] 89ifdef::VK_NV_shading_rate_image[] 90 * [[VUID-{refpage}-viewportCount-04139]] 91 If the bound graphics pipeline state was created with the 92 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic state enabled, 93 but not the ename:VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV 94 dynamic state enabled, then the bound graphics pipeline must: have been 95 created with 96 slink:VkPipelineViewportShadingRateImageStateCreateInfoNV::pname:viewportCount 97 greater or equal to the pname:viewportCount parameter in the last call 98 to flink:vkCmdSetViewportWithCountEXT 99 * [[VUID-{refpage}-viewportCount-04140]] 100 If the bound graphics pipeline state was created with the 101 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT and 102 ename:VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV dynamic states 103 enabled then the pname:viewportCount parameter in the last call to 104 flink:vkCmdSetViewportShadingRatePaletteNV must: be greater than or 105 equal to the pname:viewportCount parameter in the last call to 106 flink:vkCmdSetViewportWithCountEXT 107endif::VK_NV_shading_rate_image[] 108ifdef::VK_NV_viewport_swizzle[] 109 * [[VUID-{refpage}-VkPipelineVieportCreateInfo-04141]] 110 If the bound graphics pipeline state was created with the 111 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic state enabled and 112 a slink:VkPipelineViewportSwizzleStateCreateInfoNV structure chained 113 from pname:VkPipelineVieportCreateInfo, then the bound graphics pipeline 114 must: have been created with 115 slink:VkPipelineViewportSwizzleStateCreateInfoNV::pname:viewportCount 116 greater or equal to the pname:viewportCount parameter in the last call 117 to flink:vkCmdSetViewportWithCountEXT 118endif::VK_NV_viewport_swizzle[] 119ifdef::VK_NV_scissor_exclusive[] 120 * [[VUID-{refpage}-VkPipelineVieportCreateInfo-04142]] 121 If the bound graphics pipeline state was created with the 122 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic state enabled and 123 a slink:VkPipelineViewportExclusiveScissorStateCreateInfoNV structure 124 chained from pname:VkPipelineVieportCreateInfo, then the bound graphics 125 pipeline must: have been created with 126 slink:VkPipelineViewportExclusiveScissorStateCreateInfoNV::pname:exclusiveScissorCount 127 greater or equal to the pname:viewportCount parameter in the last call 128 to flink:vkCmdSetViewportWithCountEXT 129endif::VK_NV_scissor_exclusive[] 130endif::VK_EXT_extended_dynamic_state[] 131ifdef::VK_EXT_extended_dynamic_state2[] 132 * [[VUID-{refpage}-None-04876]] 133 If the bound graphics pipeline state was created with the 134 ename:VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT dynamic state 135 enabled then flink:vkCmdSetRasterizerDiscardEnableEXT must: have been 136 called in the current command buffer prior to this drawing command 137 * [[VUID-{refpage}-None-04877]] 138 If the bound graphics pipeline state was created with the 139 ename:VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT dynamic state enabled then 140 flink:vkCmdSetDepthBiasEnableEXT must: have been called in the current 141 command buffer prior to this drawing command 142 * [[VUID-{refpage}-logicOp-04878]] 143 If the bound graphics pipeline state was created with the 144 ename:VK_DYNAMIC_STATE_LOGIC_OP_EXT dynamic state enabled then 145 flink:vkCmdSetLogicOpEXT must: have been called in the current command 146 buffer prior to this drawing command and the pname:logicOp must: be a 147 valid elink:VkLogicOp value 148endif::VK_EXT_extended_dynamic_state2[] 149ifdef::VK_KHR_fragment_shading_rate+VK_EXT_extended_dynamic_state[] 150 * [[VUID-{refpage}-primitiveFragmentShadingRateWithMultipleViewports-04552]] 151 If the <<limits-primitiveFragmentShadingRateWithMultipleViewports, 152 pname:primitiveFragmentShadingRateWithMultipleViewports>> limit is not 153 supported, the bound graphics pipeline was created with the 154 ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT dynamic state enabled, 155 and any of the shader stages of the bound graphics pipeline write to the 156 code:PrimitiveShadingRateKHR built-in, then 157 flink:vkCmdSetViewportWithCountEXT must: have been called in the current 158 command buffer prior to this drawing command, and the 159 pname:viewportCount parameter of fname:vkCmdSetViewportWithCountEXT 160 must: be `1` 161endif::VK_KHR_fragment_shading_rate+VK_EXT_extended_dynamic_state[] 162 * [[VUID-{refpage}-blendEnable-04727]] 163 If rasterization is not disabled in the bound graphics pipeline, then 164 for each color attachment in the subpass, if the corresponding image 165 view's <<resources-image-view-format-features,format features>> do not 166 contain ename:VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT, then the 167 pname:blendEnable member of the corresponding element of the 168 pname:pAttachments member of pname:pColorBlendState must: be 169 ename:VK_FALSE 170 * [[VUID-{refpage}-rasterizationSamples-04740]] 171 If rasterization is not disabled in the bound graphics pipeline, and 172 neither the `apiext:VK_AMD_mixed_attachment_samples` nor the 173 `apiext:VK_NV_framebuffer_mixed_samples` extensions are enabled, then 174 slink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples 175 must: be the same as the current subpass color and/or depth/stencil 176 attachments 177ifdef::VK_KHR_dynamic_rendering[] 178 * [[VUID-{refpage}-imageView-06172]] 179 If the current render pass instance was begun with 180 flink:vkCmdBeginRenderingKHR, the pname:imageView member of 181 pname:pDepthAttachment is not dlink:VK_NULL_HANDLE, and the pname:layout 182 member of pname:pDepthAttachment is 183 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, this command 184 must: not write any values to the depth attachment 185 * [[VUID-{refpage}-imageView-06173]] 186 If the current render pass instance was begun with 187 flink:vkCmdBeginRenderingKHR, the pname:imageView member of 188 pname:pStencilAttachment is not dlink:VK_NULL_HANDLE, and the 189 pname:layout member of pname:pStencilAttachment is 190 ename:VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL, this command 191 must: not write any values to the stencil attachment 192ifdef::VK_VERSION_1_1,VK_KHR_maintenance2[] 193 * [[VUID-{refpage}-imageView-06174]] 194 If the current render pass instance was begun with 195 flink:vkCmdBeginRenderingKHR, the pname:imageView member of 196 pname:pDepthAttachment is not dlink:VK_NULL_HANDLE, and the pname:layout 197 member of pname:pDepthAttachment is 198 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, this 199 command must: not write any values to the depth attachment 200 * [[VUID-{refpage}-imageView-06175]] 201 If the current render pass instance was begun with 202 flink:vkCmdBeginRenderingKHR, the pname:imageView member of 203 pname:pStencilAttachment is not dlink:VK_NULL_HANDLE, and the 204 pname:layout member of pname:pStencilAttachment is 205 ename:VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, this 206 command must: not write any values to the stencil attachment 207endif::VK_VERSION_1_1,VK_KHR_maintenance2[] 208ifdef::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 209 * [[VUID-{refpage}-imageView-06176]] 210 If the current render pass instance was begun with 211 flink:vkCmdBeginRenderingKHR, the pname:imageView member of 212 pname:pDepthAttachment is not dlink:VK_NULL_HANDLE, and the pname:layout 213 member of pname:pDepthAttachment is 214 ename:VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, this command must: not 215 write any values to the depth attachment 216 * [[VUID-{refpage}-imageView-06177]] 217 If the current render pass instance was begun with 218 flink:vkCmdBeginRenderingKHR, the pname:imageView member of 219 pname:pStencilAttachment is not dlink:VK_NULL_HANDLE, and the 220 pname:layout member of pname:pStencilAttachment is 221 ename:VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL, this command must: not 222 write any values to the stencil attachment 223endif::VK_VERSION_1_2,VK_KHR_separate_depth_stencil_layouts[] 224 * [[VUID-{refpage}-viewMask-06178]] 225 If the current render pass instance was begun with 226 flink:vkCmdBeginRenderingKHR, the currently bound graphics pipeline 227 must: have been created with a 228 slink:VkPipelineRenderingCreateInfoKHR::pname:viewMask equal to 229 slink:VkRenderingInfoKHR::pname:viewMask 230 * [[VUID-{refpage}-colorAttachmentCount-06179]] 231 If the current render pass instance was begun with 232 flink:vkCmdBeginRenderingKHR, the currently bound graphics pipeline 233 must: have been created with a 234 slink:VkPipelineRenderingCreateInfoKHR::pname:colorAttachmentCount equal 235 to slink:VkRenderingInfoKHR::pname:colorAttachmentCount 236 * [[VUID-{refpage}-colorAttachmentCount-06180]] 237 If the current render pass instance was begun with 238 flink:vkCmdBeginRenderingKHR and 239 slink:VkRenderingInfoKHR::pname:colorAttachmentCount greater than `0`, 240 then each element of the 241 slink:VkRenderingInfoKHR::pname:pColorAttachments array with a 242 pname:imageView not equal to dlink:VK_NULL_HANDLE must: have been 243 created with a elink:VkFormat equal to the corresponding element of 244 slink:VkPipelineRenderingCreateInfoKHR::pname:pColorAttachmentFormats 245 used to create the currently bound graphics pipeline 246 * [[VUID-{refpage}-pDepthAttachment-06181]] 247 If the current render pass instance was begun with 248 flink:vkCmdBeginRenderingKHR and 249 slink:VkRenderingInfoKHR::pname:pDepthAttachment->pname:imageView was 250 not dlink:VK_NULL_HANDLE, the value of 251 slink:VkPipelineRenderingCreateInfoKHR::pname:depthAttachmentFormat used 252 to create the currently bound graphics pipeline must: be equal to the 253 elink:VkFormat used to create 254 slink:VkRenderingInfoKHR::pname:pDepthAttachment->pname:imageView 255 * [[VUID-{refpage}-pStencilAttachment-06182]] 256 If the current render pass instance was begun with 257 flink:vkCmdBeginRenderingKHR and 258 slink:VkRenderingInfoKHR::pname:pStencilAttachment->pname:imageView was 259 not dlink:VK_NULL_HANDLE, the value of 260 slink:VkPipelineRenderingCreateInfoKHR::pname:stencilAttachmentFormat 261 used to create the currently bound graphics pipeline must: be equal to 262 the elink:VkFormat used to create 263 slink:VkRenderingInfoKHR::pname:pStencilAttachment->pname:imageView 264ifdef::VK_KHR_fragment_shading_rate[] 265 * [[VUID-{refpage}-imageView-06183]] 266 If the current render pass instance was begun with 267 flink:vkCmdBeginRenderingKHR and 268 slink:VkRenderingFragmentShadingRateAttachmentInfoKHR::pname:imageView 269 was not dlink:VK_NULL_HANDLE, the currently bound graphics pipeline 270 must: have been created with 271 ename:VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR 272endif::VK_KHR_fragment_shading_rate[] 273ifdef::VK_EXT_fragment_density_map[] 274 * [[VUID-{refpage}-imageView-06184]] 275 If the current render pass instance was begun with 276 flink:vkCmdBeginRenderingKHR and 277 slink:VkRenderingFragmentDensityMapAttachmentInfoEXT::pname:imageView 278 was not dlink:VK_NULL_HANDLE, the currently bound graphics pipeline 279 must: have been created with 280 ename:VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT 281endif::VK_EXT_fragment_density_map[] 282ifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 283 * [[VUID-{refpage}-colorAttachmentCount-06185]] 284 If the currently bound pipeline was created with a 285 slink:VkAttachmentSampleCountInfoAMD or 286 slink:VkAttachmentSampleCountInfoNV structure, and the current render 287 pass instance was begun with flink:vkCmdBeginRenderingKHR with a 288 slink:VkRenderingInfoKHR::pname:colorAttachmentCount parameter greater 289 than `0`, then each element of the 290 slink:VkRenderingInfoKHR::pname:pColorAttachments array with a 291 pname:imageView not equal to dlink:VK_NULL_HANDLE must: have been 292 created with a sample count equal to the corresponding element of the 293 pname:pColorAttachmentSamples member of 294 slink:VkAttachmentSampleCountInfoAMD or 295 slink:VkAttachmentSampleCountInfoNV used to create the currently bound 296 graphics pipeline 297 * [[VUID-{refpage}-pDepthAttachment-06186]] 298 If the current render pass instance was begun with 299 flink:vkCmdBeginRenderingKHR, the currently bound pipeline was created 300 with a slink:VkAttachmentSampleCountInfoAMD or 301 slink:VkAttachmentSampleCountInfoNV structure, and 302 slink:VkRenderingInfoKHR::pname:pDepthAttachment->pname:imageView was 303 not dlink:VK_NULL_HANDLE, the value of the 304 pname:depthStencilAttachmentSamples member of 305 slink:VkAttachmentSampleCountInfoAMD or 306 slink:VkAttachmentSampleCountInfoNV used to create the currently bound 307 graphics pipeline must: be equal to the sample count used to create 308 slink:VkRenderingInfoKHR::pname:pDepthAttachment->pname:imageView 309 * [[VUID-{refpage}-pStencilAttachment-06187]] 310 If the current render pass instance was begun with 311 flink:vkCmdBeginRenderingKHR, the currently bound pipeline was created 312 with a slink:VkAttachmentSampleCountInfoAMD or 313 slink:VkAttachmentSampleCountInfoNV structure, and 314 slink:VkRenderingInfoKHR::pname:pStencilAttachment->pname:imageView was 315 not dlink:VK_NULL_HANDLE, the value of the 316 pname:depthStencilAttachmentSamples member of 317 slink:VkAttachmentSampleCountInfoAMD or 318 slink:VkAttachmentSampleCountInfoNV used to create the currently bound 319 graphics pipeline must: be equal to the sample count used to create 320 slink:VkRenderingInfoKHR::pname:pStencilAttachment->pname:imageView 321 * [[VUID-{refpage}-colorAttachmentCount-06188]] 322 If the currently bound pipeline was created without a 323 slink:VkAttachmentSampleCountInfoAMD or 324 slink:VkAttachmentSampleCountInfoNV structure, and the current render 325 pass instance was begun with flink:vkCmdBeginRenderingKHR with a 326 slink:VkRenderingInfoKHR::pname:colorAttachmentCount parameter greater 327 than `0`, then each element of the 328 slink:VkRenderingInfoKHR::pname:pColorAttachments array with a 329 pname:imageView not equal to dlink:VK_NULL_HANDLE must: have been 330 created with a sample count equal to the value of 331 slink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples 332 used to create the currently bound graphics pipeline 333 * [[VUID-{refpage}-pDepthAttachment-06189]] 334 If the current render pass instance was begun with 335 flink:vkCmdBeginRenderingKHR, the currently bound pipeline was created 336 without a slink:VkAttachmentSampleCountInfoAMD or 337 slink:VkAttachmentSampleCountInfoNV structure, and 338 slink:VkRenderingInfoKHR::pname:pDepthAttachment->pname:imageView was 339 not dlink:VK_NULL_HANDLE, the value of 340 slink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples 341 used to create the currently bound graphics pipeline must: be equal to 342 the sample count used to create 343 slink:VkRenderingInfoKHR::pname:pDepthAttachment->pname:imageView 344 * [[VUID-{refpage}-pStencilAttachment-06190]] 345 If the current render pass instance was begun with 346 flink:vkCmdBeginRenderingKHR, the currently bound pipeline was created 347 without a slink:VkAttachmentSampleCountInfoAMD or 348 slink:VkAttachmentSampleCountInfoNV structure, and 349 slink:VkRenderingInfoKHR::pname:pStencilAttachment->pname:imageView was 350 not dlink:VK_NULL_HANDLE, the value of 351 slink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples 352 used to create the currently bound graphics pipeline must: be equal to 353 the sample count used to create 354 slink:VkRenderingInfoKHR::pname:pStencilAttachment->pname:imageView 355 * [[VUID-{refpage}-renderPass-06198]] 356 If the current render pass instance was begun with 357 flink:vkCmdBeginRenderingKHR, the currently bound pipeline must: have 358 been created with a slink:VkGraphicsPipelineCreateInfo::pname:renderPass 359 equal to dlink:VK_NULL_HANDLE 360endif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples[] 361endif::VK_KHR_dynamic_rendering[] 362// Common Valid Usage 363