1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[fragops]] 6e5c31af7Sopenharmony_ci= Fragment Operations 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciFragments produced by rasterization go through a number of operations to 9e5c31af7Sopenharmony_cidetermine whether or how values produced by fragment shading are written to 10e5c31af7Sopenharmony_cithe framebuffer. 11e5c31af7Sopenharmony_ci 12e5c31af7Sopenharmony_ciThe following fragment operations adhere to <<primsrast-order,rasterization 13e5c31af7Sopenharmony_ciorder>>, and are typically performed in this order: 14e5c31af7Sopenharmony_ci 15e5c31af7Sopenharmony_ciifdef::VK_EXT_discard_rectangles[] 16e5c31af7Sopenharmony_ci . <<fragops-discard-rectangles,Discard rectangles test>> 17e5c31af7Sopenharmony_ciendif::VK_EXT_discard_rectangles[] 18e5c31af7Sopenharmony_ci . <<fragops-scissor,Scissor test>> 19e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 20e5c31af7Sopenharmony_ci . <<fragops-exclusive-scissor,Exclusive scissor test>> 21e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 22e5c31af7Sopenharmony_ci . <<fragops-samplemask,Sample mask test>> 23e5c31af7Sopenharmony_ci . Certain <<fragops-shader,Fragment shading>> operations: 24e5c31af7Sopenharmony_ci ** <<fragops-shader-samplemask, Sample Mask Accesses>> 25e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_tile_image[] 26e5c31af7Sopenharmony_ci ** <<fragops-shader-tileimage-reads, Tile Image Reads>> 27e5c31af7Sopenharmony_ciendif::VK_EXT_shader_tile_image[] 28e5c31af7Sopenharmony_ci ** <<fragops-shader-depthreplacement, Depth Replacement>> 29e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_stencil_export[] 30e5c31af7Sopenharmony_ci ** <<fragops-shader-stencilrefreplacement, Stencil Reference Replacement>> 31e5c31af7Sopenharmony_ciendif::VK_EXT_shader_stencil_export[] 32e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_shader_interlock[] 33e5c31af7Sopenharmony_ci ** <<fragops-shader-interlock, Interlocked Operations>> 34e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_shader_interlock[] 35e5c31af7Sopenharmony_ci . <<fragops-covg, Multisample coverage>> 36e5c31af7Sopenharmony_ci . <<fragops-dbt, Depth bounds test>> 37e5c31af7Sopenharmony_ci . <<fragops-stencil, Stencil test>> 38e5c31af7Sopenharmony_ci . <<fragops-depth, Depth test>> 39e5c31af7Sopenharmony_ciifdef::VK_NV_representative_fragment_test[] 40e5c31af7Sopenharmony_ci . <<fragops-rep-frag-test, Representative fragment test>> 41e5c31af7Sopenharmony_ciendif::VK_NV_representative_fragment_test[] 42e5c31af7Sopenharmony_ci . <<fragops-samplecount, Sample counting>> 43e5c31af7Sopenharmony_ciifdef::VK_NV_fragment_coverage_to_color[] 44e5c31af7Sopenharmony_ci . <<fragops-coverage-to-color, Coverage to color>> 45e5c31af7Sopenharmony_ciendif::VK_NV_fragment_coverage_to_color[] 46e5c31af7Sopenharmony_ci . <<fragops-coverage-reduction, Coverage reduction>> 47e5c31af7Sopenharmony_ciifdef::VK_NV_framebuffer_mixed_samples[] 48e5c31af7Sopenharmony_ci . <<fragops-coverage-modulation, Coverage modulation>> 49e5c31af7Sopenharmony_ciendif::VK_NV_framebuffer_mixed_samples[] 50e5c31af7Sopenharmony_ci 51e5c31af7Sopenharmony_ciThe <<primsrast-multisampling-coverage-mask, coverage mask>> generated by 52e5c31af7Sopenharmony_cirasterization describes the initial coverage of each sample covered by the 53e5c31af7Sopenharmony_cifragment. 54e5c31af7Sopenharmony_ciFragment operations will update the coverage mask to add or subtract 55e5c31af7Sopenharmony_cicoverage where appropriate. 56e5c31af7Sopenharmony_ciIf a fragment operation results in all bits of the coverage mask being `0`, 57e5c31af7Sopenharmony_cithe fragment is discarded, and no further operations are performed. 58e5c31af7Sopenharmony_ciFragments can also be programmatically discarded in a fragment shader by 59e5c31af7Sopenharmony_ciexecuting one of 60e5c31af7Sopenharmony_ci 61e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_shader_terminate_invocation[] 62e5c31af7Sopenharmony_ci * code:OpTerminateInvocation 63e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_shader_terminate_invocation[] 64e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_shader_demote_to_helper_invocation[] 65e5c31af7Sopenharmony_ci * code:OpDemoteToHelperInvocationEXT 66e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_shader_demote_to_helper_invocation[] 67e5c31af7Sopenharmony_ci * code:OpKill. 68e5c31af7Sopenharmony_ci 69e5c31af7Sopenharmony_ciWhen one of the fragment operations in this chapter is described as 70e5c31af7Sopenharmony_ci"`replacing`" a fragment shader output, that output is replaced 71e5c31af7Sopenharmony_ciunconditionally, even if no fragment shader previously wrote to that output. 72e5c31af7Sopenharmony_ci 73e5c31af7Sopenharmony_ciifdef::VK_EXT_post_depth_coverage[] 74e5c31af7Sopenharmony_ciIf there is a <<fragops-shader, fragment shader>> and it declares the 75e5c31af7Sopenharmony_cicode:PostDepthCoverage execution mode, the <<fragops-samplemask, sample mask 76e5c31af7Sopenharmony_citest>> is instead performed after the <<fragops-depth, depth test>>. 77e5c31af7Sopenharmony_ciendif::VK_EXT_post_depth_coverage[] 78e5c31af7Sopenharmony_ci 79e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[] 80e5c31af7Sopenharmony_ciIf 81e5c31af7Sopenharmony_cisname:VkPhysicalDeviceMaintenance5PropertiesKHR::pname:earlyFragmentMultisampleCoverageAfterSampleCounting 82e5c31af7Sopenharmony_ciis set to ename:VK_TRUE and there is a <<fragops-shader, fragment shader>> 83e5c31af7Sopenharmony_ciwhich declares the code:EarlyFragmentTests execution mode, <<fragops-shader, 84e5c31af7Sopenharmony_cifragment shading>> and <<fragops-covg, multisample coverage>> operations 85e5c31af7Sopenharmony_cimust: be performed after <<fragops-samplecount, sample counting>>. 86e5c31af7Sopenharmony_ci 87e5c31af7Sopenharmony_ciOtherwise, if 88e5c31af7Sopenharmony_cisname:VkPhysicalDeviceMaintenance5PropertiesKHR::pname:earlyFragmentMultisampleCoverageAfterSampleCounting 89e5c31af7Sopenharmony_ciis set to ename:VK_FALSE and there is a <<fragops-shader, fragment shader>> 90e5c31af7Sopenharmony_ciwhich declares the code:EarlyFragmentTests execution mode, <<fragops-shader, 91e5c31af7Sopenharmony_cifragment shading>> and <<fragops-covg, multisample coverage>> operations 92e5c31af7Sopenharmony_cishould: instead be performed after <<fragops-samplecount, sample counting>>, 93e5c31af7Sopenharmony_cibut may: be performed before <<fragops-samplecount, sample counting>>. 94e5c31af7Sopenharmony_ci 95e5c31af7Sopenharmony_ciIf 96e5c31af7Sopenharmony_cisname:VkPhysicalDeviceMaintenance5PropertiesKHR::pname:earlyFragmentSampleMaskTestBeforeSampleCounting 97e5c31af7Sopenharmony_ciis set to ename:VK_TRUE and there is a <<fragops-shader, fragment shader>> 98e5c31af7Sopenharmony_ciwhich declares the code:EarlyFragmentTests execution mode 99e5c31af7Sopenharmony_ci<<fragops-samplemask, sample mask test>> operations must: follow the order 100e5c31af7Sopenharmony_ciof fragment operations from above. 101e5c31af7Sopenharmony_ci 102e5c31af7Sopenharmony_ciOtherwise, if 103e5c31af7Sopenharmony_cisname:VkPhysicalDeviceMaintenance5PropertiesKHR::pname:earlyFragmentSampleMaskTestBeforeSampleCounting 104e5c31af7Sopenharmony_ciis set to ename:VK_FALSE and there is a <<fragops-shader, fragment shader>> 105e5c31af7Sopenharmony_ciwhich declares the code:EarlyFragmentTests execution mode, 106e5c31af7Sopenharmony_ci<<fragops-samplemask, sample mask test>> operations should: follow the order 107e5c31af7Sopenharmony_ciof fragment operations from above but may: instead be performed after 108e5c31af7Sopenharmony_ci<<fragops-samplecount, sample counting>>. 109e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance5[] 110e5c31af7Sopenharmony_ciifndef::VK_KHR_maintenance5[] 111e5c31af7Sopenharmony_ciIf there is a <<fragops-shader, fragment shader>> and it declares the 112e5c31af7Sopenharmony_cicode:EarlyFragmentTests execution mode, <<fragops-shader,fragment shading>> 113e5c31af7Sopenharmony_ciand <<fragops-covg, multisample coverage>> operations should: instead be 114e5c31af7Sopenharmony_ciperformed after <<fragops-samplecount, sample counting>>, and 115e5c31af7Sopenharmony_ci<<fragops-samplemask,sample mask test>> may: instead be performed after 116e5c31af7Sopenharmony_ci<<fragops-samplecount, sample counting>>. 117e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance5[] 118e5c31af7Sopenharmony_ci 119e5c31af7Sopenharmony_ciifdef::VK_AMD_shader_early_and_late_fragment_tests[] 120e5c31af7Sopenharmony_ciIf there is a <<fragops-shader, fragment shader>> which declares the 121e5c31af7Sopenharmony_cicode:EarlyAndLateFragmentTestsAMD execution mode, and it does not declare 122e5c31af7Sopenharmony_cithe code:DepthReplacing 123e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_stencil_export[] 124e5c31af7Sopenharmony_cior code:StencilRefReplacingEXT 125e5c31af7Sopenharmony_ciendif::VK_EXT_shader_stencil_export[] 126e5c31af7Sopenharmony_ciexecution mode, <<fragops-shader,fragment shading>> and <<fragops-covg, 127e5c31af7Sopenharmony_cimultisample coverage>> operations are instead be performed after 128e5c31af7Sopenharmony_ci<<fragops-samplecount, sample counting>>. 129e5c31af7Sopenharmony_ci 130e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_stencil_export[] 131e5c31af7Sopenharmony_ciFor a pipeline with the following properties: 132e5c31af7Sopenharmony_ci 133e5c31af7Sopenharmony_ci * a fragment shader is specified 134e5c31af7Sopenharmony_ci * the fragment shader either specifies code:EarlyAndLateFragmentTestsAMD 135e5c31af7Sopenharmony_ci or does not write to storage resources; 136e5c31af7Sopenharmony_ci * the fragment shader specifies the code:StencilRefReplacingEXT execution 137e5c31af7Sopenharmony_ci mode; 138e5c31af7Sopenharmony_ci * either 139e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:StencilRefUnchangedFrontAMD 140e5c31af7Sopenharmony_ci execution mode; 141e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:StencilRefLessFrontAMD execution 142e5c31af7Sopenharmony_ci mode and the pipeline uses a 143e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:front.compareOp of 144e5c31af7Sopenharmony_ci ename:VK_COMPARE_OP_GREATER or ename:VK_COMPARE_OP_GREATER_OR_EQUAL; or 145e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:StencilRefGreaterFrontAMD 146e5c31af7Sopenharmony_ci execution mode and the pipeline uses a 147e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:front.compareOp of 148e5c31af7Sopenharmony_ci ename:VK_COMPARE_OP_LESS or ename:VK_COMPARE_OP_LESS_OR_EQUAL; and 149e5c31af7Sopenharmony_ci * either 150e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:StencilRefUnchangedBackAMD 151e5c31af7Sopenharmony_ci execution mode; 152e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:StencilRefLessBackAMD execution 153e5c31af7Sopenharmony_ci mode and the pipeline uses a 154e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:back.compareOp of 155e5c31af7Sopenharmony_ci ename:VK_COMPARE_OP_GREATER or ename:VK_COMPARE_OP_GREATER_OR_EQUAL; or 156e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:StencilRefGreaterBackAMD 157e5c31af7Sopenharmony_ci execution mode and the pipeline uses a 158e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:back.compareOp of 159e5c31af7Sopenharmony_ci ename:VK_COMPARE_OP_LESS or ename:VK_COMPARE_OP_LESS_OR_EQUAL 160e5c31af7Sopenharmony_ci 161e5c31af7Sopenharmony_cian additional <<fragops-stencil, stencil test>> may: be performed before 162e5c31af7Sopenharmony_ci<<fragops-shader, fragment shading>>, using the stencil reference value 163e5c31af7Sopenharmony_cispecified by 164e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:front.reference or 165e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:back.reference. 166e5c31af7Sopenharmony_ciendif::VK_EXT_shader_stencil_export[] 167e5c31af7Sopenharmony_ciendif::VK_AMD_shader_early_and_late_fragment_tests[] 168e5c31af7Sopenharmony_ci 169e5c31af7Sopenharmony_ci 170e5c31af7Sopenharmony_ciFor a pipeline with the following properties: 171e5c31af7Sopenharmony_ci 172e5c31af7Sopenharmony_ci * a fragment shader is specified 173e5c31af7Sopenharmony_ci * the fragment shader 174e5c31af7Sopenharmony_ciifdef::VK_AMD_shader_early_and_late_fragment_tests[] 175e5c31af7Sopenharmony_ci either specifies code:EarlyAndLateFragmentTestsAMD or 176e5c31af7Sopenharmony_ciendif::VK_AMD_shader_early_and_late_fragment_tests[] 177e5c31af7Sopenharmony_ci does not write to storage resources; 178e5c31af7Sopenharmony_ci * the fragment shader specifies the code:DepthReplacing execution mode; 179e5c31af7Sopenharmony_ci and 180e5c31af7Sopenharmony_ci * either 181e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:DepthUnchanged execution mode; 182e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:DepthLess execution mode and the 183e5c31af7Sopenharmony_ci pipeline uses a 184e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:depthCompareOp of 185e5c31af7Sopenharmony_ci ename:VK_COMPARE_OP_GREATER or ename:VK_COMPARE_OP_GREATER_OR_EQUAL; or 186e5c31af7Sopenharmony_ci ** the fragment shader specifies the code:DepthGreater execution mode and 187e5c31af7Sopenharmony_ci the pipeline uses a 188e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:depthCompareOp of 189e5c31af7Sopenharmony_ci ename:VK_COMPARE_OP_LESS or ename:VK_COMPARE_OP_LESS_OR_EQUAL 190e5c31af7Sopenharmony_ci 191e5c31af7Sopenharmony_cithe implementation may: perform <<fragops-dbt,depth bounds test>> before 192e5c31af7Sopenharmony_ci<<fragops-shader, fragment shading>> and perform an additional 193e5c31af7Sopenharmony_ci<<fragops-depth, depth test>> immediately after that using the interpolated 194e5c31af7Sopenharmony_cidepth value generated by rasterization. 195e5c31af7Sopenharmony_ci 196e5c31af7Sopenharmony_ciOnce all fragment operations have completed, fragment shader outputs for 197e5c31af7Sopenharmony_cicovered color attachment samples pass through <<framebuffer, framebuffer 198e5c31af7Sopenharmony_cioperations>>. 199e5c31af7Sopenharmony_ci 200e5c31af7Sopenharmony_ci 201e5c31af7Sopenharmony_ciifdef::VK_EXT_discard_rectangles[] 202e5c31af7Sopenharmony_ci[[fragops-discard-rectangles]] 203e5c31af7Sopenharmony_ci== Discard Rectangles Test 204e5c31af7Sopenharmony_ci 205e5c31af7Sopenharmony_ciThe discard rectangle test compares the framebuffer coordinates 206e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# of each sample covered by a fragment against a set of 207e5c31af7Sopenharmony_ci_discard rectangles_. 208e5c31af7Sopenharmony_ci 209e5c31af7Sopenharmony_ciEach discard rectangle is defined by a slink:VkRect2D. 210e5c31af7Sopenharmony_ciThese values are either set by the 211e5c31af7Sopenharmony_cislink:VkPipelineDiscardRectangleStateCreateInfoEXT structure during pipeline 212e5c31af7Sopenharmony_cicreation, or dynamically by the flink:vkCmdSetDiscardRectangleEXT command. 213e5c31af7Sopenharmony_ci 214e5c31af7Sopenharmony_ciA given sample is considered inside a discard rectangle if the [eq]#x~f~# is 215e5c31af7Sopenharmony_ciin the range [eq]#[slink:VkRect2D::pname:offset.x, 216e5c31af7Sopenharmony_cislink:VkRect2D::pname:offset.x {plus} slink:VkRect2D::pname:extent.x)#, and 217e5c31af7Sopenharmony_ci[eq]#y~f~# is in the range [eq]#[slink:VkRect2D::pname:offset.y, 218e5c31af7Sopenharmony_cislink:VkRect2D::pname:offset.y {plus} slink:VkRect2D::pname:extent.y)#. 219e5c31af7Sopenharmony_ciIf the test is set to be inclusive, samples that are not inside any of the 220e5c31af7Sopenharmony_cidiscard rectangles will have their coverage set to `0`. 221e5c31af7Sopenharmony_ciIf the test is set to be exclusive, samples that are inside any of the 222e5c31af7Sopenharmony_cidiscard rectangles will have their coverage set to `0`. 223e5c31af7Sopenharmony_ci 224e5c31af7Sopenharmony_ciIf no discard rectangles are specified, the coverage mask is unmodified by 225e5c31af7Sopenharmony_cithis operation. 226e5c31af7Sopenharmony_ci 227e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDiscardRectangleStateCreateInfoEXT',desc='Structure specifying discard rectangle',type='structs'] 228e5c31af7Sopenharmony_ci-- 229e5c31af7Sopenharmony_ciThe sname:VkPipelineDiscardRectangleStateCreateInfoEXT structure is defined 230e5c31af7Sopenharmony_cias: 231e5c31af7Sopenharmony_ci 232e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineDiscardRectangleStateCreateInfoEXT.adoc[] 233e5c31af7Sopenharmony_ci 234e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 235e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 236e5c31af7Sopenharmony_ci structure. 237e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 238e5c31af7Sopenharmony_ci * pname:discardRectangleMode is a elink:VkDiscardRectangleModeEXT value 239e5c31af7Sopenharmony_ci determining whether the discard rectangle test is inclusive or 240e5c31af7Sopenharmony_ci exclusive. 241e5c31af7Sopenharmony_ci * pname:discardRectangleCount is the number of discard rectangles to use. 242e5c31af7Sopenharmony_ci * pname:pDiscardRectangles is a pointer to an array of slink:VkRect2D 243e5c31af7Sopenharmony_ci structures defining discard rectangles. 244e5c31af7Sopenharmony_ci 245e5c31af7Sopenharmony_ciIf the ename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT dynamic state is enabled 246e5c31af7Sopenharmony_cifor a pipeline, the pname:pDiscardRectangles member is ignored. 247e5c31af7Sopenharmony_ciIf the ename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT dynamic state is 248e5c31af7Sopenharmony_cinot enabled for the pipeline the presence of this structure in the 249e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo chain, and a pname:discardRectangleCount 250e5c31af7Sopenharmony_cigreater than zero, implicitly enables discard rectangles in the pipeline, 251e5c31af7Sopenharmony_ciotherwise discard rectangles must: enabled or disabled by 252e5c31af7Sopenharmony_ciflink:vkCmdSetDiscardRectangleEnableEXT. 253e5c31af7Sopenharmony_ciIf the ename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT dynamic state is 254e5c31af7Sopenharmony_cienabled for the pipeline, the pname:discardRectangleMode member is ignored, 255e5c31af7Sopenharmony_ciand the discard rectangle mode must: be set by 256e5c31af7Sopenharmony_ciflink:vkCmdSetDiscardRectangleModeEXT. 257e5c31af7Sopenharmony_ci 258e5c31af7Sopenharmony_ciWhen this structure is included in the pname:pNext chain of 259e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo, it defines parameters of the discard 260e5c31af7Sopenharmony_cirectangle test. 261e5c31af7Sopenharmony_ciIf the ename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT dynamic state is not 262e5c31af7Sopenharmony_cienabled, and this structure is not included in the pname:pNext chain, it is 263e5c31af7Sopenharmony_ciequivalent to specifying this structure with a pname:discardRectangleCount 264e5c31af7Sopenharmony_ciof `0`. 265e5c31af7Sopenharmony_ci 266e5c31af7Sopenharmony_ci.Valid Usage 267e5c31af7Sopenharmony_ci**** 268e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDiscardRectangleStateCreateInfoEXT-discardRectangleCount-00582]] 269e5c31af7Sopenharmony_ci pname:discardRectangleCount must: be less than or equal to 270e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceDiscardRectanglePropertiesEXT::pname:maxDiscardRectangles 271e5c31af7Sopenharmony_ci**** 272e5c31af7Sopenharmony_ci 273e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineDiscardRectangleStateCreateInfoEXT.adoc[] 274e5c31af7Sopenharmony_ci-- 275e5c31af7Sopenharmony_ci 276e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDiscardRectangleStateCreateFlagsEXT',desc='Reserved for future use',type='flags'] 277e5c31af7Sopenharmony_ci-- 278e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineDiscardRectangleStateCreateFlagsEXT.adoc[] 279e5c31af7Sopenharmony_ci 280e5c31af7Sopenharmony_citname:VkPipelineDiscardRectangleStateCreateFlagsEXT is a bitmask type for 281e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 282e5c31af7Sopenharmony_ci-- 283e5c31af7Sopenharmony_ci 284e5c31af7Sopenharmony_ci[open,refpage='VkDiscardRectangleModeEXT',desc='Specify the discard rectangle mode',type='enums'] 285e5c31af7Sopenharmony_ci-- 286e5c31af7Sopenharmony_ciename:VkDiscardRectangleModeEXT values are: 287e5c31af7Sopenharmony_ci 288e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkDiscardRectangleModeEXT.adoc[] 289e5c31af7Sopenharmony_ci 290e5c31af7Sopenharmony_ci * ename:VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT specifies that the discard 291e5c31af7Sopenharmony_ci rectangle test is inclusive. 292e5c31af7Sopenharmony_ci * ename:VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT specifies that the discard 293e5c31af7Sopenharmony_ci rectangle test is exclusive. 294e5c31af7Sopenharmony_ci-- 295e5c31af7Sopenharmony_ci 296e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDiscardRectangleEXT',desc='Set discard rectangles dynamically for a command buffer',type='protos'] 297e5c31af7Sopenharmony_ci-- 298e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the discard rectangles, 299e5c31af7Sopenharmony_cicall: 300e5c31af7Sopenharmony_ci 301e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDiscardRectangleEXT.adoc[] 302e5c31af7Sopenharmony_ci 303e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 304e5c31af7Sopenharmony_ci recorded. 305e5c31af7Sopenharmony_ci * pname:firstDiscardRectangle is the index of the first discard rectangle 306e5c31af7Sopenharmony_ci whose state is updated by the command. 307e5c31af7Sopenharmony_ci * pname:discardRectangleCount is the number of discard rectangles whose 308e5c31af7Sopenharmony_ci state are updated by the command. 309e5c31af7Sopenharmony_ci * pname:pDiscardRectangles is a pointer to an array of slink:VkRect2D 310e5c31af7Sopenharmony_ci structures specifying discard rectangles. 311e5c31af7Sopenharmony_ci 312e5c31af7Sopenharmony_ciThe discard rectangle taken from element [eq]#i# of pname:pDiscardRectangles 313e5c31af7Sopenharmony_cireplace the current state for the discard rectangle at index 314e5c31af7Sopenharmony_ci[eq]#pname:firstDiscardRectangle {plus} i#, for [eq]#i# in [eq]#[0, 315e5c31af7Sopenharmony_cipname:discardRectangleCount)#. 316e5c31af7Sopenharmony_ci 317e5c31af7Sopenharmony_ciThis command sets the discard rectangles for subsequent drawing commands 318e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 319e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 320e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT set in 321e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 322e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 323e5c31af7Sopenharmony_cislink:VkPipelineDiscardRectangleStateCreateInfoEXT::pname:pDiscardRectangles 324e5c31af7Sopenharmony_civalues used to create the currently active pipeline. 325e5c31af7Sopenharmony_ci 326e5c31af7Sopenharmony_ci.Valid Usage 327e5c31af7Sopenharmony_ci**** 328e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-firstDiscardRectangle-00585]] 329e5c31af7Sopenharmony_ci The sum of pname:firstDiscardRectangle and pname:discardRectangleCount 330e5c31af7Sopenharmony_ci must: be less than or equal to 331e5c31af7Sopenharmony_ci slink:VkPhysicalDeviceDiscardRectanglePropertiesEXT::pname:maxDiscardRectangles 332e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-x-00587]] 333e5c31af7Sopenharmony_ci The pname:x and pname:y member of pname:offset in each slink:VkRect2D 334e5c31af7Sopenharmony_ci element of pname:pDiscardRectangles must: be greater than or equal to 335e5c31af7Sopenharmony_ci `0` 336e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-offset-00588]] 337e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# in each 338e5c31af7Sopenharmony_ci slink:VkRect2D element of pname:pDiscardRectangles must: not cause a 339e5c31af7Sopenharmony_ci signed integer addition overflow 340e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-offset-00589]] 341e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# in each 342e5c31af7Sopenharmony_ci slink:VkRect2D element of pname:pDiscardRectangles must: not cause a 343e5c31af7Sopenharmony_ci signed integer addition overflow 344e5c31af7Sopenharmony_ciifdef::VK_NV_inherited_viewport_scissor[] 345e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-viewportScissor2D-04788]] 346e5c31af7Sopenharmony_ci If this command is recorded in a secondary command buffer with 347e5c31af7Sopenharmony_ci slink:VkCommandBufferInheritanceViewportScissorInfoNV::pname:viewportScissor2D 348e5c31af7Sopenharmony_ci enabled, then this function must: not be called 349e5c31af7Sopenharmony_ciendif::VK_NV_inherited_viewport_scissor[] 350e5c31af7Sopenharmony_ci**** 351e5c31af7Sopenharmony_ci 352e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDiscardRectangleEXT.adoc[] 353e5c31af7Sopenharmony_ci-- 354e5c31af7Sopenharmony_ci 355e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDiscardRectangleEnableEXT',desc='Enable discard rectangles dynamically for a command buffer',type='protos'] 356e5c31af7Sopenharmony_ci-- 357e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> whether discard rectangles 358e5c31af7Sopenharmony_ciare enabled, call: 359e5c31af7Sopenharmony_ci 360e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDiscardRectangleEnableEXT.adoc[] 361e5c31af7Sopenharmony_ci 362e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 363e5c31af7Sopenharmony_ci recorded. 364e5c31af7Sopenharmony_ci * pname:discardRectangleEnable specifies whether discard rectangles are 365e5c31af7Sopenharmony_ci enabled or not. 366e5c31af7Sopenharmony_ci 367e5c31af7Sopenharmony_ciThis command sets the discard rectangle enable for subsequent drawing 368e5c31af7Sopenharmony_cicommands 369e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 370e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 371e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT set in 372e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 373e5c31af7Sopenharmony_ciOtherwise, this state is implied by the 374e5c31af7Sopenharmony_cislink:VkPipelineDiscardRectangleStateCreateInfoEXT::pname:discardRectangleCount 375e5c31af7Sopenharmony_civalue used to create the currently active pipeline, where a non-zero 376e5c31af7Sopenharmony_cipname:discardRectangleCount implicitly enables discard rectangles, otherwise 377e5c31af7Sopenharmony_cithey are disabled. 378e5c31af7Sopenharmony_ci 379e5c31af7Sopenharmony_ci.Valid Usage 380e5c31af7Sopenharmony_ci**** 381e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEnableEXT-specVersion-07851]] 382e5c31af7Sopenharmony_ci The `apiext:VK_EXT_discard_rectangles` extension must: be enabled, and 383e5c31af7Sopenharmony_ci the implementation must: support at least pname:specVersion `2` of this 384e5c31af7Sopenharmony_ci extension 385e5c31af7Sopenharmony_ci**** 386e5c31af7Sopenharmony_ci 387e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDiscardRectangleEnableEXT.adoc[] 388e5c31af7Sopenharmony_ci-- 389e5c31af7Sopenharmony_ci 390e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDiscardRectangleModeEXT',desc='Sets the discard rectangle mode dynamically for a command buffer',type='protos'] 391e5c31af7Sopenharmony_ci-- 392e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the discard rectangle mode, 393e5c31af7Sopenharmony_cicall: 394e5c31af7Sopenharmony_ci 395e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDiscardRectangleModeEXT.adoc[] 396e5c31af7Sopenharmony_ci 397e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 398e5c31af7Sopenharmony_ci recorded. 399e5c31af7Sopenharmony_ci * pname:discardRectangleMode specifies the discard rectangle mode for all 400e5c31af7Sopenharmony_ci discard rectangles, either inclusive or exclusive. 401e5c31af7Sopenharmony_ci 402e5c31af7Sopenharmony_ciThis command sets the discard rectangle mode for subsequent drawing commands 403e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 404e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 405e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT set in 406e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 407e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 408e5c31af7Sopenharmony_cislink:VkPipelineDiscardRectangleStateCreateInfoEXT::pname:discardRectangleMode 409e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 410e5c31af7Sopenharmony_ci 411e5c31af7Sopenharmony_ci.Valid Usage 412e5c31af7Sopenharmony_ci**** 413e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleModeEXT-specVersion-07852]] 414e5c31af7Sopenharmony_ci The `apiext:VK_EXT_discard_rectangles` extension must: be enabled, and 415e5c31af7Sopenharmony_ci the implementation must: support at least pname:specVersion `2` of this 416e5c31af7Sopenharmony_ci extension 417e5c31af7Sopenharmony_ci**** 418e5c31af7Sopenharmony_ci 419e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDiscardRectangleModeEXT.adoc[] 420e5c31af7Sopenharmony_ci-- 421e5c31af7Sopenharmony_ci 422e5c31af7Sopenharmony_ciendif::VK_EXT_discard_rectangles[] 423e5c31af7Sopenharmony_ci 424e5c31af7Sopenharmony_ci 425e5c31af7Sopenharmony_ci[[fragops-scissor]] 426e5c31af7Sopenharmony_ci== Scissor Test 427e5c31af7Sopenharmony_ci 428e5c31af7Sopenharmony_ciThe scissor test compares the framebuffer coordinates [eq]#(x~f~,y~f~)# of 429e5c31af7Sopenharmony_cieach sample covered by a fragment against a _scissor rectangle_ at the index 430e5c31af7Sopenharmony_ciequal to the fragment's <<interfaces-builtin-variables-viewportindex, 431e5c31af7Sopenharmony_cicode:ViewportIndex>>. 432e5c31af7Sopenharmony_ci 433e5c31af7Sopenharmony_ciEach scissor rectangle is defined by a slink:VkRect2D. 434e5c31af7Sopenharmony_ciThese values are either set by the slink:VkPipelineViewportStateCreateInfo 435e5c31af7Sopenharmony_cistructure during pipeline creation, or dynamically by the 436e5c31af7Sopenharmony_ciflink:vkCmdSetScissor command. 437e5c31af7Sopenharmony_ci 438e5c31af7Sopenharmony_ciA given sample is considered inside a scissor rectangle if [eq]#x~f~# is in 439e5c31af7Sopenharmony_cithe range [eq]#[slink:VkRect2D::pname:offset.x, 440e5c31af7Sopenharmony_cislink:VkRect2D::pname:offset.x {plus} slink:VkRect2D::pname:extent.x)#, and 441e5c31af7Sopenharmony_ci[eq]#y~f~# is in the range [eq]#[slink:VkRect2D::pname:offset.y, 442e5c31af7Sopenharmony_cislink:VkRect2D::pname:offset.y {plus} slink:VkRect2D::pname:extent.y)#. 443e5c31af7Sopenharmony_ciSamples with coordinates outside the scissor rectangle at the corresponding 444e5c31af7Sopenharmony_cicode:ViewportIndex will have their coverage set to `0`. 445e5c31af7Sopenharmony_ci 446e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_transform[] 447e5c31af7Sopenharmony_ciIf a render pass transform is enabled, the (pname:offset.x and 448e5c31af7Sopenharmony_cipname:offset.y) and (pname:extent.width and pname:extent.height) values are 449e5c31af7Sopenharmony_citransformed as described in <<vertexpostproc-renderpass-transform, render 450e5c31af7Sopenharmony_cipass transform>> before participating in the scissor test. 451e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_transform[] 452e5c31af7Sopenharmony_ci 453e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetScissor',desc='Set scissor rectangles dynamically for a command buffer',type='protos'] 454e5c31af7Sopenharmony_ci-- 455e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the scissor rectangles, 456e5c31af7Sopenharmony_cicall: 457e5c31af7Sopenharmony_ci 458e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetScissor.adoc[] 459e5c31af7Sopenharmony_ci 460e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 461e5c31af7Sopenharmony_ci recorded. 462e5c31af7Sopenharmony_ci * pname:firstScissor is the index of the first scissor whose state is 463e5c31af7Sopenharmony_ci updated by the command. 464e5c31af7Sopenharmony_ci * pname:scissorCount is the number of scissors whose rectangles are 465e5c31af7Sopenharmony_ci updated by the command. 466e5c31af7Sopenharmony_ci * pname:pScissors is a pointer to an array of slink:VkRect2D structures 467e5c31af7Sopenharmony_ci defining scissor rectangles. 468e5c31af7Sopenharmony_ci 469e5c31af7Sopenharmony_ciThe scissor rectangles taken from element [eq]#i# of pname:pScissors replace 470e5c31af7Sopenharmony_cithe current state for the scissor index [eq]#pname:firstScissor {plus} i#, 471e5c31af7Sopenharmony_cifor [eq]#i# in [eq]#[0, pname:scissorCount)#. 472e5c31af7Sopenharmony_ci 473e5c31af7Sopenharmony_ciThis command sets the scissor rectangles for subsequent drawing commands 474e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 475e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with ename:VK_DYNAMIC_STATE_SCISSOR 476e5c31af7Sopenharmony_ciset in slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 477e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 478e5c31af7Sopenharmony_cislink:VkPipelineViewportStateCreateInfo::pname:pScissors values used to 479e5c31af7Sopenharmony_cicreate the currently active pipeline. 480e5c31af7Sopenharmony_ci 481e5c31af7Sopenharmony_ci.Valid Usage 482e5c31af7Sopenharmony_ci**** 483e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-firstScissor-00592]] 484e5c31af7Sopenharmony_ci The sum of pname:firstScissor and pname:scissorCount must: be between 485e5c31af7Sopenharmony_ci `1` and sname:VkPhysicalDeviceLimits::pname:maxViewports, inclusive 486e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-firstScissor-00593]] 487e5c31af7Sopenharmony_ci If the <<features-multiViewport, pname:multiViewport>> feature is not 488e5c31af7Sopenharmony_ci enabled, pname:firstScissor must: be `0` 489e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-scissorCount-00594]] 490e5c31af7Sopenharmony_ci If the <<features-multiViewport, pname:multiViewport>> feature is not 491e5c31af7Sopenharmony_ci enabled, pname:scissorCount must: be `1` 492e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-x-00595]] 493e5c31af7Sopenharmony_ci The pname:x and pname:y members of pname:offset member of any element of 494e5c31af7Sopenharmony_ci pname:pScissors must: be greater than or equal to `0` 495e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-offset-00596]] 496e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# must: not 497e5c31af7Sopenharmony_ci cause a signed integer addition overflow for any element of 498e5c31af7Sopenharmony_ci pname:pScissors 499e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-offset-00597]] 500e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# must: 501e5c31af7Sopenharmony_ci not cause a signed integer addition overflow for any element of 502e5c31af7Sopenharmony_ci pname:pScissors 503e5c31af7Sopenharmony_ciifdef::VK_NV_inherited_viewport_scissor[] 504e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-viewportScissor2D-04789]] 505e5c31af7Sopenharmony_ci If this command is recorded in a secondary command buffer with 506e5c31af7Sopenharmony_ci slink:VkCommandBufferInheritanceViewportScissorInfoNV::pname:viewportScissor2D 507e5c31af7Sopenharmony_ci enabled, then this function must: not be called 508e5c31af7Sopenharmony_ciendif::VK_NV_inherited_viewport_scissor[] 509e5c31af7Sopenharmony_ci**** 510e5c31af7Sopenharmony_ci 511e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetScissor.adoc[] 512e5c31af7Sopenharmony_ci-- 513e5c31af7Sopenharmony_ci 514e5c31af7Sopenharmony_ci 515e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 516e5c31af7Sopenharmony_ci[[fragops-exclusive-scissor]] 517e5c31af7Sopenharmony_ci== Exclusive Scissor Test 518e5c31af7Sopenharmony_ci 519e5c31af7Sopenharmony_ciThe exclusive scissor test compares the framebuffer coordinates 520e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# of each sample covered by a fragment against an _exclusive 521e5c31af7Sopenharmony_ciscissor rectangle_ at the index equal to the fragment's 522e5c31af7Sopenharmony_ci<<interfaces-builtin-variables-viewportindex, code:ViewportIndex>>. 523e5c31af7Sopenharmony_ci 524e5c31af7Sopenharmony_ciEach exclusive scissor rectangle is defined by a slink:VkRect2D. 525e5c31af7Sopenharmony_ciThese values are either set by the 526e5c31af7Sopenharmony_cislink:VkPipelineViewportExclusiveScissorStateCreateInfoNV structure during 527e5c31af7Sopenharmony_cipipeline creation, or dynamically by the flink:vkCmdSetExclusiveScissorNV 528e5c31af7Sopenharmony_cicommand. 529e5c31af7Sopenharmony_ci 530e5c31af7Sopenharmony_ciA given sample is considered inside an exclusive scissor rectangle if 531e5c31af7Sopenharmony_ci[eq]#x~f~# is in the range [eq]#[slink:VkRect2D::pname:offset.x, 532e5c31af7Sopenharmony_cislink:VkRect2D::pname:offset.x {plus} slink:VkRect2D::pname:extent.x)#, and 533e5c31af7Sopenharmony_ci[eq]#y~f~# is in the range [eq]#[slink:VkRect2D::pname:offset.y, 534e5c31af7Sopenharmony_cislink:VkRect2D::pname:offset.y {plus} slink:VkRect2D::pname:extent.y)#. 535e5c31af7Sopenharmony_ciSamples with coordinates inside the exclusive scissor rectangle at the 536e5c31af7Sopenharmony_cicorresponding code:ViewportIndex will have their coverage set to `0`. 537e5c31af7Sopenharmony_ci 538e5c31af7Sopenharmony_ciIf no exclusive scissor rectangles are specified, the coverage mask is 539e5c31af7Sopenharmony_ciunmodified by this operation. 540e5c31af7Sopenharmony_ci 541e5c31af7Sopenharmony_ci[open,refpage='VkPipelineViewportExclusiveScissorStateCreateInfoNV',desc='Structure specifying parameters controlling exclusive scissor testing',type='structs'] 542e5c31af7Sopenharmony_ci-- 543e5c31af7Sopenharmony_ciThe sname:VkPipelineViewportExclusiveScissorStateCreateInfoNV structure is 544e5c31af7Sopenharmony_cidefined as: 545e5c31af7Sopenharmony_ci 546e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineViewportExclusiveScissorStateCreateInfoNV.adoc[] 547e5c31af7Sopenharmony_ci 548e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 549e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 550e5c31af7Sopenharmony_ci structure. 551e5c31af7Sopenharmony_ci * pname:exclusiveScissorCount is the number of exclusive scissor 552e5c31af7Sopenharmony_ci rectangles. 553e5c31af7Sopenharmony_ci * pname:pExclusiveScissors is a pointer to an array of slink:VkRect2D 554e5c31af7Sopenharmony_ci structures defining exclusive scissor rectangles. 555e5c31af7Sopenharmony_ci 556e5c31af7Sopenharmony_ciIf the ename:VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV dynamic state is enabled 557e5c31af7Sopenharmony_cifor a pipeline, the pname:pExclusiveScissors member is ignored. 558e5c31af7Sopenharmony_ci 559e5c31af7Sopenharmony_ciWhen this structure is included in the pname:pNext chain of 560e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo, it defines parameters of the exclusive 561e5c31af7Sopenharmony_ciscissor test. 562e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is equivalent 563e5c31af7Sopenharmony_cito specifying this structure with a pname:exclusiveScissorCount of `0`. 564e5c31af7Sopenharmony_ci 565e5c31af7Sopenharmony_ci.Valid Usage 566e5c31af7Sopenharmony_ci**** 567e5c31af7Sopenharmony_ci * [[VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02027]] 568e5c31af7Sopenharmony_ci If the <<features-multiViewport, pname:multiViewport>> feature is not 569e5c31af7Sopenharmony_ci enabled, pname:exclusiveScissorCount must: be `0` or `1` 570e5c31af7Sopenharmony_ci * [[VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02028]] 571e5c31af7Sopenharmony_ci pname:exclusiveScissorCount must: be less than or equal to 572e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceLimits::pname:maxViewports 573e5c31af7Sopenharmony_ci * [[VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02029]] 574e5c31af7Sopenharmony_ci pname:exclusiveScissorCount must: be `0` or greater than or equal to the 575e5c31af7Sopenharmony_ci pname:viewportCount member of slink:VkPipelineViewportStateCreateInfo 576e5c31af7Sopenharmony_ci 577e5c31af7Sopenharmony_ci**** 578e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineViewportExclusiveScissorStateCreateInfoNV.adoc[] 579e5c31af7Sopenharmony_ci-- 580e5c31af7Sopenharmony_ci 581e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetExclusiveScissorNV',desc='Set exclusive scissor rectangles dynamically for a command buffer',type='protos'] 582e5c31af7Sopenharmony_ci-- 583e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the exclusive scissor 584e5c31af7Sopenharmony_cirectangles, call: 585e5c31af7Sopenharmony_ci 586e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetExclusiveScissorNV.adoc[] 587e5c31af7Sopenharmony_ci 588e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 589e5c31af7Sopenharmony_ci recorded. 590e5c31af7Sopenharmony_ci * pname:firstExclusiveScissor is the index of the first exclusive scissor 591e5c31af7Sopenharmony_ci rectangle whose state is updated by the command. 592e5c31af7Sopenharmony_ci * pname:exclusiveScissorCount is the number of exclusive scissor 593e5c31af7Sopenharmony_ci rectangles updated by the command. 594e5c31af7Sopenharmony_ci * pname:pExclusiveScissors is a pointer to an array of slink:VkRect2D 595e5c31af7Sopenharmony_ci structures defining exclusive scissor rectangles. 596e5c31af7Sopenharmony_ci 597e5c31af7Sopenharmony_ciThe scissor rectangles taken from element [eq]#i# of 598e5c31af7Sopenharmony_cipname:pExclusiveScissors replace the current state for the scissor index 599e5c31af7Sopenharmony_ci[eq]#pname:firstExclusiveScissor {plus} i#, for [eq]#i# in [eq]#[0, 600e5c31af7Sopenharmony_cipname:exclusiveScissorCount)#. 601e5c31af7Sopenharmony_ci 602e5c31af7Sopenharmony_ciThis command sets the exclusive scissor rectangles for subsequent drawing 603e5c31af7Sopenharmony_cicommands 604e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 605e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 606e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV set in 607e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 608e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 609e5c31af7Sopenharmony_cislink:VkPipelineViewportExclusiveScissorStateCreateInfoNV::pname:pExclusiveScissors 610e5c31af7Sopenharmony_civalues used to create the currently active pipeline. 611e5c31af7Sopenharmony_ci 612e5c31af7Sopenharmony_ci.Valid Usage 613e5c31af7Sopenharmony_ci**** 614e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-None-02031]] 615e5c31af7Sopenharmony_ci The <<features-exclusiveScissor, pname:exclusiveScissor>> feature must: 616e5c31af7Sopenharmony_ci be enabled 617e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02034]] 618e5c31af7Sopenharmony_ci The sum of pname:firstExclusiveScissor and pname:exclusiveScissorCount 619e5c31af7Sopenharmony_ci must: be between `1` and 620e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceLimits::pname:maxViewports, inclusive 621e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02035]] 622e5c31af7Sopenharmony_ci If the <<features-multiViewport, pname:multiViewport>> feature is not 623e5c31af7Sopenharmony_ci enabled, pname:firstExclusiveScissor must: be `0` 624e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-exclusiveScissorCount-02036]] 625e5c31af7Sopenharmony_ci If the <<features-multiViewport, pname:multiViewport>> feature is not 626e5c31af7Sopenharmony_ci enabled, pname:exclusiveScissorCount must: be `1` 627e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-x-02037]] 628e5c31af7Sopenharmony_ci The pname:x and pname:y members of pname:offset in each member of 629e5c31af7Sopenharmony_ci pname:pExclusiveScissors must: be greater than or equal to `0` 630e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-offset-02038]] 631e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# for each 632e5c31af7Sopenharmony_ci member of pname:pExclusiveScissors must: not cause a signed integer 633e5c31af7Sopenharmony_ci addition overflow 634e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-offset-02039]] 635e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# for each 636e5c31af7Sopenharmony_ci member of pname:pExclusiveScissors must: not cause a signed integer 637e5c31af7Sopenharmony_ci addition overflow 638e5c31af7Sopenharmony_ci**** 639e5c31af7Sopenharmony_ci 640e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetExclusiveScissorNV.adoc[] 641e5c31af7Sopenharmony_ci-- 642e5c31af7Sopenharmony_ci 643e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetExclusiveScissorEnableNV',desc='Dynamically enable each exclusive scissor for a command buffer',type='protos'] 644e5c31af7Sopenharmony_ci-- 645e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> whether an exclusive scissor 646e5c31af7Sopenharmony_ciis enabled or not, call: 647e5c31af7Sopenharmony_ci 648e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetExclusiveScissorEnableNV.adoc[] 649e5c31af7Sopenharmony_ci 650e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 651e5c31af7Sopenharmony_ci recorded. 652e5c31af7Sopenharmony_ci * pname:firstExclusiveScissor is the index of the first exclusive scissor 653e5c31af7Sopenharmony_ci rectangle whose state is updated by the command. 654e5c31af7Sopenharmony_ci * pname:exclusiveScissorCount is the number of exclusive scissor 655e5c31af7Sopenharmony_ci rectangles updated by the command. 656e5c31af7Sopenharmony_ci * pname:pExclusiveScissorEnables is a pointer to an array of 657e5c31af7Sopenharmony_ci basetype:VkBool32 values defining whether the exclusive scissor is 658e5c31af7Sopenharmony_ci enabled. 659e5c31af7Sopenharmony_ci 660e5c31af7Sopenharmony_ciThe exclusive scissor enables taken from element [eq]#i# of 661e5c31af7Sopenharmony_cipname:pExclusiveScissorEnables replace the current state for the scissor 662e5c31af7Sopenharmony_ciindex [eq]#pname:firstExclusiveScissor {plus} i#, for [eq]#i# in [eq]#[0, 663e5c31af7Sopenharmony_cipname:exclusiveScissorCount)#. 664e5c31af7Sopenharmony_ci 665e5c31af7Sopenharmony_ciThis command sets the exclusive scissor enable for subsequent drawing 666e5c31af7Sopenharmony_cicommands 667e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 668e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 669e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_ENABLE_NV set in 670e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 671e5c31af7Sopenharmony_ciOtherwise, this state is implied by the 672e5c31af7Sopenharmony_cislink:VkPipelineViewportExclusiveScissorStateCreateInfoNV::pname:exclusiveScissorCount 673e5c31af7Sopenharmony_civalue used to create the currently active pipeline, where all 674e5c31af7Sopenharmony_cipname:exclusiveScissorCount exclusive scissors are implicitly enabled and 675e5c31af7Sopenharmony_cithe remainder up to sname:VkPhysicalDeviceLimits::pname:maxViewports are 676e5c31af7Sopenharmony_ciimplicitly disabled. 677e5c31af7Sopenharmony_ci 678e5c31af7Sopenharmony_ci.Valid Usage 679e5c31af7Sopenharmony_ci**** 680e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorEnableNV-exclusiveScissor-07853]] 681e5c31af7Sopenharmony_ci The <<features-exclusiveScissor, pname:exclusiveScissor>> feature must: 682e5c31af7Sopenharmony_ci be enabled, and the implementation must: support at least 683e5c31af7Sopenharmony_ci pname:specVersion `2` of the `apiext:VK_NV_scissor_exclusive` extension 684e5c31af7Sopenharmony_ci**** 685e5c31af7Sopenharmony_ci 686e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetExclusiveScissorEnableNV.adoc[] 687e5c31af7Sopenharmony_ci-- 688e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 689e5c31af7Sopenharmony_ci 690e5c31af7Sopenharmony_ci 691e5c31af7Sopenharmony_ci[[fragops-samplemask]] 692e5c31af7Sopenharmony_ci== Sample Mask Test 693e5c31af7Sopenharmony_ci 694e5c31af7Sopenharmony_ciThe sample mask test compares the <<primsrast-multisampling-coverage-mask, 695e5c31af7Sopenharmony_cicoverage mask>> for a fragment with the _sample mask_ defined by 696e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:pSampleMask. 697e5c31af7Sopenharmony_ci 698e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 699e5c31af7Sopenharmony_ci 700e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetSampleMaskEXT',desc='Specify the sample mask dynamically for a command buffer',type='protos'] 701e5c31af7Sopenharmony_ci-- 702e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the sample mask, call: 703e5c31af7Sopenharmony_ci 704e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetSampleMaskEXT.adoc[] 705e5c31af7Sopenharmony_ci 706e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 707e5c31af7Sopenharmony_ci recorded. 708e5c31af7Sopenharmony_ci * pname:samples specifies the number of sample bits in the 709e5c31af7Sopenharmony_ci pname:pSampleMask. 710e5c31af7Sopenharmony_ci * pname:pSampleMask is a pointer to an array of basetype:VkSampleMask 711e5c31af7Sopenharmony_ci values, where the array size is based on the pname:samples parameter. 712e5c31af7Sopenharmony_ci 713e5c31af7Sopenharmony_ciThis command sets the sample mask for subsequent drawing commands 714e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 715e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 716e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 717e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 718e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 719e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 720e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_SAMPLE_MASK_EXT set in 721e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 722e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 723e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 724e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:pSampleMask value used to 725e5c31af7Sopenharmony_cicreate the currently active pipeline. 726e5c31af7Sopenharmony_ci 727e5c31af7Sopenharmony_ci:refpage: vkCmdSetSampleMaskEXT 728e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3SampleMask 729e5c31af7Sopenharmony_ci 730e5c31af7Sopenharmony_ci.Valid Usage 731e5c31af7Sopenharmony_ci**** 732e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 733e5c31af7Sopenharmony_ci**** 734e5c31af7Sopenharmony_ci 735e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetSampleMaskEXT.adoc[] 736e5c31af7Sopenharmony_ci-- 737e5c31af7Sopenharmony_ci 738e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 739e5c31af7Sopenharmony_ci 740e5c31af7Sopenharmony_ciEach bit of the coverage mask is associated with a sample index as described 741e5c31af7Sopenharmony_ciin the <<primsrast-multisampling-coverage-mask, rasterization chapter>>. 742e5c31af7Sopenharmony_ciIf the bit in slink:VkPipelineMultisampleStateCreateInfo::pname:pSampleMask 743e5c31af7Sopenharmony_ciwhich is associated with that same sample index is set to `0`, the coverage 744e5c31af7Sopenharmony_cimask bit is set to `0`. 745e5c31af7Sopenharmony_ci 746e5c31af7Sopenharmony_ci 747e5c31af7Sopenharmony_ci[[fragops-shader]] 748e5c31af7Sopenharmony_ci== Fragment Shading 749e5c31af7Sopenharmony_ci 750e5c31af7Sopenharmony_ci<<shaders-fragment, Fragment shaders>> are invoked for each fragment, or as 751e5c31af7Sopenharmony_ci<<shaders-helper-invocations, helper invocations>>. 752e5c31af7Sopenharmony_ci 753e5c31af7Sopenharmony_ciMost operations in the fragment shader are not performed in 754e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>>, with exceptions called out in the 755e5c31af7Sopenharmony_cifollowing sections. 756e5c31af7Sopenharmony_ci 757e5c31af7Sopenharmony_ciFor fragment shaders invoked by fragments, the following rules apply: 758e5c31af7Sopenharmony_ci 759e5c31af7Sopenharmony_ci * A fragment shader must: not be executed if a <<fragops, fragment 760e5c31af7Sopenharmony_ci operation>> that executes before fragment shading discards the fragment. 761e5c31af7Sopenharmony_ci * A fragment shader may: not be executed if: 762e5c31af7Sopenharmony_ci ** An implementation determines that another fragment shader, invoked by a 763e5c31af7Sopenharmony_ci subsequent primitive in <<drawing-primitive-order, primitive order>>, 764e5c31af7Sopenharmony_ci overwrites all results computed by the shader (including writes to 765e5c31af7Sopenharmony_ci storage resources). 766e5c31af7Sopenharmony_ci ** Any other <<fragops, fragment operation>> discards the fragment, and 767e5c31af7Sopenharmony_ci the shader does not write to any storage resources. 768e5c31af7Sopenharmony_ci ** If a fragment shader statically computes the same values for different 769e5c31af7Sopenharmony_ci framebuffer locations, and does not write to any storage resources, 770e5c31af7Sopenharmony_ci multiple fragments may: be shaded by one fragment shader invocation. 771e5c31af7Sopenharmony_ci This may: affect 772e5c31af7Sopenharmony_ci ename:VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT 773e5c31af7Sopenharmony_ci results, but must: otherwise not be visible behavior to applications. 774e5c31af7Sopenharmony_ci * Otherwise, at least one fragment shader must: be executed. 775e5c31af7Sopenharmony_ci ** If <<primsrast-sampleshading,sample shading>> is enabled and multiple 776e5c31af7Sopenharmony_ci invocations per fragment are required:, additional invocations must: be 777e5c31af7Sopenharmony_ci executed as specified. 778e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 779e5c31af7Sopenharmony_ci ** If a <<primsrast-shading-rate-image,shading rate image>> is used and 780e5c31af7Sopenharmony_ci multiple invocations per fragment are required:, additional invocations 781e5c31af7Sopenharmony_ci must: be executed as specified. 782e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 783e5c31af7Sopenharmony_ci ** Each covered sample must: be included in at least one fragment shader 784e5c31af7Sopenharmony_ci invocation. 785e5c31af7Sopenharmony_ci 786e5c31af7Sopenharmony_ciIf no fragment shader is included in the pipeline, no fragment shader is 787e5c31af7Sopenharmony_ciexecuted, and undefined: values may: be written to all color attachment 788e5c31af7Sopenharmony_cioutputs during this fragment operation. 789e5c31af7Sopenharmony_ci 790e5c31af7Sopenharmony_ci[NOTE] 791e5c31af7Sopenharmony_ci.Note 792e5c31af7Sopenharmony_ci==== 793e5c31af7Sopenharmony_ciMultiple fragment shader invocations may be executed for the same fragment 794e5c31af7Sopenharmony_cifor any number of implementation-dependent reasons. 795e5c31af7Sopenharmony_ciWhen there is more than one fragment shader invocation per fragment, the 796e5c31af7Sopenharmony_ciassociation of samples to invocations is implementation-dependent. 797e5c31af7Sopenharmony_ciStores and atomics performed by these additional invocations have the normal 798e5c31af7Sopenharmony_cieffect. 799e5c31af7Sopenharmony_ci 800e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 801e5c31af7Sopenharmony_ciFor example, if the subpass includes multiple views in its view mask, a 802e5c31af7Sopenharmony_cifragment shader may be invoked separately for each view. 803e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 804e5c31af7Sopenharmony_ci 805e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 806e5c31af7Sopenharmony_ciSimilarly, if the render pass has a fragment density map attachment, more 807e5c31af7Sopenharmony_cithan one fragment shader invocation may be invoked for each covered sample. 808e5c31af7Sopenharmony_ciSuch additional invocations are only produced if 809e5c31af7Sopenharmony_cisname:VkPhysicalDeviceFragmentDensityMapPropertiesEXT::pname:fragmentDensityInvocations 810e5c31af7Sopenharmony_ciis ename:VK_TRUE. 811e5c31af7Sopenharmony_ciImplementations may generate these additional fragment shader invocations in 812e5c31af7Sopenharmony_ciorder to make transitions between fragment areas with different fragment 813e5c31af7Sopenharmony_cidensities more smooth. 814e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 815e5c31af7Sopenharmony_ci==== 816e5c31af7Sopenharmony_ci 817e5c31af7Sopenharmony_ci 818e5c31af7Sopenharmony_ci[[fragops-shader-samplemask]] 819e5c31af7Sopenharmony_ci=== Sample Mask 820e5c31af7Sopenharmony_ci 821e5c31af7Sopenharmony_ciReading from the <<interfaces-builtin-variables-samplemask, 822e5c31af7Sopenharmony_cicode:SampleMask>> built-in in the code:Input storage class will return the 823e5c31af7Sopenharmony_cicoverage mask for the current fragment as calculated by fragment operations 824e5c31af7Sopenharmony_cithat executed prior to fragment shading. 825e5c31af7Sopenharmony_ci 826e5c31af7Sopenharmony_ciIf <<primsrast-sampleshading, sample shading>> is enabled, fragment shaders 827e5c31af7Sopenharmony_ciwill only see values of `1` for samples being shaded - other bits will be 828e5c31af7Sopenharmony_ci`0`. 829e5c31af7Sopenharmony_ci 830e5c31af7Sopenharmony_ciEach bit of the coverage mask is associated with a sample index as described 831e5c31af7Sopenharmony_ciin the <<primsrast-multisampling-coverage-mask, rasterization chapter>>. 832e5c31af7Sopenharmony_ciIf the bit in code:SampleMask which is associated with that same sample 833e5c31af7Sopenharmony_ciindex is set to `0`, that coverage mask bit is set to `0`. 834e5c31af7Sopenharmony_ci 835e5c31af7Sopenharmony_ciValues written to the <<interfaces-builtin-variables-samplemask, 836e5c31af7Sopenharmony_cicode:SampleMask>> built-in in the code:Output storage class will be used by 837e5c31af7Sopenharmony_cithe <<fragops-covg, multisample coverage>> operation, with the same encoding 838e5c31af7Sopenharmony_cias the input built-in. 839e5c31af7Sopenharmony_ci 840e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_tile_image[] 841e5c31af7Sopenharmony_ci[[fragops-shader-tileimage-reads]] 842e5c31af7Sopenharmony_ci=== Fragment Shader Tile Image Reads 843e5c31af7Sopenharmony_ciIf the `apiext:VK_EXT_shader_tile_image` extension is enabled, 844e5c31af7Sopenharmony_ciimplementations divide the framebuffer into a grid of tiles. 845e5c31af7Sopenharmony_ciA <<glossary-tile-image, tile image>> is a view of a framebuffer attachment 846e5c31af7Sopenharmony_citile for fragments with locations within the tile. 847e5c31af7Sopenharmony_ci 848e5c31af7Sopenharmony_ciWithin a render pass instance initiated by flink:vkCmdBeginRenderingKHR, 849e5c31af7Sopenharmony_cifragment shader invocations can: read the framebuffer color, depth, and 850e5c31af7Sopenharmony_cistencil values at the fragment location via tile images. 851e5c31af7Sopenharmony_ci 852e5c31af7Sopenharmony_ci[NOTE] 853e5c31af7Sopenharmony_ci.Note 854e5c31af7Sopenharmony_ci==== 855e5c31af7Sopenharmony_ciEven though fragment shader invocation can only read from the corresponding 856e5c31af7Sopenharmony_cifragment location, the abstraction of a tile image is introduced for the 857e5c31af7Sopenharmony_cifollowing reasons: 858e5c31af7Sopenharmony_ci 859e5c31af7Sopenharmony_ci * Tile dimensions will be exposed in a future extension 860e5c31af7Sopenharmony_ci * Future functionality such as executing compute dispatches within render 861e5c31af7Sopenharmony_ci passes via tile shaders can leverage tile images. 862e5c31af7Sopenharmony_ci==== 863e5c31af7Sopenharmony_ci 864e5c31af7Sopenharmony_ciEnabling <<features-shaderTileImageColorReadAccess, 865e5c31af7Sopenharmony_cishaderTileImageColorReadAccess>>, <<features-shaderTileImageDepthReadAccess, 866e5c31af7Sopenharmony_cishaderTileImageDepthReadAccess>>, 867e5c31af7Sopenharmony_ci<<features-shaderTileImageStencilReadAccess, 868e5c31af7Sopenharmony_cishaderTileImageStencilReadAccess>> enables fragment shader invocations to 869e5c31af7Sopenharmony_ciread from color, depth, and stencil, respectively. 870e5c31af7Sopenharmony_ci 871e5c31af7Sopenharmony_ciColor values are read from tile image variables with 872e5c31af7Sopenharmony_cicode:OpColorAttachmentReadEXT. 873e5c31af7Sopenharmony_ciTile image variables are linked to specific color attachments using 874e5c31af7Sopenharmony_cicode:Location decoration. 875e5c31af7Sopenharmony_ciSee <<interfaces-fragmenttileimage, Fragment Tile Image Interface>> for more 876e5c31af7Sopenharmony_cidetails. 877e5c31af7Sopenharmony_ci 878e5c31af7Sopenharmony_ciDepth values are read with code:OpDepthAttachmentReadEXT. 879e5c31af7Sopenharmony_ci 880e5c31af7Sopenharmony_ciStencil values are read with code:OpStencilAttachmentReadEXT. 881e5c31af7Sopenharmony_ci 882e5c31af7Sopenharmony_ciThe sample to read is specified by a 883e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>> value specified as 884e5c31af7Sopenharmony_cithe code:Sample operand to code:OpColorAttachmentReadEXT, 885e5c31af7Sopenharmony_cicode:OpDepthAttachmentReadEXT, or code:OpStencilAttachmentReadEXT. 886e5c31af7Sopenharmony_ci 887e5c31af7Sopenharmony_ciIf <<primsrast-sampleshading, sample shading>> is disabled, a fragment 888e5c31af7Sopenharmony_ciinvocation can: read from all sample locations associated with the fragment 889e5c31af7Sopenharmony_ciregardless of the fragment's coverage. 890e5c31af7Sopenharmony_ciThis functionality is supported for 891e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples > 1 892e5c31af7Sopenharmony_ciwhen 893e5c31af7Sopenharmony_cislink:VkPhysicalDeviceShaderTileImagePropertiesEXT::pname:shaderTileImageReadSampleFromPixelRateInvocation 894e5c31af7Sopenharmony_ciis ename:VK_TRUE. 895e5c31af7Sopenharmony_ci 896e5c31af7Sopenharmony_ciIf <<primsrast-sampleshading, sample shading>> is enabled, and 897e5c31af7Sopenharmony_cipname:minSampleShading is 1.0, a fragment invocation must: only read from 898e5c31af7Sopenharmony_cithe <<primsrast-multisampling-coverageindex, coverage index>> sample. 899e5c31af7Sopenharmony_ciTile image access must: not be used if the value of pname:minSampleShading 900e5c31af7Sopenharmony_ciis not 1.0. 901e5c31af7Sopenharmony_ci 902e5c31af7Sopenharmony_ciIf the <<fragops-shader, fragment shader>> declares the 903e5c31af7Sopenharmony_cicode:EarlyFragmentTests execution mode, depth reads are allowed only if 904e5c31af7Sopenharmony_cidepth writes are disabled and stencil reads are allowed only if stencil 905e5c31af7Sopenharmony_ciwrites are disabled. 906e5c31af7Sopenharmony_ci 907e5c31af7Sopenharmony_ciIf 908e5c31af7Sopenharmony_cislink:VkPhysicalDeviceShaderTileImagePropertiesEXT::pname:shaderTileImageReadFromHelperInvocation 909e5c31af7Sopenharmony_ciis ename:VK_FALSE, values read from helper invocations are undefined: 910e5c31af7Sopenharmony_ciotherwise the values read are subject to the coherency guarantees described 911e5c31af7Sopenharmony_cibelow. 912e5c31af7Sopenharmony_ci 913e5c31af7Sopenharmony_cicode:OpDepthAttachmentReadEXT returns an undefined: value if no depth 914e5c31af7Sopenharmony_ciattachment is present. 915e5c31af7Sopenharmony_cicode:OpStencilAttachmentReadEXT returns an undefined: value if no stencil 916e5c31af7Sopenharmony_ciattachment is present. 917e5c31af7Sopenharmony_ci 918e5c31af7Sopenharmony_ciTile image reads from color, depth and stencil attachments are said to be 919e5c31af7Sopenharmony_cicoherent when the accesses happen in raster order and without 920e5c31af7Sopenharmony_ci<<memory-model-access-data-race, data race>> with respect to accesses to the 921e5c31af7Sopenharmony_ciattachments from framebuffer-space pipeline stages. 922e5c31af7Sopenharmony_ciThe samples which qualify for coherent access and the enabling conditions 923e5c31af7Sopenharmony_ciare described below. 924e5c31af7Sopenharmony_ci 925e5c31af7Sopenharmony_ci * Let [eq]#Rc# be the set of components being read from an attachment 926e5c31af7Sopenharmony_ci [eq]#A# in a draw call 927e5c31af7Sopenharmony_ci * Let [eq]#Wc# be the set of components being written to [eq]#A# by the 928e5c31af7Sopenharmony_ci draw call 929e5c31af7Sopenharmony_ci 930e5c31af7Sopenharmony_ciThe samples which qualify for coherent tile image reads from an attachment 931e5c31af7Sopenharmony_ci[eq]#A# are: 932e5c31af7Sopenharmony_ci 933e5c31af7Sopenharmony_ci * All samples in a pixel when [eq]#Rc# is disjoint with [eq]#Wc#. 934e5c31af7Sopenharmony_ci * The samples with coverage in a fragment when [eq]#Rc# is not disjoint 935e5c31af7Sopenharmony_ci with [eq]#Wc#. 936e5c31af7Sopenharmony_ci The samples with coverage are determined by the coverage mask for the 937e5c31af7Sopenharmony_ci fragment as calculated by fragment operations that executed prior to 938e5c31af7Sopenharmony_ci fragment shading, including early fragment tests if enabled for the draw 939e5c31af7Sopenharmony_ci call. 940e5c31af7Sopenharmony_ci 941e5c31af7Sopenharmony_ciA fragment shader can: declare code:NonCoherentColorAttachmentReadEXT, 942e5c31af7Sopenharmony_cicode:NonCoherentDepthAttachmentReadEXT, or 943e5c31af7Sopenharmony_cicode:NonCoherentStencilAttachmentReadEXT execution modes to enable 944e5c31af7Sopenharmony_cinon-coherent tile image reads which requires 945e5c31af7Sopenharmony_ci<<synchronization-pipeline-barriers-explicit-renderpass-tileimage, explicit 946e5c31af7Sopenharmony_citile image synchronization>> for the writes to an attachment to be made 947e5c31af7Sopenharmony_civisible via tile image reads. 948e5c31af7Sopenharmony_ci 949e5c31af7Sopenharmony_ciWhen 950e5c31af7Sopenharmony_cislink:VkPhysicalDeviceShaderTileImagePropertiesEXT::pname:shaderTileImageCoherentReadAccelerated 951e5c31af7Sopenharmony_ciis ename:VK_TRUE, the implementation prefers that coherent tile image reads 952e5c31af7Sopenharmony_ciare used, otherwise the implementation prefers that non-coherent tile image 953e5c31af7Sopenharmony_cireads are used. 954e5c31af7Sopenharmony_ci 955e5c31af7Sopenharmony_ci[NOTE] 956e5c31af7Sopenharmony_ci.Note 957e5c31af7Sopenharmony_ci==== 958e5c31af7Sopenharmony_ciIn practice, the most common tile image reads usage patterns fall under one 959e5c31af7Sopenharmony_ciof the following: 960e5c31af7Sopenharmony_ci 961e5c31af7Sopenharmony_ci * Programmable blending - each fragment reads from a single sample 962e5c31af7Sopenharmony_ci (SampleID) at its location. 963e5c31af7Sopenharmony_ci Per-sample shading is typically enabled when multisampled rendertargets 964e5c31af7Sopenharmony_ci are used. 965e5c31af7Sopenharmony_ci * G-buffer generation and shading in one render pass - in the shading 966e5c31af7Sopenharmony_ci phase a fragment reads from a single sample at its location. 967e5c31af7Sopenharmony_ci * Programmable resolve - a fragment reads from all samples at its location 968e5c31af7Sopenharmony_ci (per-sample shading is disabled). 969e5c31af7Sopenharmony_ci This requires the use of a "full-screen triangle" instead of a rectangle 970e5c31af7Sopenharmony_ci composed of two triangles in order to avoid data races along the shared 971e5c31af7Sopenharmony_ci edge of the triangles. 972e5c31af7Sopenharmony_ci * 1:1 texturing with LOD - in use cases such a deferred screen space 973e5c31af7Sopenharmony_ci decals a fragment reads a single sample (SampleID) from depth buffer, 974e5c31af7Sopenharmony_ci but requires being able to read from helper threads to derive the 975e5c31af7Sopenharmony_ci texture LOD. 976e5c31af7Sopenharmony_ci This use case is supported as long as the attachment components being 977e5c31af7Sopenharmony_ci read are not overwritten by color, depth, or stencil attachment writes. 978e5c31af7Sopenharmony_ci 979e5c31af7Sopenharmony_ciAll of the above use cases are supported by coherent tile image reads, but 980e5c31af7Sopenharmony_cionly the latter three are supported when non-coherent reads are used as 981e5c31af7Sopenharmony_cithere is no mechanism to synchronize non-coherent reads with writes within a 982e5c31af7Sopenharmony_cidraw call. 983e5c31af7Sopenharmony_ci==== 984e5c31af7Sopenharmony_ci 985e5c31af7Sopenharmony_ciendif::VK_EXT_shader_tile_image[] 986e5c31af7Sopenharmony_ci 987e5c31af7Sopenharmony_ci[[fragops-shader-depthreplacement]] 988e5c31af7Sopenharmony_ci=== Depth Replacement 989e5c31af7Sopenharmony_ci 990e5c31af7Sopenharmony_ciWriting to the <<interfaces-builtin-variables-fragdepth,code:FragDepth>> 991e5c31af7Sopenharmony_cibuilt-in will replace the fragment's calculated depth values for each sample 992e5c31af7Sopenharmony_ciin the input code:SampleMask. 993e5c31af7Sopenharmony_ci<<fragops-depth, Depth testing>> performed after the fragment shader for 994e5c31af7Sopenharmony_cithis fragment will use this new value as [eq]#z~f~#. 995e5c31af7Sopenharmony_ci 996e5c31af7Sopenharmony_ci 997e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_stencil_export[] 998e5c31af7Sopenharmony_ci[[fragops-shader-stencilrefreplacement]] 999e5c31af7Sopenharmony_ci=== Stencil Reference Replacement 1000e5c31af7Sopenharmony_ci 1001e5c31af7Sopenharmony_ciWriting to the 1002e5c31af7Sopenharmony_ci<<interfaces-builtin-variables-fragdepth,code:FragStencilRefEXT>> built-in 1003e5c31af7Sopenharmony_ciwill replace the fragment's stencil reference value for each sample in the 1004e5c31af7Sopenharmony_ciinput code:SampleMask. 1005e5c31af7Sopenharmony_ci<<fragops-stencil, Stencil testing>> performed after the fragment shader for 1006e5c31af7Sopenharmony_cithis fragment will use this new value as [eq]#s~r~#. 1007e5c31af7Sopenharmony_ciendif::VK_EXT_shader_stencil_export[] 1008e5c31af7Sopenharmony_ci 1009e5c31af7Sopenharmony_ci 1010e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_shader_interlock[] 1011e5c31af7Sopenharmony_ci[[fragops-shader-interlock]] 1012e5c31af7Sopenharmony_ci=== Interlocked Operations 1013e5c31af7Sopenharmony_ci 1014e5c31af7Sopenharmony_cicode:OpBeginInvocationInterlockEXT and code:OpEndInvocationInterlockEXT 1015e5c31af7Sopenharmony_cidefine a section of a fragment shader which imposes additional ordering 1016e5c31af7Sopenharmony_ciconstraints on operations performed within them. 1017e5c31af7Sopenharmony_ciThese operations are defined as _interlocked operations_. 1018e5c31af7Sopenharmony_ciHow interlocked operations are ordered against other fragment shader 1019e5c31af7Sopenharmony_ciinvocations depends on the specified execution modes. 1020e5c31af7Sopenharmony_ci 1021e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image,VK_KHR_fragment_shading_rate[] 1022e5c31af7Sopenharmony_ciIf the code:ShadingRateInterlockOrderedEXT execution mode is specified, any 1023e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before interlocked 1024e5c31af7Sopenharmony_cioperations in fragment shader invocations that execute later in 1025e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>> and cover at least one sample in 1026e5c31af7Sopenharmony_cithe same fragment area, and must: happen after interlocked operations in a 1027e5c31af7Sopenharmony_cifragment shader that executes earlier in <<primsrast-order, rasterization 1028e5c31af7Sopenharmony_ciorder>> and cover at least one sample in the same fragment area. 1029e5c31af7Sopenharmony_ci 1030e5c31af7Sopenharmony_ciIf the code:ShadingRateInterlockUnorderedEXT execution mode is specified, 1031e5c31af7Sopenharmony_ciany interlocked operations in a fragment shader must: happen before or after 1032e5c31af7Sopenharmony_ciinterlocked operations in fragment shader invocations that execute earlier 1033e5c31af7Sopenharmony_cior later in <<primsrast-order, rasterization order>> and cover at least one 1034e5c31af7Sopenharmony_cisample in the same fragment area. 1035e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image,VK_KHR_fragment_shading_rate[] 1036e5c31af7Sopenharmony_ci 1037e5c31af7Sopenharmony_ciIf the code:PixelInterlockOrderedEXT execution mode is specified, any 1038e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before interlocked 1039e5c31af7Sopenharmony_cioperations in fragment shader invocations that execute later in 1040e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>> and cover at least one sample in 1041e5c31af7Sopenharmony_cithe same pixel, and must: happen after interlocked operations in a fragment 1042e5c31af7Sopenharmony_cishader that executes earlier in <<primsrast-order, rasterization order>> and 1043e5c31af7Sopenharmony_cicover at least one sample in the same pixel. 1044e5c31af7Sopenharmony_ci 1045e5c31af7Sopenharmony_ciIf the code:PixelInterlockUnorderedEXT execution mode is specified, any 1046e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before or after 1047e5c31af7Sopenharmony_ciinterlocked operations in fragment shader invocations that execute earlier 1048e5c31af7Sopenharmony_cior later in <<primsrast-order, rasterization order>> and cover at least one 1049e5c31af7Sopenharmony_cisample in the same pixel. 1050e5c31af7Sopenharmony_ci 1051e5c31af7Sopenharmony_ciIf the code:SampleInterlockOrderedEXT execution mode is specified, any 1052e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before interlocked 1053e5c31af7Sopenharmony_cioperations in fragment shader invocations that execute later in 1054e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>> and cover at least one of the same 1055e5c31af7Sopenharmony_cisamples, and must: happen after interlocked operations in a fragment shader 1056e5c31af7Sopenharmony_cithat executes earlier in <<primsrast-order, rasterization order>> and cover 1057e5c31af7Sopenharmony_ciat least one of the same samples. 1058e5c31af7Sopenharmony_ci 1059e5c31af7Sopenharmony_ciIf the code:SampleInterlockUnorderedEXT execution mode is specified, any 1060e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before or after 1061e5c31af7Sopenharmony_ciinterlocked operations in fragment shader invocations that execute earlier 1062e5c31af7Sopenharmony_cior later in <<primsrast-order, rasterization order>> and cover at least one 1063e5c31af7Sopenharmony_ciof the same samples. 1064e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_shader_interlock[] 1065e5c31af7Sopenharmony_ci 1066e5c31af7Sopenharmony_ci 1067e5c31af7Sopenharmony_ci[[fragops-covg]] 1068e5c31af7Sopenharmony_ci== Multisample Coverage 1069e5c31af7Sopenharmony_ci 1070e5c31af7Sopenharmony_ciIf a fragment shader is active and its entry point's interface includes a 1071e5c31af7Sopenharmony_cibuilt-in output variable decorated with code:SampleMask, 1072e5c31af7Sopenharmony_ciifdef::VK_NV_sample_mask_override_coverage[] 1073e5c31af7Sopenharmony_cibut not code:OverrideCoverageNV, 1074e5c31af7Sopenharmony_ciendif::VK_NV_sample_mask_override_coverage[] 1075e5c31af7Sopenharmony_cithe coverage mask is code:ANDed with the bits of the code:SampleMask 1076e5c31af7Sopenharmony_cibuilt-in to generate a new coverage mask. 1077e5c31af7Sopenharmony_ciifdef::VK_NV_sample_mask_override_coverage[] 1078e5c31af7Sopenharmony_ciIf the code:SampleMask built-in is also decorated with 1079e5c31af7Sopenharmony_cicode:OverrideCoverageNV, the coverage mask is replaced with the mask bits 1080e5c31af7Sopenharmony_ciset in the shader. 1081e5c31af7Sopenharmony_ciendif::VK_NV_sample_mask_override_coverage[] 1082e5c31af7Sopenharmony_ciIf <<primsrast-sampleshading,sample shading>> is enabled, bits written to 1083e5c31af7Sopenharmony_cicode:SampleMask corresponding to samples that are not being shaded by the 1084e5c31af7Sopenharmony_cifragment shader invocation are ignored. 1085e5c31af7Sopenharmony_ciIf no fragment shader is active, or if the active fragment shader does not 1086e5c31af7Sopenharmony_ciinclude code:SampleMask in its interface, the coverage mask is not modified. 1087e5c31af7Sopenharmony_ci 1088e5c31af7Sopenharmony_ciNext, the fragment alpha value and coverage mask are modified based on the 1089e5c31af7Sopenharmony_ciifdef::VK_EXT_line_rasterization[] 1090e5c31af7Sopenharmony_ciline coverage factor if the pname:lineRasterizationMode member of the 1091e5c31af7Sopenharmony_cislink:VkPipelineRasterizationStateCreateInfo structure is 1092e5c31af7Sopenharmony_ciename:VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT, and the 1093e5c31af7Sopenharmony_ciendif::VK_EXT_line_rasterization[] 1094e5c31af7Sopenharmony_cipname:alphaToCoverageEnable and pname:alphaToOneEnable members of the 1095e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo structure. 1096e5c31af7Sopenharmony_ci 1097e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 1098e5c31af7Sopenharmony_ci 1099e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetAlphaToCoverageEnableEXT',desc='Specify the alpha to coverage enable state dynamically for a command buffer',type='protos'] 1100e5c31af7Sopenharmony_ci-- 1101e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 1102e5c31af7Sopenharmony_cipname:alphaToCoverageEnable state, call: 1103e5c31af7Sopenharmony_ci 1104e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetAlphaToCoverageEnableEXT.adoc[] 1105e5c31af7Sopenharmony_ci 1106e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1107e5c31af7Sopenharmony_ci recorded. 1108e5c31af7Sopenharmony_ci * pname:alphaToCoverageEnable specifies the pname:alphaToCoverageEnable 1109e5c31af7Sopenharmony_ci state. 1110e5c31af7Sopenharmony_ci 1111e5c31af7Sopenharmony_ciThis command sets the pname:alphaToCoverageEnable state for subsequent 1112e5c31af7Sopenharmony_cidrawing commands 1113e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 1114e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 1115e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 1116e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 1117e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 1118e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1119e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT set in 1120e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1121e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 1122e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1123e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:alphaToCoverageEnable 1124e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 1125e5c31af7Sopenharmony_ci 1126e5c31af7Sopenharmony_ci:refpage: vkCmdSetAlphaToCoverageEnableEXT 1127e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3AlphaToCoverageEnable 1128e5c31af7Sopenharmony_ci 1129e5c31af7Sopenharmony_ci.Valid Usage 1130e5c31af7Sopenharmony_ci**** 1131e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 1132e5c31af7Sopenharmony_ci**** 1133e5c31af7Sopenharmony_ci 1134e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetAlphaToCoverageEnableEXT.adoc[] 1135e5c31af7Sopenharmony_ci-- 1136e5c31af7Sopenharmony_ci 1137e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetAlphaToOneEnableEXT',desc='Specify the alpha to one enable state dynamically for a command buffer',type='protos'] 1138e5c31af7Sopenharmony_ci-- 1139e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the pname:alphaToOneEnable 1140e5c31af7Sopenharmony_cistate, call: 1141e5c31af7Sopenharmony_ci 1142e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetAlphaToOneEnableEXT.adoc[] 1143e5c31af7Sopenharmony_ci 1144e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1145e5c31af7Sopenharmony_ci recorded. 1146e5c31af7Sopenharmony_ci * pname:alphaToOneEnable specifies the pname:alphaToOneEnable state. 1147e5c31af7Sopenharmony_ci 1148e5c31af7Sopenharmony_ciThis command sets the pname:alphaToOneEnable state for subsequent drawing 1149e5c31af7Sopenharmony_cicommands 1150e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 1151e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 1152e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 1153e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 1154e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 1155e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1156e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT set in 1157e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1158e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 1159e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1160e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:alphaToOneEnable value 1161e5c31af7Sopenharmony_ciused to create the currently active pipeline. 1162e5c31af7Sopenharmony_ci 1163e5c31af7Sopenharmony_ci:refpage: vkCmdSetAlphaToOneEnableEXT 1164e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3AlphaToOneEnable 1165e5c31af7Sopenharmony_ci 1166e5c31af7Sopenharmony_ci.Valid Usage 1167e5c31af7Sopenharmony_ci**** 1168e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 1169e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetAlphaToOneEnableEXT-alphaToOne-07607]] 1170e5c31af7Sopenharmony_ci If the <<features-alphaToOne, pname:alphaToOne>> feature is not enabled, 1171e5c31af7Sopenharmony_ci pname:alphaToOneEnable must: be ename:VK_FALSE 1172e5c31af7Sopenharmony_ci**** 1173e5c31af7Sopenharmony_ci 1174e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetAlphaToOneEnableEXT.adoc[] 1175e5c31af7Sopenharmony_ci-- 1176e5c31af7Sopenharmony_ci 1177e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 1178e5c31af7Sopenharmony_ci 1179e5c31af7Sopenharmony_ciAll alpha values in this section refer only to the alpha component of the 1180e5c31af7Sopenharmony_cifragment shader output that has a code:Location and code:Index decoration of 1181e5c31af7Sopenharmony_cizero (see the <<interfaces-fragmentoutput,Fragment Output Interface>> 1182e5c31af7Sopenharmony_cisection). 1183e5c31af7Sopenharmony_ciIf that shader output has an integer or unsigned integer type, then these 1184e5c31af7Sopenharmony_cioperations are skipped. 1185e5c31af7Sopenharmony_ci 1186e5c31af7Sopenharmony_ciifdef::VK_EXT_line_rasterization[] 1187e5c31af7Sopenharmony_ciIf the pname:lineRasterizationMode member of the 1188e5c31af7Sopenharmony_cislink:VkPipelineRasterizationStateCreateInfo structure is 1189e5c31af7Sopenharmony_ciename:VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT and the fragment 1190e5c31af7Sopenharmony_cicame from a line segment, then the alpha value is replaced by multiplying it 1191e5c31af7Sopenharmony_ciby the coverage factor for the fragment computed during 1192e5c31af7Sopenharmony_ci<<primsrast-lines-smooth,smooth line rasterization>>. 1193e5c31af7Sopenharmony_ciendif::VK_EXT_line_rasterization[] 1194e5c31af7Sopenharmony_ci 1195e5c31af7Sopenharmony_ciIf pname:alphaToCoverageEnable is enabled, a temporary coverage mask is 1196e5c31af7Sopenharmony_cigenerated where each bit is determined by the fragment's alpha value, which 1197e5c31af7Sopenharmony_ciis ANDed with the fragment coverage mask. 1198e5c31af7Sopenharmony_ci 1199e5c31af7Sopenharmony_ciNo specific algorithm is specified for converting the alpha value to a 1200e5c31af7Sopenharmony_citemporary coverage mask. 1201e5c31af7Sopenharmony_ciIt is intended that the number of 1's in this value be proportional to the 1202e5c31af7Sopenharmony_cialpha value (clamped to [eq]#[0,1]#), with all 1's corresponding to a value 1203e5c31af7Sopenharmony_ciof 1.0 and all 0's corresponding to 0.0. 1204e5c31af7Sopenharmony_ciThe algorithm may: be different at different framebuffer coordinates. 1205e5c31af7Sopenharmony_ci 1206e5c31af7Sopenharmony_ci[NOTE] 1207e5c31af7Sopenharmony_ci.Note 1208e5c31af7Sopenharmony_ci==== 1209e5c31af7Sopenharmony_ciUsing different algorithms at different framebuffer coordinates may: help to 1210e5c31af7Sopenharmony_ciavoid artifacts caused by regular coverage sample locations. 1211e5c31af7Sopenharmony_ci==== 1212e5c31af7Sopenharmony_ci 1213e5c31af7Sopenharmony_ciFinally, if pname:alphaToOneEnable is enabled, each alpha value is replaced 1214e5c31af7Sopenharmony_ciby the maximum representable alpha value for fixed-point color attachments, 1215e5c31af7Sopenharmony_cior by 1.0 for floating-point attachments. 1216e5c31af7Sopenharmony_ciOtherwise, the alpha values are not changed. 1217e5c31af7Sopenharmony_ci 1218e5c31af7Sopenharmony_ci 1219e5c31af7Sopenharmony_ci[[fragops-ds-state]] 1220e5c31af7Sopenharmony_ci== Depth and Stencil Operations 1221e5c31af7Sopenharmony_ci 1222e5c31af7Sopenharmony_ciPipeline state controlling the <<fragops-dbt,depth bounds tests>>, 1223e5c31af7Sopenharmony_ci<<fragops-stencil,stencil test>>, and <<fragops-depth,depth test>> is 1224e5c31af7Sopenharmony_cispecified through the members of the 1225e5c31af7Sopenharmony_cisname:VkPipelineDepthStencilStateCreateInfo structure. 1226e5c31af7Sopenharmony_ci 1227e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDepthStencilStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline depth stencil state',type='structs'] 1228e5c31af7Sopenharmony_ci-- 1229e5c31af7Sopenharmony_ciThe sname:VkPipelineDepthStencilStateCreateInfo structure is defined as: 1230e5c31af7Sopenharmony_ci 1231e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineDepthStencilStateCreateInfo.adoc[] 1232e5c31af7Sopenharmony_ci 1233e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 1234e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1235e5c31af7Sopenharmony_ci structure. 1236e5c31af7Sopenharmony_ciifndef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1237e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 1238e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1239e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1240e5c31af7Sopenharmony_ci * pname:flags is a bitmask of 1241e5c31af7Sopenharmony_ci elink:VkPipelineDepthStencilStateCreateFlagBits specifying additional 1242e5c31af7Sopenharmony_ci depth/stencil state information. 1243e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1244e5c31af7Sopenharmony_ci * pname:depthTestEnable controls whether <<fragops-depth,depth testing>> 1245e5c31af7Sopenharmony_ci is enabled. 1246e5c31af7Sopenharmony_ci * pname:depthWriteEnable controls whether <<fragops-depth-write,depth 1247e5c31af7Sopenharmony_ci writes>> are enabled when pname:depthTestEnable is ename:VK_TRUE. 1248e5c31af7Sopenharmony_ci Depth writes are always disabled when pname:depthTestEnable is 1249e5c31af7Sopenharmony_ci ename:VK_FALSE. 1250e5c31af7Sopenharmony_ci * pname:depthCompareOp is a elink:VkCompareOp value specifying the 1251e5c31af7Sopenharmony_ci comparison operator to use in the <<fragops-depth-comparison, Depth 1252e5c31af7Sopenharmony_ci Comparison>> step of the <<fragops-depth,depth test>>. 1253e5c31af7Sopenharmony_ci * pname:depthBoundsTestEnable controls whether <<fragops-dbt,depth bounds 1254e5c31af7Sopenharmony_ci testing>> is enabled. 1255e5c31af7Sopenharmony_ci * pname:stencilTestEnable controls whether <<fragops-stencil,stencil 1256e5c31af7Sopenharmony_ci testing>> is enabled. 1257e5c31af7Sopenharmony_ci * pname:front and pname:back are slink:VkStencilOpState values controlling 1258e5c31af7Sopenharmony_ci the corresponding parameters of the <<fragops-stencil,stencil test>>. 1259e5c31af7Sopenharmony_ci * pname:minDepthBounds is the minimum depth bound used in the 1260e5c31af7Sopenharmony_ci <<fragops-dbt, depth bounds test>>. 1261e5c31af7Sopenharmony_ci * pname:maxDepthBounds is the maximum depth bound used in the 1262e5c31af7Sopenharmony_ci <<fragops-dbt, depth bounds test>>. 1263e5c31af7Sopenharmony_ci 1264e5c31af7Sopenharmony_ci.Valid Usage 1265e5c31af7Sopenharmony_ci**** 1266e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-depthBoundsTestEnable-00598]] 1267e5c31af7Sopenharmony_ci If the <<features-depthBounds, pname:depthBounds>> feature is not 1268e5c31af7Sopenharmony_ci enabled, pname:depthBoundsTestEnable must: be ename:VK_FALSE 1269e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 1270e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-separateStencilMaskRef-04453]] 1271e5c31af7Sopenharmony_ci If the `apiext:VK_KHR_portability_subset` extension is enabled, and 1272e5c31af7Sopenharmony_ci slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:separateStencilMaskRef 1273e5c31af7Sopenharmony_ci is ename:VK_FALSE, and the value of 1274e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:stencilTestEnable is 1275e5c31af7Sopenharmony_ci ename:VK_TRUE, and the value of 1276e5c31af7Sopenharmony_ci slink:VkPipelineRasterizationStateCreateInfo::pname:cullMode is 1277e5c31af7Sopenharmony_ci ename:VK_CULL_MODE_NONE, the value of pname:reference in each of the 1278e5c31af7Sopenharmony_ci slink:VkStencilOpState structs in pname:front and pname:back must: be 1279e5c31af7Sopenharmony_ci the same 1280e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 1281e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1282e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-rasterizationOrderDepthAttachmentAccess-06463]] 1283e5c31af7Sopenharmony_ci If the <<features-rasterizationOrderDepthAttachmentAccess, 1284e5c31af7Sopenharmony_ci pname:rasterizationOrderDepthAttachmentAccess>> feature is not enabled, 1285e5c31af7Sopenharmony_ci pname:flags must: not include 1286e5c31af7Sopenharmony_ci ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT 1287e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-rasterizationOrderStencilAttachmentAccess-06464]] 1288e5c31af7Sopenharmony_ci If the <<features-rasterizationOrderStencilAttachmentAccess, 1289e5c31af7Sopenharmony_ci pname:rasterizationOrderStencilAttachmentAccess>> feature is not 1290e5c31af7Sopenharmony_ci enabled, pname:flags must: not include 1291e5c31af7Sopenharmony_ci ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT 1292e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1293e5c31af7Sopenharmony_ci**** 1294e5c31af7Sopenharmony_ci 1295e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineDepthStencilStateCreateInfo.adoc[] 1296e5c31af7Sopenharmony_ci-- 1297e5c31af7Sopenharmony_ci 1298e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDepthStencilStateCreateFlags',desc='Bitmask of VkPipelineDepthStencilStateCreateFlagBits',type='flags'] 1299e5c31af7Sopenharmony_ci-- 1300e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineDepthStencilStateCreateFlags.adoc[] 1301e5c31af7Sopenharmony_ci 1302e5c31af7Sopenharmony_ciifndef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1303e5c31af7Sopenharmony_citname:VkPipelineDepthStencilStateCreateFlags is a bitmask type for setting a 1304e5c31af7Sopenharmony_cimask, but is currently reserved for future use. 1305e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1306e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1307e5c31af7Sopenharmony_citname:VkPipelineDepthStencilStateCreateFlags is a bitmask type for setting a 1308e5c31af7Sopenharmony_cimask of zero or more elink:VkPipelineDepthStencilStateCreateFlagBits. 1309e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1310e5c31af7Sopenharmony_ci-- 1311e5c31af7Sopenharmony_ci 1312e5c31af7Sopenharmony_ciifdef::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1313e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDepthStencilStateCreateFlagBits',desc='Bitmask specifying additional depth/stencil state information.',type='enums'] 1314e5c31af7Sopenharmony_ci-- 1315e5c31af7Sopenharmony_ciBits which can: be set in the 1316e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:flags parameter are: 1317e5c31af7Sopenharmony_ci 1318e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPipelineDepthStencilStateCreateFlagBits.adoc[] 1319e5c31af7Sopenharmony_ci 1320e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT 1321e5c31af7Sopenharmony_ci indicates that access to the depth aspects of depth/stencil and input 1322e5c31af7Sopenharmony_ci attachments will have implicit framebuffer-local memory dependencies. 1323e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT 1324e5c31af7Sopenharmony_ci indicates that access to the stencil aspects of depth/stencil and input 1325e5c31af7Sopenharmony_ci attachments will have implicit framebuffer-local memory dependencies. 1326e5c31af7Sopenharmony_ci 1327e5c31af7Sopenharmony_ciWhen 1328e5c31af7Sopenharmony_ciename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_EXT 1329e5c31af7Sopenharmony_ciis included in a pipeline, it forms a framebuffer-local memory dependency 1330e5c31af7Sopenharmony_cifor each fragment generated by draw commands for that pipeline with the 1331e5c31af7Sopenharmony_cifollowing scopes: 1332e5c31af7Sopenharmony_ci 1333e5c31af7Sopenharmony_ci * The first <<synchronization-dependencies-scopes, synchronization scope>> 1334e5c31af7Sopenharmony_ci includes ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT and 1335e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT pipeline stages executed 1336e5c31af7Sopenharmony_ci by all previous fragments (as defined by <<drawing-primitive-order, 1337e5c31af7Sopenharmony_ci primitive order>>) in the corresponding 1338e5c31af7Sopenharmony_ci <<synchronization-framebuffer-regions, framebuffer regions>> including 1339e5c31af7Sopenharmony_ci those generated by the same draw command. 1340e5c31af7Sopenharmony_ci * The second <<synchronization-dependencies-scopes, synchronization 1341e5c31af7Sopenharmony_ci scope>> includes ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT stage 1342e5c31af7Sopenharmony_ci executed by the generated fragment. 1343e5c31af7Sopenharmony_ci * The first <<synchronization-dependencies-access-scopes, access scope>> 1344e5c31af7Sopenharmony_ci includes all writes to the depth aspect of depth/stencil attachments. 1345e5c31af7Sopenharmony_ci * The second <<synchronization-dependencies-access-scopes, access scope>> 1346e5c31af7Sopenharmony_ci includes all reads from the depth aspect of input attachments. 1347e5c31af7Sopenharmony_ci 1348e5c31af7Sopenharmony_ciWhen 1349e5c31af7Sopenharmony_ciename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_EXT 1350e5c31af7Sopenharmony_ciis included in a pipeline, it forms a framebuffer-local memory dependency 1351e5c31af7Sopenharmony_cifor each fragment generated by draw commands for that pipeline with the 1352e5c31af7Sopenharmony_cifollowing scopes: 1353e5c31af7Sopenharmony_ci 1354e5c31af7Sopenharmony_ci * The first <<synchronization-dependencies-scopes, synchronization scope>> 1355e5c31af7Sopenharmony_ci includes ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT 1356e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT pipeline stages executed 1357e5c31af7Sopenharmony_ci by all previous fragments (as defined by <<drawing-primitive-order, 1358e5c31af7Sopenharmony_ci primitive order>>) in the corresponding 1359e5c31af7Sopenharmony_ci <<synchronization-framebuffer-regions, framebuffer regions>> including 1360e5c31af7Sopenharmony_ci those generated by the same draw command. 1361e5c31af7Sopenharmony_ci * The second <<synchronization-dependencies-scopes, synchronization 1362e5c31af7Sopenharmony_ci scope>> includes ename:VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT and 1363e5c31af7Sopenharmony_ci ename:VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT pipeline stages executed 1364e5c31af7Sopenharmony_ci by the generated fragment. 1365e5c31af7Sopenharmony_ci * The first <<synchronization-dependencies-access-scopes, access scope>> 1366e5c31af7Sopenharmony_ci includes all writes to the stencil aspect of depth/stencil attachments. 1367e5c31af7Sopenharmony_ci * The second <<synchronization-dependencies-access-scopes, access scope>> 1368e5c31af7Sopenharmony_ci includes all reads from the stencil aspect of input attachments. 1369e5c31af7Sopenharmony_ci-- 1370e5c31af7Sopenharmony_ciendif::VK_EXT_rasterization_order_attachment_access,VK_ARM_rasterization_order_attachment_access[] 1371e5c31af7Sopenharmony_ci 1372e5c31af7Sopenharmony_ci 1373e5c31af7Sopenharmony_ci[[fragops-dbt]] 1374e5c31af7Sopenharmony_ci== Depth Bounds Test 1375e5c31af7Sopenharmony_ci 1376e5c31af7Sopenharmony_ciThe depth bounds test compares the depth value [eq]#z~a~# in the 1377e5c31af7Sopenharmony_cidepth/stencil attachment at each sample's framebuffer coordinates 1378e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# and <<primsrast-multisampling-coverage-mask, sample 1379e5c31af7Sopenharmony_ciindex>> [eq]#i# against a set of _depth bounds_. 1380e5c31af7Sopenharmony_ci 1381e5c31af7Sopenharmony_ciThe depth bounds are determined by two floating point values defining a 1382e5c31af7Sopenharmony_ciminimum (pname:minDepthBounds) and maximum (pname:maxDepthBounds) depth 1383e5c31af7Sopenharmony_civalue. 1384e5c31af7Sopenharmony_ciThese values are either set by the 1385e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo structure during pipeline 1386e5c31af7Sopenharmony_cicreation, or dynamically by 1387e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1388e5c31af7Sopenharmony_ciflink:vkCmdSetDepthBoundsTestEnable and 1389e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1390e5c31af7Sopenharmony_ciflink:vkCmdSetDepthBounds. 1391e5c31af7Sopenharmony_ci 1392e5c31af7Sopenharmony_ciA given sample is considered within the depth bounds if [eq]#z~a~# is in the 1393e5c31af7Sopenharmony_cirange [eq]#[pname:minDepthBounds,pname:maxDepthBounds]#. 1394e5c31af7Sopenharmony_ciSamples with depth attachment values outside of the depth bounds will have 1395e5c31af7Sopenharmony_citheir coverage set to `0`. 1396e5c31af7Sopenharmony_ci 1397e5c31af7Sopenharmony_ciIf the depth bounds test is disabled, or if there is no depth attachment, 1398e5c31af7Sopenharmony_cithe coverage mask is unmodified by this operation. 1399e5c31af7Sopenharmony_ci 1400e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1401e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthBoundsTestEnable',desc='Set depth bounds test enable dynamically for a command buffer',type='protos',alias='vkCmdSetDepthBoundsTestEnableEXT'] 1402e5c31af7Sopenharmony_ci-- 1403e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically enable or disable>> the depth 1404e5c31af7Sopenharmony_cibounds test, call: 1405e5c31af7Sopenharmony_ci 1406e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 1407e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthBoundsTestEnable.adoc[] 1408e5c31af7Sopenharmony_ci 1409e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[or the equivalent command] 1410e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 1411e5c31af7Sopenharmony_ci 1412e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1413e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthBoundsTestEnableEXT.adoc[] 1414e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1415e5c31af7Sopenharmony_ci 1416e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1417e5c31af7Sopenharmony_ci recorded. 1418e5c31af7Sopenharmony_ci * pname:depthBoundsTestEnable specifies if the depth bounds test is 1419e5c31af7Sopenharmony_ci enabled. 1420e5c31af7Sopenharmony_ci 1421e5c31af7Sopenharmony_ciThis command sets the depth bounds enable for subsequent drawing commands 1422e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 1423e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>, or] 1424e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>.] 1425e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 1426e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1427e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1428e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE set in 1429e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1430e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1431e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1432e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthBoundsTestEnable 1433e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 1434e5c31af7Sopenharmony_ci 1435e5c31af7Sopenharmony_ci:refpage: vkCmdSetDepthBoundsTestEnable 1436e5c31af7Sopenharmony_ci 1437e5c31af7Sopenharmony_ci.Valid Usage 1438e5c31af7Sopenharmony_ci**** 1439e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state_feature_common.adoc[] 1440e5c31af7Sopenharmony_ci**** 1441e5c31af7Sopenharmony_ci 1442e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthBoundsTestEnable.adoc[] 1443e5c31af7Sopenharmony_ci-- 1444e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1445e5c31af7Sopenharmony_ci 1446e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthBounds',desc='Set depth bounds range dynamically for a command buffer',type='protos'] 1447e5c31af7Sopenharmony_ci-- 1448e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the depth bounds range, 1449e5c31af7Sopenharmony_cicall: 1450e5c31af7Sopenharmony_ci 1451e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthBounds.adoc[] 1452e5c31af7Sopenharmony_ci 1453e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1454e5c31af7Sopenharmony_ci recorded. 1455e5c31af7Sopenharmony_ci * pname:minDepthBounds is the minimum depth bound. 1456e5c31af7Sopenharmony_ci * pname:maxDepthBounds is the maximum depth bound. 1457e5c31af7Sopenharmony_ci 1458e5c31af7Sopenharmony_ciThis command sets the depth bounds range for subsequent drawing commands 1459e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 1460e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1461e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_BOUNDS set in 1462e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1463e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1464e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:minDepthBounds and 1465e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:maxDepthBounds values 1466e5c31af7Sopenharmony_ciused to create the currently active pipeline. 1467e5c31af7Sopenharmony_ci 1468e5c31af7Sopenharmony_ci.Valid Usage 1469e5c31af7Sopenharmony_ci**** 1470e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthBounds-minDepthBounds-00600]] 1471e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[] 1472e5c31af7Sopenharmony_ci If the `apiext:VK_EXT_depth_range_unrestricted` extension is not enabled 1473e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 1474e5c31af7Sopenharmony_ci pname:minDepthBounds must: be between `0.0` and `1.0`, inclusive 1475e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthBounds-maxDepthBounds-00601]] 1476e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[] 1477e5c31af7Sopenharmony_ci If the `apiext:VK_EXT_depth_range_unrestricted` extension is not enabled 1478e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 1479e5c31af7Sopenharmony_ci pname:maxDepthBounds must: be between `0.0` and `1.0`, inclusive 1480e5c31af7Sopenharmony_ci**** 1481e5c31af7Sopenharmony_ci 1482e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthBounds.adoc[] 1483e5c31af7Sopenharmony_ci-- 1484e5c31af7Sopenharmony_ci 1485e5c31af7Sopenharmony_ci 1486e5c31af7Sopenharmony_ci[[fragops-stencil]] 1487e5c31af7Sopenharmony_ci== Stencil Test 1488e5c31af7Sopenharmony_ci 1489e5c31af7Sopenharmony_ciThe stencil test compares the stencil attachment value [eq]#s~a~# in the 1490e5c31af7Sopenharmony_cidepth/stencil attachment at each sample's framebuffer coordinates 1491e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# and <<primsrast-multisampling-coverage-mask, sample 1492e5c31af7Sopenharmony_ciindex>> [eq]#i# against a _stencil reference value_. 1493e5c31af7Sopenharmony_ci 1494e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 1495e5c31af7Sopenharmony_ciIf the render pass has a fragment density map attachment and the fragment 1496e5c31af7Sopenharmony_cicovers multiple pixels, there is an implementation-dependent association of 1497e5c31af7Sopenharmony_cicoverage samples to stencil attachment samples within the fragment. 1498e5c31af7Sopenharmony_ciHowever, if all samples in the fragment are covered, and the stencil 1499e5c31af7Sopenharmony_ciattachment value is updated as a result of this test, all stencil attachment 1500e5c31af7Sopenharmony_cisamples will be updated. 1501e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 1502e5c31af7Sopenharmony_ci 1503e5c31af7Sopenharmony_ciIf the stencil test is not enabled, as specified by 1504e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1505e5c31af7Sopenharmony_ciflink:vkCmdSetStencilTestEnable or 1506e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1507e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:stencilTestEnable, or if 1508e5c31af7Sopenharmony_cithere is no stencil attachment, the coverage mask is unmodified by this 1509e5c31af7Sopenharmony_cioperation. 1510e5c31af7Sopenharmony_ci 1511e5c31af7Sopenharmony_ciThe stencil test is controlled by one of two sets of stencil-related state, 1512e5c31af7Sopenharmony_cithe front stencil state and the back stencil state. 1513e5c31af7Sopenharmony_ciStencil tests and writes use the back stencil state when processing 1514e5c31af7Sopenharmony_cifragments generated by <<primsrast-polygons-basic,back-facing>> 1515e5c31af7Sopenharmony_ci<<primsrast-polygons,polygons>>, and the front stencil state when processing 1516e5c31af7Sopenharmony_cifragments generated by <<primsrast-polygons-basic,front-facing polygons>> or 1517e5c31af7Sopenharmony_ciany other primitives. 1518e5c31af7Sopenharmony_ci 1519e5c31af7Sopenharmony_ciThe comparison operation performed is determined by the elink:VkCompareOp 1520e5c31af7Sopenharmony_civalue set by 1521e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1522e5c31af7Sopenharmony_ciflink:vkCmdSetStencilOp::pname:compareOp, or by 1523e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1524e5c31af7Sopenharmony_cislink:VkStencilOpState::pname:compareOp during pipeline creation. 1525e5c31af7Sopenharmony_ci 1526e5c31af7Sopenharmony_ciThe compare mask [eq]#s~c~# and stencil reference value [eq]#s~r~# of the 1527e5c31af7Sopenharmony_cifront or the back stencil state set determine arguments of the comparison 1528e5c31af7Sopenharmony_cioperation. 1529e5c31af7Sopenharmony_ci[eq]#s~c~# is set by the slink:VkPipelineDepthStencilStateCreateInfo 1530e5c31af7Sopenharmony_cistructure during pipeline creation, or by the 1531e5c31af7Sopenharmony_ciflink:vkCmdSetStencilCompareMask command. 1532e5c31af7Sopenharmony_ci[eq]#s~r~# is set by slink:VkPipelineDepthStencilStateCreateInfo or by 1533e5c31af7Sopenharmony_ciflink:vkCmdSetStencilReference. 1534e5c31af7Sopenharmony_ci 1535e5c31af7Sopenharmony_ci[eq]#s~r~# and [eq]#s~a~# are each independently combined with [eq]#s~c~# 1536e5c31af7Sopenharmony_ciusing a bitwise code:AND operation to create masked reference and attachment 1537e5c31af7Sopenharmony_civalues [eq]#s'~r~# and [eq]#s'~a~#. 1538e5c31af7Sopenharmony_ci[eq]#s'~r~# and [eq]#s'~a~# are used as the _reference_ and _test_ values, 1539e5c31af7Sopenharmony_cirespectively, in the operation specified by the elink:VkCompareOp. 1540e5c31af7Sopenharmony_ci 1541e5c31af7Sopenharmony_ciIf the comparison evaluates to false, the coverage for the sample is set to 1542e5c31af7Sopenharmony_ci`0`. 1543e5c31af7Sopenharmony_ci 1544e5c31af7Sopenharmony_ciA new stencil value [eq]#s~g~# is generated according to a stencil operation 1545e5c31af7Sopenharmony_cidefined by elink:VkStencilOp parameters set by 1546e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1547e5c31af7Sopenharmony_ciflink:vkCmdSetStencilOp or 1548e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1549e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo. 1550e5c31af7Sopenharmony_ciIf the stencil test fails, pname:failOp defines the stencil operation used. 1551e5c31af7Sopenharmony_ciIf the stencil test passes however, the stencil op used is based on the 1552e5c31af7Sopenharmony_ci<<fragops-depth, depth test>> - if it passes, 1553e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:passOp is used, otherwise 1554e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthFailOp is used. 1555e5c31af7Sopenharmony_ci 1556e5c31af7Sopenharmony_ciThe stencil attachment value [eq]#s~a~# is then updated with the generated 1557e5c31af7Sopenharmony_cistencil value [eq]#s~g~# according to the write mask [eq]#s~w~# defined by 1558e5c31af7Sopenharmony_cipname:writeMask in slink:VkPipelineDepthStencilStateCreateInfo::pname:front 1559e5c31af7Sopenharmony_ciand slink:VkPipelineDepthStencilStateCreateInfo::pname:back as: 1560e5c31af7Sopenharmony_ci 1561e5c31af7Sopenharmony_ci {empty}:: [eq]#s~a~ = (s~a~ & ¬s~w~) | (s~g~ & s~w~)# 1562e5c31af7Sopenharmony_ci 1563e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1564e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilTestEnable',desc='Set stencil test enable dynamically for a command buffer',type='protos',alias='vkCmdSetStencilTestEnableEXT'] 1565e5c31af7Sopenharmony_ci-- 1566e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically enable or disable>> the stencil 1567e5c31af7Sopenharmony_citest, call: 1568e5c31af7Sopenharmony_ci 1569e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 1570e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilTestEnable.adoc[] 1571e5c31af7Sopenharmony_ci 1572e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[or the equivalent command] 1573e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 1574e5c31af7Sopenharmony_ci 1575e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1576e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilTestEnableEXT.adoc[] 1577e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1578e5c31af7Sopenharmony_ci 1579e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1580e5c31af7Sopenharmony_ci recorded. 1581e5c31af7Sopenharmony_ci * pname:stencilTestEnable specifies if the stencil test is enabled. 1582e5c31af7Sopenharmony_ci 1583e5c31af7Sopenharmony_ciThis command sets the stencil test enable for subsequent drawing commands 1584e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 1585e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>, or] 1586e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>.] 1587e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 1588e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1589e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1590e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE set in 1591e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1592e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1593e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1594e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:stencilTestEnable value 1595e5c31af7Sopenharmony_ciused to create the currently active pipeline. 1596e5c31af7Sopenharmony_ci 1597e5c31af7Sopenharmony_ci:refpage: vkCmdSetStencilTestEnable 1598e5c31af7Sopenharmony_ci 1599e5c31af7Sopenharmony_ci.Valid Usage 1600e5c31af7Sopenharmony_ci**** 1601e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state_feature_common.adoc[] 1602e5c31af7Sopenharmony_ci**** 1603e5c31af7Sopenharmony_ci 1604e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilTestEnable.adoc[] 1605e5c31af7Sopenharmony_ci-- 1606e5c31af7Sopenharmony_ci 1607e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilOp',desc='Set stencil operation dynamically for a command buffer',type='protos',alias='vkCmdSetStencilOpEXT'] 1608e5c31af7Sopenharmony_ci-- 1609e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil operation, call: 1610e5c31af7Sopenharmony_ci 1611e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 1612e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilOp.adoc[] 1613e5c31af7Sopenharmony_ci 1614e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[or the equivalent command] 1615e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 1616e5c31af7Sopenharmony_ci 1617e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1618e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilOpEXT.adoc[] 1619e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1620e5c31af7Sopenharmony_ci 1621e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1622e5c31af7Sopenharmony_ci recorded. 1623e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1624e5c31af7Sopenharmony_ci the set of stencil state for which to update the stencil operation. 1625e5c31af7Sopenharmony_ci * pname:failOp is a elink:VkStencilOp value specifying the action 1626e5c31af7Sopenharmony_ci performed on samples that fail the stencil test. 1627e5c31af7Sopenharmony_ci * pname:passOp is a elink:VkStencilOp value specifying the action 1628e5c31af7Sopenharmony_ci performed on samples that pass both the depth and stencil tests. 1629e5c31af7Sopenharmony_ci * pname:depthFailOp is a elink:VkStencilOp value specifying the action 1630e5c31af7Sopenharmony_ci performed on samples that pass the stencil test and fail the depth test. 1631e5c31af7Sopenharmony_ci * pname:compareOp is a elink:VkCompareOp value specifying the comparison 1632e5c31af7Sopenharmony_ci operator used in the stencil test. 1633e5c31af7Sopenharmony_ci 1634e5c31af7Sopenharmony_ciThis command sets the stencil operation for subsequent drawing commands when 1635e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 1636e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>, or] 1637e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>.] 1638e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 1639e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1640e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with ename:VK_DYNAMIC_STATE_STENCIL_OP 1641e5c31af7Sopenharmony_ciset in slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1642e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1643e5c31af7Sopenharmony_ciOtherwise, this state is specified by the corresponding 1644e5c31af7Sopenharmony_cisname:VkPipelineDepthStencilStateCreateInfo::pname:failOp, pname:passOp, 1645e5c31af7Sopenharmony_cipname:depthFailOp, and pname:compareOp values used to create the currently 1646e5c31af7Sopenharmony_ciactive pipeline, for both front and back faces. 1647e5c31af7Sopenharmony_ci 1648e5c31af7Sopenharmony_ci:refpage: vkCmdSetStencilOp 1649e5c31af7Sopenharmony_ci 1650e5c31af7Sopenharmony_ci.Valid Usage 1651e5c31af7Sopenharmony_ci**** 1652e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state_feature_common.adoc[] 1653e5c31af7Sopenharmony_ci**** 1654e5c31af7Sopenharmony_ci 1655e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilOp.adoc[] 1656e5c31af7Sopenharmony_ci-- 1657e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1658e5c31af7Sopenharmony_ci 1659e5c31af7Sopenharmony_ci[open,refpage='VkStencilOpState',desc='Structure specifying stencil operation state',type='structs'] 1660e5c31af7Sopenharmony_ci-- 1661e5c31af7Sopenharmony_ciThe sname:VkStencilOpState structure is defined as: 1662e5c31af7Sopenharmony_ci 1663e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkStencilOpState.adoc[] 1664e5c31af7Sopenharmony_ci 1665e5c31af7Sopenharmony_ci * pname:failOp is a elink:VkStencilOp value specifying the action 1666e5c31af7Sopenharmony_ci performed on samples that fail the stencil test. 1667e5c31af7Sopenharmony_ci * pname:passOp is a elink:VkStencilOp value specifying the action 1668e5c31af7Sopenharmony_ci performed on samples that pass both the depth and stencil tests. 1669e5c31af7Sopenharmony_ci * pname:depthFailOp is a elink:VkStencilOp value specifying the action 1670e5c31af7Sopenharmony_ci performed on samples that pass the stencil test and fail the depth test. 1671e5c31af7Sopenharmony_ci * pname:compareOp is a elink:VkCompareOp value specifying the comparison 1672e5c31af7Sopenharmony_ci operator used in the stencil test. 1673e5c31af7Sopenharmony_ci * pname:compareMask selects the bits of the unsigned integer stencil 1674e5c31af7Sopenharmony_ci values participating in the stencil test. 1675e5c31af7Sopenharmony_ci * pname:writeMask selects the bits of the unsigned integer stencil values 1676e5c31af7Sopenharmony_ci updated by the stencil test in the stencil framebuffer attachment. 1677e5c31af7Sopenharmony_ci * pname:reference is an integer stencil reference value that is used in 1678e5c31af7Sopenharmony_ci the unsigned stencil comparison. 1679e5c31af7Sopenharmony_ci 1680e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkStencilOpState.adoc[] 1681e5c31af7Sopenharmony_ci-- 1682e5c31af7Sopenharmony_ci 1683e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilCompareMask',desc='Set stencil compare mask dynamically for a command buffer',type='protos'] 1684e5c31af7Sopenharmony_ci-- 1685e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil compare mask, 1686e5c31af7Sopenharmony_cicall: 1687e5c31af7Sopenharmony_ci 1688e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilCompareMask.adoc[] 1689e5c31af7Sopenharmony_ci 1690e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1691e5c31af7Sopenharmony_ci recorded. 1692e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1693e5c31af7Sopenharmony_ci the set of stencil state for which to update the compare mask. 1694e5c31af7Sopenharmony_ci * pname:compareMask is the new value to use as the stencil compare mask. 1695e5c31af7Sopenharmony_ci 1696e5c31af7Sopenharmony_ciThis command sets the stencil compare mask for subsequent drawing commands 1697e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 1698e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1699e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK set in 1700e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1701e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1702e5c31af7Sopenharmony_cislink:VkStencilOpState::pname:compareMask value used to create the currently 1703e5c31af7Sopenharmony_ciactive pipeline, for both front and back faces. 1704e5c31af7Sopenharmony_ci 1705e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilCompareMask.adoc[] 1706e5c31af7Sopenharmony_ci-- 1707e5c31af7Sopenharmony_ci 1708e5c31af7Sopenharmony_ci[open,refpage='VkStencilFaceFlagBits',desc='Bitmask specifying sets of stencil state for which to update the compare mask',type='enums'] 1709e5c31af7Sopenharmony_ci-- 1710e5c31af7Sopenharmony_ciename:VkStencilFaceFlagBits values are: 1711e5c31af7Sopenharmony_ci 1712e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkStencilFaceFlagBits.adoc[] 1713e5c31af7Sopenharmony_ci 1714e5c31af7Sopenharmony_ci * ename:VK_STENCIL_FACE_FRONT_BIT specifies that only the front set of 1715e5c31af7Sopenharmony_ci stencil state is updated. 1716e5c31af7Sopenharmony_ci * ename:VK_STENCIL_FACE_BACK_BIT specifies that only the back set of 1717e5c31af7Sopenharmony_ci stencil state is updated. 1718e5c31af7Sopenharmony_ci * ename:VK_STENCIL_FACE_FRONT_AND_BACK is the combination of 1719e5c31af7Sopenharmony_ci ename:VK_STENCIL_FACE_FRONT_BIT and ename:VK_STENCIL_FACE_BACK_BIT, and 1720e5c31af7Sopenharmony_ci specifies that both sets of stencil state are updated. 1721e5c31af7Sopenharmony_ci 1722e5c31af7Sopenharmony_ciifdef::VKSC_VERSION_1_0[] 1723e5c31af7Sopenharmony_ciifdef::hidden[] 1724e5c31af7Sopenharmony_ci// tag::scremoved[] 1725e5c31af7Sopenharmony_ci * elink:VkStencilFaceFlagBits (deprecated alias) 1726e5c31af7Sopenharmony_ci ** etext:VK_STENCIL_FRONT_AND_BACK <<SCID-8>> 1727e5c31af7Sopenharmony_ci// end::scremoved[] 1728e5c31af7Sopenharmony_ciendif::hidden[] 1729e5c31af7Sopenharmony_ciendif::VKSC_VERSION_1_0[] 1730e5c31af7Sopenharmony_ci-- 1731e5c31af7Sopenharmony_ci 1732e5c31af7Sopenharmony_ci[open,refpage='VkStencilFaceFlags',desc='Bitmask of VkStencilFaceFlagBits',type='flags'] 1733e5c31af7Sopenharmony_ci-- 1734e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkStencilFaceFlags.adoc[] 1735e5c31af7Sopenharmony_ci 1736e5c31af7Sopenharmony_citname:VkStencilFaceFlags is a bitmask type for setting a mask of zero or 1737e5c31af7Sopenharmony_cimore elink:VkStencilFaceFlagBits. 1738e5c31af7Sopenharmony_ci-- 1739e5c31af7Sopenharmony_ci 1740e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilWriteMask',desc='Set stencil write mask dynamically for a command buffer',type='protos'] 1741e5c31af7Sopenharmony_ci-- 1742e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil write mask, 1743e5c31af7Sopenharmony_cicall: 1744e5c31af7Sopenharmony_ci 1745e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilWriteMask.adoc[] 1746e5c31af7Sopenharmony_ci 1747e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1748e5c31af7Sopenharmony_ci recorded. 1749e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1750e5c31af7Sopenharmony_ci the set of stencil state for which to update the write mask, as 1751e5c31af7Sopenharmony_ci described above for flink:vkCmdSetStencilCompareMask. 1752e5c31af7Sopenharmony_ci * pname:writeMask is the new value to use as the stencil write mask. 1753e5c31af7Sopenharmony_ci 1754e5c31af7Sopenharmony_ciThis command sets the stencil write mask for subsequent drawing commands 1755e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 1756e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1757e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_WRITE_MASK set in 1758e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1759e5c31af7Sopenharmony_ciOtherwise, this state is specified by the pname:writeMask value used to 1760e5c31af7Sopenharmony_cicreate the currently active pipeline, for both 1761e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:front and 1762e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:back faces. 1763e5c31af7Sopenharmony_ci 1764e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilWriteMask.adoc[] 1765e5c31af7Sopenharmony_ci-- 1766e5c31af7Sopenharmony_ci 1767e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilReference',desc='Set stencil reference value dynamically for a command buffer',type='protos'] 1768e5c31af7Sopenharmony_ci-- 1769e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil reference value, 1770e5c31af7Sopenharmony_cicall: 1771e5c31af7Sopenharmony_ci 1772e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilReference.adoc[] 1773e5c31af7Sopenharmony_ci 1774e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1775e5c31af7Sopenharmony_ci recorded. 1776e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1777e5c31af7Sopenharmony_ci the set of stencil state for which to update the reference value, as 1778e5c31af7Sopenharmony_ci described above for flink:vkCmdSetStencilCompareMask. 1779e5c31af7Sopenharmony_ci * pname:reference is the new value to use as the stencil reference value. 1780e5c31af7Sopenharmony_ci 1781e5c31af7Sopenharmony_ciThis command sets the stencil reference value for subsequent drawing 1782e5c31af7Sopenharmony_cicommands 1783e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[when drawing using <<shaders-objects, shader objects>>, or] 1784e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1785e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_REFERENCE set in 1786e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1787e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1788e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:reference value used to 1789e5c31af7Sopenharmony_cicreate the currently active pipeline, for both front and back faces. 1790e5c31af7Sopenharmony_ci 1791e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilReference.adoc[] 1792e5c31af7Sopenharmony_ci-- 1793e5c31af7Sopenharmony_ci 1794e5c31af7Sopenharmony_ci[open,refpage='VkStencilOp',desc='Stencil comparison function',type='enums'] 1795e5c31af7Sopenharmony_ci-- 1796e5c31af7Sopenharmony_ciPossible values of the pname:failOp, pname:passOp, and pname:depthFailOp 1797e5c31af7Sopenharmony_cimembers of slink:VkStencilOpState, specifying what happens to the stored 1798e5c31af7Sopenharmony_cistencil value if this or certain subsequent tests fail or pass, are: 1799e5c31af7Sopenharmony_ci 1800e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkStencilOp.adoc[] 1801e5c31af7Sopenharmony_ci 1802e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_KEEP keeps the current value. 1803e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_ZERO sets the value to 0. 1804e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_REPLACE sets the value to pname:reference. 1805e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_INCREMENT_AND_CLAMP increments the current value and 1806e5c31af7Sopenharmony_ci clamps to the maximum representable unsigned value. 1807e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_DECREMENT_AND_CLAMP decrements the current value and 1808e5c31af7Sopenharmony_ci clamps to 0. 1809e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_INVERT bitwise-inverts the current value. 1810e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_INCREMENT_AND_WRAP increments the current value and 1811e5c31af7Sopenharmony_ci wraps to 0 when the maximum value would have been exceeded. 1812e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_DECREMENT_AND_WRAP decrements the current value and 1813e5c31af7Sopenharmony_ci wraps to the maximum possible value when the value would go below 0. 1814e5c31af7Sopenharmony_ci 1815e5c31af7Sopenharmony_ciFor purposes of increment and decrement, the stencil bits are considered as 1816e5c31af7Sopenharmony_cian unsigned integer. 1817e5c31af7Sopenharmony_ci-- 1818e5c31af7Sopenharmony_ci 1819e5c31af7Sopenharmony_ci 1820e5c31af7Sopenharmony_ci[[fragops-depth]] 1821e5c31af7Sopenharmony_ci== Depth Test 1822e5c31af7Sopenharmony_ci 1823e5c31af7Sopenharmony_ciThe depth test compares the depth value [eq]#z~a~# in the depth/stencil 1824e5c31af7Sopenharmony_ciattachment at each sample's framebuffer coordinates [eq]#(x~f~,y~f~)# and 1825e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# against the 1826e5c31af7Sopenharmony_cisample's depth value [eq]#z~f~#. 1827e5c31af7Sopenharmony_ciIf there is no depth attachment then the depth test is skipped. 1828e5c31af7Sopenharmony_ci 1829e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 1830e5c31af7Sopenharmony_ciIf the render pass has a fragment density map attachment and the fragment 1831e5c31af7Sopenharmony_cicovers multiple pixels, there is an implementation-dependent association of 1832e5c31af7Sopenharmony_cirasterization samples to depth attachment samples within the fragment. 1833e5c31af7Sopenharmony_ciHowever, if all samples in the fragment are covered, and the depth 1834e5c31af7Sopenharmony_ciattachment value is updated as a result of this test, all depth attachment 1835e5c31af7Sopenharmony_cisamples will be updated. 1836e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 1837e5c31af7Sopenharmony_ci 1838e5c31af7Sopenharmony_ciThe depth test occurs in three stages, as detailed in the following 1839e5c31af7Sopenharmony_cisections. 1840e5c31af7Sopenharmony_ci 1841e5c31af7Sopenharmony_ci 1842e5c31af7Sopenharmony_ci=== Depth Clamping and Range Adjustment 1843e5c31af7Sopenharmony_ci 1844e5c31af7Sopenharmony_ciIf slink:VkPipelineRasterizationStateCreateInfo::pname:depthClampEnable is 1845e5c31af7Sopenharmony_cienabled, [eq]#z~f~# is clamped to [eq]#[z~min~, z~max~]#, where [eq]#z~min~ 1846e5c31af7Sopenharmony_ci= min(n,f)#, [eq]#z~max~ = max(n,f)]#, and [eq]#n# and [eq]#f# are the 1847e5c31af7Sopenharmony_cipname:minDepth and pname:maxDepth depth range values of the viewport used by 1848e5c31af7Sopenharmony_cithis fragment, respectively. 1849e5c31af7Sopenharmony_ci 1850e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_clamp_zero_one[] 1851e5c31af7Sopenharmony_ciIf 1852e5c31af7Sopenharmony_cislink:VkPhysicalDeviceDepthClampZeroOneFeaturesEXT::pname:depthClampZeroOne 1853e5c31af7Sopenharmony_ciis enabled: 1854e5c31af7Sopenharmony_ci 1855e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[] 1856e5c31af7Sopenharmony_ci * If the depth attachment has a floating-point format and 1857e5c31af7Sopenharmony_ci apiext:VK_EXT_depth_range_unrestricted is enabled then [eq]#z~f~# is 1858e5c31af7Sopenharmony_ci unchanged. 1859e5c31af7Sopenharmony_ci * Otherwise, [eq]#z~f~# is clamped to the range [eq]#[0, 1]#. 1860e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 1861e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_range_unrestricted[] 1862e5c31af7Sopenharmony_ci * [eq]#z~f~# is clamped to the range [eq]#[0, 1]#. 1863e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 1864e5c31af7Sopenharmony_ci 1865e5c31af7Sopenharmony_ciOtherwise: 1866e5c31af7Sopenharmony_ciendif::VK_EXT_depth_clamp_zero_one[] 1867e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_clamp_zero_one[] 1868e5c31af7Sopenharmony_ciFollowing depth clamping: 1869e5c31af7Sopenharmony_ciendif::VK_EXT_depth_clamp_zero_one[] 1870e5c31af7Sopenharmony_ci 1871e5c31af7Sopenharmony_ci * If [eq]#z~f~# is not in the range [eq]#[z~min~, z~max~]#, then 1872e5c31af7Sopenharmony_ci [eq]#z~f~# is undefined: following this step. 1873e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[] 1874e5c31af7Sopenharmony_ci * If the depth attachment has a fixed-point format and [eq]#z~f~# is not 1875e5c31af7Sopenharmony_ci in the range [eq]#[0, 1]#, then [eq]#z~f~# is undefined: following this 1876e5c31af7Sopenharmony_ci step. 1877e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 1878e5c31af7Sopenharmony_ci 1879e5c31af7Sopenharmony_ci 1880e5c31af7Sopenharmony_ci[[fragops-depth-comparison]] 1881e5c31af7Sopenharmony_ci=== Depth Comparison 1882e5c31af7Sopenharmony_ci 1883e5c31af7Sopenharmony_ciIf the depth test is not enabled, as specified by 1884e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1885e5c31af7Sopenharmony_ciflink:vkCmdSetDepthTestEnable or 1886e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1887e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthTestEnable, then 1888e5c31af7Sopenharmony_cithis step is skipped. 1889e5c31af7Sopenharmony_ci 1890e5c31af7Sopenharmony_ciThe comparison operation performed is determined by the elink:VkCompareOp 1891e5c31af7Sopenharmony_civalue set by 1892e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1893e5c31af7Sopenharmony_ciflink:vkCmdSetDepthCompareOp, or by 1894e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1895e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthCompareOp during 1896e5c31af7Sopenharmony_cipipeline creation. 1897e5c31af7Sopenharmony_ci[eq]#z~f~# and [eq]#z~a~# are used as the _reference_ and _test_ values, 1898e5c31af7Sopenharmony_cirespectively, in the operation specified by the elink:VkCompareOp. 1899e5c31af7Sopenharmony_ci 1900e5c31af7Sopenharmony_ciIf the comparison evaluates to false, the coverage for the sample is set to 1901e5c31af7Sopenharmony_ci`0`. 1902e5c31af7Sopenharmony_ci 1903e5c31af7Sopenharmony_ci 1904e5c31af7Sopenharmony_ci[[fragops-depth-write]] 1905e5c31af7Sopenharmony_ci=== Depth Attachment Writes 1906e5c31af7Sopenharmony_ci 1907e5c31af7Sopenharmony_ciIf depth writes are enabled, as specified by 1908e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1909e5c31af7Sopenharmony_ciflink:vkCmdSetDepthWriteEnable or 1910e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1911e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthWriteEnable, and the 1912e5c31af7Sopenharmony_cicomparison evaluated to true, the depth attachment value [eq]#z~a~# is set 1913e5c31af7Sopenharmony_cito the sample's depth value [eq]#z~f~#. 1914e5c31af7Sopenharmony_ciIf there is no depth attachment, no value is written. 1915e5c31af7Sopenharmony_ci 1916e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1917e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthTestEnable',desc='Set depth test enable dynamically for a command buffer',type='protos',alias='vkCmdSetDepthTestEnableEXT'] 1918e5c31af7Sopenharmony_ci-- 1919e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically enable or disable>> the depth 1920e5c31af7Sopenharmony_citest, call: 1921e5c31af7Sopenharmony_ci 1922e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 1923e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthTestEnable.adoc[] 1924e5c31af7Sopenharmony_ci 1925e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[or the equivalent command] 1926e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 1927e5c31af7Sopenharmony_ci 1928e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1929e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthTestEnableEXT.adoc[] 1930e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1931e5c31af7Sopenharmony_ci 1932e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1933e5c31af7Sopenharmony_ci recorded. 1934e5c31af7Sopenharmony_ci * pname:depthTestEnable specifies if the depth test is enabled. 1935e5c31af7Sopenharmony_ci 1936e5c31af7Sopenharmony_ciThis command sets the depth test enable for subsequent drawing commands 1937e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 1938e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>, or] 1939e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>.] 1940e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 1941e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1942e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1943e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE set in 1944e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1945e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1946e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1947e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthTestEnable value 1948e5c31af7Sopenharmony_ciused to create the currently active pipeline. 1949e5c31af7Sopenharmony_ci 1950e5c31af7Sopenharmony_ci:refpage: vkCmdSetDepthTestEnable 1951e5c31af7Sopenharmony_ci 1952e5c31af7Sopenharmony_ci.Valid Usage 1953e5c31af7Sopenharmony_ci**** 1954e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state_feature_common.adoc[] 1955e5c31af7Sopenharmony_ci**** 1956e5c31af7Sopenharmony_ci 1957e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthTestEnable.adoc[] 1958e5c31af7Sopenharmony_ci-- 1959e5c31af7Sopenharmony_ci 1960e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthCompareOp',desc='Set depth comparison operator dynamically for a command buffer',type='protos',alias='vkCmdSetDepthCompareOpEXT'] 1961e5c31af7Sopenharmony_ci-- 1962e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the depth compare operator, 1963e5c31af7Sopenharmony_cicall: 1964e5c31af7Sopenharmony_ci 1965e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 1966e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthCompareOp.adoc[] 1967e5c31af7Sopenharmony_ci 1968e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[or the equivalent command] 1969e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 1970e5c31af7Sopenharmony_ci 1971e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1972e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthCompareOpEXT.adoc[] 1973e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 1974e5c31af7Sopenharmony_ci 1975e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1976e5c31af7Sopenharmony_ci recorded. 1977e5c31af7Sopenharmony_ci * pname:depthCompareOp is a elink:VkCompareOp value specifying the 1978e5c31af7Sopenharmony_ci comparison operator used for the <<fragops-depth-comparison, Depth 1979e5c31af7Sopenharmony_ci Comparison>> step of the <<fragops-depth,depth test>>. 1980e5c31af7Sopenharmony_ci 1981e5c31af7Sopenharmony_ciThis command sets the depth comparison operator for subsequent drawing 1982e5c31af7Sopenharmony_cicommands 1983e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 1984e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>, or] 1985e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>.] 1986e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 1987e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1988e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1989e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_COMPARE_OP set in 1990e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1991e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 1992e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1993e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthCompareOp value used 1994e5c31af7Sopenharmony_cito create the currently active pipeline. 1995e5c31af7Sopenharmony_ci 1996e5c31af7Sopenharmony_ci:refpage: vkCmdSetDepthCompareOp 1997e5c31af7Sopenharmony_ci 1998e5c31af7Sopenharmony_ci.Valid Usage 1999e5c31af7Sopenharmony_ci**** 2000e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state_feature_common.adoc[] 2001e5c31af7Sopenharmony_ci**** 2002e5c31af7Sopenharmony_ci 2003e5c31af7Sopenharmony_ci 2004e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthCompareOp.adoc[] 2005e5c31af7Sopenharmony_ci-- 2006e5c31af7Sopenharmony_ci 2007e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthWriteEnable',desc='Set depth write enable dynamically for a command buffer',type='protos',alias='vkCmdSetDepthWriteEnableEXT'] 2008e5c31af7Sopenharmony_ci-- 2009e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the depth write enable, 2010e5c31af7Sopenharmony_cicall: 2011e5c31af7Sopenharmony_ci 2012e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 2013e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthWriteEnable.adoc[] 2014e5c31af7Sopenharmony_ci 2015e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[or the equivalent command] 2016e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 2017e5c31af7Sopenharmony_ci 2018e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 2019e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthWriteEnableEXT.adoc[] 2020e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 2021e5c31af7Sopenharmony_ci 2022e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2023e5c31af7Sopenharmony_ci recorded. 2024e5c31af7Sopenharmony_ci * pname:depthWriteEnable specifies if depth writes are enabled. 2025e5c31af7Sopenharmony_ci 2026e5c31af7Sopenharmony_ciThis command sets the depth write enable for subsequent drawing commands 2027e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2028e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>, or] 2029e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>.] 2030e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2031e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 2032e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 2033e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE set in 2034e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2035e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[] 2036e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2037e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthWriteEnable value 2038e5c31af7Sopenharmony_ciused to create the currently active pipeline. 2039e5c31af7Sopenharmony_ci 2040e5c31af7Sopenharmony_ci:refpage: vkCmdSetDepthWriteEnable 2041e5c31af7Sopenharmony_ci 2042e5c31af7Sopenharmony_ci.Valid Usage 2043e5c31af7Sopenharmony_ci**** 2044e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state_feature_common.adoc[] 2045e5c31af7Sopenharmony_ci**** 2046e5c31af7Sopenharmony_ci 2047e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthWriteEnable.adoc[] 2048e5c31af7Sopenharmony_ci-- 2049e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[] 2050e5c31af7Sopenharmony_ci 2051e5c31af7Sopenharmony_ci 2052e5c31af7Sopenharmony_ciifdef::VK_NV_representative_fragment_test[] 2053e5c31af7Sopenharmony_ci[[fragops-rep-frag-test]] 2054e5c31af7Sopenharmony_ci== Representative Fragment Test 2055e5c31af7Sopenharmony_ci 2056e5c31af7Sopenharmony_ciThe representative fragment test allows implementations to reduce the amount 2057e5c31af7Sopenharmony_ciof rasterization and fragment processing work performed for each point, 2058e5c31af7Sopenharmony_ciline, or triangle primitive. 2059e5c31af7Sopenharmony_ciFor any primitive that produces one or more fragments that pass all prior 2060e5c31af7Sopenharmony_ciearly fragment tests, the implementation may: choose one or more 2061e5c31af7Sopenharmony_ci"`representative`" fragments for processing and discard all other fragments. 2062e5c31af7Sopenharmony_ciFor draw calls rendering multiple points, lines, or triangles arranged in 2063e5c31af7Sopenharmony_cilists, strips, or fans, the representative fragment test is performed 2064e5c31af7Sopenharmony_ciindependently for each of those primitives. 2065e5c31af7Sopenharmony_ciThe set of fragments discarded by the representative fragment test is 2066e5c31af7Sopenharmony_ciimplementation-dependent. 2067e5c31af7Sopenharmony_ciIn some cases, the representative fragment test may not discard any 2068e5c31af7Sopenharmony_cifragments for a given primitive. 2069e5c31af7Sopenharmony_ci 2070e5c31af7Sopenharmony_ci[open,refpage='VkPipelineRepresentativeFragmentTestStateCreateInfoNV',desc='Structure specifying representative fragment test',type='structs'] 2071e5c31af7Sopenharmony_ci-- 2072e5c31af7Sopenharmony_ciIf the pname:pNext chain of slink:VkGraphicsPipelineCreateInfo includes a 2073e5c31af7Sopenharmony_cisname:VkPipelineRepresentativeFragmentTestStateCreateInfoNV structure, then 2074e5c31af7Sopenharmony_cithat structure includes parameters controlling the representative fragment 2075e5c31af7Sopenharmony_citest. 2076e5c31af7Sopenharmony_ci 2077e5c31af7Sopenharmony_ciThe sname:VkPipelineRepresentativeFragmentTestStateCreateInfoNV structure is 2078e5c31af7Sopenharmony_cidefined as: 2079e5c31af7Sopenharmony_ci 2080e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineRepresentativeFragmentTestStateCreateInfoNV.adoc[] 2081e5c31af7Sopenharmony_ci 2082e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2083e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2084e5c31af7Sopenharmony_ci structure. 2085e5c31af7Sopenharmony_ci * pname:representativeFragmentTestEnable controls whether the 2086e5c31af7Sopenharmony_ci representative fragment test is enabled. 2087e5c31af7Sopenharmony_ci 2088e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, 2089e5c31af7Sopenharmony_cipname:representativeFragmentTestEnable is considered to be ename:VK_FALSE, 2090e5c31af7Sopenharmony_ciand the representative fragment test is disabled. 2091e5c31af7Sopenharmony_ci 2092e5c31af7Sopenharmony_ciIf the active fragment shader does not specify the code:EarlyFragmentTests 2093e5c31af7Sopenharmony_ciexecution mode, the representative fragment shader test has no effect, even 2094e5c31af7Sopenharmony_ciif enabled. 2095e5c31af7Sopenharmony_ci 2096e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineRepresentativeFragmentTestStateCreateInfoNV.adoc[] 2097e5c31af7Sopenharmony_ci-- 2098e5c31af7Sopenharmony_ci 2099e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2100e5c31af7Sopenharmony_ci 2101e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetRepresentativeFragmentTestEnableNV',desc='Specify the representative fragment test enable dynamically for a command buffer',type='protos'] 2102e5c31af7Sopenharmony_ci-- 2103e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 2104e5c31af7Sopenharmony_cipname:representativeFragmentTestEnable state, call: 2105e5c31af7Sopenharmony_ci 2106e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetRepresentativeFragmentTestEnableNV.adoc[] 2107e5c31af7Sopenharmony_ci 2108e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2109e5c31af7Sopenharmony_ci recorded. 2110e5c31af7Sopenharmony_ci * pname:representativeFragmentTestEnable specifies the 2111e5c31af7Sopenharmony_ci pname:representativeFragmentTestEnable state. 2112e5c31af7Sopenharmony_ci 2113e5c31af7Sopenharmony_ciThis command sets the pname:representativeFragmentTestEnable state for 2114e5c31af7Sopenharmony_cisubsequent drawing commands 2115e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2116e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 2117e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 2118e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2119e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 2120e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 2121e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV set in 2122e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2123e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 2124e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2125e5c31af7Sopenharmony_cislink:VkPipelineRepresentativeFragmentTestStateCreateInfoNV::pname:representativeFragmentTestEnable 2126e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 2127e5c31af7Sopenharmony_ci 2128e5c31af7Sopenharmony_ci:refpage: vkCmdSetRepresentativeFragmentTestEnableNV 2129e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3RepresentativeFragmentTestEnable 2130e5c31af7Sopenharmony_ci 2131e5c31af7Sopenharmony_ci.Valid Usage 2132e5c31af7Sopenharmony_ci**** 2133e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 2134e5c31af7Sopenharmony_ci**** 2135e5c31af7Sopenharmony_ci 2136e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetRepresentativeFragmentTestEnableNV.adoc[] 2137e5c31af7Sopenharmony_ci-- 2138e5c31af7Sopenharmony_ci 2139e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2140e5c31af7Sopenharmony_ci 2141e5c31af7Sopenharmony_ciendif::VK_NV_representative_fragment_test[] 2142e5c31af7Sopenharmony_ci 2143e5c31af7Sopenharmony_ci 2144e5c31af7Sopenharmony_ci[[fragops-samplecount]] 2145e5c31af7Sopenharmony_ci== Sample Counting 2146e5c31af7Sopenharmony_ci 2147e5c31af7Sopenharmony_ciOcclusion queries use query pool entries to track the number of samples that 2148e5c31af7Sopenharmony_cipass all the per-fragment tests. 2149e5c31af7Sopenharmony_ciThe mechanism of collecting an occlusion query value is described in 2150e5c31af7Sopenharmony_ci<<queries-occlusion,Occlusion Queries>>. 2151e5c31af7Sopenharmony_ci 2152e5c31af7Sopenharmony_ciThe occlusion query sample counter increments by one for each sample with a 2153e5c31af7Sopenharmony_cicoverage value of 1 in each fragment that survives all the per-fragment 2154e5c31af7Sopenharmony_citests, including scissor, 2155e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 2156e5c31af7Sopenharmony_ciexclusive scissor, 2157e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 2158e5c31af7Sopenharmony_cisample mask, alpha to coverage, stencil, and depth tests. 2159e5c31af7Sopenharmony_ci 2160e5c31af7Sopenharmony_ci 2161e5c31af7Sopenharmony_ciifdef::VK_NV_fragment_coverage_to_color[] 2162e5c31af7Sopenharmony_ci[[fragops-coverage-to-color]] 2163e5c31af7Sopenharmony_ci== Fragment Coverage to Color 2164e5c31af7Sopenharmony_ci 2165e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageToColorStateCreateInfoNV',desc='Structure specifying whether fragment coverage replaces a color',type='structs'] 2166e5c31af7Sopenharmony_ci-- 2167e5c31af7Sopenharmony_ciThe sname:VkPipelineCoverageToColorStateCreateInfoNV structure is defined 2168e5c31af7Sopenharmony_cias: 2169e5c31af7Sopenharmony_ci 2170e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineCoverageToColorStateCreateInfoNV.adoc[] 2171e5c31af7Sopenharmony_ci 2172e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2173e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2174e5c31af7Sopenharmony_ci structure. 2175e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 2176e5c31af7Sopenharmony_ci * pname:coverageToColorEnable controls whether the fragment coverage value 2177e5c31af7Sopenharmony_ci replaces a fragment color output. 2178e5c31af7Sopenharmony_ci * pname:coverageToColorLocation controls which fragment shader color 2179e5c31af7Sopenharmony_ci output value is replaced. 2180e5c31af7Sopenharmony_ci 2181e5c31af7Sopenharmony_ciIf the pname:pNext chain of slink:VkPipelineMultisampleStateCreateInfo 2182e5c31af7Sopenharmony_ciincludes a sname:VkPipelineCoverageToColorStateCreateInfoNV structure, then 2183e5c31af7Sopenharmony_cithat structure controls whether the fragment coverage is substituted for a 2184e5c31af7Sopenharmony_cifragment color output and, if so, which output is replaced. 2185e5c31af7Sopenharmony_ci 2186e5c31af7Sopenharmony_ciIf pname:coverageToColorEnable is ename:VK_TRUE, the 2187e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, coverage mask>> replaces the first 2188e5c31af7Sopenharmony_cicomponent of the color value corresponding to the fragment shader output 2189e5c31af7Sopenharmony_cilocation with code:Location equal to pname:coverageToColorLocation and 2190e5c31af7Sopenharmony_cicode:Index equal to zero. 2191e5c31af7Sopenharmony_ciIf the color attachment format has fewer bits than the coverage mask, the 2192e5c31af7Sopenharmony_cilow bits of the sample coverage mask are taken without any clamping. 2193e5c31af7Sopenharmony_ciIf the color attachment format has more bits than the coverage mask, the 2194e5c31af7Sopenharmony_cihigh bits of the sample coverage mask are filled with zeros. 2195e5c31af7Sopenharmony_ci 2196e5c31af7Sopenharmony_ciIf pname:coverageToColorEnable is ename:VK_FALSE, these operations are 2197e5c31af7Sopenharmony_ciskipped. 2198e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is as if 2199e5c31af7Sopenharmony_cipname:coverageToColorEnable is ename:VK_FALSE. 2200e5c31af7Sopenharmony_ci 2201e5c31af7Sopenharmony_ci.Valid Usage 2202e5c31af7Sopenharmony_ci**** 2203e5c31af7Sopenharmony_ci * [[VUID-VkPipelineCoverageToColorStateCreateInfoNV-coverageToColorEnable-01404]] 2204e5c31af7Sopenharmony_ci If pname:coverageToColorEnable is ename:VK_TRUE, then the render pass 2205e5c31af7Sopenharmony_ci subpass indicated by 2206e5c31af7Sopenharmony_ci slink:VkGraphicsPipelineCreateInfo::pname:renderPass and 2207e5c31af7Sopenharmony_ci slink:VkGraphicsPipelineCreateInfo::pname:subpass must: have a color 2208e5c31af7Sopenharmony_ci attachment at the location selected by pname:coverageToColorLocation, 2209e5c31af7Sopenharmony_ci with a elink:VkFormat of ename:VK_FORMAT_R8_UINT, 2210e5c31af7Sopenharmony_ci ename:VK_FORMAT_R8_SINT, ename:VK_FORMAT_R16_UINT, 2211e5c31af7Sopenharmony_ci ename:VK_FORMAT_R16_SINT, ename:VK_FORMAT_R32_UINT, or 2212e5c31af7Sopenharmony_ci ename:VK_FORMAT_R32_SINT 2213e5c31af7Sopenharmony_ci**** 2214e5c31af7Sopenharmony_ci 2215e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineCoverageToColorStateCreateInfoNV.adoc[] 2216e5c31af7Sopenharmony_ci-- 2217e5c31af7Sopenharmony_ci 2218e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageToColorStateCreateFlagsNV',desc='Reserved for future use',type='flags'] 2219e5c31af7Sopenharmony_ci-- 2220e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineCoverageToColorStateCreateFlagsNV.adoc[] 2221e5c31af7Sopenharmony_ci 2222e5c31af7Sopenharmony_citname:VkPipelineCoverageToColorStateCreateFlagsNV is a bitmask type for 2223e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 2224e5c31af7Sopenharmony_ci-- 2225e5c31af7Sopenharmony_ci 2226e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2227e5c31af7Sopenharmony_ci 2228e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetCoverageToColorEnableNV',desc='Specify the coverage to color enable state dynamically for a command buffer',type='protos'] 2229e5c31af7Sopenharmony_ci-- 2230e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 2231e5c31af7Sopenharmony_cipname:coverageToColorEnable state, call: 2232e5c31af7Sopenharmony_ci 2233e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetCoverageToColorEnableNV.adoc[] 2234e5c31af7Sopenharmony_ci 2235e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2236e5c31af7Sopenharmony_ci recorded. 2237e5c31af7Sopenharmony_ci * pname:coverageToColorEnable specifies the pname:coverageToColorEnable 2238e5c31af7Sopenharmony_ci state. 2239e5c31af7Sopenharmony_ci 2240e5c31af7Sopenharmony_ciThis command sets the pname:coverageToColorEnable state for subsequent 2241e5c31af7Sopenharmony_cidrawing commands 2242e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2243e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 2244e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 2245e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2246e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 2247e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 2248e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_ENABLE_NV set in 2249e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2250e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 2251e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2252e5c31af7Sopenharmony_cislink:VkPipelineCoverageToColorStateCreateInfoNV::pname:coverageToColorEnable 2253e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 2254e5c31af7Sopenharmony_ci 2255e5c31af7Sopenharmony_ci:refpage: vkCmdSetCoverageToColorEnableNV 2256e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3CoverageToColorEnable 2257e5c31af7Sopenharmony_ci 2258e5c31af7Sopenharmony_ci.Valid Usage 2259e5c31af7Sopenharmony_ci**** 2260e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 2261e5c31af7Sopenharmony_ci**** 2262e5c31af7Sopenharmony_ci 2263e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetCoverageToColorEnableNV.adoc[] 2264e5c31af7Sopenharmony_ci-- 2265e5c31af7Sopenharmony_ci 2266e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetCoverageToColorLocationNV',desc='Specify the coverage to color location dynamically for a command buffer',type='protos'] 2267e5c31af7Sopenharmony_ci-- 2268e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 2269e5c31af7Sopenharmony_cipname:coverageToColorLocation state, call: 2270e5c31af7Sopenharmony_ci 2271e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetCoverageToColorLocationNV.adoc[] 2272e5c31af7Sopenharmony_ci 2273e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2274e5c31af7Sopenharmony_ci recorded. 2275e5c31af7Sopenharmony_ci * pname:coverageToColorLocation specifies the 2276e5c31af7Sopenharmony_ci pname:coverageToColorLocation state. 2277e5c31af7Sopenharmony_ci 2278e5c31af7Sopenharmony_ciThis command sets the pname:coverageToColorLocation state for subsequent 2279e5c31af7Sopenharmony_cidrawing commands 2280e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2281e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 2282e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 2283e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2284e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 2285e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 2286e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_LOCATION_NV set in 2287e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2288e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 2289e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2290e5c31af7Sopenharmony_cislink:VkPipelineCoverageToColorStateCreateInfoNV::pname:coverageToColorLocation 2291e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 2292e5c31af7Sopenharmony_ci 2293e5c31af7Sopenharmony_ci:refpage: vkCmdSetCoverageToColorLocationNV 2294e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3CoverageToColorLocation 2295e5c31af7Sopenharmony_ci 2296e5c31af7Sopenharmony_ci.Valid Usage 2297e5c31af7Sopenharmony_ci**** 2298e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 2299e5c31af7Sopenharmony_ci**** 2300e5c31af7Sopenharmony_ci 2301e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetCoverageToColorLocationNV.adoc[] 2302e5c31af7Sopenharmony_ci-- 2303e5c31af7Sopenharmony_ci 2304e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2305e5c31af7Sopenharmony_ci 2306e5c31af7Sopenharmony_ciendif::VK_NV_fragment_coverage_to_color[] 2307e5c31af7Sopenharmony_ci 2308e5c31af7Sopenharmony_ci 2309e5c31af7Sopenharmony_ci[[fragops-coverage-reduction]] 2310e5c31af7Sopenharmony_ci== Coverage Reduction 2311e5c31af7Sopenharmony_ci 2312e5c31af7Sopenharmony_ciCoverage reduction takes the coverage information for a fragment and 2313e5c31af7Sopenharmony_ciconverts that to a boolean coverage value for each color sample in each 2314e5c31af7Sopenharmony_cipixel covered by the fragment. 2315e5c31af7Sopenharmony_ci 2316e5c31af7Sopenharmony_ci 2317e5c31af7Sopenharmony_ci=== Pixel Coverage 2318e5c31af7Sopenharmony_ci 2319e5c31af7Sopenharmony_ciCoverage for each pixel is first extracted from the total fragment coverage 2320e5c31af7Sopenharmony_cimask. 2321e5c31af7Sopenharmony_ciThis consists of pname:rasterizationSamples unique coverage samples for each 2322e5c31af7Sopenharmony_cipixel in the fragment area, each with a unique 2323e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>>. 2324e5c31af7Sopenharmony_ciIf the fragment only contains a single pixel, coverage for the pixel is 2325e5c31af7Sopenharmony_ciequivalent to the fragment coverage. 2326e5c31af7Sopenharmony_ci 2327e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 2328e5c31af7Sopenharmony_ciIf the render pass has a fragment density map attachment and the fragment 2329e5c31af7Sopenharmony_cicovers multiple pixels, pixel coverage is generated in an 2330e5c31af7Sopenharmony_ciimplementation-dependent manner. 2331e5c31af7Sopenharmony_ciIf all samples in the fragment are covered, all samples will be covered in 2332e5c31af7Sopenharmony_cieach pixel coverage. 2333e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 2334e5c31af7Sopenharmony_ci 2335e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 2336e5c31af7Sopenharmony_ciIf a <<primsrast-shading-rate-image,shading rate image>> is used, and the 2337e5c31af7Sopenharmony_cifragment covers multiple pixels, each pixel's coverage consists of the 2338e5c31af7Sopenharmony_cicoverage samples corresponding to that pixel, and each sample retains its 2339e5c31af7Sopenharmony_ciunique <<primsrast-multisampling-coverage-mask, sample index [eq]#i#>>. 2340e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 2341e5c31af7Sopenharmony_ci 2342e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 2343e5c31af7Sopenharmony_ciIf the <<primsrast-fragment-shading-rate, fragment shading rate>> is set, 2344e5c31af7Sopenharmony_ciand the fragment covers multiple pixels, each pixel's coverage consists of 2345e5c31af7Sopenharmony_cithe coverage samples with a <<primsrast-multisampling-coverage-mask-vrfs, 2346e5c31af7Sopenharmony_cipixel index>> matching that pixel, and each sample retains its unique 2347e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index [eq]#i#>>. 2348e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 2349e5c31af7Sopenharmony_ci 2350e5c31af7Sopenharmony_ci 2351e5c31af7Sopenharmony_ci=== Color Sample Coverage 2352e5c31af7Sopenharmony_ci 2353e5c31af7Sopenharmony_ciOnce pixel coverage is determined, coverage for each individual color sample 2354e5c31af7Sopenharmony_cicorresponding to that pixel is determined. 2355e5c31af7Sopenharmony_ci 2356e5c31af7Sopenharmony_ciifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[If the] 2357e5c31af7Sopenharmony_ciifndef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[The] 2358e5c31af7Sopenharmony_cinumber of pname:rasterizationSamples is identical to the number of samples 2359e5c31af7Sopenharmony_ciin the color 2360e5c31af7Sopenharmony_ciifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[attachments, a] 2361e5c31af7Sopenharmony_ciifndef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[attachments. A] 2362e5c31af7Sopenharmony_cicolor sample is covered if the pixel coverage sample with the same 2363e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# is covered. 2364e5c31af7Sopenharmony_ci 2365e5c31af7Sopenharmony_ciifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[] 2366e5c31af7Sopenharmony_ciOtherwise, the coverage for each color sample is computed from the pixel 2367e5c31af7Sopenharmony_cicoverage as follows. 2368e5c31af7Sopenharmony_ciendif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[] 2369e5c31af7Sopenharmony_ci 2370e5c31af7Sopenharmony_ciifdef::VK_AMD_mixed_attachment_samples[] 2371e5c31af7Sopenharmony_ciIf the `apiext:VK_AMD_mixed_attachment_samples` extension is enabled, for 2372e5c31af7Sopenharmony_cicolor samples present in the color attachments, a color sample is covered if 2373e5c31af7Sopenharmony_cithe pixel coverage sample with the same 2374e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# is covered; 2375e5c31af7Sopenharmony_ciadditional pixel coverage samples are discarded. 2376e5c31af7Sopenharmony_ciendif::VK_AMD_mixed_attachment_samples[] 2377e5c31af7Sopenharmony_ci 2378e5c31af7Sopenharmony_ciifdef::VK_EXT_multisampled_render_to_single_sampled[] 2379e5c31af7Sopenharmony_ciIf the pname:pNext chain of slink:VkSubpassDescription2 2380e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[or slink:VkRenderingInfo] 2381e5c31af7Sopenharmony_ciincludes a slink:VkMultisampledRenderToSingleSampledInfoEXT structure with 2382e5c31af7Sopenharmony_cithe pname:multisampledRenderToSingleSampledEnable field equal to 2383e5c31af7Sopenharmony_ciename:VK_TRUE, sample coverage is calculated as if the attachment has 2384e5c31af7Sopenharmony_cislink:VkMultisampledRenderToSingleSampledInfoEXT::pname:rasterizationSamples 2385e5c31af7Sopenharmony_cisamples. 2386e5c31af7Sopenharmony_ciendif::VK_EXT_multisampled_render_to_single_sampled[] 2387e5c31af7Sopenharmony_ci 2388e5c31af7Sopenharmony_ciifdef::VK_NV_framebuffer_mixed_samples[] 2389e5c31af7Sopenharmony_ci 2390e5c31af7Sopenharmony_ciifndef::VK_NV_coverage_reduction_mode[] 2391e5c31af7Sopenharmony_ciWhen the `apiext:VK_NV_framebuffer_mixed_samples` extension is enabled, if 2392e5c31af7Sopenharmony_cithe pipeline's 2393e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples is 2394e5c31af7Sopenharmony_cigreater than the slink:VkAttachmentDescription::pname:samples of the color 2395e5c31af7Sopenharmony_ciattachments in the subpass, each color sample will be associated with an 2396e5c31af7Sopenharmony_ciimplementation-dependent subset of samples in the pixel coverage. 2397e5c31af7Sopenharmony_ciIf any of those associated samples are covered, the color sample is covered. 2398e5c31af7Sopenharmony_ciendif::VK_NV_coverage_reduction_mode[] 2399e5c31af7Sopenharmony_ci 2400e5c31af7Sopenharmony_ciifdef::VK_NV_coverage_reduction_mode[] 2401e5c31af7Sopenharmony_ciWhen the `apiext:VK_NV_coverage_reduction_mode` extension is enabled, the 2402e5c31af7Sopenharmony_cipipeline state controlling coverage reduction is specified through the 2403e5c31af7Sopenharmony_cimembers of the sname:VkPipelineCoverageReductionStateCreateInfoNV structure. 2404e5c31af7Sopenharmony_ci 2405e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageReductionStateCreateInfoNV',desc='Structure specifying parameters controlling coverage reduction',type='structs'] 2406e5c31af7Sopenharmony_ci-- 2407e5c31af7Sopenharmony_ciThe sname:VkPipelineCoverageReductionStateCreateInfoNV structure is defined 2408e5c31af7Sopenharmony_cias: 2409e5c31af7Sopenharmony_ci 2410e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineCoverageReductionStateCreateInfoNV.adoc[] 2411e5c31af7Sopenharmony_ci 2412e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2413e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2414e5c31af7Sopenharmony_ci structure. 2415e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 2416e5c31af7Sopenharmony_ci * pname:coverageReductionMode is a elink:VkCoverageReductionModeNV value 2417e5c31af7Sopenharmony_ci controlling how color sample coverage is generated from pixel coverage. 2418e5c31af7Sopenharmony_ci 2419e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, or if the 2420e5c31af7Sopenharmony_ciextension is not enabled, the default coverage reduction mode is inferred as 2421e5c31af7Sopenharmony_cifollows: 2422e5c31af7Sopenharmony_ci 2423e5c31af7Sopenharmony_ci * If the `apiext:VK_NV_framebuffer_mixed_samples` extension is enabled, 2424e5c31af7Sopenharmony_ci then it is as if the pname:coverageReductionMode is 2425e5c31af7Sopenharmony_ci ename:VK_COVERAGE_REDUCTION_MODE_MERGE_NV. 2426e5c31af7Sopenharmony_ci * If the `apiext:VK_AMD_mixed_attachment_samples` extension is enabled, 2427e5c31af7Sopenharmony_ci then it is as if the pname:coverageReductionMode is 2428e5c31af7Sopenharmony_ci ename:VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV. 2429e5c31af7Sopenharmony_ci * If both `apiext:VK_NV_framebuffer_mixed_samples` and 2430e5c31af7Sopenharmony_ci `apiext:VK_AMD_mixed_attachment_samples` are enabled, then the default 2431e5c31af7Sopenharmony_ci coverage reduction mode is implementation-dependent. 2432e5c31af7Sopenharmony_ci 2433e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineCoverageReductionStateCreateInfoNV.adoc[] 2434e5c31af7Sopenharmony_ci-- 2435e5c31af7Sopenharmony_ci 2436e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageReductionStateCreateFlagsNV',desc='Reserved for future use',type='flags'] 2437e5c31af7Sopenharmony_ci-- 2438e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineCoverageReductionStateCreateFlagsNV.adoc[] 2439e5c31af7Sopenharmony_ci 2440e5c31af7Sopenharmony_citname:VkPipelineCoverageReductionStateCreateFlagsNV is a bitmask type for 2441e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 2442e5c31af7Sopenharmony_ci-- 2443e5c31af7Sopenharmony_ci 2444e5c31af7Sopenharmony_ci[open,refpage='VkCoverageReductionModeNV',desc='Specify the coverage reduction mode',type='enums'] 2445e5c31af7Sopenharmony_ci-- 2446e5c31af7Sopenharmony_ciPossible values of 2447e5c31af7Sopenharmony_cislink:VkPipelineCoverageReductionStateCreateInfoNV::pname:coverageReductionMode, 2448e5c31af7Sopenharmony_cispecifying how color sample coverage is generated from pixel coverage, are: 2449e5c31af7Sopenharmony_ci 2450e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCoverageReductionModeNV.adoc[] 2451e5c31af7Sopenharmony_ci 2452e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_REDUCTION_MODE_MERGE_NV specifies that each color 2453e5c31af7Sopenharmony_ci sample will be associated with an implementation-dependent subset of 2454e5c31af7Sopenharmony_ci samples in the pixel coverage. 2455e5c31af7Sopenharmony_ci If any of those associated samples are covered, the color sample is 2456e5c31af7Sopenharmony_ci covered. 2457e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV specifies that for color 2458e5c31af7Sopenharmony_ci samples present in the color attachments, a color sample is covered if 2459e5c31af7Sopenharmony_ci the pixel coverage sample with the same 2460e5c31af7Sopenharmony_ci <<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# is 2461e5c31af7Sopenharmony_ci covered; other pixel coverage samples are discarded. 2462e5c31af7Sopenharmony_ci-- 2463e5c31af7Sopenharmony_ci 2464e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2465e5c31af7Sopenharmony_ci 2466e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetCoverageReductionModeNV',desc='Specify the coverage reduction mode dynamically for a command buffer',type='protos'] 2467e5c31af7Sopenharmony_ci-- 2468e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 2469e5c31af7Sopenharmony_cipname:coverageReductionMode state, call: 2470e5c31af7Sopenharmony_ci 2471e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetCoverageReductionModeNV.adoc[] 2472e5c31af7Sopenharmony_ci 2473e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2474e5c31af7Sopenharmony_ci recorded. 2475e5c31af7Sopenharmony_ci * pname:coverageReductionMode specifies the pname:coverageReductionMode 2476e5c31af7Sopenharmony_ci state. 2477e5c31af7Sopenharmony_ci 2478e5c31af7Sopenharmony_ciThis command sets the pname:coverageReductionMode state for subsequent 2479e5c31af7Sopenharmony_cidrawing commands 2480e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2481e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 2482e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 2483e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2484e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 2485e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 2486e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COVERAGE_REDUCTION_MODE_NV set in 2487e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2488e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 2489e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2490e5c31af7Sopenharmony_cislink:VkPipelineCoverageReductionStateCreateInfoNV::pname:coverageReductionMode 2491e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 2492e5c31af7Sopenharmony_ci 2493e5c31af7Sopenharmony_ci:refpage: vkCmdSetCoverageReductionModeNV 2494e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3CoverageReductionMode 2495e5c31af7Sopenharmony_ci 2496e5c31af7Sopenharmony_ci.Valid Usage 2497e5c31af7Sopenharmony_ci**** 2498e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 2499e5c31af7Sopenharmony_ci**** 2500e5c31af7Sopenharmony_ci 2501e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetCoverageReductionModeNV.adoc[] 2502e5c31af7Sopenharmony_ci-- 2503e5c31af7Sopenharmony_ci 2504e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2505e5c31af7Sopenharmony_ci 2506e5c31af7Sopenharmony_ci[open,refpage='vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV',desc='Query supported sample count combinations',type='protos'] 2507e5c31af7Sopenharmony_ci-- 2508e5c31af7Sopenharmony_ciTo query the set of mixed sample combinations of coverage reduction mode, 2509e5c31af7Sopenharmony_cirasterization samples and color, depth, stencil attachment sample counts 2510e5c31af7Sopenharmony_cithat are supported by a physical device, call: 2511e5c31af7Sopenharmony_ci 2512e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.adoc[] 2513e5c31af7Sopenharmony_ci 2514e5c31af7Sopenharmony_ci * pname:physicalDevice is the physical device from which to query the set 2515e5c31af7Sopenharmony_ci of combinations. 2516e5c31af7Sopenharmony_ci * pname:pCombinationCount is a pointer to an integer related to the number 2517e5c31af7Sopenharmony_ci of combinations available or queried, as described below. 2518e5c31af7Sopenharmony_ci * pname:pCombinations is either `NULL` or a pointer to an array of 2519e5c31af7Sopenharmony_ci slink:VkFramebufferMixedSamplesCombinationNV values, indicating the 2520e5c31af7Sopenharmony_ci supported combinations of coverage reduction mode, rasterization 2521e5c31af7Sopenharmony_ci samples, and color, depth, stencil attachment sample counts. 2522e5c31af7Sopenharmony_ci 2523e5c31af7Sopenharmony_ciIf pname:pCombinations is `NULL`, then the number of supported combinations 2524e5c31af7Sopenharmony_cifor the given pname:physicalDevice is returned in pname:pCombinationCount. 2525e5c31af7Sopenharmony_ciOtherwise, pname:pCombinationCount must: point to a variable set by the user 2526e5c31af7Sopenharmony_cito the number of elements in the pname:pCombinations array, and on return 2527e5c31af7Sopenharmony_cithe variable is overwritten with the number of values actually written to 2528e5c31af7Sopenharmony_cipname:pCombinations. 2529e5c31af7Sopenharmony_ciIf the value of pname:pCombinationCount is less than the number of 2530e5c31af7Sopenharmony_cicombinations supported for the given pname:physicalDevice, at most 2531e5c31af7Sopenharmony_cipname:pCombinationCount values will be written to pname:pCombinations, and 2532e5c31af7Sopenharmony_ciename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to 2533e5c31af7Sopenharmony_ciindicate that not all the supported values were returned. 2534e5c31af7Sopenharmony_ci 2535e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.adoc[] 2536e5c31af7Sopenharmony_ci-- 2537e5c31af7Sopenharmony_ci 2538e5c31af7Sopenharmony_ci[open,refpage='VkFramebufferMixedSamplesCombinationNV',desc='Structure specifying a supported sample count combination',type='structs'] 2539e5c31af7Sopenharmony_ci-- 2540e5c31af7Sopenharmony_ciThe sname:VkFramebufferMixedSamplesCombinationNV structure is defined as: 2541e5c31af7Sopenharmony_ci 2542e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkFramebufferMixedSamplesCombinationNV.adoc[] 2543e5c31af7Sopenharmony_ci 2544e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2545e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2546e5c31af7Sopenharmony_ci structure. 2547e5c31af7Sopenharmony_ci * pname:coverageReductionMode is a elink:VkCoverageReductionModeNV value 2548e5c31af7Sopenharmony_ci specifying the coverage reduction mode. 2549e5c31af7Sopenharmony_ci * pname:rasterizationSamples is a elink:VkSampleCountFlagBits specifying 2550e5c31af7Sopenharmony_ci the number of rasterization samples in the supported combination. 2551e5c31af7Sopenharmony_ci * pname:depthStencilSamples specifies the number of samples in the depth 2552e5c31af7Sopenharmony_ci stencil attachment in the supported combination. 2553e5c31af7Sopenharmony_ci A value of 0 indicates the combination does not have a depth stencil 2554e5c31af7Sopenharmony_ci attachment. 2555e5c31af7Sopenharmony_ci * pname:colorSamples specifies the number of color samples in a color 2556e5c31af7Sopenharmony_ci attachment in the supported combination. 2557e5c31af7Sopenharmony_ci A value of 0 indicates the combination does not have a color attachment. 2558e5c31af7Sopenharmony_ci 2559e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkFramebufferMixedSamplesCombinationNV.adoc[] 2560e5c31af7Sopenharmony_ci-- 2561e5c31af7Sopenharmony_ciendif::VK_NV_coverage_reduction_mode[] 2562e5c31af7Sopenharmony_ci 2563e5c31af7Sopenharmony_ci 2564e5c31af7Sopenharmony_ci[[fragops-coverage-modulation]] 2565e5c31af7Sopenharmony_ci=== Coverage Modulation 2566e5c31af7Sopenharmony_ci 2567e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageModulationStateCreateInfoNV',desc='Structure specifying parameters controlling coverage modulation',type='structs'] 2568e5c31af7Sopenharmony_ci-- 2569e5c31af7Sopenharmony_ciAs part of coverage reduction, fragment color values can: also be modulated 2570e5c31af7Sopenharmony_ci(multiplied) by a value that is a function of fraction of covered 2571e5c31af7Sopenharmony_cirasterization samples associated with that color sample. 2572e5c31af7Sopenharmony_ci 2573e5c31af7Sopenharmony_ciPipeline state controlling coverage modulation is specified through the 2574e5c31af7Sopenharmony_cimembers of the sname:VkPipelineCoverageModulationStateCreateInfoNV 2575e5c31af7Sopenharmony_cistructure. 2576e5c31af7Sopenharmony_ci 2577e5c31af7Sopenharmony_ciThe sname:VkPipelineCoverageModulationStateCreateInfoNV structure is defined 2578e5c31af7Sopenharmony_cias: 2579e5c31af7Sopenharmony_ci 2580e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineCoverageModulationStateCreateInfoNV.adoc[] 2581e5c31af7Sopenharmony_ci 2582e5c31af7Sopenharmony_ci * pname:sType is a elink:VkStructureType value identifying this structure. 2583e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 2584e5c31af7Sopenharmony_ci structure. 2585e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 2586e5c31af7Sopenharmony_ci * pname:coverageModulationMode is a elink:VkCoverageModulationModeNV value 2587e5c31af7Sopenharmony_ci controlling which color components are modulated. 2588e5c31af7Sopenharmony_ci * pname:coverageModulationTableEnable controls whether the modulation 2589e5c31af7Sopenharmony_ci factor is looked up from a table in pname:pCoverageModulationTable. 2590e5c31af7Sopenharmony_ci * pname:coverageModulationTableCount is the number of elements in 2591e5c31af7Sopenharmony_ci pname:pCoverageModulationTable. 2592e5c31af7Sopenharmony_ci * pname:pCoverageModulationTable is a table of modulation factors 2593e5c31af7Sopenharmony_ci containing a value for each number of covered samples. 2594e5c31af7Sopenharmony_ci 2595e5c31af7Sopenharmony_ciIf pname:coverageModulationTableEnable is ename:VK_FALSE, then for each 2596e5c31af7Sopenharmony_cicolor sample the associated bits of the pixel coverage are counted and 2597e5c31af7Sopenharmony_cidivided by the number of associated bits to produce a modulation factor 2598e5c31af7Sopenharmony_ci[eq]#R# in the range [eq]#(0,1]# (a value of zero would have been killed due 2599e5c31af7Sopenharmony_cito a color coverage of 0). 2600e5c31af7Sopenharmony_ciSpecifically: 2601e5c31af7Sopenharmony_ci 2602e5c31af7Sopenharmony_ci * [eq]#N# = value of pname:rasterizationSamples 2603e5c31af7Sopenharmony_ci * [eq]#M# = value of slink:VkAttachmentDescription::pname:samples for any 2604e5c31af7Sopenharmony_ci color attachments 2605e5c31af7Sopenharmony_ci * [eq]#R = popcount(associated coverage bits) / (N / M)# 2606e5c31af7Sopenharmony_ci 2607e5c31af7Sopenharmony_ciIf pname:coverageModulationTableEnable is ename:VK_TRUE, the value [eq]#R# 2608e5c31af7Sopenharmony_ciis computed using a programmable lookup table. 2609e5c31af7Sopenharmony_ciThe lookup table has [eq]#N / M# elements, and the element of the table is 2610e5c31af7Sopenharmony_ciselected by: 2611e5c31af7Sopenharmony_ci 2612e5c31af7Sopenharmony_ci * [eq]#R = pname:pCoverageModulationTable[popcount(associated coverage 2613e5c31af7Sopenharmony_ci bits)-1]# 2614e5c31af7Sopenharmony_ci 2615e5c31af7Sopenharmony_ciNote that the table does not have an entry for [eq]#popcount(associated 2616e5c31af7Sopenharmony_cicoverage bits) = 0#, because such samples would have been killed. 2617e5c31af7Sopenharmony_ci 2618e5c31af7Sopenharmony_ciThe values of pname:pCoverageModulationTable may: be rounded to an 2619e5c31af7Sopenharmony_ciimplementation-dependent precision, which is at least as fine as [eq]#1 / 2620e5c31af7Sopenharmony_ciN#, and clamped to [eq]#[0,1]#. 2621e5c31af7Sopenharmony_ci 2622e5c31af7Sopenharmony_ciFor each color attachment with a floating point or normalized color format, 2623e5c31af7Sopenharmony_cieach fragment output color value is replicated to [eq]#M# values which can: 2624e5c31af7Sopenharmony_cieach be modulated (multiplied) by that color sample's associated value of 2625e5c31af7Sopenharmony_ci[eq]#R#. 2626e5c31af7Sopenharmony_ciWhich components are modulated is controlled by 2627e5c31af7Sopenharmony_cipname:coverageModulationMode. 2628e5c31af7Sopenharmony_ci 2629e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is as if 2630e5c31af7Sopenharmony_cipname:coverageModulationMode is ename:VK_COVERAGE_MODULATION_MODE_NONE_NV. 2631e5c31af7Sopenharmony_ci 2632e5c31af7Sopenharmony_ciifdef::VK_NV_coverage_reduction_mode[] 2633e5c31af7Sopenharmony_ciIf the <<fragops-coverage-reduction, coverage reduction mode>> is 2634e5c31af7Sopenharmony_ciename:VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV, each color sample is 2635e5c31af7Sopenharmony_ciassociated with only a single coverage sample. 2636e5c31af7Sopenharmony_ciIn this case, it is as if pname:coverageModulationMode is 2637e5c31af7Sopenharmony_ciename:VK_COVERAGE_MODULATION_MODE_NONE_NV. 2638e5c31af7Sopenharmony_ciendif::VK_NV_coverage_reduction_mode[] 2639e5c31af7Sopenharmony_ci 2640e5c31af7Sopenharmony_ci.Valid Usage 2641e5c31af7Sopenharmony_ci**** 2642e5c31af7Sopenharmony_ci * [[VUID-VkPipelineCoverageModulationStateCreateInfoNV-coverageModulationTableEnable-01405]] 2643e5c31af7Sopenharmony_ci If pname:coverageModulationTableEnable is ename:VK_TRUE, 2644e5c31af7Sopenharmony_ci pname:coverageModulationTableCount must: be equal to the number of 2645e5c31af7Sopenharmony_ci rasterization samples divided by the number of color samples in the 2646e5c31af7Sopenharmony_ci subpass 2647e5c31af7Sopenharmony_ci**** 2648e5c31af7Sopenharmony_ci 2649e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineCoverageModulationStateCreateInfoNV.adoc[] 2650e5c31af7Sopenharmony_ci-- 2651e5c31af7Sopenharmony_ci 2652e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageModulationStateCreateFlagsNV',desc='Reserved for future use',type='flags'] 2653e5c31af7Sopenharmony_ci-- 2654e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineCoverageModulationStateCreateFlagsNV.adoc[] 2655e5c31af7Sopenharmony_ci 2656e5c31af7Sopenharmony_citname:VkPipelineCoverageModulationStateCreateFlagsNV is a bitmask type for 2657e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 2658e5c31af7Sopenharmony_ci-- 2659e5c31af7Sopenharmony_ci 2660e5c31af7Sopenharmony_ci[open,refpage='VkCoverageModulationModeNV',desc='Specify the coverage modulation mode',type='enums'] 2661e5c31af7Sopenharmony_ci-- 2662e5c31af7Sopenharmony_ciPossible values of 2663e5c31af7Sopenharmony_cislink:VkPipelineCoverageModulationStateCreateInfoNV::pname:coverageModulationMode, 2664e5c31af7Sopenharmony_cispecifying which color components are modulated, are: 2665e5c31af7Sopenharmony_ci 2666e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCoverageModulationModeNV.adoc[] 2667e5c31af7Sopenharmony_ci 2668e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_NONE_NV specifies that no components 2669e5c31af7Sopenharmony_ci are multiplied by the modulation factor. 2670e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_RGB_NV specifies that the red, green, 2671e5c31af7Sopenharmony_ci and blue components are multiplied by the modulation factor. 2672e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_ALPHA_NV specifies that the alpha 2673e5c31af7Sopenharmony_ci component is multiplied by the modulation factor. 2674e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_RGBA_NV specifies that all components 2675e5c31af7Sopenharmony_ci are multiplied by the modulation factor. 2676e5c31af7Sopenharmony_ci-- 2677e5c31af7Sopenharmony_ci 2678e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2679e5c31af7Sopenharmony_ci 2680e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetCoverageModulationModeNV',desc='Specify the coverage modulation mode dynamically for a command buffer',type='protos'] 2681e5c31af7Sopenharmony_ci-- 2682e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 2683e5c31af7Sopenharmony_cipname:coverageModulationMode state, call: 2684e5c31af7Sopenharmony_ci 2685e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetCoverageModulationModeNV.adoc[] 2686e5c31af7Sopenharmony_ci 2687e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2688e5c31af7Sopenharmony_ci recorded. 2689e5c31af7Sopenharmony_ci * pname:coverageModulationMode specifies the pname:coverageModulationMode 2690e5c31af7Sopenharmony_ci state. 2691e5c31af7Sopenharmony_ci 2692e5c31af7Sopenharmony_ciThis command sets the pname:coverageModulationMode state for subsequent 2693e5c31af7Sopenharmony_cidrawing commands 2694e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2695e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 2696e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 2697e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2698e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 2699e5c31af7Sopenharmony_cithe graphics pipeline is created with 2700e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COVERAGE_MODULATION_MODE_NV set in 2701e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2702e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 2703e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2704e5c31af7Sopenharmony_cislink:VkPipelineCoverageModulationStateCreateInfoNV::pname:coverageModulationMode 2705e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 2706e5c31af7Sopenharmony_ci 2707e5c31af7Sopenharmony_ci:refpage: vkCmdSetCoverageModulationModeNV 2708e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3CoverageModulationMode 2709e5c31af7Sopenharmony_ci 2710e5c31af7Sopenharmony_ci.Valid Usage 2711e5c31af7Sopenharmony_ci**** 2712e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 2713e5c31af7Sopenharmony_ci**** 2714e5c31af7Sopenharmony_ci 2715e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetCoverageModulationModeNV.adoc[] 2716e5c31af7Sopenharmony_ci-- 2717e5c31af7Sopenharmony_ci 2718e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetCoverageModulationTableEnableNV',desc='Specify the coverage modulation table enable state dynamically for a command buffer',type='protos'] 2719e5c31af7Sopenharmony_ci-- 2720e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 2721e5c31af7Sopenharmony_cipname:coverageModulationTableEnable state, call: 2722e5c31af7Sopenharmony_ci 2723e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetCoverageModulationTableEnableNV.adoc[] 2724e5c31af7Sopenharmony_ci 2725e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2726e5c31af7Sopenharmony_ci recorded. 2727e5c31af7Sopenharmony_ci * pname:coverageModulationTableEnable specifies the 2728e5c31af7Sopenharmony_ci pname:coverageModulationTableEnable state. 2729e5c31af7Sopenharmony_ci 2730e5c31af7Sopenharmony_ciThis command sets the pname:coverageModulationTableEnable state for 2731e5c31af7Sopenharmony_cisubsequent drawing commands 2732e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2733e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 2734e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 2735e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2736e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 2737e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 2738e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_ENABLE_NV set in 2739e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2740e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 2741e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2742e5c31af7Sopenharmony_cislink:VkPipelineCoverageModulationStateCreateInfoNV::pname:coverageModulationTableEnable 2743e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 2744e5c31af7Sopenharmony_ci 2745e5c31af7Sopenharmony_ci:refpage: vkCmdSetCoverageModulationTableEnableNV 2746e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3CoverageModulationTableEnable 2747e5c31af7Sopenharmony_ci 2748e5c31af7Sopenharmony_ci.Valid Usage 2749e5c31af7Sopenharmony_ci**** 2750e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 2751e5c31af7Sopenharmony_ci**** 2752e5c31af7Sopenharmony_ci 2753e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetCoverageModulationTableEnableNV.adoc[] 2754e5c31af7Sopenharmony_ci-- 2755e5c31af7Sopenharmony_ci 2756e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetCoverageModulationTableNV',desc='Specify the coverage modulation table dynamically for a command buffer',type='protos'] 2757e5c31af7Sopenharmony_ci-- 2758e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the 2759e5c31af7Sopenharmony_cipname:pCoverageModulationTable state, call: 2760e5c31af7Sopenharmony_ci 2761e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetCoverageModulationTableNV.adoc[] 2762e5c31af7Sopenharmony_ci 2763e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 2764e5c31af7Sopenharmony_ci recorded. 2765e5c31af7Sopenharmony_ci * pname:coverageModulationTableCount specifies the number of elements in 2766e5c31af7Sopenharmony_ci pname:pCoverageModulationTable. 2767e5c31af7Sopenharmony_ci * pname:pCoverageModulationTable specifies the table of modulation factors 2768e5c31af7Sopenharmony_ci containing a value for each number of covered samples. 2769e5c31af7Sopenharmony_ci 2770e5c31af7Sopenharmony_ciThis command sets the table of modulation factors for subsequent drawing 2771e5c31af7Sopenharmony_cicommands 2772e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 2773e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>, or] 2774e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state3[when drawing using <<shaders-objects, shader objects>>.] 2775e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 2776e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state3[] 2777e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 2778e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_NV set in 2779e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 2780e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3[] 2781e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 2782e5c31af7Sopenharmony_cislink:VkPipelineCoverageModulationStateCreateInfoNV::pname:coverageModulationTableCount, 2783e5c31af7Sopenharmony_ciand 2784e5c31af7Sopenharmony_cislink:VkPipelineCoverageModulationStateCreateInfoNV::pname:pCoverageModulationTable 2785e5c31af7Sopenharmony_civalues used to create the currently active pipeline. 2786e5c31af7Sopenharmony_ci 2787e5c31af7Sopenharmony_ci:refpage: vkCmdSetCoverageModulationTableNV 2788e5c31af7Sopenharmony_ci:requiredfeature: extendedDynamicState3CoverageModulationTable 2789e5c31af7Sopenharmony_ci 2790e5c31af7Sopenharmony_ci.Valid Usage 2791e5c31af7Sopenharmony_ci**** 2792e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state3_feature_common.adoc[] 2793e5c31af7Sopenharmony_ci**** 2794e5c31af7Sopenharmony_ci 2795e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetCoverageModulationTableNV.adoc[] 2796e5c31af7Sopenharmony_ci-- 2797e5c31af7Sopenharmony_ci 2798e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state3,VK_EXT_shader_object[] 2799e5c31af7Sopenharmony_ci 2800e5c31af7Sopenharmony_ciendif::VK_NV_framebuffer_mixed_samples[] 2801