1e5c31af7Sopenharmony_ci// Copyright 2015-2021 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_ci ** <<fragops-shader-depthreplacement, Depth Replacement>> 26e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_stencil_export[] 27e5c31af7Sopenharmony_ci ** <<fragops-shader-stencilrefreplacement, Stencil Reference Replacement>> 28e5c31af7Sopenharmony_ciendif::VK_EXT_shader_stencil_export[] 29e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_shader_interlock[] 30e5c31af7Sopenharmony_ci ** <<fragops-shader-interlock, Interlocked Operations>> 31e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_shader_interlock[] 32e5c31af7Sopenharmony_ci . <<fragops-covg, Multisample coverage>> 33e5c31af7Sopenharmony_ci . <<fragops-dbt, Depth bounds test>> 34e5c31af7Sopenharmony_ci . <<fragops-stencil, Stencil test>> 35e5c31af7Sopenharmony_ci . <<fragops-depth, Depth test>> 36e5c31af7Sopenharmony_ciifdef::VK_NV_representative_fragment_test[] 37e5c31af7Sopenharmony_ci . <<fragops-rep-frag-test, Representative fragment test>> 38e5c31af7Sopenharmony_ciendif::VK_NV_representative_fragment_test[] 39e5c31af7Sopenharmony_ci . <<fragops-samplecount, Sample counting>> 40e5c31af7Sopenharmony_ciifdef::VK_NV_fragment_coverage_to_color[] 41e5c31af7Sopenharmony_ci . <<fragops-coverage-to-color, Coverage to color>> 42e5c31af7Sopenharmony_ciendif::VK_NV_fragment_coverage_to_color[] 43e5c31af7Sopenharmony_ci . <<fragops-coverage-reduction, Coverage reduction>> 44e5c31af7Sopenharmony_ciifdef::VK_NV_framebuffer_mixed_samples[] 45e5c31af7Sopenharmony_ci . <<fragops-coverage-modulation, Coverage modulation>> 46e5c31af7Sopenharmony_ciendif::VK_NV_framebuffer_mixed_samples[] 47e5c31af7Sopenharmony_ci 48e5c31af7Sopenharmony_ciThe <<primsrast-multisampling-coverage-mask, coverage mask>> generated by 49e5c31af7Sopenharmony_cirasterization describes the initial coverage of each sample covered by the 50e5c31af7Sopenharmony_cifragment. 51e5c31af7Sopenharmony_ciFragment operations will update the coverage mask to add or subtract 52e5c31af7Sopenharmony_cicoverage where appropriate. 53e5c31af7Sopenharmony_ciIf a fragment operation results in all bits of the coverage mask being `0`, 54e5c31af7Sopenharmony_cithe fragment is discarded, and no further operations are performed. 55e5c31af7Sopenharmony_ciFragments can also be programmatically discarded in a fragment shader by 56e5c31af7Sopenharmony_ciexecuting one of 57e5c31af7Sopenharmony_ci 58e5c31af7Sopenharmony_ciifdef::VK_KHR_shader_terminate_invocation[] 59e5c31af7Sopenharmony_ci * code:OpTerminateInvocation 60e5c31af7Sopenharmony_ciendif::VK_KHR_shader_terminate_invocation[] 61e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_demote_to_helper_invocation[] 62e5c31af7Sopenharmony_ci * code:OpDemoteToHelperInvocationEXT 63e5c31af7Sopenharmony_ciendif::VK_EXT_shader_demote_to_helper_invocation[] 64e5c31af7Sopenharmony_ci * code:OpKill. 65e5c31af7Sopenharmony_ci 66e5c31af7Sopenharmony_ciWhen one of the fragment operations in this chapter is described as 67e5c31af7Sopenharmony_ci"`replacing`" a fragment shader output, that output is replaced 68e5c31af7Sopenharmony_ciunconditionally, even if no fragment shader previously wrote to that output. 69e5c31af7Sopenharmony_ci 70e5c31af7Sopenharmony_ciifdef::VK_EXT_post_depth_coverage[] 71e5c31af7Sopenharmony_ciIf the <<fragops-shader, fragment shader>> declares the 72e5c31af7Sopenharmony_cicode:PostDepthCoverage execution mode, the <<fragops-samplemask, sample mask 73e5c31af7Sopenharmony_citest>> is instead performed after the <<fragops-depth, depth test>>. 74e5c31af7Sopenharmony_ciendif::VK_EXT_post_depth_coverage[] 75e5c31af7Sopenharmony_ci 76e5c31af7Sopenharmony_ciIf the <<fragops-shader, fragment shader>> declares the 77e5c31af7Sopenharmony_cicode:EarlyFragmentTests execution mode, <<fragops-shader,fragment shading>> 78e5c31af7Sopenharmony_ciand <<fragops-covg, multisample coverage>> operations are instead performed 79e5c31af7Sopenharmony_ciafter <<fragops-samplecount, sample counting>>. 80e5c31af7Sopenharmony_ci 81e5c31af7Sopenharmony_ciOnce all fragment operations have completed, fragment shader outputs for 82e5c31af7Sopenharmony_cicovered color attachment samples pass through <<framebuffer, framebuffer 83e5c31af7Sopenharmony_cioperations>>. 84e5c31af7Sopenharmony_ci 85e5c31af7Sopenharmony_ci 86e5c31af7Sopenharmony_ciifdef::VK_EXT_discard_rectangles[] 87e5c31af7Sopenharmony_ci[[fragops-discard-rectangles]] 88e5c31af7Sopenharmony_ci== Discard Rectangles Test 89e5c31af7Sopenharmony_ci 90e5c31af7Sopenharmony_ciThe discard rectangle test compares the framebuffer coordinates 91e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# of each sample covered by a fragment against a set of 92e5c31af7Sopenharmony_ci_discard rectangles_. 93e5c31af7Sopenharmony_ci 94e5c31af7Sopenharmony_ciEach discard rectangle is defined by a slink:VkRect2D. 95e5c31af7Sopenharmony_ciThese values are either set by the 96e5c31af7Sopenharmony_cislink:VkPipelineDiscardRectangleStateCreateInfoEXT structure during pipeline 97e5c31af7Sopenharmony_cicreation, or dynamically by the flink:vkCmdSetDiscardRectangleEXT command. 98e5c31af7Sopenharmony_ci 99e5c31af7Sopenharmony_ciA given sample is considered inside a discard rectangle if the [eq]#x~f~# is 100e5c31af7Sopenharmony_ciin the range [eq]#[slink:VkRect2D::offset.x, slink:VkRect2D::offset.x {plus} 101e5c31af7Sopenharmony_cislink:VkRect2D::extent.x)#, and [eq]#y~f~# is in the range 102e5c31af7Sopenharmony_ci[eq]#[slink:VkRect2D::offset.y, slink:VkRect2D::offset.y {plus} 103e5c31af7Sopenharmony_cislink:VkRect2D::extent.y)#. 104e5c31af7Sopenharmony_ciIf the test is set to be inclusive, samples that are not inside any of the 105e5c31af7Sopenharmony_cidiscard rectangles will have their coverage set to `0`. 106e5c31af7Sopenharmony_ciIf the test is set to be exclusive, samples that are inside any of the 107e5c31af7Sopenharmony_cidiscard rectangles will have their coverage set to `0`. 108e5c31af7Sopenharmony_ci 109e5c31af7Sopenharmony_ciIf no discard rectangles are specified, the coverage mask is unmodified by 110e5c31af7Sopenharmony_cithis operation. 111e5c31af7Sopenharmony_ci 112e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDiscardRectangleStateCreateInfoEXT',desc='Structure specifying discard rectangle',type='structs'] 113e5c31af7Sopenharmony_ci-- 114e5c31af7Sopenharmony_ciThe sname:VkPipelineDiscardRectangleStateCreateInfoEXT structure is defined 115e5c31af7Sopenharmony_cias: 116e5c31af7Sopenharmony_ci 117e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineDiscardRectangleStateCreateInfoEXT.txt[] 118e5c31af7Sopenharmony_ci 119e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 120e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 121e5c31af7Sopenharmony_ci structure. 122e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 123e5c31af7Sopenharmony_ci * pname:discardRectangleMode is a elink:VkDiscardRectangleModeEXT value 124e5c31af7Sopenharmony_ci determining whether the discard rectangle test is inclusive or 125e5c31af7Sopenharmony_ci exclusive. 126e5c31af7Sopenharmony_ci * pname:discardRectangleCount is the number of discard rectangles to use. 127e5c31af7Sopenharmony_ci * pname:pDiscardRectangles is a pointer to an array of slink:VkRect2D 128e5c31af7Sopenharmony_ci structures defining discard rectangles. 129e5c31af7Sopenharmony_ci 130e5c31af7Sopenharmony_ciIf the ename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT dynamic state is enabled 131e5c31af7Sopenharmony_cifor a pipeline, the pname:pDiscardRectangles member is ignored. 132e5c31af7Sopenharmony_ci 133e5c31af7Sopenharmony_ciWhen this structure is included in the pname:pNext chain of 134e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo, it defines parameters of the discard 135e5c31af7Sopenharmony_cirectangle test. 136e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is equivalent 137e5c31af7Sopenharmony_cito specifying this structure with a pname:discardRectangleCount of `0`. 138e5c31af7Sopenharmony_ci 139e5c31af7Sopenharmony_ci.Valid Usage 140e5c31af7Sopenharmony_ci**** 141e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDiscardRectangleStateCreateInfoEXT-discardRectangleCount-00582]] 142e5c31af7Sopenharmony_ci pname:discardRectangleCount must: be less than or equal to 143e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceDiscardRectanglePropertiesEXT::pname:maxDiscardRectangles 144e5c31af7Sopenharmony_ci**** 145e5c31af7Sopenharmony_ci 146e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineDiscardRectangleStateCreateInfoEXT.txt[] 147e5c31af7Sopenharmony_ci-- 148e5c31af7Sopenharmony_ci 149e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDiscardRectangleStateCreateFlagsEXT',desc='Reserved for future use',type='flags'] 150e5c31af7Sopenharmony_ci-- 151e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineDiscardRectangleStateCreateFlagsEXT.txt[] 152e5c31af7Sopenharmony_ci 153e5c31af7Sopenharmony_citname:VkPipelineDiscardRectangleStateCreateFlagsEXT is a bitmask type for 154e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 155e5c31af7Sopenharmony_ci-- 156e5c31af7Sopenharmony_ci 157e5c31af7Sopenharmony_ci[open,refpage='VkDiscardRectangleModeEXT',desc='Specify the discard rectangle mode',type='enums'] 158e5c31af7Sopenharmony_ci-- 159e5c31af7Sopenharmony_ciename:VkDiscardRectangleModeEXT values are: 160e5c31af7Sopenharmony_ci 161e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkDiscardRectangleModeEXT.txt[] 162e5c31af7Sopenharmony_ci 163e5c31af7Sopenharmony_ci * ename:VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT specifies that the discard 164e5c31af7Sopenharmony_ci rectangle test is inclusive. 165e5c31af7Sopenharmony_ci * ename:VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT specifies that the discard 166e5c31af7Sopenharmony_ci rectangle test is exclusive. 167e5c31af7Sopenharmony_ci-- 168e5c31af7Sopenharmony_ci 169e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDiscardRectangleEXT',desc='Set discard rectangles dynamically for a command buffer',type='protos'] 170e5c31af7Sopenharmony_ci-- 171e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the discard rectangles, 172e5c31af7Sopenharmony_cicall: 173e5c31af7Sopenharmony_ci 174e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDiscardRectangleEXT.txt[] 175e5c31af7Sopenharmony_ci 176e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 177e5c31af7Sopenharmony_ci recorded. 178e5c31af7Sopenharmony_ci * pname:firstDiscardRectangle is the index of the first discard rectangle 179e5c31af7Sopenharmony_ci whose state is updated by the command. 180e5c31af7Sopenharmony_ci * pname:discardRectangleCount is the number of discard rectangles whose 181e5c31af7Sopenharmony_ci state are updated by the command. 182e5c31af7Sopenharmony_ci * pname:pDiscardRectangles is a pointer to an array of slink:VkRect2D 183e5c31af7Sopenharmony_ci structures specifying discard rectangles. 184e5c31af7Sopenharmony_ci 185e5c31af7Sopenharmony_ciThe discard rectangle taken from element [eq]#i# of pname:pDiscardRectangles 186e5c31af7Sopenharmony_cireplace the current state for the discard rectangle at index 187e5c31af7Sopenharmony_ci[eq]#pname:firstDiscardRectangle {plus} i#, for [eq]#i# in [eq]#[0, 188e5c31af7Sopenharmony_cipname:discardRectangleCount)#. 189e5c31af7Sopenharmony_ci 190e5c31af7Sopenharmony_ciThis command sets the discard rectangles for subsequent drawing commands 191e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 192e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT set in 193e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 194e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 195e5c31af7Sopenharmony_cislink:VkPipelineDiscardRectangleStateCreateInfoEXT::pname:pDiscardRectangles 196e5c31af7Sopenharmony_civalues used to create the currently active pipeline. 197e5c31af7Sopenharmony_ci 198e5c31af7Sopenharmony_ci.Valid Usage 199e5c31af7Sopenharmony_ci**** 200e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-firstDiscardRectangle-00585]] 201e5c31af7Sopenharmony_ci The sum of pname:firstDiscardRectangle and pname:discardRectangleCount 202e5c31af7Sopenharmony_ci must: be less than or equal to 203e5c31af7Sopenharmony_ci slink:VkPhysicalDeviceDiscardRectanglePropertiesEXT::pname:maxDiscardRectangles 204e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-x-00587]] 205e5c31af7Sopenharmony_ci The pname:x and pname:y member of pname:offset in each slink:VkRect2D 206e5c31af7Sopenharmony_ci element of pname:pDiscardRectangles must: be greater than or equal to 207e5c31af7Sopenharmony_ci `0` 208e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-offset-00588]] 209e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# in each 210e5c31af7Sopenharmony_ci slink:VkRect2D element of pname:pDiscardRectangles must: not cause a 211e5c31af7Sopenharmony_ci signed integer addition overflow 212e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-offset-00589]] 213e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# in each 214e5c31af7Sopenharmony_ci slink:VkRect2D element of pname:pDiscardRectangles must: not cause a 215e5c31af7Sopenharmony_ci signed integer addition overflow 216e5c31af7Sopenharmony_ciifdef::VK_NV_inherited_viewport_scissor[] 217e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDiscardRectangleEXT-viewportScissor2D-04788]] 218e5c31af7Sopenharmony_ci If this command is recorded in a secondary command buffer with 219e5c31af7Sopenharmony_ci slink:VkCommandBufferInheritanceViewportScissorInfoNV::pname:viewportScissor2D 220e5c31af7Sopenharmony_ci enabled, then this function must: not be called 221e5c31af7Sopenharmony_ciendif::VK_NV_inherited_viewport_scissor[] 222e5c31af7Sopenharmony_ci**** 223e5c31af7Sopenharmony_ci 224e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDiscardRectangleEXT.txt[] 225e5c31af7Sopenharmony_ci-- 226e5c31af7Sopenharmony_ciendif::VK_EXT_discard_rectangles[] 227e5c31af7Sopenharmony_ci 228e5c31af7Sopenharmony_ci 229e5c31af7Sopenharmony_ci[[fragops-scissor]] 230e5c31af7Sopenharmony_ci== Scissor Test 231e5c31af7Sopenharmony_ci 232e5c31af7Sopenharmony_ciThe scissor test compares the framebuffer coordinates [eq]#(x~f~,y~f~)# of 233e5c31af7Sopenharmony_cieach sample covered by a fragment against a _scissor rectangle_ at the index 234e5c31af7Sopenharmony_ciequal to the fragment's <<interfaces-builtin-variables-viewportindex, 235e5c31af7Sopenharmony_cicode:ViewportIndex>>. 236e5c31af7Sopenharmony_ci 237e5c31af7Sopenharmony_ciEach scissor rectangle is defined by a slink:VkRect2D. 238e5c31af7Sopenharmony_ciThese values are either set by the slink:VkPipelineViewportStateCreateInfo 239e5c31af7Sopenharmony_cistructure during pipeline creation, or dynamically by the 240e5c31af7Sopenharmony_ciflink:vkCmdSetScissor command. 241e5c31af7Sopenharmony_ci 242e5c31af7Sopenharmony_ciA given sample is considered inside a scissor rectangle if [eq]#x~f~# is in 243e5c31af7Sopenharmony_cithe range [eq]#[slink:VkRect2D::offset.x, slink:VkRect2D::offset.x {plus} 244e5c31af7Sopenharmony_cislink:VkRect2D::extent.x)#, and [eq]#y~f~# is in the range 245e5c31af7Sopenharmony_ci[eq]#[slink:VkRect2D::offset.y, slink:VkRect2D::offset.y {plus} 246e5c31af7Sopenharmony_cislink:VkRect2D::extent.y)#. 247e5c31af7Sopenharmony_ciSamples with coordinates outside the scissor rectangle at the corresponding 248e5c31af7Sopenharmony_cicode:ViewportIndex will have their coverage set to `0`. 249e5c31af7Sopenharmony_ci 250e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_transform[] 251e5c31af7Sopenharmony_ciIf a render pass transform is enabled, the (pname:offset.x and 252e5c31af7Sopenharmony_cipname:offset.y) and (pname:extent.width and pname:extent.height) values are 253e5c31af7Sopenharmony_citransformed as described in <<vertexpostproc-renderpass-transform, render 254e5c31af7Sopenharmony_cipass transform>> before participating in the scissor test. 255e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_transform[] 256e5c31af7Sopenharmony_ci 257e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetScissor',desc='Set scissor rectangles dynamically for a command buffer',type='protos'] 258e5c31af7Sopenharmony_ci-- 259e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the scissor rectangles, 260e5c31af7Sopenharmony_cicall: 261e5c31af7Sopenharmony_ci 262e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetScissor.txt[] 263e5c31af7Sopenharmony_ci 264e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 265e5c31af7Sopenharmony_ci recorded. 266e5c31af7Sopenharmony_ci * pname:firstScissor is the index of the first scissor whose state is 267e5c31af7Sopenharmony_ci updated by the command. 268e5c31af7Sopenharmony_ci * pname:scissorCount is the number of scissors whose rectangles are 269e5c31af7Sopenharmony_ci updated by the command. 270e5c31af7Sopenharmony_ci * pname:pScissors is a pointer to an array of slink:VkRect2D structures 271e5c31af7Sopenharmony_ci defining scissor rectangles. 272e5c31af7Sopenharmony_ci 273e5c31af7Sopenharmony_ciThe scissor rectangles taken from element [eq]#i# of pname:pScissors replace 274e5c31af7Sopenharmony_cithe current state for the scissor index [eq]#pname:firstScissor {plus} i#, 275e5c31af7Sopenharmony_cifor [eq]#i# in [eq]#[0, pname:scissorCount)#. 276e5c31af7Sopenharmony_ci 277e5c31af7Sopenharmony_ciThis command sets the scissor rectangles for subsequent drawing commands 278e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with ename:VK_DYNAMIC_STATE_SCISSOR 279e5c31af7Sopenharmony_ciset in slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 280e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 281e5c31af7Sopenharmony_cislink:VkPipelineViewportStateCreateInfo::pname:pScissors values used to 282e5c31af7Sopenharmony_cicreate the currently active pipeline. 283e5c31af7Sopenharmony_ci 284e5c31af7Sopenharmony_ci.Valid Usage 285e5c31af7Sopenharmony_ci**** 286e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-firstScissor-00592]] 287e5c31af7Sopenharmony_ci The sum of pname:firstScissor and pname:scissorCount must: be between 288e5c31af7Sopenharmony_ci `1` and sname:VkPhysicalDeviceLimits::pname:maxViewports, inclusive 289e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-firstScissor-00593]] 290e5c31af7Sopenharmony_ci If the <<features-multiViewport,multiple viewports>> feature is not 291e5c31af7Sopenharmony_ci enabled, pname:firstScissor must: be `0` 292e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-scissorCount-00594]] 293e5c31af7Sopenharmony_ci If the <<features-multiViewport,multiple viewports>> feature is not 294e5c31af7Sopenharmony_ci enabled, pname:scissorCount must: be `1` 295e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-x-00595]] 296e5c31af7Sopenharmony_ci The pname:x and pname:y members of pname:offset member of any element of 297e5c31af7Sopenharmony_ci pname:pScissors must: be greater than or equal to `0` 298e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-offset-00596]] 299e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# must: not 300e5c31af7Sopenharmony_ci cause a signed integer addition overflow for any element of 301e5c31af7Sopenharmony_ci pname:pScissors 302e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-offset-00597]] 303e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# must: 304e5c31af7Sopenharmony_ci not cause a signed integer addition overflow for any element of 305e5c31af7Sopenharmony_ci pname:pScissors 306e5c31af7Sopenharmony_ciifdef::VK_NV_inherited_viewport_scissor[] 307e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetScissor-viewportScissor2D-04789]] 308e5c31af7Sopenharmony_ci If this command is recorded in a secondary command buffer with 309e5c31af7Sopenharmony_ci slink:VkCommandBufferInheritanceViewportScissorInfoNV::pname:viewportScissor2D 310e5c31af7Sopenharmony_ci enabled, then this function must: not be called 311e5c31af7Sopenharmony_ciendif::VK_NV_inherited_viewport_scissor[] 312e5c31af7Sopenharmony_ci**** 313e5c31af7Sopenharmony_ci 314e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetScissor.txt[] 315e5c31af7Sopenharmony_ci-- 316e5c31af7Sopenharmony_ci 317e5c31af7Sopenharmony_ci 318e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 319e5c31af7Sopenharmony_ci[[fragops-exclusive-scissor]] 320e5c31af7Sopenharmony_ci== Exclusive Scissor Test 321e5c31af7Sopenharmony_ci 322e5c31af7Sopenharmony_ciThe exclusive scissor test compares the framebuffer coordinates 323e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# of each sample covered by a fragment against an _exclusive 324e5c31af7Sopenharmony_ciscissor rectangle_ at the index equal to the fragment's 325e5c31af7Sopenharmony_ci<<interfaces-builtin-variables-viewportindex, code:ViewportIndex>>. 326e5c31af7Sopenharmony_ci 327e5c31af7Sopenharmony_ciEach exclusive scissor rectangle is defined by a slink:VkRect2D. 328e5c31af7Sopenharmony_ciThese values are either set by the 329e5c31af7Sopenharmony_cislink:VkPipelineViewportExclusiveScissorStateCreateInfoNV structure during 330e5c31af7Sopenharmony_cipipeline creation, or dynamically by the flink:vkCmdSetExclusiveScissorNV 331e5c31af7Sopenharmony_cicommand. 332e5c31af7Sopenharmony_ci 333e5c31af7Sopenharmony_ciA given sample is considered inside an exclusive scissor rectangle if 334e5c31af7Sopenharmony_ci[eq]#x~f~# is in the range [eq]#[slink:VkRect2D::offset.x, 335e5c31af7Sopenharmony_cislink:VkRect2D::offset.x {plus} slink:VkRect2D::extent.x)#, and [eq]#y~f~# 336e5c31af7Sopenharmony_ciis in the range [eq]#[slink:VkRect2D::offset.y, slink:VkRect2D::offset.y 337e5c31af7Sopenharmony_ci{plus} slink:VkRect2D::extent.y)#. 338e5c31af7Sopenharmony_ciSamples with coordinates inside the exclusive scissor rectangle at the 339e5c31af7Sopenharmony_cicorresponding code:ViewportIndex will have their coverage set to `0`. 340e5c31af7Sopenharmony_ci 341e5c31af7Sopenharmony_ciIf no exclusive scissor rectangles are specified, the coverage mask is 342e5c31af7Sopenharmony_ciunmodified by this operation. 343e5c31af7Sopenharmony_ci 344e5c31af7Sopenharmony_ci[open,refpage='VkPipelineViewportExclusiveScissorStateCreateInfoNV',desc='Structure specifying parameters controlling exclusive scissor testing',type='structs'] 345e5c31af7Sopenharmony_ci-- 346e5c31af7Sopenharmony_ciThe sname:VkPipelineViewportExclusiveScissorStateCreateInfoNV structure is 347e5c31af7Sopenharmony_cidefined as: 348e5c31af7Sopenharmony_ci 349e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineViewportExclusiveScissorStateCreateInfoNV.txt[] 350e5c31af7Sopenharmony_ci 351e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 352e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 353e5c31af7Sopenharmony_ci structure. 354e5c31af7Sopenharmony_ci * pname:exclusiveScissorCount is the number of exclusive scissor 355e5c31af7Sopenharmony_ci rectangles. 356e5c31af7Sopenharmony_ci * pname:pExclusiveScissors is a pointer to an array of slink:VkRect2D 357e5c31af7Sopenharmony_ci structures defining exclusive scissor rectangles. 358e5c31af7Sopenharmony_ci 359e5c31af7Sopenharmony_ciIf the ename:VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV dynamic state is enabled 360e5c31af7Sopenharmony_cifor a pipeline, the pname:pExclusiveScissors member is ignored. 361e5c31af7Sopenharmony_ci 362e5c31af7Sopenharmony_ciWhen this structure is included in the pname:pNext chain of 363e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo, it defines parameters of the exclusive 364e5c31af7Sopenharmony_ciscissor test. 365e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is equivalent 366e5c31af7Sopenharmony_cito specifying this structure with a pname:exclusiveScissorCount of `0`. 367e5c31af7Sopenharmony_ci 368e5c31af7Sopenharmony_ci.Valid Usage 369e5c31af7Sopenharmony_ci**** 370e5c31af7Sopenharmony_ci * [[VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02027]] 371e5c31af7Sopenharmony_ci If the <<features-multiViewport,multiple viewports>> feature is not 372e5c31af7Sopenharmony_ci enabled, pname:exclusiveScissorCount must: be `0` or `1` 373e5c31af7Sopenharmony_ci * [[VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02028]] 374e5c31af7Sopenharmony_ci pname:exclusiveScissorCount must: be less than or equal to 375e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceLimits::pname:maxViewports 376e5c31af7Sopenharmony_ci * [[VUID-VkPipelineViewportExclusiveScissorStateCreateInfoNV-exclusiveScissorCount-02029]] 377e5c31af7Sopenharmony_ci pname:exclusiveScissorCount must: be `0` or greater than or equal to the 378e5c31af7Sopenharmony_ci pname:viewportCount member of slink:VkPipelineViewportStateCreateInfo 379e5c31af7Sopenharmony_ci 380e5c31af7Sopenharmony_ci**** 381e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineViewportExclusiveScissorStateCreateInfoNV.txt[] 382e5c31af7Sopenharmony_ci-- 383e5c31af7Sopenharmony_ci 384e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetExclusiveScissorNV',desc='Set exclusive scissor rectangles dynamically for a command buffer',type='protos'] 385e5c31af7Sopenharmony_ci-- 386e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the exclusive scissor 387e5c31af7Sopenharmony_cirectangles, call: 388e5c31af7Sopenharmony_ci 389e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetExclusiveScissorNV.txt[] 390e5c31af7Sopenharmony_ci 391e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 392e5c31af7Sopenharmony_ci recorded. 393e5c31af7Sopenharmony_ci * pname:firstExclusiveScissor is the index of the first exclusive scissor 394e5c31af7Sopenharmony_ci rectangle whose state is updated by the command. 395e5c31af7Sopenharmony_ci * pname:exclusiveScissorCount is the number of exclusive scissor 396e5c31af7Sopenharmony_ci rectangles updated by the command. 397e5c31af7Sopenharmony_ci * pname:pExclusiveScissors is a pointer to an array of slink:VkRect2D 398e5c31af7Sopenharmony_ci structures defining exclusive scissor rectangles. 399e5c31af7Sopenharmony_ci 400e5c31af7Sopenharmony_ciThe scissor rectangles taken from element [eq]#i# of 401e5c31af7Sopenharmony_cipname:pExclusiveScissors replace the current state for the scissor index 402e5c31af7Sopenharmony_ci[eq]#pname:firstExclusiveScissor {plus} i#, for [eq]#i# in [eq]#[0, 403e5c31af7Sopenharmony_cipname:exclusiveScissorCount)#. 404e5c31af7Sopenharmony_ci 405e5c31af7Sopenharmony_ciThis command sets the exclusive scissor rectangles for subsequent drawing 406e5c31af7Sopenharmony_cicommands when the graphics pipeline is created with 407e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV set in 408e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 409e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 410e5c31af7Sopenharmony_cislink:VkPipelineViewportExclusiveScissorStateCreateInfoNV::pname:pExclusiveScissors 411e5c31af7Sopenharmony_civalues used to create the currently active pipeline. 412e5c31af7Sopenharmony_ci 413e5c31af7Sopenharmony_ci.Valid Usage 414e5c31af7Sopenharmony_ci**** 415e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-None-02031]] 416e5c31af7Sopenharmony_ci The <<features-exclusiveScissor,exclusive scissor>> feature must: be 417e5c31af7Sopenharmony_ci enabled 418e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02034]] 419e5c31af7Sopenharmony_ci The sum of pname:firstExclusiveScissor and pname:exclusiveScissorCount 420e5c31af7Sopenharmony_ci must: be between `1` and 421e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceLimits::pname:maxViewports, inclusive 422e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-firstExclusiveScissor-02035]] 423e5c31af7Sopenharmony_ci If the <<features-multiViewport,multiple viewports>> feature is not 424e5c31af7Sopenharmony_ci enabled, pname:firstExclusiveScissor must: be `0` 425e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-exclusiveScissorCount-02036]] 426e5c31af7Sopenharmony_ci If the <<features-multiViewport,multiple viewports>> feature is not 427e5c31af7Sopenharmony_ci enabled, pname:exclusiveScissorCount must: be `1` 428e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-x-02037]] 429e5c31af7Sopenharmony_ci The pname:x and pname:y members of pname:offset in each member of 430e5c31af7Sopenharmony_ci pname:pExclusiveScissors must: be greater than or equal to `0` 431e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-offset-02038]] 432e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# for each 433e5c31af7Sopenharmony_ci member of pname:pExclusiveScissors must: not cause a signed integer 434e5c31af7Sopenharmony_ci addition overflow 435e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetExclusiveScissorNV-offset-02039]] 436e5c31af7Sopenharmony_ci Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# for each 437e5c31af7Sopenharmony_ci member of pname:pExclusiveScissors must: not cause a signed integer 438e5c31af7Sopenharmony_ci addition overflow 439e5c31af7Sopenharmony_ci**** 440e5c31af7Sopenharmony_ci 441e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetExclusiveScissorNV.txt[] 442e5c31af7Sopenharmony_ci-- 443e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 444e5c31af7Sopenharmony_ci 445e5c31af7Sopenharmony_ci 446e5c31af7Sopenharmony_ci[[fragops-samplemask]] 447e5c31af7Sopenharmony_ci== Sample Mask Test 448e5c31af7Sopenharmony_ci 449e5c31af7Sopenharmony_ciThe sample mask test compares the <<primsrast-multisampling-coverage-mask, 450e5c31af7Sopenharmony_cicoverage mask>> for a fragment with the _sample mask_ defined by 451e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:pSampleMask. 452e5c31af7Sopenharmony_ci 453e5c31af7Sopenharmony_ciEach bit of the coverage mask is associated with a sample index as described 454e5c31af7Sopenharmony_ciin the <<primsrast-multisampling-coverage-mask, rasterization chapter>>. 455e5c31af7Sopenharmony_ciIf the bit in slink:VkPipelineMultisampleStateCreateInfo::pname:pSampleMask 456e5c31af7Sopenharmony_ciwhich is associated with that same sample index is set to `0`, the coverage 457e5c31af7Sopenharmony_cimask bit is set to `0`. 458e5c31af7Sopenharmony_ci 459e5c31af7Sopenharmony_ci 460e5c31af7Sopenharmony_ci[[fragops-shader]] 461e5c31af7Sopenharmony_ci== Fragment Shading 462e5c31af7Sopenharmony_ci 463e5c31af7Sopenharmony_ci<<shaders-fragment, Fragment shaders>> are invoked for each fragment, or as 464e5c31af7Sopenharmony_ci<<shaders-helper-invocations, helper invocations>>. 465e5c31af7Sopenharmony_ci 466e5c31af7Sopenharmony_ciMost operations in the fragment shader are not performed in 467e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>>, with exceptions called out in the 468e5c31af7Sopenharmony_cifollowing sections. 469e5c31af7Sopenharmony_ci 470e5c31af7Sopenharmony_ciFor fragment shaders invoked by fragments, the following rules apply: 471e5c31af7Sopenharmony_ci 472e5c31af7Sopenharmony_ci * A fragment shader must: not be executed if a <<fragops, fragment 473e5c31af7Sopenharmony_ci operation>> that executes before fragment shading discards the fragment. 474e5c31af7Sopenharmony_ci * A fragment shader may: not be executed if: 475e5c31af7Sopenharmony_ci ** An implementation determines that another fragment shader, invoked by a 476e5c31af7Sopenharmony_ci subsequent primitive in <<drawing-primitive-order, primitive order>>, 477e5c31af7Sopenharmony_ci overwrites all results computed by the shader (including writes to 478e5c31af7Sopenharmony_ci storage resources). 479e5c31af7Sopenharmony_ci ** Any other <<fragops, fragment operation>> discards the fragment, and 480e5c31af7Sopenharmony_ci the shader does not write to any storage resources. 481e5c31af7Sopenharmony_ci * Otherwise, at least one fragment shader must: be executed. 482e5c31af7Sopenharmony_ci ** If <<primsrast-sampleshading,sample shading>> is enabled and multiple 483e5c31af7Sopenharmony_ci invocations per fragment are required:, additional invocations must: be 484e5c31af7Sopenharmony_ci executed as specified. 485e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 486e5c31af7Sopenharmony_ci ** If a <<primsrast-shading-rate-image,shading rate image>> is used and 487e5c31af7Sopenharmony_ci multiple invocations per fragment are required:, additional invocations 488e5c31af7Sopenharmony_ci must: be executed as specified. 489e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 490e5c31af7Sopenharmony_ci ** Each covered sample must: be included in at least one fragment shader 491e5c31af7Sopenharmony_ci invocation. 492e5c31af7Sopenharmony_ci 493e5c31af7Sopenharmony_ci 494e5c31af7Sopenharmony_ci[NOTE] 495e5c31af7Sopenharmony_ci.Note 496e5c31af7Sopenharmony_ci==== 497e5c31af7Sopenharmony_ciMultiple fragment shader invocations may be executed for the same fragment 498e5c31af7Sopenharmony_cifor any number of implementation-dependent reasons. 499e5c31af7Sopenharmony_ciWhen there is more than one fragment shader invocation per fragment, the 500e5c31af7Sopenharmony_ciassociation of samples to invocations is implementation-dependent. 501e5c31af7Sopenharmony_ciStores and atomics performed by these additional invocations have the normal 502e5c31af7Sopenharmony_cieffect. 503e5c31af7Sopenharmony_ci 504e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 505e5c31af7Sopenharmony_ciFor example, if the subpass includes multiple views in its view mask, a 506e5c31af7Sopenharmony_cifragment shader may be invoked separately for each view. 507e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 508e5c31af7Sopenharmony_ci 509e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 510e5c31af7Sopenharmony_ciSimilarly, if the render pass has a fragment density map attachment, more 511e5c31af7Sopenharmony_cithan one fragment shader invocation may be invoked for each covered sample. 512e5c31af7Sopenharmony_ciSuch additional invocations are only produced if 513e5c31af7Sopenharmony_cisname:VkPhysicalDeviceFragmentDensityMapPropertiesEXT::pname:fragmentDensityInvocations 514e5c31af7Sopenharmony_ciis ename:VK_TRUE. 515e5c31af7Sopenharmony_ciImplementations may generate these additional fragment shader invocations in 516e5c31af7Sopenharmony_ciorder to make transitions between fragment areas with different fragment 517e5c31af7Sopenharmony_cidensities more smooth. 518e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 519e5c31af7Sopenharmony_ci==== 520e5c31af7Sopenharmony_ci 521e5c31af7Sopenharmony_ci 522e5c31af7Sopenharmony_ci[[fragops-shader-samplemask]] 523e5c31af7Sopenharmony_ci=== Sample Mask 524e5c31af7Sopenharmony_ci 525e5c31af7Sopenharmony_ciReading from the <<interfaces-builtin-variables-samplemask, 526e5c31af7Sopenharmony_cicode:SampleMask>> built-in in the code:Input storage class will return the 527e5c31af7Sopenharmony_cicoverage mask for the current fragment as calculated by fragment operations 528e5c31af7Sopenharmony_cithat executed prior to fragment shading. 529e5c31af7Sopenharmony_ci 530e5c31af7Sopenharmony_ciIf <<primsrast-sampleshading, sample shading>> is enabled, fragment shaders 531e5c31af7Sopenharmony_ciwill only see values of `1` for samples being shaded - other bits will be 532e5c31af7Sopenharmony_ci`0`. 533e5c31af7Sopenharmony_ci 534e5c31af7Sopenharmony_ciEach bit of the coverage mask is associated with a sample index as described 535e5c31af7Sopenharmony_ciin the <<primsrast-multisampling-coverage-mask, rasterization chapter>>. 536e5c31af7Sopenharmony_ciIf the bit in code:SampleMask which is associated with that same sample 537e5c31af7Sopenharmony_ciindex is set to `0`, that coverage mask bit is set to `0`. 538e5c31af7Sopenharmony_ci 539e5c31af7Sopenharmony_ciValues written to the <<interfaces-builtin-variables-samplemask, 540e5c31af7Sopenharmony_cicode:SampleMask>> built-in in the code:Output storage class will be used by 541e5c31af7Sopenharmony_cithe <<fragops-covg, multisample coverage>> operation, with the same encoding 542e5c31af7Sopenharmony_cias the input built-in. 543e5c31af7Sopenharmony_ci 544e5c31af7Sopenharmony_ci 545e5c31af7Sopenharmony_ci[[fragops-shader-depthreplacement]] 546e5c31af7Sopenharmony_ci=== Depth Replacement 547e5c31af7Sopenharmony_ci 548e5c31af7Sopenharmony_ciWriting to the <<interfaces-builtin-variables-fragdepth,code:FragDepth>> 549e5c31af7Sopenharmony_cibuilt-in will replace the fragment's calculated depth values for each sample 550e5c31af7Sopenharmony_ciin the input code:SampleMask. 551e5c31af7Sopenharmony_ci<<fragops-depth, Depth testing>> performed after the fragment shader for 552e5c31af7Sopenharmony_cithis fragment will use this new value as [eq]#z~f~#. 553e5c31af7Sopenharmony_ci 554e5c31af7Sopenharmony_ci 555e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_stencil_export[] 556e5c31af7Sopenharmony_ci[[fragops-shader-stencilrefreplacement]] 557e5c31af7Sopenharmony_ci=== Stencil Reference Replacement 558e5c31af7Sopenharmony_ci 559e5c31af7Sopenharmony_ciWriting to the 560e5c31af7Sopenharmony_ci<<interfaces-builtin-variables-fragdepth,code:FragStencilRefEXT>> built-in 561e5c31af7Sopenharmony_ciwill replace the fragment's stencil reference value for each sample in the 562e5c31af7Sopenharmony_ciinput code:SampleMask. 563e5c31af7Sopenharmony_ci<<fragops-stencil, Stencil testing>> performed after the fragment shader for 564e5c31af7Sopenharmony_cithis fragment will use this new value as [eq]#s~r~#. 565e5c31af7Sopenharmony_ciendif::VK_EXT_shader_stencil_export[] 566e5c31af7Sopenharmony_ci 567e5c31af7Sopenharmony_ci 568e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_shader_interlock[] 569e5c31af7Sopenharmony_ci[[fragops-shader-interlock]] 570e5c31af7Sopenharmony_ci=== Interlocked Operations 571e5c31af7Sopenharmony_ci 572e5c31af7Sopenharmony_cicode:OpBeginInvocationInterlockEXT and code:OpEndInvocationInterlockEXT 573e5c31af7Sopenharmony_cidefine a section of a fragment shader which imposes additional ordering 574e5c31af7Sopenharmony_ciconstraints on operations performed within them. 575e5c31af7Sopenharmony_ciThese operations are defined as _interlocked operations_. 576e5c31af7Sopenharmony_ciHow interlocked operations are ordered against other fragment shader 577e5c31af7Sopenharmony_ciinvocations depends on the specified execution modes. 578e5c31af7Sopenharmony_ci 579e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image,VK_KHR_fragment_shading_rate[] 580e5c31af7Sopenharmony_ciIf the code:ShadingRateInterlockOrderedEXT execution mode is specified, any 581e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before interlocked 582e5c31af7Sopenharmony_cioperations in fragment shader invocations that execute later in 583e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>> and cover at least one sample in 584e5c31af7Sopenharmony_cithe same fragment area, and must: happen after interlocked operations in a 585e5c31af7Sopenharmony_cifragment shader that executes earlier in <<primsrast-order, rasterization 586e5c31af7Sopenharmony_ciorder>> and cover at least one sample in the same fragment area. 587e5c31af7Sopenharmony_ci 588e5c31af7Sopenharmony_ciIf the code:ShadingRateInterlockUnorderedEXT execution mode is specified, 589e5c31af7Sopenharmony_ciany interlocked operations in a fragment shader must: happen before or after 590e5c31af7Sopenharmony_ciinterlocked operations in fragment shader invocations that execute earlier 591e5c31af7Sopenharmony_cior later in <<primsrast-order, rasterization order>> and cover at least one 592e5c31af7Sopenharmony_cisample in the same fragment area. 593e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image,VK_KHR_fragment_shading_rate[] 594e5c31af7Sopenharmony_ci 595e5c31af7Sopenharmony_ciIf the code:PixelInterlockOrderedEXT execution mode is specified, any 596e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before interlocked 597e5c31af7Sopenharmony_cioperations in fragment shader invocations that execute later in 598e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>> and cover at least one sample in 599e5c31af7Sopenharmony_cithe same pixel, and must: happen after interlocked operations in a fragment 600e5c31af7Sopenharmony_cishader that executes earlier in <<primsrast-order, rasterization order>> and 601e5c31af7Sopenharmony_cicover at least one sample in the same pixel. 602e5c31af7Sopenharmony_ci 603e5c31af7Sopenharmony_ciIf the code:PixelInterlockUnorderedEXT execution mode is specified, any 604e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before or after 605e5c31af7Sopenharmony_ciinterlocked operations in fragment shader invocations that execute earlier 606e5c31af7Sopenharmony_cior later in <<primsrast-order, rasterization order>> and cover at least one 607e5c31af7Sopenharmony_cisample in the same pixel. 608e5c31af7Sopenharmony_ci 609e5c31af7Sopenharmony_ciIf the code:SampleInterlockOrderedEXT execution mode is specified, any 610e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before interlocked 611e5c31af7Sopenharmony_cioperations in fragment shader invocations that execute later in 612e5c31af7Sopenharmony_ci<<primsrast-order, rasterization order>> and cover at least one of the same 613e5c31af7Sopenharmony_cisamples, and must: happen after interlocked operations in a fragment shader 614e5c31af7Sopenharmony_cithat executes earlier in <<primsrast-order, rasterization order>> and cover 615e5c31af7Sopenharmony_ciat least one of the same samples. 616e5c31af7Sopenharmony_ci 617e5c31af7Sopenharmony_ciIf the code:SampleInterlockUnorderedEXT execution mode is specified, any 618e5c31af7Sopenharmony_ciinterlocked operations in a fragment shader must: happen before or after 619e5c31af7Sopenharmony_ciinterlocked operations in fragment shader invocations that execute earlier 620e5c31af7Sopenharmony_cior later in <<primsrast-order, rasterization order>> and cover at least one 621e5c31af7Sopenharmony_ciof the same samples. 622e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_shader_interlock[] 623e5c31af7Sopenharmony_ci 624e5c31af7Sopenharmony_ci 625e5c31af7Sopenharmony_ci[[fragops-covg]] 626e5c31af7Sopenharmony_ci== Multisample Coverage 627e5c31af7Sopenharmony_ci 628e5c31af7Sopenharmony_ciIf a fragment shader is active and its entry point's interface includes a 629e5c31af7Sopenharmony_cibuilt-in output variable decorated with code:SampleMask, 630e5c31af7Sopenharmony_ciifdef::VK_NV_sample_mask_override_coverage[] 631e5c31af7Sopenharmony_cibut not code:OverrideCoverageNV, 632e5c31af7Sopenharmony_ciendif::VK_NV_sample_mask_override_coverage[] 633e5c31af7Sopenharmony_cithe coverage mask is code:ANDed with the bits of the code:SampleMask 634e5c31af7Sopenharmony_cibuilt-in to generate a new coverage mask. 635e5c31af7Sopenharmony_ciifdef::VK_NV_sample_mask_override_coverage[] 636e5c31af7Sopenharmony_ciIf the code:SampleMask built-in is also decorated with 637e5c31af7Sopenharmony_cicode:OverrideCoverageNV, the coverage mask is replaced with the mask bits 638e5c31af7Sopenharmony_ciset in the shader. 639e5c31af7Sopenharmony_ciendif::VK_NV_sample_mask_override_coverage[] 640e5c31af7Sopenharmony_ciIf <<primsrast-sampleshading,sample shading>> is enabled, bits written to 641e5c31af7Sopenharmony_cicode:SampleMask corresponding to samples that are not being shaded by the 642e5c31af7Sopenharmony_cifragment shader invocation are ignored. 643e5c31af7Sopenharmony_ciIf no fragment shader is active, or if the active fragment shader does not 644e5c31af7Sopenharmony_ciinclude code:SampleMask in its interface, the coverage mask is not modified. 645e5c31af7Sopenharmony_ci 646e5c31af7Sopenharmony_ciNext, the fragment alpha value and coverage mask are modified based on the 647e5c31af7Sopenharmony_ciifdef::VK_EXT_line_rasterization[] 648e5c31af7Sopenharmony_ciline coverage factor if the pname:lineRasterizationMode member of the 649e5c31af7Sopenharmony_cislink:VkPipelineRasterizationStateCreateInfo structure is 650e5c31af7Sopenharmony_ciename:VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT, and the 651e5c31af7Sopenharmony_ciendif::VK_EXT_line_rasterization[] 652e5c31af7Sopenharmony_cipname:alphaToCoverageEnable and pname:alphaToOneEnable members of the 653e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo structure. 654e5c31af7Sopenharmony_ci 655e5c31af7Sopenharmony_ciAll alpha values in this section refer only to the alpha component of the 656e5c31af7Sopenharmony_cifragment shader output that has a code:Location and code:Index decoration of 657e5c31af7Sopenharmony_cizero (see the <<interfaces-fragmentoutput,Fragment Output Interface>> 658e5c31af7Sopenharmony_cisection). 659e5c31af7Sopenharmony_ciIf that shader output has an integer or unsigned integer type, then these 660e5c31af7Sopenharmony_cioperations are skipped. 661e5c31af7Sopenharmony_ci 662e5c31af7Sopenharmony_ciifdef::VK_EXT_line_rasterization[] 663e5c31af7Sopenharmony_ciIf the pname:lineRasterizationMode member of the 664e5c31af7Sopenharmony_cislink:VkPipelineRasterizationStateCreateInfo structure is 665e5c31af7Sopenharmony_ciename:VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT and the fragment 666e5c31af7Sopenharmony_cicame from a line segment, then the alpha value is replaced by multiplying it 667e5c31af7Sopenharmony_ciby the coverage factor for the fragment computed during 668e5c31af7Sopenharmony_ci<<primsrast-lines-smooth,smooth line rasterization>>. 669e5c31af7Sopenharmony_ciendif::VK_EXT_line_rasterization[] 670e5c31af7Sopenharmony_ci 671e5c31af7Sopenharmony_ciIf pname:alphaToCoverageEnable is enabled, a temporary coverage mask is 672e5c31af7Sopenharmony_cigenerated where each bit is determined by the fragment's alpha value, which 673e5c31af7Sopenharmony_ciis ANDed with the fragment coverage mask. 674e5c31af7Sopenharmony_ci 675e5c31af7Sopenharmony_ciNo specific algorithm is specified for converting the alpha value to a 676e5c31af7Sopenharmony_citemporary coverage mask. 677e5c31af7Sopenharmony_ciIt is intended that the number of 1's in this value be proportional to the 678e5c31af7Sopenharmony_cialpha value (clamped to [eq]#[0,1]#), with all 1's corresponding to a value 679e5c31af7Sopenharmony_ciof 1.0 and all 0's corresponding to 0.0. 680e5c31af7Sopenharmony_ciThe algorithm may: be different at different framebuffer coordinates. 681e5c31af7Sopenharmony_ci 682e5c31af7Sopenharmony_ci[NOTE] 683e5c31af7Sopenharmony_ci.Note 684e5c31af7Sopenharmony_ci==== 685e5c31af7Sopenharmony_ciUsing different algorithms at different framebuffer coordinates may: help to 686e5c31af7Sopenharmony_ciavoid artifacts caused by regular coverage sample locations. 687e5c31af7Sopenharmony_ci==== 688e5c31af7Sopenharmony_ci 689e5c31af7Sopenharmony_ciFinally, if pname:alphaToOneEnable is enabled, each alpha value is replaced 690e5c31af7Sopenharmony_ciby the maximum representable alpha value for fixed-point color attachments, 691e5c31af7Sopenharmony_cior by 1.0 for floating-point attachments. 692e5c31af7Sopenharmony_ciOtherwise, the alpha values are not changed. 693e5c31af7Sopenharmony_ci 694e5c31af7Sopenharmony_ci 695e5c31af7Sopenharmony_ci[[fragops-ds-state]] 696e5c31af7Sopenharmony_ci== Depth and Stencil Operations 697e5c31af7Sopenharmony_ci 698e5c31af7Sopenharmony_ciPipeline state controlling the <<fragops-dbt,depth bounds tests>>, 699e5c31af7Sopenharmony_ci<<fragops-stencil,stencil test>>, and <<fragops-depth,depth test>> is 700e5c31af7Sopenharmony_cispecified through the members of the 701e5c31af7Sopenharmony_cisname:VkPipelineDepthStencilStateCreateInfo structure. 702e5c31af7Sopenharmony_ci 703e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDepthStencilStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline depth stencil state',type='structs'] 704e5c31af7Sopenharmony_ci-- 705e5c31af7Sopenharmony_ciThe sname:VkPipelineDepthStencilStateCreateInfo structure is defined as: 706e5c31af7Sopenharmony_ci 707e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineDepthStencilStateCreateInfo.txt[] 708e5c31af7Sopenharmony_ci 709e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 710e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 711e5c31af7Sopenharmony_ci structure. 712e5c31af7Sopenharmony_ciifndef::VK_ARM_rasterization_order_attachment_access[] 713e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 714e5c31af7Sopenharmony_ciendif::VK_ARM_rasterization_order_attachment_access[] 715e5c31af7Sopenharmony_ciifdef::VK_ARM_rasterization_order_attachment_access[] 716e5c31af7Sopenharmony_ci * pname:flags is a bitmask of 717e5c31af7Sopenharmony_ci elink:VkPipelineDepthStencilStateCreateFlagBits specifying additional 718e5c31af7Sopenharmony_ci depth/stencil state information. 719e5c31af7Sopenharmony_ciendif::VK_ARM_rasterization_order_attachment_access[] 720e5c31af7Sopenharmony_ci * pname:depthTestEnable controls whether <<fragops-depth,depth testing>> 721e5c31af7Sopenharmony_ci is enabled. 722e5c31af7Sopenharmony_ci * pname:depthWriteEnable controls whether <<fragops-depth-write,depth 723e5c31af7Sopenharmony_ci writes>> are enabled when pname:depthTestEnable is ename:VK_TRUE. 724e5c31af7Sopenharmony_ci Depth writes are always disabled when pname:depthTestEnable is 725e5c31af7Sopenharmony_ci ename:VK_FALSE. 726e5c31af7Sopenharmony_ci * pname:depthCompareOp is the comparison operator used in the 727e5c31af7Sopenharmony_ci <<fragops-depth,depth test>>. 728e5c31af7Sopenharmony_ci * pname:depthBoundsTestEnable controls whether <<fragops-dbt,depth bounds 729e5c31af7Sopenharmony_ci testing>> is enabled. 730e5c31af7Sopenharmony_ci * pname:stencilTestEnable controls whether <<fragops-stencil,stencil 731e5c31af7Sopenharmony_ci testing>> is enabled. 732e5c31af7Sopenharmony_ci * pname:front and pname:back control the parameters of the 733e5c31af7Sopenharmony_ci <<fragops-stencil,stencil test>>. 734e5c31af7Sopenharmony_ci * pname:minDepthBounds is the minimum depth bound used in the 735e5c31af7Sopenharmony_ci <<fragops-dbt, depth bounds test>>. 736e5c31af7Sopenharmony_ci * pname:maxDepthBounds is the maximum depth bound used in the 737e5c31af7Sopenharmony_ci <<fragops-dbt, depth bounds test>>. 738e5c31af7Sopenharmony_ci 739e5c31af7Sopenharmony_ci.Valid Usage 740e5c31af7Sopenharmony_ci**** 741e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-depthBoundsTestEnable-00598]] 742e5c31af7Sopenharmony_ci If the <<features-depthBounds,depth bounds testing>> feature is not 743e5c31af7Sopenharmony_ci enabled, pname:depthBoundsTestEnable must: be ename:VK_FALSE 744e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[] 745e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-separateStencilMaskRef-04453]] 746e5c31af7Sopenharmony_ci If the `apiext:VK_KHR_portability_subset` extension is enabled, and 747e5c31af7Sopenharmony_ci slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:separateStencilMaskRef 748e5c31af7Sopenharmony_ci is ename:VK_FALSE, and the value of 749e5c31af7Sopenharmony_ci slink:VkPipelineDepthStencilStateCreateInfo::pname:stencilTestEnable is 750e5c31af7Sopenharmony_ci ename:VK_TRUE, and the value of 751e5c31af7Sopenharmony_ci slink:VkPipelineRasterizationStateCreateInfo::pname:cullMode is 752e5c31af7Sopenharmony_ci ename:VK_CULL_MODE_NONE, the value of pname:reference in each of the 753e5c31af7Sopenharmony_ci slink:VkStencilOpState structs in pname:front and pname:back must: be 754e5c31af7Sopenharmony_ci the same 755e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[] 756e5c31af7Sopenharmony_ciifdef::VK_ARM_rasterization_order_attachment_access[] 757e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-rasterizationOrderDepthAttachmentAccess-06463]] 758e5c31af7Sopenharmony_ci If the <<features-rasterizationOrderDepthAttachmentAccess, 759e5c31af7Sopenharmony_ci pname:rasterizationOrderDepthAttachmentAccess>> feature is not enabled, 760e5c31af7Sopenharmony_ci pname:flags must: not include 761e5c31af7Sopenharmony_ci ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_ARM 762e5c31af7Sopenharmony_ci * [[VUID-VkPipelineDepthStencilStateCreateInfo-rasterizationOrderStencilAttachmentAccess-06464]] 763e5c31af7Sopenharmony_ci If the <<features-rasterizationOrderStencilAttachmentAccess, 764e5c31af7Sopenharmony_ci pname:rasterizationOrderStencilAttachmentAccess>> feature is not 765e5c31af7Sopenharmony_ci enabled, pname:flags must: not include 766e5c31af7Sopenharmony_ci ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_ARM 767e5c31af7Sopenharmony_ciendif::VK_ARM_rasterization_order_attachment_access[] 768e5c31af7Sopenharmony_ci**** 769e5c31af7Sopenharmony_ci 770e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineDepthStencilStateCreateInfo.txt[] 771e5c31af7Sopenharmony_ci-- 772e5c31af7Sopenharmony_ci 773e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDepthStencilStateCreateFlags',desc='Bitmask of VkPipelineDepthStencilStateCreateFlagBits',type='flags'] 774e5c31af7Sopenharmony_ci-- 775e5c31af7Sopenharmony_ci 776e5c31af7Sopenharmony_ciifndef::VK_ARM_rasterization_order_attachment_access[] 777e5c31af7Sopenharmony_citname:VkPipelineDepthStencilStateCreateFlags is a bitmask type for setting a 778e5c31af7Sopenharmony_cimask, but is currently reserved for future use. 779e5c31af7Sopenharmony_ciendif::VK_ARM_rasterization_order_attachment_access[] 780e5c31af7Sopenharmony_ciifdef::VK_ARM_rasterization_order_attachment_access[] 781e5c31af7Sopenharmony_citname:VkPipelineDepthStencilStateCreateFlags is a bitmask type for setting a 782e5c31af7Sopenharmony_cimask of zero or more elink:VkPipelineDepthStencilStateCreateFlagBits. 783e5c31af7Sopenharmony_ciendif::VK_ARM_rasterization_order_attachment_access[] 784e5c31af7Sopenharmony_ci-- 785e5c31af7Sopenharmony_ci 786e5c31af7Sopenharmony_ciifdef::VK_ARM_rasterization_order_attachment_access[] 787e5c31af7Sopenharmony_ci[open,refpage='VkPipelineDepthStencilStateCreateFlagBits',desc='Bitmask specifying additional depth/stencil state information.',type='enums'] 788e5c31af7Sopenharmony_ci-- 789e5c31af7Sopenharmony_ci 790e5c31af7Sopenharmony_ciBits which can: be set in the 791e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:flags parameter are: 792e5c31af7Sopenharmony_ci 793e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPipelineDepthStencilStateCreateFlagBits.txt[] 794e5c31af7Sopenharmony_ci 795e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_DEPTH_ACCESS_BIT_ARM 796e5c31af7Sopenharmony_ci indicates that access to the depth aspects of depth/stencil and input 797e5c31af7Sopenharmony_ci attachments will have implicit framebuffer-local memory dependencies. 798e5c31af7Sopenharmony_ci See <<renderpass-feedbackloop, renderpass feedback loops>> for more 799e5c31af7Sopenharmony_ci information. 800e5c31af7Sopenharmony_ci * ename:VK_PIPELINE_DEPTH_STENCIL_STATE_CREATE_RASTERIZATION_ORDER_ATTACHMENT_STENCIL_ACCESS_BIT_ARM 801e5c31af7Sopenharmony_ci indicates that access to the stencil aspects of depth/stencil and input 802e5c31af7Sopenharmony_ci attachments will have implicit framebuffer-local memory dependencies. 803e5c31af7Sopenharmony_ci See <<renderpass-feedbackloop, renderpass feedback loops>> for more 804e5c31af7Sopenharmony_ci information. 805e5c31af7Sopenharmony_ci-- 806e5c31af7Sopenharmony_ciendif::VK_ARM_rasterization_order_attachment_access[] 807e5c31af7Sopenharmony_ci 808e5c31af7Sopenharmony_ci 809e5c31af7Sopenharmony_ci[[fragops-dbt]] 810e5c31af7Sopenharmony_ci== Depth Bounds Test 811e5c31af7Sopenharmony_ci 812e5c31af7Sopenharmony_ciThe depth bounds test compares the depth value [eq]#z~a~# in the 813e5c31af7Sopenharmony_cidepth/stencil attachment at each sample's framebuffer coordinates 814e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# and <<primsrast-multisampling-coverage-mask, sample 815e5c31af7Sopenharmony_ciindex>> [eq]#i# against a set of _depth bounds_. 816e5c31af7Sopenharmony_ci 817e5c31af7Sopenharmony_ciThe depth bounds are determined by two floating point values defining a 818e5c31af7Sopenharmony_ciminimum (pname:minDepthBounds) and maximum (pname:maxDepthBounds) depth 819e5c31af7Sopenharmony_civalue. 820e5c31af7Sopenharmony_ciThese values are either set by the 821e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo structure during pipeline 822e5c31af7Sopenharmony_cicreation, or dynamically by 823e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 824e5c31af7Sopenharmony_ciflink:vkCmdSetDepthBoundsTestEnableEXT and 825e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 826e5c31af7Sopenharmony_ciflink:vkCmdSetDepthBounds. 827e5c31af7Sopenharmony_ci 828e5c31af7Sopenharmony_ciA given sample is considered within the depth bounds if [eq]#z~a~# is in the 829e5c31af7Sopenharmony_cirange [eq]#[pname:minDepthBounds,pname:maxDepthBounds]#. 830e5c31af7Sopenharmony_ciSamples with depth attachment values outside of the depth bounds will have 831e5c31af7Sopenharmony_citheir coverage set to `0`. 832e5c31af7Sopenharmony_ci 833e5c31af7Sopenharmony_ciIf the depth bounds test is disabled, or if there is no depth attachment, 834e5c31af7Sopenharmony_cithe coverage mask is unmodified by this operation. 835e5c31af7Sopenharmony_ci 836e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 837e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthBoundsTestEnableEXT',desc='Set depth bounds test enable dynamically for a command buffer',type='protos'] 838e5c31af7Sopenharmony_ci-- 839e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically enable or disable>> the depth 840e5c31af7Sopenharmony_cibounds test, call: 841e5c31af7Sopenharmony_ci 842e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthBoundsTestEnableEXT.txt[] 843e5c31af7Sopenharmony_ci 844e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 845e5c31af7Sopenharmony_ci recorded. 846e5c31af7Sopenharmony_ci * pname:depthBoundsTestEnable specifies if the depth bounds test is 847e5c31af7Sopenharmony_ci enabled. 848e5c31af7Sopenharmony_ci 849e5c31af7Sopenharmony_ciThis command sets the depth bounds enable for subsequent drawing commands 850e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 851e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT set in 852e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 853e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 854e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthBoundsTestEnable 855e5c31af7Sopenharmony_civalue used to create the currently active pipeline. 856e5c31af7Sopenharmony_ci 857e5c31af7Sopenharmony_ci.Valid Usage 858e5c31af7Sopenharmony_ci**** 859e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthBoundsTestEnableEXT-None-03349]] 860e5c31af7Sopenharmony_ci The <<features-extendedDynamicState, extendedDynamicState>> feature 861e5c31af7Sopenharmony_ci must: be enabled 862e5c31af7Sopenharmony_ci**** 863e5c31af7Sopenharmony_ci 864e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthBoundsTestEnableEXT.txt[] 865e5c31af7Sopenharmony_ci-- 866e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 867e5c31af7Sopenharmony_ci 868e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthBounds',desc='Set depth bounds range dynamically for a command buffer',type='protos'] 869e5c31af7Sopenharmony_ci-- 870e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the depth bounds range, 871e5c31af7Sopenharmony_cicall: 872e5c31af7Sopenharmony_ci 873e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthBounds.txt[] 874e5c31af7Sopenharmony_ci 875e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 876e5c31af7Sopenharmony_ci recorded. 877e5c31af7Sopenharmony_ci * pname:minDepthBounds is the minimum depth bound. 878e5c31af7Sopenharmony_ci * pname:maxDepthBounds is the maximum depth bound. 879e5c31af7Sopenharmony_ci 880e5c31af7Sopenharmony_ciThis command sets the depth bounds range for subsequent drawing commands 881e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 882e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_BOUNDS set in 883e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 884e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 885e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:minDepthBounds and 886e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:maxDepthBounds values 887e5c31af7Sopenharmony_ciused to create the currently active pipeline. 888e5c31af7Sopenharmony_ci 889e5c31af7Sopenharmony_ci.Valid Usage 890e5c31af7Sopenharmony_ci**** 891e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[] 892e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthBounds-minDepthBounds-00600]] 893e5c31af7Sopenharmony_ci Unless the `apiext:VK_EXT_depth_range_unrestricted` extension is enabled 894e5c31af7Sopenharmony_ci pname:minDepthBounds must: be between `0.0` and `1.0`, inclusive 895e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 896e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_range_unrestricted[] 897e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthBounds-minDepthBounds-02508]] 898e5c31af7Sopenharmony_ci pname:minDepthBounds must: be between `0.0` and `1.0`, inclusive 899e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 900e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[] 901e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthBounds-maxDepthBounds-00601]] 902e5c31af7Sopenharmony_ci Unless the `apiext:VK_EXT_depth_range_unrestricted` extension is enabled 903e5c31af7Sopenharmony_ci pname:maxDepthBounds must: be between `0.0` and `1.0`, inclusive 904e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 905e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_range_unrestricted[] 906e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthBounds-maxDepthBounds-02509]] 907e5c31af7Sopenharmony_ci pname:maxDepthBounds must: be between `0.0` and `1.0`, inclusive 908e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 909e5c31af7Sopenharmony_ci**** 910e5c31af7Sopenharmony_ci 911e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthBounds.txt[] 912e5c31af7Sopenharmony_ci-- 913e5c31af7Sopenharmony_ci 914e5c31af7Sopenharmony_ci 915e5c31af7Sopenharmony_ci[[fragops-stencil]] 916e5c31af7Sopenharmony_ci== Stencil Test 917e5c31af7Sopenharmony_ci 918e5c31af7Sopenharmony_ciThe stencil test compares the stencil attachment value [eq]#s~a~# in the 919e5c31af7Sopenharmony_cidepth/stencil attachment at each sample's framebuffer coordinates 920e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# and <<primsrast-multisampling-coverage-mask, sample 921e5c31af7Sopenharmony_ciindex>> [eq]#i# against a _stencil reference value_. 922e5c31af7Sopenharmony_ci 923e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 924e5c31af7Sopenharmony_ciIf the render pass has a fragment density map attachment and the fragment 925e5c31af7Sopenharmony_cicovers multiple pixels, there is an implementation-dependent association of 926e5c31af7Sopenharmony_cicoverage samples to stencil attachment samples within the fragment. 927e5c31af7Sopenharmony_ciHowever, if all samples in the fragment are covered, and the stencil 928e5c31af7Sopenharmony_ciattachment value is updated as a result of this test, all stencil attachment 929e5c31af7Sopenharmony_cisamples will be updated. 930e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 931e5c31af7Sopenharmony_ci 932e5c31af7Sopenharmony_ciIf the stencil test is not enabled, as specified by 933e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 934e5c31af7Sopenharmony_ciflink:vkCmdSetStencilTestEnableEXT or 935e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 936e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:stencilTestEnable, or if 937e5c31af7Sopenharmony_cithere is no stencil attachment, the coverage mask is unmodified by this 938e5c31af7Sopenharmony_cioperation. 939e5c31af7Sopenharmony_ci 940e5c31af7Sopenharmony_ciThe stencil test is controlled by one of two sets of stencil-related state, 941e5c31af7Sopenharmony_cithe front stencil state and the back stencil state. 942e5c31af7Sopenharmony_ciStencil tests and writes use the back stencil state when processing 943e5c31af7Sopenharmony_cifragments generated by <<primsrast-polygons-basic,back-facing>> 944e5c31af7Sopenharmony_ci<<primsrast-polygons,polygons>>, and the front stencil state when processing 945e5c31af7Sopenharmony_cifragments generated by <<primsrast-polygons-basic,front-facing polygons>> or 946e5c31af7Sopenharmony_ciany other primitives. 947e5c31af7Sopenharmony_ci 948e5c31af7Sopenharmony_ciThe comparison performed is based on the elink:VkCompareOp, compare mask 949e5c31af7Sopenharmony_ci[eq]#s~c~# , and stencil reference value [eq]#s~r~# of the relevant state 950e5c31af7Sopenharmony_ciset. 951e5c31af7Sopenharmony_ciThe compare mask and stencil reference value are set by either the 952e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo structure during pipeline 953e5c31af7Sopenharmony_cicreation, or by the flink:vkCmdSetStencilCompareMask and 954e5c31af7Sopenharmony_ciflink:vkCmdSetStencilReference commands respectively. 955e5c31af7Sopenharmony_ciThe compare operation is set by slink:VkStencilOpState::pname:compareOp 956e5c31af7Sopenharmony_ciduring pipeline creation. 957e5c31af7Sopenharmony_ci 958e5c31af7Sopenharmony_ciThe stencil reference and attachment values [eq]#s~r~# and [eq]#s~a~# are 959e5c31af7Sopenharmony_cieach independently combined with the compare mask [eq]#s~c~# using a logical 960e5c31af7Sopenharmony_cicode:AND operation to create masked reference and attachment values 961e5c31af7Sopenharmony_ci[eq]#s'~r~# and [eq]#s'~a~#. 962e5c31af7Sopenharmony_ci[eq]#s'~r~# and [eq]#s'~a~# are used as [eq]#A# and [eq]#B#, respectively, 963e5c31af7Sopenharmony_ciin the operation specified by elink:VkCompareOp. 964e5c31af7Sopenharmony_ci 965e5c31af7Sopenharmony_ciIf the comparison evaluates to false, the coverage for the sample is set to 966e5c31af7Sopenharmony_ci`0`. 967e5c31af7Sopenharmony_ci 968e5c31af7Sopenharmony_ciA new stencil value [eq]#s~g~# is generated according to a stencil operation 969e5c31af7Sopenharmony_cidefined by elink:VkStencilOp parameters set by 970e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 971e5c31af7Sopenharmony_ciflink:vkCmdSetStencilOpEXT or 972e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 973e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo. 974e5c31af7Sopenharmony_ciIf the stencil test fails, pname:failOp defines the stencil operation used. 975e5c31af7Sopenharmony_ciIf the stencil test passes however, the stencil op used is based on the 976e5c31af7Sopenharmony_ci<<fragops-depth, depth test>> - if it passes, 977e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:passOp is used, otherwise 978e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthFailOp is used. 979e5c31af7Sopenharmony_ci 980e5c31af7Sopenharmony_ciThe stencil attachment value [eq]#s~a~# is then updated with the generated 981e5c31af7Sopenharmony_cistencil value [eq]#s~g~# according to the write mask [eq]#s~w~# defined by 982e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:writeMask as: 983e5c31af7Sopenharmony_ci 984e5c31af7Sopenharmony_ci {empty}:: [eq]#s~a~ = (s~a~ & ¬s~w~) | (s~g~ & s~w~)# 985e5c31af7Sopenharmony_ci 986e5c31af7Sopenharmony_ciIf there is no stencil attachment, no value is written. 987e5c31af7Sopenharmony_ci 988e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 989e5c31af7Sopenharmony_ci 990e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilTestEnableEXT',desc='Set stencil test enable dynamically for a command buffer',type='protos'] 991e5c31af7Sopenharmony_ci-- 992e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically enable or disable>> the stencil 993e5c31af7Sopenharmony_citest, call: 994e5c31af7Sopenharmony_ci 995e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilTestEnableEXT.txt[] 996e5c31af7Sopenharmony_ci 997e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 998e5c31af7Sopenharmony_ci recorded. 999e5c31af7Sopenharmony_ci * pname:stencilTestEnable specifies if the stencil test is enabled. 1000e5c31af7Sopenharmony_ci 1001e5c31af7Sopenharmony_ciThis command sets the stencil test enable for subsequent drawing commands 1002e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1003e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT set in 1004e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1005e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1006e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:stencilTestEnable value 1007e5c31af7Sopenharmony_ciused to create the currently active pipeline. 1008e5c31af7Sopenharmony_ci 1009e5c31af7Sopenharmony_ci.Valid Usage 1010e5c31af7Sopenharmony_ci**** 1011e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetStencilTestEnableEXT-None-03350]] 1012e5c31af7Sopenharmony_ci The <<features-extendedDynamicState, extendedDynamicState>> feature 1013e5c31af7Sopenharmony_ci must: be enabled 1014e5c31af7Sopenharmony_ci**** 1015e5c31af7Sopenharmony_ci 1016e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilTestEnableEXT.txt[] 1017e5c31af7Sopenharmony_ci-- 1018e5c31af7Sopenharmony_ci 1019e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilOpEXT',desc='Set stencil operation dynamically for a command buffer',type='protos'] 1020e5c31af7Sopenharmony_ci-- 1021e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil operation, call: 1022e5c31af7Sopenharmony_ci 1023e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilOpEXT.txt[] 1024e5c31af7Sopenharmony_ci 1025e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1026e5c31af7Sopenharmony_ci recorded. 1027e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1028e5c31af7Sopenharmony_ci the set of stencil state for which to update the stencil operation. 1029e5c31af7Sopenharmony_ci * pname:failOp is a elink:VkStencilOp value specifying the action 1030e5c31af7Sopenharmony_ci performed on samples that fail the stencil test. 1031e5c31af7Sopenharmony_ci * pname:passOp is a elink:VkStencilOp value specifying the action 1032e5c31af7Sopenharmony_ci performed on samples that pass both the depth and stencil tests. 1033e5c31af7Sopenharmony_ci * pname:depthFailOp is a elink:VkStencilOp value specifying the action 1034e5c31af7Sopenharmony_ci performed on samples that pass the stencil test and fail the depth test. 1035e5c31af7Sopenharmony_ci * pname:compareOp is a elink:VkCompareOp value specifying the comparison 1036e5c31af7Sopenharmony_ci operator used in the stencil test. 1037e5c31af7Sopenharmony_ci 1038e5c31af7Sopenharmony_ciThis command sets the stencil operation for subsequent drawing commands when 1039e5c31af7Sopenharmony_cithe graphics pipeline is created with ename:VK_DYNAMIC_STATE_STENCIL_OP_EXT 1040e5c31af7Sopenharmony_ciset in slink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1041e5c31af7Sopenharmony_ciOtherwise, this state is specified by the corresponding 1042e5c31af7Sopenharmony_cisname:VkPipelineDepthStencilStateCreateInfo::pname:failOp, pname:passOp, 1043e5c31af7Sopenharmony_cipname:depthFailOp, and pname:compareOp values used to create the currently 1044e5c31af7Sopenharmony_ciactive pipeline, for both front and back faces. 1045e5c31af7Sopenharmony_ci 1046e5c31af7Sopenharmony_ci.Valid Usage 1047e5c31af7Sopenharmony_ci**** 1048e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetStencilOpEXT-None-03351]] 1049e5c31af7Sopenharmony_ci The <<features-extendedDynamicState, extendedDynamicState>> feature 1050e5c31af7Sopenharmony_ci must: be enabled 1051e5c31af7Sopenharmony_ci**** 1052e5c31af7Sopenharmony_ci 1053e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilOpEXT.txt[] 1054e5c31af7Sopenharmony_ci-- 1055e5c31af7Sopenharmony_ci 1056e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 1057e5c31af7Sopenharmony_ci 1058e5c31af7Sopenharmony_ci[open,refpage='VkStencilOpState',desc='Structure specifying stencil operation state',type='structs'] 1059e5c31af7Sopenharmony_ci-- 1060e5c31af7Sopenharmony_ciThe sname:VkStencilOpState structure is defined as: 1061e5c31af7Sopenharmony_ci 1062e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkStencilOpState.txt[] 1063e5c31af7Sopenharmony_ci 1064e5c31af7Sopenharmony_ci * pname:failOp is a elink:VkStencilOp value specifying the action 1065e5c31af7Sopenharmony_ci performed on samples that fail the stencil test. 1066e5c31af7Sopenharmony_ci * pname:passOp is a elink:VkStencilOp value specifying the action 1067e5c31af7Sopenharmony_ci performed on samples that pass both the depth and stencil tests. 1068e5c31af7Sopenharmony_ci * pname:depthFailOp is a elink:VkStencilOp value specifying the action 1069e5c31af7Sopenharmony_ci performed on samples that pass the stencil test and fail the depth test. 1070e5c31af7Sopenharmony_ci * pname:compareOp is a elink:VkCompareOp value specifying the comparison 1071e5c31af7Sopenharmony_ci operator used in the stencil test. 1072e5c31af7Sopenharmony_ci * pname:compareMask selects the bits of the unsigned integer stencil 1073e5c31af7Sopenharmony_ci values participating in the stencil test. 1074e5c31af7Sopenharmony_ci * pname:writeMask selects the bits of the unsigned integer stencil values 1075e5c31af7Sopenharmony_ci updated by the stencil test in the stencil framebuffer attachment. 1076e5c31af7Sopenharmony_ci * pname:reference is an integer reference value that is used in the 1077e5c31af7Sopenharmony_ci unsigned stencil comparison. 1078e5c31af7Sopenharmony_ci 1079e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkStencilOpState.txt[] 1080e5c31af7Sopenharmony_ci-- 1081e5c31af7Sopenharmony_ci 1082e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilCompareMask',desc='Set stencil compare mask dynamically for a command buffer',type='protos'] 1083e5c31af7Sopenharmony_ci-- 1084e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil compare mask 1085e5c31af7Sopenharmony_cicall: 1086e5c31af7Sopenharmony_ci 1087e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilCompareMask.txt[] 1088e5c31af7Sopenharmony_ci 1089e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1090e5c31af7Sopenharmony_ci recorded. 1091e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1092e5c31af7Sopenharmony_ci the set of stencil state for which to update the compare mask. 1093e5c31af7Sopenharmony_ci * pname:compareMask is the new value to use as the stencil compare mask. 1094e5c31af7Sopenharmony_ci 1095e5c31af7Sopenharmony_ciThis command sets the stencil compare mask for subsequent drawing commands 1096e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1097e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK set in 1098e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1099e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1100e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:compareMask value used to 1101e5c31af7Sopenharmony_cicreate the currently active pipeline, for both front and back faces. 1102e5c31af7Sopenharmony_ci 1103e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilCompareMask.txt[] 1104e5c31af7Sopenharmony_ci-- 1105e5c31af7Sopenharmony_ci 1106e5c31af7Sopenharmony_ci[open,refpage='VkStencilFaceFlagBits',desc='Bitmask specifying sets of stencil state for which to update the compare mask',type='enums'] 1107e5c31af7Sopenharmony_ci-- 1108e5c31af7Sopenharmony_ciename:VkStencilFaceFlagBits values are: 1109e5c31af7Sopenharmony_ci 1110e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkStencilFaceFlagBits.txt[] 1111e5c31af7Sopenharmony_ci 1112e5c31af7Sopenharmony_ci * ename:VK_STENCIL_FACE_FRONT_BIT specifies that only the front set of 1113e5c31af7Sopenharmony_ci stencil state is updated. 1114e5c31af7Sopenharmony_ci * ename:VK_STENCIL_FACE_BACK_BIT specifies that only the back set of 1115e5c31af7Sopenharmony_ci stencil state is updated. 1116e5c31af7Sopenharmony_ci * ename:VK_STENCIL_FACE_FRONT_AND_BACK is the combination of 1117e5c31af7Sopenharmony_ci ename:VK_STENCIL_FACE_FRONT_BIT and ename:VK_STENCIL_FACE_BACK_BIT, and 1118e5c31af7Sopenharmony_ci specifies that both sets of stencil state are updated. 1119e5c31af7Sopenharmony_ci 1120e5c31af7Sopenharmony_ci-- 1121e5c31af7Sopenharmony_ci 1122e5c31af7Sopenharmony_ci[open,refpage='VkStencilFaceFlags',desc='Bitmask of VkStencilFaceFlagBits',type='flags'] 1123e5c31af7Sopenharmony_ci-- 1124e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkStencilFaceFlags.txt[] 1125e5c31af7Sopenharmony_ci 1126e5c31af7Sopenharmony_citname:VkStencilFaceFlags is a bitmask type for setting a mask of zero or 1127e5c31af7Sopenharmony_cimore elink:VkStencilFaceFlagBits. 1128e5c31af7Sopenharmony_ci-- 1129e5c31af7Sopenharmony_ci 1130e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilWriteMask',desc='Set stencil write mask dynamically for a command buffer',type='protos'] 1131e5c31af7Sopenharmony_ci-- 1132e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil write mask, 1133e5c31af7Sopenharmony_cicall: 1134e5c31af7Sopenharmony_ci 1135e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilWriteMask.txt[] 1136e5c31af7Sopenharmony_ci 1137e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1138e5c31af7Sopenharmony_ci recorded. 1139e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1140e5c31af7Sopenharmony_ci the set of stencil state for which to update the write mask, as 1141e5c31af7Sopenharmony_ci described above for flink:vkCmdSetStencilCompareMask. 1142e5c31af7Sopenharmony_ci * pname:writeMask is the new value to use as the stencil write mask. 1143e5c31af7Sopenharmony_ci 1144e5c31af7Sopenharmony_ciThis command sets the stencil write mask for subsequent drawing commands 1145e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1146e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_WRITE_MASK set in 1147e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1148e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1149e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:writeMask value used to 1150e5c31af7Sopenharmony_cicreate the currently active pipeline, for both front and back faces. 1151e5c31af7Sopenharmony_ci 1152e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilWriteMask.txt[] 1153e5c31af7Sopenharmony_ci-- 1154e5c31af7Sopenharmony_ci 1155e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetStencilReference',desc='Set stencil reference value dynamically for a command buffer',type='protos'] 1156e5c31af7Sopenharmony_ci-- 1157e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the stencil reference value, 1158e5c31af7Sopenharmony_cicall: 1159e5c31af7Sopenharmony_ci 1160e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetStencilReference.txt[] 1161e5c31af7Sopenharmony_ci 1162e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1163e5c31af7Sopenharmony_ci recorded. 1164e5c31af7Sopenharmony_ci * pname:faceMask is a bitmask of elink:VkStencilFaceFlagBits specifying 1165e5c31af7Sopenharmony_ci the set of stencil state for which to update the reference value, as 1166e5c31af7Sopenharmony_ci described above for flink:vkCmdSetStencilCompareMask. 1167e5c31af7Sopenharmony_ci * pname:reference is the new value to use as the stencil reference value. 1168e5c31af7Sopenharmony_ci 1169e5c31af7Sopenharmony_ciThis command sets the stencil reference value for subsequent drawing 1170e5c31af7Sopenharmony_cicommands when the graphics pipeline is created with 1171e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_STENCIL_REFERENCE set in 1172e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1173e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1174e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:reference value used to 1175e5c31af7Sopenharmony_cicreate the currently active pipeline, for both front and back faces. 1176e5c31af7Sopenharmony_ci 1177e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetStencilReference.txt[] 1178e5c31af7Sopenharmony_ci-- 1179e5c31af7Sopenharmony_ci 1180e5c31af7Sopenharmony_ci[open,refpage='VkCompareOp',desc='Stencil comparison function',type='enums'] 1181e5c31af7Sopenharmony_ci-- 1182e5c31af7Sopenharmony_ciPossible values of slink:VkStencilOpState::pname:compareOp, specifying the 1183e5c31af7Sopenharmony_cistencil comparison function, are: 1184e5c31af7Sopenharmony_ci 1185e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCompareOp.txt[] 1186e5c31af7Sopenharmony_ci 1187e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_NEVER specifies that the test evaluates to false. 1188e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_LESS specifies that the test evaluates [eq]#A < B#. 1189e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_EQUAL specifies that the test evaluates [eq]#A = B#. 1190e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_LESS_OR_EQUAL specifies that the test evaluates 1191e5c31af7Sopenharmony_ci [eq]#A {leq} B#. 1192e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_GREATER specifies that the test evaluates [eq]#A > 1193e5c31af7Sopenharmony_ci B#. 1194e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_NOT_EQUAL specifies that the test evaluates [eq]#A 1195e5c31af7Sopenharmony_ci {neq} B#. 1196e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_GREATER_OR_EQUAL specifies that the test evaluates 1197e5c31af7Sopenharmony_ci [eq]#A {geq} B#. 1198e5c31af7Sopenharmony_ci * ename:VK_COMPARE_OP_ALWAYS specifies that the test evaluates to true. 1199e5c31af7Sopenharmony_ci-- 1200e5c31af7Sopenharmony_ci 1201e5c31af7Sopenharmony_ci[open,refpage='VkStencilOp',desc='Stencil comparison function',type='enums'] 1202e5c31af7Sopenharmony_ci-- 1203e5c31af7Sopenharmony_ciPossible values of the pname:failOp, pname:passOp, and pname:depthFailOp 1204e5c31af7Sopenharmony_cimembers of slink:VkStencilOpState, specifying what happens to the stored 1205e5c31af7Sopenharmony_cistencil value if this or certain subsequent tests fail or pass, are: 1206e5c31af7Sopenharmony_ci 1207e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkStencilOp.txt[] 1208e5c31af7Sopenharmony_ci 1209e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_KEEP keeps the current value. 1210e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_ZERO sets the value to 0. 1211e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_REPLACE sets the value to pname:reference. 1212e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_INCREMENT_AND_CLAMP increments the current value and 1213e5c31af7Sopenharmony_ci clamps to the maximum representable unsigned value. 1214e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_DECREMENT_AND_CLAMP decrements the current value and 1215e5c31af7Sopenharmony_ci clamps to 0. 1216e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_INVERT bitwise-inverts the current value. 1217e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_INCREMENT_AND_WRAP increments the current value and 1218e5c31af7Sopenharmony_ci wraps to 0 when the maximum value would have been exceeded. 1219e5c31af7Sopenharmony_ci * ename:VK_STENCIL_OP_DECREMENT_AND_WRAP decrements the current value and 1220e5c31af7Sopenharmony_ci wraps to the maximum possible value when the value would go below 0. 1221e5c31af7Sopenharmony_ci 1222e5c31af7Sopenharmony_ciFor purposes of increment and decrement, the stencil bits are considered as 1223e5c31af7Sopenharmony_cian unsigned integer. 1224e5c31af7Sopenharmony_ci-- 1225e5c31af7Sopenharmony_ci 1226e5c31af7Sopenharmony_ci 1227e5c31af7Sopenharmony_ci[[fragops-depth]] 1228e5c31af7Sopenharmony_ci== Depth Test 1229e5c31af7Sopenharmony_ci 1230e5c31af7Sopenharmony_ciThe depth test compares the depth value [eq]#z~a~# in the depth/stencil 1231e5c31af7Sopenharmony_ciattachment at each sample's framebuffer coordinates [eq]#(x~f~,y~f~)# and 1232e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# against the 1233e5c31af7Sopenharmony_cisample's depth value [eq]#z~f~#. 1234e5c31af7Sopenharmony_ciIf there is no depth attachment then the depth test is skipped. 1235e5c31af7Sopenharmony_ci 1236e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 1237e5c31af7Sopenharmony_ciIf the render pass has a fragment density map attachment and the fragment 1238e5c31af7Sopenharmony_cicovers multiple pixels, there is an implementation-dependent association of 1239e5c31af7Sopenharmony_cirasterization samples to depth attachment samples within the fragment. 1240e5c31af7Sopenharmony_ciHowever, if all samples in the fragment are covered, and the depth 1241e5c31af7Sopenharmony_ciattachment value is updated as a result of this test, all depth attachment 1242e5c31af7Sopenharmony_cisamples will be updated. 1243e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 1244e5c31af7Sopenharmony_ci 1245e5c31af7Sopenharmony_ciThe depth test occurs in three stages, as detailed in the following 1246e5c31af7Sopenharmony_cisections. 1247e5c31af7Sopenharmony_ci 1248e5c31af7Sopenharmony_ci=== Depth Clamping and Range Adjustment 1249e5c31af7Sopenharmony_ci 1250e5c31af7Sopenharmony_ciIf slink:VkPipelineRasterizationStateCreateInfo::pname:depthClampEnable is 1251e5c31af7Sopenharmony_cienabled, before the sample's [eq]#z~f~# is compared to [eq]#z~a~#, 1252e5c31af7Sopenharmony_ci[eq]#z~f~# is clamped to [eq]#[min(n,f),max(n,f)]#, where [eq]#n# and 1253e5c31af7Sopenharmony_ci[eq]#f# are the pname:minDepth and pname:maxDepth depth range values of the 1254e5c31af7Sopenharmony_civiewport used by this fragment, respectively. 1255e5c31af7Sopenharmony_ci 1256e5c31af7Sopenharmony_ciIf depth clamping is not enabled and [eq]#z~f~# is not in the range [eq]#[0, 1257e5c31af7Sopenharmony_ci1]# 1258e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[] 1259e5c31af7Sopenharmony_ciand either apiext:VK_EXT_depth_range_unrestricted is not enabled, or the 1260e5c31af7Sopenharmony_cidepth attachment has a fixed-point format, 1261e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[] 1262e5c31af7Sopenharmony_cithen [eq]#z~f~# is undefined: following this step. 1263e5c31af7Sopenharmony_ci 1264e5c31af7Sopenharmony_ci 1265e5c31af7Sopenharmony_ci=== Depth Comparison 1266e5c31af7Sopenharmony_ci 1267e5c31af7Sopenharmony_ciIf the depth test is not enabled, as specified by 1268e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 1269e5c31af7Sopenharmony_ciflink:vkCmdSetDepthTestEnableEXT or 1270e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 1271e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthTestEnable, then 1272e5c31af7Sopenharmony_cithis step is skipped. 1273e5c31af7Sopenharmony_ci 1274e5c31af7Sopenharmony_ciThe comparison performed is based on the elink:VkCompareOp, set by 1275e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 1276e5c31af7Sopenharmony_ciflink:vkCmdSetDepthCompareOpEXT or 1277e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 1278e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthCompareOp during 1279e5c31af7Sopenharmony_cipipeline creation. 1280e5c31af7Sopenharmony_ci[eq]#z~f~# and [eq]#z~a~# are used as [eq]#A# and [eq]#B#, respectively, in 1281e5c31af7Sopenharmony_cithe operation specified by the elink:VkCompareOp. 1282e5c31af7Sopenharmony_ci 1283e5c31af7Sopenharmony_ciIf the comparison evaluates to false, the coverage for the sample is set to 1284e5c31af7Sopenharmony_ci`0`. 1285e5c31af7Sopenharmony_ci 1286e5c31af7Sopenharmony_ci 1287e5c31af7Sopenharmony_ci[[fragops-depth-write]] 1288e5c31af7Sopenharmony_ci=== Depth Attachment Writes 1289e5c31af7Sopenharmony_ci 1290e5c31af7Sopenharmony_ciIf depth writes are enabled, as specified by 1291e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 1292e5c31af7Sopenharmony_ciflink:vkCmdSetDepthWriteEnableEXT or 1293e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 1294e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthWriteEnable, and the 1295e5c31af7Sopenharmony_cicomparison evaluated to true, the depth attachment value [eq]#z~a~# is set 1296e5c31af7Sopenharmony_cito the sample's depth value [eq]#z~f~#. 1297e5c31af7Sopenharmony_ciIf there is no depth attachment, no value is written. 1298e5c31af7Sopenharmony_ci 1299e5c31af7Sopenharmony_ci 1300e5c31af7Sopenharmony_ci 1301e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[] 1302e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthTestEnableEXT',desc='Set depth test enable dynamically for a command buffer',type='protos'] 1303e5c31af7Sopenharmony_ci-- 1304e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically enable or disable>> the depth 1305e5c31af7Sopenharmony_citest, call: 1306e5c31af7Sopenharmony_ci 1307e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthTestEnableEXT.txt[] 1308e5c31af7Sopenharmony_ci 1309e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1310e5c31af7Sopenharmony_ci recorded. 1311e5c31af7Sopenharmony_ci * pname:depthTestEnable specifies if the depth test is enabled. 1312e5c31af7Sopenharmony_ci 1313e5c31af7Sopenharmony_ciThis command sets the depth test enable for subsequent drawing commands when 1314e5c31af7Sopenharmony_cithe graphics pipeline is created with 1315e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT set in 1316e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1317e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1318e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthTestEnable value 1319e5c31af7Sopenharmony_ciused to create the currently active pipeline. 1320e5c31af7Sopenharmony_ci 1321e5c31af7Sopenharmony_ci.Valid Usage 1322e5c31af7Sopenharmony_ci**** 1323e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthTestEnableEXT-None-03352]] 1324e5c31af7Sopenharmony_ci The <<features-extendedDynamicState, extendedDynamicState>> feature 1325e5c31af7Sopenharmony_ci must: be enabled 1326e5c31af7Sopenharmony_ci**** 1327e5c31af7Sopenharmony_ci 1328e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthTestEnableEXT.txt[] 1329e5c31af7Sopenharmony_ci-- 1330e5c31af7Sopenharmony_ci 1331e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthCompareOpEXT',desc='Set depth comparison operator dynamically for a command buffer',type='protos'] 1332e5c31af7Sopenharmony_ci-- 1333e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the depth compare operator, 1334e5c31af7Sopenharmony_cicall: 1335e5c31af7Sopenharmony_ci 1336e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthCompareOpEXT.txt[] 1337e5c31af7Sopenharmony_ci 1338e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1339e5c31af7Sopenharmony_ci recorded. 1340e5c31af7Sopenharmony_ci * pname:depthCompareOp specifies the depth comparison operator. 1341e5c31af7Sopenharmony_ci 1342e5c31af7Sopenharmony_ciThis command sets the depth comparison operator for subsequent drawing 1343e5c31af7Sopenharmony_cicommands when the graphics pipeline is created with 1344e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT set in 1345e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1346e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1347e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthCompareOp value used 1348e5c31af7Sopenharmony_cito create the currently active pipeline. 1349e5c31af7Sopenharmony_ci 1350e5c31af7Sopenharmony_ci.Valid Usage 1351e5c31af7Sopenharmony_ci**** 1352e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthCompareOpEXT-None-03353]] 1353e5c31af7Sopenharmony_ci The <<features-extendedDynamicState, extendedDynamicState>> feature 1354e5c31af7Sopenharmony_ci must: be enabled 1355e5c31af7Sopenharmony_ci**** 1356e5c31af7Sopenharmony_ci 1357e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthCompareOpEXT.txt[] 1358e5c31af7Sopenharmony_ci-- 1359e5c31af7Sopenharmony_ci 1360e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetDepthWriteEnableEXT',desc='Set depth write enable dynamically for a command buffer',type='protos'] 1361e5c31af7Sopenharmony_ci-- 1362e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the depth write enable, 1363e5c31af7Sopenharmony_cicall: 1364e5c31af7Sopenharmony_ci 1365e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetDepthWriteEnableEXT.txt[] 1366e5c31af7Sopenharmony_ci 1367e5c31af7Sopenharmony_ci * pname:commandBuffer is the command buffer into which the command will be 1368e5c31af7Sopenharmony_ci recorded. 1369e5c31af7Sopenharmony_ci * pname:depthWriteEnable specifies if depth writes are enabled. 1370e5c31af7Sopenharmony_ci 1371e5c31af7Sopenharmony_ciThis command sets the depth write enable for subsequent drawing commands 1372e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with 1373e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT set in 1374e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates. 1375e5c31af7Sopenharmony_ciOtherwise, this state is specified by the 1376e5c31af7Sopenharmony_cislink:VkPipelineDepthStencilStateCreateInfo::pname:depthWriteEnable value 1377e5c31af7Sopenharmony_ciused to create the currently active pipeline. 1378e5c31af7Sopenharmony_ci 1379e5c31af7Sopenharmony_ci.Valid Usage 1380e5c31af7Sopenharmony_ci**** 1381e5c31af7Sopenharmony_ci * [[VUID-vkCmdSetDepthWriteEnableEXT-None-03354]] 1382e5c31af7Sopenharmony_ci The <<features-extendedDynamicState, extendedDynamicState>> feature 1383e5c31af7Sopenharmony_ci must: be enabled 1384e5c31af7Sopenharmony_ci**** 1385e5c31af7Sopenharmony_ci 1386e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetDepthWriteEnableEXT.txt[] 1387e5c31af7Sopenharmony_ci-- 1388e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[] 1389e5c31af7Sopenharmony_ci 1390e5c31af7Sopenharmony_ci 1391e5c31af7Sopenharmony_ciifdef::VK_NV_representative_fragment_test[] 1392e5c31af7Sopenharmony_ci[[fragops-rep-frag-test]] 1393e5c31af7Sopenharmony_ci== Representative Fragment Test 1394e5c31af7Sopenharmony_ci 1395e5c31af7Sopenharmony_ciThe representative fragment test allows implementations to reduce the amount 1396e5c31af7Sopenharmony_ciof rasterization and fragment processing work performed for each point, 1397e5c31af7Sopenharmony_ciline, or triangle primitive. 1398e5c31af7Sopenharmony_ciFor any primitive that produces one or more fragments that pass all prior 1399e5c31af7Sopenharmony_ciearly fragment tests, the implementation may: choose one or more 1400e5c31af7Sopenharmony_ci"`representative`" fragments for processing and discard all other fragments. 1401e5c31af7Sopenharmony_ciFor draw calls rendering multiple points, lines, or triangles arranged in 1402e5c31af7Sopenharmony_cilists, strips, or fans, the representative fragment test is performed 1403e5c31af7Sopenharmony_ciindependently for each of those primitives. 1404e5c31af7Sopenharmony_ciThe set of fragments discarded by the representative fragment test is 1405e5c31af7Sopenharmony_ciimplementation-dependent. 1406e5c31af7Sopenharmony_ciIn some cases, the representative fragment test may not discard any 1407e5c31af7Sopenharmony_cifragments for a given primitive. 1408e5c31af7Sopenharmony_ci 1409e5c31af7Sopenharmony_ci[open,refpage='VkPipelineRepresentativeFragmentTestStateCreateInfoNV',desc='Structure specifying representative fragment test',type='structs'] 1410e5c31af7Sopenharmony_ci-- 1411e5c31af7Sopenharmony_ciIf the pname:pNext chain of slink:VkGraphicsPipelineCreateInfo includes a 1412e5c31af7Sopenharmony_cisname:VkPipelineRepresentativeFragmentTestStateCreateInfoNV structure, then 1413e5c31af7Sopenharmony_cithat structure includes parameters controlling the representative fragment 1414e5c31af7Sopenharmony_citest. 1415e5c31af7Sopenharmony_ci 1416e5c31af7Sopenharmony_ciThe sname:VkPipelineRepresentativeFragmentTestStateCreateInfoNV structure is 1417e5c31af7Sopenharmony_cidefined as: 1418e5c31af7Sopenharmony_ci 1419e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineRepresentativeFragmentTestStateCreateInfoNV.txt[] 1420e5c31af7Sopenharmony_ci 1421e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 1422e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1423e5c31af7Sopenharmony_ci structure. 1424e5c31af7Sopenharmony_ci * pname:representativeFragmentTestEnable controls whether the 1425e5c31af7Sopenharmony_ci representative fragment test is enabled. 1426e5c31af7Sopenharmony_ci 1427e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, 1428e5c31af7Sopenharmony_cipname:representativeFragmentTestEnable is considered to be ename:VK_FALSE, 1429e5c31af7Sopenharmony_ciand the representative fragment test is disabled. 1430e5c31af7Sopenharmony_ci 1431e5c31af7Sopenharmony_ciIf the active fragment shader specifies the code:EarlyFragmentTests 1432e5c31af7Sopenharmony_ciexecution mode, the representative fragment shader test has no effect, even 1433e5c31af7Sopenharmony_ciif enabled. 1434e5c31af7Sopenharmony_ci 1435e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineRepresentativeFragmentTestStateCreateInfoNV.txt[] 1436e5c31af7Sopenharmony_ci-- 1437e5c31af7Sopenharmony_ci 1438e5c31af7Sopenharmony_ciendif::VK_NV_representative_fragment_test[] 1439e5c31af7Sopenharmony_ci 1440e5c31af7Sopenharmony_ci 1441e5c31af7Sopenharmony_ci[[fragops-samplecount]] 1442e5c31af7Sopenharmony_ci== Sample Counting 1443e5c31af7Sopenharmony_ci 1444e5c31af7Sopenharmony_ciOcclusion queries use query pool entries to track the number of samples that 1445e5c31af7Sopenharmony_cipass all the per-fragment tests. 1446e5c31af7Sopenharmony_ciThe mechanism of collecting an occlusion query value is described in 1447e5c31af7Sopenharmony_ci<<queries-occlusion,Occlusion Queries>>. 1448e5c31af7Sopenharmony_ci 1449e5c31af7Sopenharmony_ciThe occlusion query sample counter increments by one for each sample with a 1450e5c31af7Sopenharmony_cicoverage value of 1 in each fragment that survives all the per-fragment 1451e5c31af7Sopenharmony_citests, including scissor, 1452e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 1453e5c31af7Sopenharmony_ciexclusive scissor, 1454e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 1455e5c31af7Sopenharmony_cisample mask, alpha to coverage, stencil, and depth tests. 1456e5c31af7Sopenharmony_ci 1457e5c31af7Sopenharmony_ci 1458e5c31af7Sopenharmony_ciifdef::VK_NV_fragment_coverage_to_color[] 1459e5c31af7Sopenharmony_ci[[fragops-coverage-to-color]] 1460e5c31af7Sopenharmony_ci== Fragment Coverage To Color 1461e5c31af7Sopenharmony_ci 1462e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageToColorStateCreateInfoNV',desc='Structure specifying whether fragment coverage replaces a color',type='structs'] 1463e5c31af7Sopenharmony_ci-- 1464e5c31af7Sopenharmony_ciThe sname:VkPipelineCoverageToColorStateCreateInfoNV structure is defined 1465e5c31af7Sopenharmony_cias: 1466e5c31af7Sopenharmony_ci 1467e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineCoverageToColorStateCreateInfoNV.txt[] 1468e5c31af7Sopenharmony_ci 1469e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 1470e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1471e5c31af7Sopenharmony_ci structure. 1472e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 1473e5c31af7Sopenharmony_ci * pname:coverageToColorEnable controls whether the fragment coverage value 1474e5c31af7Sopenharmony_ci replaces a fragment color output. 1475e5c31af7Sopenharmony_ci * pname:coverageToColorLocation controls which fragment shader color 1476e5c31af7Sopenharmony_ci output value is replaced. 1477e5c31af7Sopenharmony_ci 1478e5c31af7Sopenharmony_ciIf the pname:pNext chain of slink:VkPipelineMultisampleStateCreateInfo 1479e5c31af7Sopenharmony_ciincludes a sname:VkPipelineCoverageToColorStateCreateInfoNV structure, then 1480e5c31af7Sopenharmony_cithat structure controls whether the fragment coverage is substituted for a 1481e5c31af7Sopenharmony_cifragment color output and, if so, which output is replaced. 1482e5c31af7Sopenharmony_ci 1483e5c31af7Sopenharmony_ciIf pname:coverageToColorEnable is ename:VK_TRUE, the 1484e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, coverage mask>> replaces the first 1485e5c31af7Sopenharmony_cicomponent of the color value corresponding to the fragment shader output 1486e5c31af7Sopenharmony_cilocation with code:Location equal to pname:coverageToColorLocation and 1487e5c31af7Sopenharmony_cicode:Index equal to zero. 1488e5c31af7Sopenharmony_ciIf the color attachment format has fewer bits than the coverage mask, the 1489e5c31af7Sopenharmony_cilow bits of the sample coverage mask are taken without any clamping. 1490e5c31af7Sopenharmony_ciIf the color attachment format has more bits than the coverage mask, the 1491e5c31af7Sopenharmony_cihigh bits of the sample coverage mask are filled with zeros. 1492e5c31af7Sopenharmony_ci 1493e5c31af7Sopenharmony_ciIf pname:coverageToColorEnable is ename:VK_FALSE, these operations are 1494e5c31af7Sopenharmony_ciskipped. 1495e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is as if 1496e5c31af7Sopenharmony_cipname:coverageToColorEnable is ename:VK_FALSE. 1497e5c31af7Sopenharmony_ci 1498e5c31af7Sopenharmony_ci.Valid Usage 1499e5c31af7Sopenharmony_ci**** 1500e5c31af7Sopenharmony_ci * [[VUID-VkPipelineCoverageToColorStateCreateInfoNV-coverageToColorEnable-01404]] 1501e5c31af7Sopenharmony_ci If pname:coverageToColorEnable is ename:VK_TRUE, then the render pass 1502e5c31af7Sopenharmony_ci subpass indicated by 1503e5c31af7Sopenharmony_ci slink:VkGraphicsPipelineCreateInfo::pname:renderPass and 1504e5c31af7Sopenharmony_ci slink:VkGraphicsPipelineCreateInfo::pname:subpass must: have a color 1505e5c31af7Sopenharmony_ci attachment at the location selected by pname:coverageToColorLocation, 1506e5c31af7Sopenharmony_ci with a elink:VkFormat of ename:VK_FORMAT_R8_UINT, 1507e5c31af7Sopenharmony_ci ename:VK_FORMAT_R8_SINT, ename:VK_FORMAT_R16_UINT, 1508e5c31af7Sopenharmony_ci ename:VK_FORMAT_R16_SINT, ename:VK_FORMAT_R32_UINT, or 1509e5c31af7Sopenharmony_ci ename:VK_FORMAT_R32_SINT 1510e5c31af7Sopenharmony_ci**** 1511e5c31af7Sopenharmony_ci 1512e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineCoverageToColorStateCreateInfoNV.txt[] 1513e5c31af7Sopenharmony_ci-- 1514e5c31af7Sopenharmony_ci 1515e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageToColorStateCreateFlagsNV',desc='Reserved for future use',type='flags'] 1516e5c31af7Sopenharmony_ci-- 1517e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineCoverageToColorStateCreateFlagsNV.txt[] 1518e5c31af7Sopenharmony_ci 1519e5c31af7Sopenharmony_citname:VkPipelineCoverageToColorStateCreateFlagsNV is a bitmask type for 1520e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 1521e5c31af7Sopenharmony_ci-- 1522e5c31af7Sopenharmony_ciendif::VK_NV_fragment_coverage_to_color[] 1523e5c31af7Sopenharmony_ci 1524e5c31af7Sopenharmony_ci 1525e5c31af7Sopenharmony_ci[[fragops-coverage-reduction]] 1526e5c31af7Sopenharmony_ci== Coverage Reduction 1527e5c31af7Sopenharmony_ci 1528e5c31af7Sopenharmony_ciCoverage reduction takes the coverage information for a fragment and 1529e5c31af7Sopenharmony_ciconverts that to a boolean coverage value for each color sample in each 1530e5c31af7Sopenharmony_cipixel covered by the fragment. 1531e5c31af7Sopenharmony_ci 1532e5c31af7Sopenharmony_ci 1533e5c31af7Sopenharmony_ci=== Pixel Coverage 1534e5c31af7Sopenharmony_ci 1535e5c31af7Sopenharmony_ciCoverage for each pixel is first extracted from the total fragment coverage 1536e5c31af7Sopenharmony_cimask. 1537e5c31af7Sopenharmony_ciThis consists of pname:rasterizationSamples unique coverage samples for each 1538e5c31af7Sopenharmony_cipixel in the fragment area, each with a unique 1539e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>>. 1540e5c31af7Sopenharmony_ciIf the fragment only contains a single pixel, coverage for the pixel is 1541e5c31af7Sopenharmony_ciequivalent to the fragment coverage. 1542e5c31af7Sopenharmony_ci 1543e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 1544e5c31af7Sopenharmony_ciIf the render pass has a fragment density map attachment and the fragment 1545e5c31af7Sopenharmony_cicovers multiple pixels, pixel coverage is generated in an 1546e5c31af7Sopenharmony_ciimplementation-dependent manner. 1547e5c31af7Sopenharmony_ciIf all samples in the fragment are covered, all samples will be covered in 1548e5c31af7Sopenharmony_cieach pixel coverage. 1549e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 1550e5c31af7Sopenharmony_ci 1551e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 1552e5c31af7Sopenharmony_ciIf a <<primsrast-shading-rate-image,shading rate image>> is used, and the 1553e5c31af7Sopenharmony_cifragment covers multiple pixels, each pixel's coverage consists of the 1554e5c31af7Sopenharmony_cicoverage samples corresponding to that pixel, and each sample retains its 1555e5c31af7Sopenharmony_ciunique <<primsrast-multisampling-coverage-mask, sample index [eq]#i#>>. 1556e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 1557e5c31af7Sopenharmony_ci 1558e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 1559e5c31af7Sopenharmony_ciIf the <<primsrast-fragment-shading-rate, fragment shading rate>> is set, 1560e5c31af7Sopenharmony_ciand the fragment covers multiple pixels, each pixel's coverage consists of 1561e5c31af7Sopenharmony_cithe coverage samples with a <<primsrast-multisampling-coverage-mask-vrfs, 1562e5c31af7Sopenharmony_cipixel index>> matching that pixel, and each sample retains its unique 1563e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index [eq]#i#>>. 1564e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 1565e5c31af7Sopenharmony_ci 1566e5c31af7Sopenharmony_ci=== Color Sample Coverage 1567e5c31af7Sopenharmony_ci 1568e5c31af7Sopenharmony_ciOnce pixel coverage is determined, coverage for each individual color sample 1569e5c31af7Sopenharmony_cicorresponding to that pixel is determined. 1570e5c31af7Sopenharmony_ci 1571e5c31af7Sopenharmony_ciifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[If the] 1572e5c31af7Sopenharmony_ciifndef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[The] 1573e5c31af7Sopenharmony_cinumber of pname:rasterizationSamples is identical to the number of samples 1574e5c31af7Sopenharmony_ciin the color attachments. 1575e5c31af7Sopenharmony_ciA color sample is covered if the pixel coverage sample with the same 1576e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# is covered. 1577e5c31af7Sopenharmony_ci 1578e5c31af7Sopenharmony_ciifdef::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[] 1579e5c31af7Sopenharmony_ciOtherwise, the coverage for each color sample is computed from the pixel 1580e5c31af7Sopenharmony_cicoverage as follows. 1581e5c31af7Sopenharmony_ciendif::VK_AMD_mixed_attachment_samples,VK_NV_framebuffer_mixed_samples,VK_NV_coverage_reduction_mode[] 1582e5c31af7Sopenharmony_ci 1583e5c31af7Sopenharmony_ciifdef::VK_AMD_mixed_attachment_samples[] 1584e5c31af7Sopenharmony_ciIf the `apiext:VK_AMD_mixed_attachment_samples` extension is enabled, for 1585e5c31af7Sopenharmony_cicolor samples present in the color attachments, a color sample is covered if 1586e5c31af7Sopenharmony_cithe pixel coverage sample with the same 1587e5c31af7Sopenharmony_ci<<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# is covered; 1588e5c31af7Sopenharmony_ciadditional pixel coverage samples are discarded. 1589e5c31af7Sopenharmony_ciendif::VK_AMD_mixed_attachment_samples[] 1590e5c31af7Sopenharmony_ci 1591e5c31af7Sopenharmony_ciifdef::VK_NV_framebuffer_mixed_samples[] 1592e5c31af7Sopenharmony_ci 1593e5c31af7Sopenharmony_ciifndef::VK_NV_coverage_reduction_mode[] 1594e5c31af7Sopenharmony_ciWhen the `apiext:VK_NV_framebuffer_mixed_samples` extension is enabled, if 1595e5c31af7Sopenharmony_cithe pipeline's 1596e5c31af7Sopenharmony_cislink:VkPipelineMultisampleStateCreateInfo::pname:rasterizationSamples is 1597e5c31af7Sopenharmony_cigreater than the slink:VkAttachmentDescription::pname:samples of the color 1598e5c31af7Sopenharmony_ciattachments in the subpass, each color sample will be associated with an 1599e5c31af7Sopenharmony_ciimplementation-dependent subset of samples in the pixel coverage. 1600e5c31af7Sopenharmony_ciIf any of those associated samples are covered, the color sample is covered. 1601e5c31af7Sopenharmony_ciendif::VK_NV_coverage_reduction_mode[] 1602e5c31af7Sopenharmony_ci 1603e5c31af7Sopenharmony_ciifdef::VK_NV_coverage_reduction_mode[] 1604e5c31af7Sopenharmony_ciWhen the `apiext:VK_NV_coverage_reduction_mode` extension is enabled, the 1605e5c31af7Sopenharmony_cipipeline state controlling coverage reduction is specified through the 1606e5c31af7Sopenharmony_cimembers of the sname:VkPipelineCoverageReductionStateCreateInfoNV structure. 1607e5c31af7Sopenharmony_ci 1608e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageReductionStateCreateInfoNV',desc='Structure specifying parameters controlling coverage reduction',type='structs'] 1609e5c31af7Sopenharmony_ci-- 1610e5c31af7Sopenharmony_ciThe sname:VkPipelineCoverageReductionStateCreateInfoNV structure is defined 1611e5c31af7Sopenharmony_cias: 1612e5c31af7Sopenharmony_ci 1613e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineCoverageReductionStateCreateInfoNV.txt[] 1614e5c31af7Sopenharmony_ci 1615e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 1616e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1617e5c31af7Sopenharmony_ci structure. 1618e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 1619e5c31af7Sopenharmony_ci * pname:coverageReductionMode is a elink:VkCoverageReductionModeNV value 1620e5c31af7Sopenharmony_ci controlling how color sample coverage is generated from pixel coverage. 1621e5c31af7Sopenharmony_ci 1622e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, or if the 1623e5c31af7Sopenharmony_ciextension is not enabled, the default coverage reduction mode is inferred as 1624e5c31af7Sopenharmony_cifollows: 1625e5c31af7Sopenharmony_ci 1626e5c31af7Sopenharmony_ci * If the `apiext:VK_NV_framebuffer_mixed_samples` extension is enabled, 1627e5c31af7Sopenharmony_ci then it is as if the pname:coverageReductionMode is 1628e5c31af7Sopenharmony_ci ename:VK_COVERAGE_REDUCTION_MODE_MERGE_NV. 1629e5c31af7Sopenharmony_ci * If the `apiext:VK_AMD_mixed_attachment_samples` extension is enabled, 1630e5c31af7Sopenharmony_ci then it is as if the pname:coverageReductionMode is 1631e5c31af7Sopenharmony_ci ename:VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV. 1632e5c31af7Sopenharmony_ci * If both `apiext:VK_NV_framebuffer_mixed_samples` and 1633e5c31af7Sopenharmony_ci `apiext:VK_AMD_mixed_attachment_samples` are enabled, then the default 1634e5c31af7Sopenharmony_ci coverage reduction mode is implementation-dependent. 1635e5c31af7Sopenharmony_ci 1636e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineCoverageReductionStateCreateInfoNV.txt[] 1637e5c31af7Sopenharmony_ci-- 1638e5c31af7Sopenharmony_ci 1639e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageReductionStateCreateFlagsNV',desc='Reserved for future use',type='flags'] 1640e5c31af7Sopenharmony_ci-- 1641e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineCoverageReductionStateCreateFlagsNV.txt[] 1642e5c31af7Sopenharmony_ci 1643e5c31af7Sopenharmony_citname:VkPipelineCoverageReductionStateCreateFlagsNV is a bitmask type for 1644e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 1645e5c31af7Sopenharmony_ci-- 1646e5c31af7Sopenharmony_ci 1647e5c31af7Sopenharmony_ci[open,refpage='VkCoverageReductionModeNV',desc='Specify the coverage reduction mode',type='enums'] 1648e5c31af7Sopenharmony_ci-- 1649e5c31af7Sopenharmony_ciPossible values of 1650e5c31af7Sopenharmony_cislink:VkPipelineCoverageReductionStateCreateInfoNV::pname:coverageReductionMode, 1651e5c31af7Sopenharmony_cispecifying how color sample coverage is generated from pixel coverage, are: 1652e5c31af7Sopenharmony_ci 1653e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCoverageReductionModeNV.txt[] 1654e5c31af7Sopenharmony_ci 1655e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_REDUCTION_MODE_MERGE_NV specifies that each color 1656e5c31af7Sopenharmony_ci sample will be associated with an implementation-dependent subset of 1657e5c31af7Sopenharmony_ci samples in the pixel coverage. 1658e5c31af7Sopenharmony_ci If any of those associated samples are covered, the color sample is 1659e5c31af7Sopenharmony_ci covered. 1660e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV specifies that for color 1661e5c31af7Sopenharmony_ci samples present in the color attachments, a color sample is covered if 1662e5c31af7Sopenharmony_ci the pixel coverage sample with the same 1663e5c31af7Sopenharmony_ci <<primsrast-multisampling-coverage-mask, sample index>> [eq]#i# is 1664e5c31af7Sopenharmony_ci covered; other pixel coverage samples are discarded. 1665e5c31af7Sopenharmony_ci-- 1666e5c31af7Sopenharmony_ci 1667e5c31af7Sopenharmony_ci[open,refpage='vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV',desc='Query supported sample count combinations',type='protos'] 1668e5c31af7Sopenharmony_ci-- 1669e5c31af7Sopenharmony_ciTo query the set of mixed sample combinations of coverage reduction mode, 1670e5c31af7Sopenharmony_cirasterization samples and color, depth, stencil attachment sample counts 1671e5c31af7Sopenharmony_cithat are supported by a physical device, call: 1672e5c31af7Sopenharmony_ci 1673e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.txt[] 1674e5c31af7Sopenharmony_ci 1675e5c31af7Sopenharmony_ci * pname:physicalDevice is the physical device from which to query the set 1676e5c31af7Sopenharmony_ci of combinations. 1677e5c31af7Sopenharmony_ci * pname:pCombinationCount is a pointer to an integer related to the number 1678e5c31af7Sopenharmony_ci of combinations available or queried, as described below. 1679e5c31af7Sopenharmony_ci * pname:pCombinations is either `NULL` or a pointer to an array of 1680e5c31af7Sopenharmony_ci slink:VkFramebufferMixedSamplesCombinationNV values, indicating the 1681e5c31af7Sopenharmony_ci supported combinations of coverage reduction mode, rasterization 1682e5c31af7Sopenharmony_ci samples, and color, depth, stencil attachment sample counts. 1683e5c31af7Sopenharmony_ci 1684e5c31af7Sopenharmony_ciIf pname:pCombinations is `NULL`, then the number of supported combinations 1685e5c31af7Sopenharmony_cifor the given pname:physicalDevice is returned in pname:pCombinationCount. 1686e5c31af7Sopenharmony_ciOtherwise, pname:pCombinationCount must: point to a variable set by the user 1687e5c31af7Sopenharmony_cito the number of elements in the pname:pCombinations array, and on return 1688e5c31af7Sopenharmony_cithe variable is overwritten with the number of values actually written to 1689e5c31af7Sopenharmony_cipname:pCombinations. 1690e5c31af7Sopenharmony_ciIf the value of pname:pCombinationCount is less than the number of 1691e5c31af7Sopenharmony_cicombinations supported for the given pname:physicalDevice, at most 1692e5c31af7Sopenharmony_cipname:pCombinationCount values will be written to pname:pCombinations, and 1693e5c31af7Sopenharmony_ciename:VK_INCOMPLETE will be returned instead of ename:VK_SUCCESS, to 1694e5c31af7Sopenharmony_ciindicate that not all the supported values were returned. 1695e5c31af7Sopenharmony_ci 1696e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV.txt[] 1697e5c31af7Sopenharmony_ci-- 1698e5c31af7Sopenharmony_ci 1699e5c31af7Sopenharmony_ci[open,refpage='VkFramebufferMixedSamplesCombinationNV',desc='Structure specifying a supported sample count combination',type='structs'] 1700e5c31af7Sopenharmony_ci-- 1701e5c31af7Sopenharmony_ciThe sname:VkFramebufferMixedSamplesCombinationNV structure is defined as: 1702e5c31af7Sopenharmony_ci 1703e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkFramebufferMixedSamplesCombinationNV.txt[] 1704e5c31af7Sopenharmony_ci 1705e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 1706e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1707e5c31af7Sopenharmony_ci structure. 1708e5c31af7Sopenharmony_ci * pname:coverageReductionMode is a elink:VkCoverageReductionModeNV value 1709e5c31af7Sopenharmony_ci specifying the coverage reduction mode. 1710e5c31af7Sopenharmony_ci * pname:rasterizationSamples is a elink:VkSampleCountFlagBits specifying 1711e5c31af7Sopenharmony_ci the number of rasterization samples in the supported combination. 1712e5c31af7Sopenharmony_ci * pname:depthStencilSamples specifies the number of samples in the depth 1713e5c31af7Sopenharmony_ci stencil attachment in the supported combination. 1714e5c31af7Sopenharmony_ci A value of 0 indicates the combination does not have a depth stencil 1715e5c31af7Sopenharmony_ci attachment. 1716e5c31af7Sopenharmony_ci * pname:colorSamples specifies the number of color samples in a color 1717e5c31af7Sopenharmony_ci attachment in the supported combination. 1718e5c31af7Sopenharmony_ci A value of 0 indicates the combination does not have a color attachment. 1719e5c31af7Sopenharmony_ci 1720e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkFramebufferMixedSamplesCombinationNV.txt[] 1721e5c31af7Sopenharmony_ci-- 1722e5c31af7Sopenharmony_ciendif::VK_NV_coverage_reduction_mode[] 1723e5c31af7Sopenharmony_ci 1724e5c31af7Sopenharmony_ci 1725e5c31af7Sopenharmony_ci[[fragops-coverage-modulation]] 1726e5c31af7Sopenharmony_ci=== Coverage Modulation 1727e5c31af7Sopenharmony_ci 1728e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageModulationStateCreateInfoNV',desc='Structure specifying parameters controlling coverage modulation',type='structs'] 1729e5c31af7Sopenharmony_ci-- 1730e5c31af7Sopenharmony_ciAs part of coverage reduction, fragment color values can: also be modulated 1731e5c31af7Sopenharmony_ci(multiplied) by a value that is a function of fraction of covered 1732e5c31af7Sopenharmony_cirasterization samples associated with that color sample. 1733e5c31af7Sopenharmony_ci 1734e5c31af7Sopenharmony_ciPipeline state controlling coverage modulation is specified through the 1735e5c31af7Sopenharmony_cimembers of the sname:VkPipelineCoverageModulationStateCreateInfoNV 1736e5c31af7Sopenharmony_cistructure. 1737e5c31af7Sopenharmony_ci 1738e5c31af7Sopenharmony_ciThe sname:VkPipelineCoverageModulationStateCreateInfoNV structure is defined 1739e5c31af7Sopenharmony_cias: 1740e5c31af7Sopenharmony_ci 1741e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineCoverageModulationStateCreateInfoNV.txt[] 1742e5c31af7Sopenharmony_ci 1743e5c31af7Sopenharmony_ci * pname:sType is the type of this structure. 1744e5c31af7Sopenharmony_ci * pname:pNext is `NULL` or a pointer to a structure extending this 1745e5c31af7Sopenharmony_ci structure. 1746e5c31af7Sopenharmony_ci * pname:flags is reserved for future use. 1747e5c31af7Sopenharmony_ci * pname:coverageModulationMode is a elink:VkCoverageModulationModeNV value 1748e5c31af7Sopenharmony_ci controlling which color components are modulated. 1749e5c31af7Sopenharmony_ci * pname:coverageModulationTableEnable controls whether the modulation 1750e5c31af7Sopenharmony_ci factor is looked up from a table in pname:pCoverageModulationTable. 1751e5c31af7Sopenharmony_ci * pname:coverageModulationTableCount is the number of elements in 1752e5c31af7Sopenharmony_ci pname:pCoverageModulationTable. 1753e5c31af7Sopenharmony_ci * pname:pCoverageModulationTable is a table of modulation factors 1754e5c31af7Sopenharmony_ci containing a value for each number of covered samples. 1755e5c31af7Sopenharmony_ci 1756e5c31af7Sopenharmony_ciIf pname:coverageModulationTableEnable is ename:VK_FALSE, then for each 1757e5c31af7Sopenharmony_cicolor sample the associated bits of the pixel coverage are counted and 1758e5c31af7Sopenharmony_cidivided by the number of associated bits to produce a modulation factor 1759e5c31af7Sopenharmony_ci[eq]#R# in the range [eq]#(0,1]# (a value of zero would have been killed due 1760e5c31af7Sopenharmony_cito a color coverage of 0). 1761e5c31af7Sopenharmony_ciSpecifically: 1762e5c31af7Sopenharmony_ci 1763e5c31af7Sopenharmony_ci * [eq]#N# = value of pname:rasterizationSamples 1764e5c31af7Sopenharmony_ci * [eq]#M# = value of slink:VkAttachmentDescription::pname:samples for any 1765e5c31af7Sopenharmony_ci color attachments 1766e5c31af7Sopenharmony_ci * [eq]#R = popcount(associated coverage bits) / (N / M)# 1767e5c31af7Sopenharmony_ci 1768e5c31af7Sopenharmony_ciIf pname:coverageModulationTableEnable is ename:VK_TRUE, the value [eq]#R# 1769e5c31af7Sopenharmony_ciis computed using a programmable lookup table. 1770e5c31af7Sopenharmony_ciThe lookup table has [eq]#N / M# elements, and the element of the table is 1771e5c31af7Sopenharmony_ciselected by: 1772e5c31af7Sopenharmony_ci 1773e5c31af7Sopenharmony_ci * [eq]#R = pname:pCoverageModulationTable[popcount(associated coverage 1774e5c31af7Sopenharmony_ci bits)-1]# 1775e5c31af7Sopenharmony_ci 1776e5c31af7Sopenharmony_ciNote that the table does not have an entry for [eq]#popcount(associated 1777e5c31af7Sopenharmony_cicoverage bits) = 0#, because such samples would have been killed. 1778e5c31af7Sopenharmony_ci 1779e5c31af7Sopenharmony_ciThe values of pname:pCoverageModulationTable may: be rounded to an 1780e5c31af7Sopenharmony_ciimplementation-dependent precision, which is at least as fine as [eq]#1 / 1781e5c31af7Sopenharmony_ciN#, and clamped to [eq]#[0,1]#. 1782e5c31af7Sopenharmony_ci 1783e5c31af7Sopenharmony_ciFor each color attachment with a floating point or normalized color format, 1784e5c31af7Sopenharmony_cieach fragment output color value is replicated to [eq]#M# values which can: 1785e5c31af7Sopenharmony_cieach be modulated (multiplied) by that color sample's associated value of 1786e5c31af7Sopenharmony_ci[eq]#R#. 1787e5c31af7Sopenharmony_ciWhich components are modulated is controlled by 1788e5c31af7Sopenharmony_cipname:coverageModulationMode. 1789e5c31af7Sopenharmony_ci 1790e5c31af7Sopenharmony_ciIf this structure is not included in the pname:pNext chain, it is as if 1791e5c31af7Sopenharmony_cipname:coverageModulationMode is ename:VK_COVERAGE_MODULATION_MODE_NONE_NV. 1792e5c31af7Sopenharmony_ci 1793e5c31af7Sopenharmony_ciifdef::VK_NV_coverage_reduction_mode[] 1794e5c31af7Sopenharmony_ciIf the <<fragops-coverage-reduction, coverage reduction mode>> is 1795e5c31af7Sopenharmony_ciename:VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV, each color sample is 1796e5c31af7Sopenharmony_ciassociated with only a single coverage sample. 1797e5c31af7Sopenharmony_ciIn this case, it is as if pname:coverageModulationMode is 1798e5c31af7Sopenharmony_ciename:VK_COVERAGE_MODULATION_MODE_NONE_NV. 1799e5c31af7Sopenharmony_ciendif::VK_NV_coverage_reduction_mode[] 1800e5c31af7Sopenharmony_ci 1801e5c31af7Sopenharmony_ci.Valid Usage 1802e5c31af7Sopenharmony_ci**** 1803e5c31af7Sopenharmony_ci * [[VUID-VkPipelineCoverageModulationStateCreateInfoNV-coverageModulationTableEnable-01405]] 1804e5c31af7Sopenharmony_ci If pname:coverageModulationTableEnable is ename:VK_TRUE, 1805e5c31af7Sopenharmony_ci pname:coverageModulationTableCount must: be equal to the number of 1806e5c31af7Sopenharmony_ci rasterization samples divided by the number of color samples in the 1807e5c31af7Sopenharmony_ci subpass 1808e5c31af7Sopenharmony_ci**** 1809e5c31af7Sopenharmony_ci 1810e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineCoverageModulationStateCreateInfoNV.txt[] 1811e5c31af7Sopenharmony_ci-- 1812e5c31af7Sopenharmony_ci 1813e5c31af7Sopenharmony_ci[open,refpage='VkPipelineCoverageModulationStateCreateFlagsNV',desc='Reserved for future use',type='flags'] 1814e5c31af7Sopenharmony_ci-- 1815e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineCoverageModulationStateCreateFlagsNV.txt[] 1816e5c31af7Sopenharmony_ci 1817e5c31af7Sopenharmony_citname:VkPipelineCoverageModulationStateCreateFlagsNV is a bitmask type for 1818e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use. 1819e5c31af7Sopenharmony_ci-- 1820e5c31af7Sopenharmony_ci 1821e5c31af7Sopenharmony_ci[open,refpage='VkCoverageModulationModeNV',desc='Specify the coverage modulation mode',type='enums'] 1822e5c31af7Sopenharmony_ci-- 1823e5c31af7Sopenharmony_ciPossible values of 1824e5c31af7Sopenharmony_cislink:VkPipelineCoverageModulationStateCreateInfoNV::pname:coverageModulationMode, 1825e5c31af7Sopenharmony_cispecifying which color components are modulated, are: 1826e5c31af7Sopenharmony_ci 1827e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkCoverageModulationModeNV.txt[] 1828e5c31af7Sopenharmony_ci 1829e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_NONE_NV specifies that no components 1830e5c31af7Sopenharmony_ci are multiplied by the modulation factor. 1831e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_RGB_NV specifies that the red, green, 1832e5c31af7Sopenharmony_ci and blue components are multiplied by the modulation factor. 1833e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_ALPHA_NV specifies that the alpha 1834e5c31af7Sopenharmony_ci component is multiplied by the modulation factor. 1835e5c31af7Sopenharmony_ci * ename:VK_COVERAGE_MODULATION_MODE_RGBA_NV specifies that all components 1836e5c31af7Sopenharmony_ci are multiplied by the modulation factor. 1837e5c31af7Sopenharmony_ci-- 1838e5c31af7Sopenharmony_ci 1839e5c31af7Sopenharmony_ciendif::VK_NV_framebuffer_mixed_samples[] 1840