1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc. 2e5c31af7Sopenharmony_ci// 3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0 4e5c31af7Sopenharmony_ci 5e5c31af7Sopenharmony_ci[[interfaces]] 6e5c31af7Sopenharmony_ci= Shader Interfaces 7e5c31af7Sopenharmony_ci 8e5c31af7Sopenharmony_ciWhen a pipeline is created, the set of shaders specified in the 9e5c31af7Sopenharmony_cicorresponding stext:VkPipelineCreateInfo structure are implicitly linked at 10e5c31af7Sopenharmony_cia number of different interfaces. 11e5c31af7Sopenharmony_ci 12e5c31af7Sopenharmony_ci * <<interfaces-iointerfaces,Shader Input and Output Interface>> 13e5c31af7Sopenharmony_ci * <<interfaces-vertexinput,Vertex Input Interface>> 14e5c31af7Sopenharmony_ci * <<interfaces-fragmentoutput,Fragment Output Interface>> 15e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_tile_image[] 16e5c31af7Sopenharmony_ci * <<interfaces-fragmenttileimage,Fragment Tile Image Interface>> 17e5c31af7Sopenharmony_ciendif::VK_EXT_shader_tile_image[] 18e5c31af7Sopenharmony_ci * <<interfaces-inputattachment,Fragment Input Attachment Interface>> 19e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 20e5c31af7Sopenharmony_ci * <<interfaces-raypipeline, Ray Tracing Pipeline Interface>> 21e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 22e5c31af7Sopenharmony_ci * <<interfaces-resources,Shader Resource Interface>> 23e5c31af7Sopenharmony_ciifdef::VK_NV_geometry_shader_passthrough[] 24e5c31af7Sopenharmony_ci * <<geometry-passthrough-passthrough,Geometry Shader Passthrough>> 25e5c31af7Sopenharmony_ciendif::VK_NV_geometry_shader_passthrough[] 26e5c31af7Sopenharmony_ci 27e5c31af7Sopenharmony_ciifdef::VKSC_VERSION_1_0[] 28e5c31af7Sopenharmony_ciIn Vulkan SC, the pipeline compilation process occurs 29e5c31af7Sopenharmony_ci<<pipelines-offline-compilation,offline>> using the implementation-provided 30e5c31af7Sopenharmony_cipipeline cache compiler. 31e5c31af7Sopenharmony_ciThe set of shaders being used to create a pipeline can: be specified using 32e5c31af7Sopenharmony_cithe pipeline JSON schema. 33e5c31af7Sopenharmony_ciendif::VKSC_VERSION_1_0[] 34e5c31af7Sopenharmony_ci 35e5c31af7Sopenharmony_ciThis chapter describes valid uses for a set of SPIR-V decorations. 36e5c31af7Sopenharmony_ciAny other use of one of these decorations is invalid, with the exception 37e5c31af7Sopenharmony_cithat, when using SPIR-V versions 1.4 and earlier: code:Block, 38e5c31af7Sopenharmony_cicode:BufferBlock, code:Offset, code:ArrayStride, and code:MatrixStride can 39e5c31af7Sopenharmony_cialso decorate types and type members used by variables in the code:Private 40e5c31af7Sopenharmony_ciand code:Function storage classes. 41e5c31af7Sopenharmony_ci 42e5c31af7Sopenharmony_ci[NOTE] 43e5c31af7Sopenharmony_ci.Note 44e5c31af7Sopenharmony_ci==== 45e5c31af7Sopenharmony_ciIn this chapter, there are references to SPIR-V terms such as the 46e5c31af7Sopenharmony_cicode:MeshNV execution model. 47e5c31af7Sopenharmony_ciThese terms will appear even in a build of the specification which does not 48e5c31af7Sopenharmony_cisupport any extensions. 49e5c31af7Sopenharmony_ciThis is as intended, since these terms appear in the unified SPIR-V 50e5c31af7Sopenharmony_cispecification without such qualifiers. 51e5c31af7Sopenharmony_ci==== 52e5c31af7Sopenharmony_ci 53e5c31af7Sopenharmony_ci 54e5c31af7Sopenharmony_ci[[interfaces-iointerfaces]] 55e5c31af7Sopenharmony_ci== Shader Input and Output Interfaces 56e5c31af7Sopenharmony_ci 57e5c31af7Sopenharmony_ciWhen multiple stages are present in a pipeline, the outputs of one stage 58e5c31af7Sopenharmony_ciform an interface with the inputs of the next stage. 59e5c31af7Sopenharmony_ciWhen such an interface involves a shader, shader outputs are matched against 60e5c31af7Sopenharmony_cithe inputs of the next stage, and shader inputs are matched against the 61e5c31af7Sopenharmony_cioutputs of the previous stage. 62e5c31af7Sopenharmony_ci 63e5c31af7Sopenharmony_ciAll the variables forming the shader input and output _interfaces_ are 64e5c31af7Sopenharmony_cilisted as operands to the code:OpEntryPoint instruction and are declared 65e5c31af7Sopenharmony_ciwith the code:Input or code:Output storage classes, respectively, in the 66e5c31af7Sopenharmony_ciSPIR-V module. 67e5c31af7Sopenharmony_ciThese generally form the interfaces between consecutive shader stages, 68e5c31af7Sopenharmony_ciregardless of any non-shader stages between the consecutive shader stages. 69e5c31af7Sopenharmony_ci 70e5c31af7Sopenharmony_ciThere are two classes of variables that can: be matched between shader 71e5c31af7Sopenharmony_cistages, built-in variables and user-defined variables. 72e5c31af7Sopenharmony_ciEach class has a different set of matching criteria. 73e5c31af7Sopenharmony_ci 74e5c31af7Sopenharmony_cicode:Output variables of a shader stage have undefined: values until the 75e5c31af7Sopenharmony_cishader writes to them or uses the code:Initializer operand when declaring 76e5c31af7Sopenharmony_cithe variable. 77e5c31af7Sopenharmony_ci 78e5c31af7Sopenharmony_ci 79e5c31af7Sopenharmony_ci[[interfaces-iointerfaces-builtin]] 80e5c31af7Sopenharmony_ci=== Built-in Interface Block 81e5c31af7Sopenharmony_ci 82e5c31af7Sopenharmony_ciShader <<interfaces-builtin-variables,built-in>> variables meeting the 83e5c31af7Sopenharmony_cifollowing requirements define the _built-in interface block_. 84e5c31af7Sopenharmony_ciThey must: 85e5c31af7Sopenharmony_ci 86e5c31af7Sopenharmony_ci * be explicitly declared (there are no implicit built-ins), 87e5c31af7Sopenharmony_ci * be identified with a code:BuiltIn decoration, 88e5c31af7Sopenharmony_ci * form object types as described in the 89e5c31af7Sopenharmony_ci <<interfaces-builtin-variables,Built-in Variables>> section, and 90e5c31af7Sopenharmony_ci * be declared in a block whose top-level members are the built-ins. 91e5c31af7Sopenharmony_ci 92e5c31af7Sopenharmony_ciThere must: be no more than one built-in interface block per shader per 93e5c31af7Sopenharmony_ciinterface 94e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 95e5c31af7Sopenharmony_ci, except for the mesh output interface where there must: be at most one 96e5c31af7Sopenharmony_cibuilt-in interface block decorated with the code:PerPrimitiveEXT decoration 97e5c31af7Sopenharmony_ciand at most one built-in interface block without this decoration 98e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 99e5c31af7Sopenharmony_ci. 100e5c31af7Sopenharmony_ci 101e5c31af7Sopenharmony_ciBuilt-ins must: not have any code:Location or code:Component decorations. 102e5c31af7Sopenharmony_ci 103e5c31af7Sopenharmony_ci 104e5c31af7Sopenharmony_ci[[interfaces-iointerfaces-user]] 105e5c31af7Sopenharmony_ci=== User-defined Variable Interface 106e5c31af7Sopenharmony_ci 107e5c31af7Sopenharmony_ciThe non-built-in variables listed by code:OpEntryPoint with the code:Input 108e5c31af7Sopenharmony_cior code:Output storage class form the _user-defined variable interface_. 109e5c31af7Sopenharmony_ciThese must: have <<formats-numericformat, numeric type>> or, recursively, 110e5c31af7Sopenharmony_cicomposite types of such types. 111e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[] 112e5c31af7Sopenharmony_ciIf an implementation supports <<features-storageInputOutput16, 113e5c31af7Sopenharmony_cipname:storageInputOutput16>>, components can: have a width of 16 bits. 114e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_16bit_storage[] 115e5c31af7Sopenharmony_ciThese variables must: be identified with a code:Location decoration and can: 116e5c31af7Sopenharmony_cialso be identified with a code:Component decoration. 117e5c31af7Sopenharmony_ci 118e5c31af7Sopenharmony_ci 119e5c31af7Sopenharmony_ci[[interfaces-iointerfaces-matching]] 120e5c31af7Sopenharmony_ci=== Interface Matching 121e5c31af7Sopenharmony_ci 122e5c31af7Sopenharmony_ciAn output variable, block, or structure member in a given shader stage has 123e5c31af7Sopenharmony_cian interface match with an input variable, block, or structure member in a 124e5c31af7Sopenharmony_cisubsequent shader stage if they both adhere to the following conditions: 125e5c31af7Sopenharmony_ci 126e5c31af7Sopenharmony_ci * They have equivalent decorations, other than: 127e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[] 128e5c31af7Sopenharmony_ci ** code:XfbBuffer, code:XfbStride, code:Offset, and code:Stream 129e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[] 130e5c31af7Sopenharmony_ci ** one is not decorated with code:Component and the other is declared with 131e5c31af7Sopenharmony_ci a code:Component of `0` 132e5c31af7Sopenharmony_ci ** <<shaders-interpolation-decorations,Interpolation decorations>> 133e5c31af7Sopenharmony_ci ** code:RelaxedPrecision if one is an input variable and the other an 134e5c31af7Sopenharmony_ci output variable 135e5c31af7Sopenharmony_ci * Their types match as follows: 136e5c31af7Sopenharmony_ci ** if the input is declared in a tessellation control or geometry shader 137e5c31af7Sopenharmony_ci as an code:OpTypeArray with an code:Element code:Type equivalent to the 138e5c31af7Sopenharmony_ci code:OpType* declaration of the output, and neither is a structure 139e5c31af7Sopenharmony_ci member; or 140e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_maintenance4[] 141e5c31af7Sopenharmony_ci ** if the <<features-maintenance4, pname:maintenance4>> feature is 142e5c31af7Sopenharmony_ci enabled, they are declared as code:OpTypeVector variables, and the 143e5c31af7Sopenharmony_ci output has a code:Component code:Count value higher than that of the 144e5c31af7Sopenharmony_ci input but the same code:Component code:Type; or 145e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_maintenance4[] 146e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 147e5c31af7Sopenharmony_ci ** if the output is declared in a mesh shader as an code:OpTypeArray with 148e5c31af7Sopenharmony_ci an code:Element code:Type equivalent to the code:OpType* declaration of 149e5c31af7Sopenharmony_ci the input, and neither is a structure member; or 150e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 151e5c31af7Sopenharmony_ciifdef::VK_NV_fragment_shader_barycentric,VK_KHR_fragment_shader_barycentric[] 152e5c31af7Sopenharmony_ci ** if the input is decorated with code:PerVertexKHR, and is declared in a 153e5c31af7Sopenharmony_ci fragment shader as an code:OpTypeArray with an code:Element code:Type 154e5c31af7Sopenharmony_ci equivalent to the code:OpType* declaration of the output, and neither 155e5c31af7Sopenharmony_ci the input nor the output is a structure member; or 156e5c31af7Sopenharmony_ciendif::VK_NV_fragment_shader_barycentric,VK_KHR_fragment_shader_barycentric[] 157e5c31af7Sopenharmony_ci ** if in any other case they are declared with an equivalent code:OpType* 158e5c31af7Sopenharmony_ci declaration. 159e5c31af7Sopenharmony_ci * If both are structures and every member has an interface match. 160e5c31af7Sopenharmony_ci 161e5c31af7Sopenharmony_ci[NOTE] 162e5c31af7Sopenharmony_ci.Note 163e5c31af7Sopenharmony_ci==== 164e5c31af7Sopenharmony_ciThe word "`structure`" above refers to both variables that have an 165e5c31af7Sopenharmony_cicode:OpTypeStruct type and interface blocks (which are also declared as 166e5c31af7Sopenharmony_cicode:OpTypeStruct). 167e5c31af7Sopenharmony_ci==== 168e5c31af7Sopenharmony_ci 169e5c31af7Sopenharmony_ciifdef::VK_EXT_graphics_pipeline_library[] 170e5c31af7Sopenharmony_ciIf the pipeline is compiled as separate graphics pipeline libraries and the 171e5c31af7Sopenharmony_ci<<limits-graphicsPipelineLibraryIndependentInterpolationDecoration, 172e5c31af7Sopenharmony_cipname:graphicsPipelineLibraryIndependentInterpolationDecoration>> limit is 173e5c31af7Sopenharmony_cinot supported, matches are not found if the 174e5c31af7Sopenharmony_ci<<shaders-interpolation-decorations, interpolation decorations>> differ 175e5c31af7Sopenharmony_cibetween the last <<pipelines-graphics-subsets-pre-rasterization, 176e5c31af7Sopenharmony_cipre-rasterization shader stage>> and the fragment shader stage. 177e5c31af7Sopenharmony_ciendif::VK_EXT_graphics_pipeline_library[] 178e5c31af7Sopenharmony_ci 179e5c31af7Sopenharmony_ciAll input variables and blocks must: have an interface match in the 180e5c31af7Sopenharmony_cipreceding shader stage, except for built-in variables in fragment shaders. 181e5c31af7Sopenharmony_ciShaders can: declare and write to output variables that are not declared or 182e5c31af7Sopenharmony_ciread by the subsequent stage. 183e5c31af7Sopenharmony_ci 184e5c31af7Sopenharmony_ciifdef::VK_NV_geometry_shader_passthrough[] 185e5c31af7Sopenharmony_ciMatching rules for _passthrough geometry shaders_ are slightly different and 186e5c31af7Sopenharmony_ciare described in the <<geometry-passthrough-interface,Passthrough Interface 187e5c31af7Sopenharmony_ciMatching>> section. 188e5c31af7Sopenharmony_ciendif::VK_NV_geometry_shader_passthrough[] 189e5c31af7Sopenharmony_ci 190e5c31af7Sopenharmony_ciThe value of an input variable is undefined: if the preceding stage does not 191e5c31af7Sopenharmony_ciwrite to a matching output variable, as described above. 192e5c31af7Sopenharmony_ci 193e5c31af7Sopenharmony_ci 194e5c31af7Sopenharmony_ci[[interfaces-iointerfaces-locations]] 195e5c31af7Sopenharmony_ci=== Location Assignment 196e5c31af7Sopenharmony_ci 197e5c31af7Sopenharmony_ciThis section describes code:Location assignments for user-defined variables 198e5c31af7Sopenharmony_ciand how many code:Location slots are consumed by a given user-variable type. 199e5c31af7Sopenharmony_ci<<interfaces-iointerfaces-matching, As mentioned above>>, some inputs and 200e5c31af7Sopenharmony_cioutputs have an additional level of arrayness relative to other shader 201e5c31af7Sopenharmony_ciinputs and outputs. 202e5c31af7Sopenharmony_ciThis outer array level is removed from the type before considering how many 203e5c31af7Sopenharmony_cicode:Location slots the type consumes. 204e5c31af7Sopenharmony_ci 205e5c31af7Sopenharmony_ciThe code:Location value specifies an interface slot comprised of a 32-bit 206e5c31af7Sopenharmony_cifour-component vector conveyed between stages. 207e5c31af7Sopenharmony_ciThe code:Component specifies <<interfaces-iointerfaces-components, word 208e5c31af7Sopenharmony_cicomponents>> within these vector code:Location slots. 209e5c31af7Sopenharmony_ciOnly types with widths of 210e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[] 211e5c31af7Sopenharmony_ci16, 212e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_16bit_storage[] 213e5c31af7Sopenharmony_ci32 or 64 are supported in shader interfaces. 214e5c31af7Sopenharmony_ci 215e5c31af7Sopenharmony_ciInputs and outputs of the following types consume a single interface 216e5c31af7Sopenharmony_cicode:Location: 217e5c31af7Sopenharmony_ci 218e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[] 219e5c31af7Sopenharmony_ci * 16-bit scalar and vector types, and 220e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_16bit_storage[] 221e5c31af7Sopenharmony_ci * 32-bit scalar and vector types, and 222e5c31af7Sopenharmony_ci * 64-bit scalar and 2-component vector types. 223e5c31af7Sopenharmony_ci 224e5c31af7Sopenharmony_ci64-bit three- and four-component vectors consume two consecutive 225e5c31af7Sopenharmony_cicode:Location slots. 226e5c31af7Sopenharmony_ci 227e5c31af7Sopenharmony_ciIf a declared input or output is an array of size _n_ and each element takes 228e5c31af7Sopenharmony_ci_m_ code:Location slots, it will be assigned _m_ {times} _n_ consecutive 229e5c31af7Sopenharmony_cicode:Location slots starting with the specified code:Location. 230e5c31af7Sopenharmony_ci 231e5c31af7Sopenharmony_ciIf the declared input or output is an _n_ {times} _m_ 232e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[] 233e5c31af7Sopenharmony_ci16-, 234e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_16bit_storage[] 235e5c31af7Sopenharmony_ci32- or 64-bit matrix, it will be assigned multiple code:Location slots 236e5c31af7Sopenharmony_cistarting with the specified code:Location. 237e5c31af7Sopenharmony_ciThe number of code:Location slots assigned for each matrix will be the same 238e5c31af7Sopenharmony_cias for an _n_-element array of _m_-component vectors. 239e5c31af7Sopenharmony_ci 240e5c31af7Sopenharmony_ciAn code:OpVariable with a structure type that is not a block must: be 241e5c31af7Sopenharmony_cidecorated with a code:Location. 242e5c31af7Sopenharmony_ci 243e5c31af7Sopenharmony_ciWhen an code:OpVariable with a structure type (either block or non-block) is 244e5c31af7Sopenharmony_cidecorated with a code:Location, the members in the structure type must: not 245e5c31af7Sopenharmony_cibe decorated with a code:Location. 246e5c31af7Sopenharmony_ciThe code:OpVariable's members are assigned consecutive code:Location slots 247e5c31af7Sopenharmony_ciin declaration order, starting from the first member, which is assigned the 248e5c31af7Sopenharmony_cicode:Location decoration from the code:OpVariable. 249e5c31af7Sopenharmony_ci 250e5c31af7Sopenharmony_ciWhen a block-type code:OpVariable is declared without a code:Location 251e5c31af7Sopenharmony_cidecoration, each member in its structure type must: be decorated with a 252e5c31af7Sopenharmony_cicode:Location. 253e5c31af7Sopenharmony_ciTypes nested deeper than the top-level members must: not have code:Location 254e5c31af7Sopenharmony_cidecorations. 255e5c31af7Sopenharmony_ci 256e5c31af7Sopenharmony_ciThe code:Location slots consumed by block and structure members are 257e5c31af7Sopenharmony_cidetermined by applying the rules above in a depth-first traversal of the 258e5c31af7Sopenharmony_ciinstantiated members as though the structure or block member were declared 259e5c31af7Sopenharmony_cias an input or output variable of the same type. 260e5c31af7Sopenharmony_ci 261e5c31af7Sopenharmony_ciAny two inputs listed as operands on the same code:OpEntryPoint must: not be 262e5c31af7Sopenharmony_ciassigned the same code:Location slot and code:Component word, either 263e5c31af7Sopenharmony_ciexplicitly or implicitly. 264e5c31af7Sopenharmony_ciAny two outputs listed as operands on the same code:OpEntryPoint must: not 265e5c31af7Sopenharmony_cibe assigned the same code:Location slot and code:Component word, either 266e5c31af7Sopenharmony_ciexplicitly or implicitly. 267e5c31af7Sopenharmony_ci 268e5c31af7Sopenharmony_ciThe number of input and output code:Location slots available for a shader 269e5c31af7Sopenharmony_ciinput or output interface is limited, and dependent on the shader stage as 270e5c31af7Sopenharmony_cidescribed in <<interfaces-iointerfaces-limits>>. 271e5c31af7Sopenharmony_ciAll variables in both the <<interfaces-builtin-variables,built-in interface 272e5c31af7Sopenharmony_ciblock>> and the <<interfaces-iointerfaces-user,user-defined variable 273e5c31af7Sopenharmony_ciinterface>> count against these limits. 274e5c31af7Sopenharmony_ciEach effective code:Location must: have a value less than the number of 275e5c31af7Sopenharmony_cicode:Location slots available for the given interface, as specified in the 276e5c31af7Sopenharmony_ci"`Locations Available`" column in <<interfaces-iointerfaces-limits>>. 277e5c31af7Sopenharmony_ci 278e5c31af7Sopenharmony_ci 279e5c31af7Sopenharmony_ci[[interfaces-iointerfaces-limits]] 280e5c31af7Sopenharmony_ci.Shader Input and Output Locations 281e5c31af7Sopenharmony_ci[width="90%",cols="<6,<13",options="header"] 282e5c31af7Sopenharmony_ci|==== 283e5c31af7Sopenharmony_ci| Shader Interface | Locations Available 284e5c31af7Sopenharmony_ci| vertex input | pname:maxVertexInputAttributes 285e5c31af7Sopenharmony_ci| vertex output | pname:maxVertexOutputComponents / 4 286e5c31af7Sopenharmony_ci| tessellation control input | pname:maxTessellationControlPerVertexInputComponents / 4 287e5c31af7Sopenharmony_ci| tessellation control output | pname:maxTessellationControlPerVertexOutputComponents / 4 288e5c31af7Sopenharmony_ci| tessellation evaluation input | pname:maxTessellationEvaluationInputComponents / 4 289e5c31af7Sopenharmony_ci| tessellation evaluation output| pname:maxTessellationEvaluationOutputComponents / 4 290e5c31af7Sopenharmony_ci| geometry input | pname:maxGeometryInputComponents / 4 291e5c31af7Sopenharmony_ci| geometry output | pname:maxGeometryOutputComponents / 4 292e5c31af7Sopenharmony_ci| fragment input | pname:maxFragmentInputComponents / 4 293e5c31af7Sopenharmony_ci| fragment output | pname:maxFragmentOutputAttachments 294e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 295e5c31af7Sopenharmony_ci| mesh output | pname:maxMeshOutputComponents / 4 296e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 297e5c31af7Sopenharmony_ciifndef::VK_EXT_mesh_shader[] 298e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 299e5c31af7Sopenharmony_ci// we forgot to add maxMeshOutputComponents 300e5c31af7Sopenharmony_ci| mesh output | pname:maxFragmentInputComponents / 4 301e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 302e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 303e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 304e5c31af7Sopenharmony_ci| cluster culling output | pname:maxOutputClusterCount 305e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 306e5c31af7Sopenharmony_ci|==== 307e5c31af7Sopenharmony_ci 308e5c31af7Sopenharmony_ci 309e5c31af7Sopenharmony_ci[[interfaces-iointerfaces-components]] 310e5c31af7Sopenharmony_ci=== Component Assignment 311e5c31af7Sopenharmony_ci 312e5c31af7Sopenharmony_ciThe code:Component decoration allows the code:Location to be more finely 313e5c31af7Sopenharmony_cispecified for scalars and vectors, down to the individual code:Component 314e5c31af7Sopenharmony_ciword within a code:Location slot that are consumed. 315e5c31af7Sopenharmony_ciThe code:Component word within a code:Location are 0, 1, 2, and 3. 316e5c31af7Sopenharmony_ciA variable or block member starting at code:Component N will consume 317e5c31af7Sopenharmony_cicode:Component words N, N+1, N+2, ... 318e5c31af7Sopenharmony_ciup through its size. 319e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[] 320e5c31af7Sopenharmony_ciFor 16-, and 32-bit types, 321e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_16bit_storage[] 322e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_16bit_storage[] 323e5c31af7Sopenharmony_ciFor single precision types, 324e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_16bit_storage[] 325e5c31af7Sopenharmony_ciit is invalid if this sequence of code:Component words gets larger than 3. 326e5c31af7Sopenharmony_ciA scalar 64-bit type will consume two of these code:Component words in 327e5c31af7Sopenharmony_cisequence, and a two-component 64-bit vector type will consume all four 328e5c31af7Sopenharmony_cicode:Component words available within a code:Location. 329e5c31af7Sopenharmony_ciA three- or four-component 64-bit vector type must: not specify a non-zero 330e5c31af7Sopenharmony_cicode:Component decoration. 331e5c31af7Sopenharmony_ciA three-component 64-bit vector type will consume all four code:Component 332e5c31af7Sopenharmony_ciwords of the first code:Location and code:Component 0 and 1 of the second 333e5c31af7Sopenharmony_cicode:Location. 334e5c31af7Sopenharmony_ciThis leaves code:Component 2 and 3 available for other component-qualified 335e5c31af7Sopenharmony_cideclarations. 336e5c31af7Sopenharmony_ci 337e5c31af7Sopenharmony_ciA scalar or two-component 64-bit data type must: not specify a 338e5c31af7Sopenharmony_cicode:Component decoration of 1 or 3. 339e5c31af7Sopenharmony_ciA code:Component decoration must: not be specified for any type that is not 340e5c31af7Sopenharmony_cia scalar or vector. 341e5c31af7Sopenharmony_ci 342e5c31af7Sopenharmony_ciA four-component 64-bit data type will consume all four code:Component words 343e5c31af7Sopenharmony_ciof the first code:Location and all four code:Component words of the second 344e5c31af7Sopenharmony_cicode:Location. 345e5c31af7Sopenharmony_ci 346e5c31af7Sopenharmony_ci[[interfaces-vertexinput]] 347e5c31af7Sopenharmony_ci== Vertex Input Interface 348e5c31af7Sopenharmony_ci 349e5c31af7Sopenharmony_ciWhen the vertex stage is present in a pipeline, the vertex shader input 350e5c31af7Sopenharmony_civariables form an interface with the vertex input attributes. 351e5c31af7Sopenharmony_ciThe vertex shader input variables are matched by the code:Location and 352e5c31af7Sopenharmony_cicode:Component decorations to the vertex input attributes specified in the 353e5c31af7Sopenharmony_cipname:pVertexInputState member of the slink:VkGraphicsPipelineCreateInfo 354e5c31af7Sopenharmony_cistructure. 355e5c31af7Sopenharmony_ci 356e5c31af7Sopenharmony_ciThe vertex shader input variables listed by code:OpEntryPoint with the 357e5c31af7Sopenharmony_cicode:Input storage class form the _vertex input interface_. 358e5c31af7Sopenharmony_ciThese variables must: be identified with a code:Location decoration and can: 359e5c31af7Sopenharmony_cialso be identified with a code:Component decoration. 360e5c31af7Sopenharmony_ci 361e5c31af7Sopenharmony_ciFor the purposes of interface matching: variables declared without a 362e5c31af7Sopenharmony_cicode:Component decoration are considered to have a code:Component decoration 363e5c31af7Sopenharmony_ciof zero. 364e5c31af7Sopenharmony_ciThe number of available vertex input code:Location slots is given by the 365e5c31af7Sopenharmony_cipname:maxVertexInputAttributes member of the sname:VkPhysicalDeviceLimits 366e5c31af7Sopenharmony_cistructure. 367e5c31af7Sopenharmony_ci 368e5c31af7Sopenharmony_ciSee <<fxvertex-attrib-location>> for details. 369e5c31af7Sopenharmony_ci 370e5c31af7Sopenharmony_ciAll vertex shader inputs declared as above must: have a corresponding 371e5c31af7Sopenharmony_ciattribute and binding in the pipeline. 372e5c31af7Sopenharmony_ci 373e5c31af7Sopenharmony_ci 374e5c31af7Sopenharmony_ci[[interfaces-fragmentoutput]] 375e5c31af7Sopenharmony_ci== Fragment Output Interface 376e5c31af7Sopenharmony_ci 377e5c31af7Sopenharmony_ciWhen the fragment stage is present in a pipeline, the fragment shader 378e5c31af7Sopenharmony_cioutputs form an interface with the output attachments defined by a 379e5c31af7Sopenharmony_ci<<renderpass, render pass instance>>. 380e5c31af7Sopenharmony_ciThe fragment shader output variables are matched by the code:Location and 381e5c31af7Sopenharmony_cicode:Component decorations to specified color attachments. 382e5c31af7Sopenharmony_ci 383e5c31af7Sopenharmony_ciThe fragment shader output variables listed by code:OpEntryPoint with the 384e5c31af7Sopenharmony_cicode:Output storage class form the _fragment output interface_. 385e5c31af7Sopenharmony_ciThese variables must: be identified with a code:Location decoration. 386e5c31af7Sopenharmony_ciThey can: also be identified with a code:Component decoration and/or an 387e5c31af7Sopenharmony_cicode:Index decoration. 388e5c31af7Sopenharmony_ciFor the purposes of interface matching: variables declared without a 389e5c31af7Sopenharmony_cicode:Component decoration are considered to have a code:Component decoration 390e5c31af7Sopenharmony_ciof zero, and variables declared without an code:Index decoration are 391e5c31af7Sopenharmony_ciconsidered to have an code:Index decoration of zero. 392e5c31af7Sopenharmony_ci 393e5c31af7Sopenharmony_ciA fragment shader output variable identified with a code:Location decoration 394e5c31af7Sopenharmony_ciof _i_ is associated with 395e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 396e5c31af7Sopenharmony_cithe color attachment indicated by 397e5c31af7Sopenharmony_cislink:VkRenderingInfo::pname:pColorAttachments[_i_]. 398e5c31af7Sopenharmony_ciWhen using render pass objects, it is associated with 399e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 400e5c31af7Sopenharmony_cithe color attachment indicated by 401e5c31af7Sopenharmony_cislink:VkSubpassDescription::pname:pColorAttachments[_i_]. 402e5c31af7Sopenharmony_ciValues are written to those attachments after passing through the blending 403e5c31af7Sopenharmony_ciunit as described in <<framebuffer-blending>>, if enabled. 404e5c31af7Sopenharmony_ciLocations are consumed as described in 405e5c31af7Sopenharmony_ci<<interfaces-iointerfaces-locations,Location Assignment>>. 406e5c31af7Sopenharmony_ciThe number of available fragment output code:Location slots is given by the 407e5c31af7Sopenharmony_cipname:maxFragmentOutputAttachments member of the 408e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits structure. 409e5c31af7Sopenharmony_ci 410e5c31af7Sopenharmony_ciWhen an active fragment shader invocation finishes, the values of all 411e5c31af7Sopenharmony_cifragment shader outputs are copied out and used as blend inputs or color 412e5c31af7Sopenharmony_ciattachments writes. 413e5c31af7Sopenharmony_ciIf the invocation does not set a value for them, the input values to those 414e5c31af7Sopenharmony_ciblending or color attachment writes are undefined:. 415e5c31af7Sopenharmony_ci 416e5c31af7Sopenharmony_ciComponents of the output variables are assigned as described in 417e5c31af7Sopenharmony_ci<<interfaces-iointerfaces-components,Component Assignment>>. 418e5c31af7Sopenharmony_ciOutput code:Component words identified as 0, 1, 2, and 3 will be directed to 419e5c31af7Sopenharmony_cithe R, G, B, and A inputs to the blending unit, respectively, or to the 420e5c31af7Sopenharmony_cioutput attachment if blending is disabled. 421e5c31af7Sopenharmony_ciIf two variables are placed within the same code:Location, they must: have 422e5c31af7Sopenharmony_cithe same underlying type (floating-point or integer). 423e5c31af7Sopenharmony_cicode:Component words which do not correspond to any fragment shader output 424e5c31af7Sopenharmony_ciwill also result in undefined: values for blending or color attachment 425e5c31af7Sopenharmony_ciwrites. 426e5c31af7Sopenharmony_ci 427e5c31af7Sopenharmony_ciFragment outputs identified with an code:Index of zero are directed to the 428e5c31af7Sopenharmony_cifirst input of the blending unit associated with the corresponding 429e5c31af7Sopenharmony_cicode:Location. 430e5c31af7Sopenharmony_ciOutputs identified with an code:Index of one are directed to the second 431e5c31af7Sopenharmony_ciinput of the corresponding blending unit. 432e5c31af7Sopenharmony_ci 433e5c31af7Sopenharmony_ciThere must: be no output variable which has the same code:Location, 434e5c31af7Sopenharmony_cicode:Component, and code:Index as any other, either explicitly declared or 435e5c31af7Sopenharmony_ciimplied. 436e5c31af7Sopenharmony_ci 437e5c31af7Sopenharmony_ciOutput values written by a fragment shader must: be declared with either 438e5c31af7Sopenharmony_cicode:OpTypeFloat or code:OpTypeInt, and a code:Width of 32. 439e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_16bit_storage[] 440e5c31af7Sopenharmony_ciIf pname:storageInputOutput16 is supported, output values written by a 441e5c31af7Sopenharmony_cifragment shader can: be also declared with either code:OpTypeFloat or 442e5c31af7Sopenharmony_cicode:OpTypeInt and a code:Width of 16. 443e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_16bit_storage[] 444e5c31af7Sopenharmony_ciComposites of these types are also permitted. 445e5c31af7Sopenharmony_ciIf the color attachment has a signed or unsigned normalized fixed-point 446e5c31af7Sopenharmony_ciformat, color values are assumed to be floating-point and are converted to 447e5c31af7Sopenharmony_cifixed-point as described in <<fundamentals-fpfixedconv>>; If the color 448e5c31af7Sopenharmony_ciattachment has an integer format, color values are assumed to be integers 449e5c31af7Sopenharmony_ciand converted to the bit-depth of the target. 450e5c31af7Sopenharmony_ciAny value that cannot be represented in the attachment's format is 451e5c31af7Sopenharmony_ciundefined:. 452e5c31af7Sopenharmony_ciFor any other attachment format no conversion is performed. 453e5c31af7Sopenharmony_ciIf the type of the values written by the fragment shader do not match the 454e5c31af7Sopenharmony_ciformat of the corresponding color attachment, the resulting values are 455e5c31af7Sopenharmony_ciundefined: for those components. 456e5c31af7Sopenharmony_ci 457e5c31af7Sopenharmony_ciifdef::VK_EXT_legacy_dithering[] 458e5c31af7Sopenharmony_ci[[interfaces-legacy-dithering]] 459e5c31af7Sopenharmony_ci== Legacy Dithering 460e5c31af7Sopenharmony_ci 461e5c31af7Sopenharmony_ciThe application can: enable dithering to be applied to the color output of a 462e5c31af7Sopenharmony_cisubpass, by using the 463e5c31af7Sopenharmony_ciename:VK_SUBPASS_DESCRIPTION_ENABLE_LEGACY_DITHERING_BIT_EXT 464e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 465e5c31af7Sopenharmony_ciflag. 466e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 467e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 468e5c31af7Sopenharmony_cior the ename:VK_RENDERING_ENABLE_LEGACY_DITHERING_BIT_EXT flags. 469e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_dynamic_rendering[] 470e5c31af7Sopenharmony_ci 471e5c31af7Sopenharmony_ciWhen dithering is enabled, the implementation may: modify the output color 472e5c31af7Sopenharmony_civalue [eq]#c# by one ULP. 473e5c31af7Sopenharmony_ciThis modification must: only depend on the framebuffer coordinates 474e5c31af7Sopenharmony_ci[eq]#(x~f~,y~f~)# of the sample, as well as on the value of [eq]#c#. 475e5c31af7Sopenharmony_ci 476e5c31af7Sopenharmony_ciThe exact details of the dithering algorithm are unspecified, including the 477e5c31af7Sopenharmony_cialgorithm itself, the formats dithering is applied to, and the stage in 478e5c31af7Sopenharmony_ciwhich it is applied. 479e5c31af7Sopenharmony_ci 480e5c31af7Sopenharmony_ci[NOTE] 481e5c31af7Sopenharmony_ci.Note 482e5c31af7Sopenharmony_ci==== 483e5c31af7Sopenharmony_ciThis extension is intended only for use by OpenGL emulation layers, and as 484e5c31af7Sopenharmony_cisuch the dithering algorithm applied to the subpass should: be equivalent to 485e5c31af7Sopenharmony_cithe vendor's OpenGL implementation, if any. 486e5c31af7Sopenharmony_ci==== 487e5c31af7Sopenharmony_ciendif::VK_EXT_legacy_dithering[] 488e5c31af7Sopenharmony_ci 489e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_tile_image[] 490e5c31af7Sopenharmony_ci[[interfaces-fragmenttileimage]] 491e5c31af7Sopenharmony_ci== Fragment Tile Image Interface 492e5c31af7Sopenharmony_ci 493e5c31af7Sopenharmony_ciWhen a fragment stage is present in a pipeline, the fragment shader tile 494e5c31af7Sopenharmony_ciimage variables decorated with code:Location form an interface with the 495e5c31af7Sopenharmony_cicolor attachments defined by the render pass instance. 496e5c31af7Sopenharmony_ciThe fragment shader tile image variables are matched by code:Location 497e5c31af7Sopenharmony_cidecorations to the color attachments specified in the 498e5c31af7Sopenharmony_cipname:pColorAttachments array of the slink:VkRenderingInfoKHR structure 499e5c31af7Sopenharmony_cidescribing the render pass instance the fragment shader is executed in. 500e5c31af7Sopenharmony_ci 501e5c31af7Sopenharmony_ciThe fragment shader variables listed by code:OpEntryPoint with the 502e5c31af7Sopenharmony_cicode:TileImageEXT storage class and a decoration of code:Location form the 503e5c31af7Sopenharmony_ci_fragment tile image interface_. 504e5c31af7Sopenharmony_ciThese variables must: be declared with a type of code:OpTypeImage, and a 505e5c31af7Sopenharmony_cicode:Dim operand of code:TileImageDataEXT. 506e5c31af7Sopenharmony_ciThe code:Component decoration is not supported for these variables. 507e5c31af7Sopenharmony_ci 508e5c31af7Sopenharmony_ciReading from a tile image variable with a code:Location decoration of _i_ 509e5c31af7Sopenharmony_cireads from the color attachment identified by the element of 510e5c31af7Sopenharmony_cislink:VkRenderingInfoKHR::pname:pColorAttachments with a pname:location 511e5c31af7Sopenharmony_ciequal to _i_. 512e5c31af7Sopenharmony_ciIf the tile image variable is declared as an array of size N, it consumes N 513e5c31af7Sopenharmony_ciconsecutive tile image locations, starting with the index specified. 514e5c31af7Sopenharmony_ciThere must: not be more than one tile image variable with the same 515e5c31af7Sopenharmony_cicode:Location whether explicitly declared or implied by an array 516e5c31af7Sopenharmony_cideclaration. 517e5c31af7Sopenharmony_ciThe number of available tile image locations is the same as the number of 518e5c31af7Sopenharmony_ciavailable fragment output locations as given by the 519e5c31af7Sopenharmony_cipname:maxFragmentOutputAttachments member of the 520e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits structure. 521e5c31af7Sopenharmony_ci 522e5c31af7Sopenharmony_ciThe basic data type (floating-point, integer, unsigned integer) of the tile 523e5c31af7Sopenharmony_ciimage variable must: match the basic format of the corresponding color 524e5c31af7Sopenharmony_ciattachment, or the values read from the tile image variables are undefined:. 525e5c31af7Sopenharmony_ciendif::VK_EXT_shader_tile_image[] 526e5c31af7Sopenharmony_ci 527e5c31af7Sopenharmony_ci[[interfaces-inputattachment]] 528e5c31af7Sopenharmony_ci== Fragment Input Attachment Interface 529e5c31af7Sopenharmony_ci 530e5c31af7Sopenharmony_ciWhen a fragment stage is present in a pipeline, the fragment shader subpass 531e5c31af7Sopenharmony_ciinputs form an interface with the input attachments of the current subpass. 532e5c31af7Sopenharmony_ciThe fragment shader subpass input variables are matched by 533e5c31af7Sopenharmony_cicode:InputAttachmentIndex decorations to the input attachments specified in 534e5c31af7Sopenharmony_cithe pname:pInputAttachments array of the slink:VkSubpassDescription 535e5c31af7Sopenharmony_cistructure describing the subpass that the fragment shader is executed in. 536e5c31af7Sopenharmony_ci 537e5c31af7Sopenharmony_ciThe fragment shader subpass input variables with the code:UniformConstant 538e5c31af7Sopenharmony_cistorage class and a decoration of code:InputAttachmentIndex that are 539e5c31af7Sopenharmony_cistatically used by code:OpEntryPoint form the _fragment input attachment 540e5c31af7Sopenharmony_ciinterface_. 541e5c31af7Sopenharmony_ciThese variables must: be declared with a type of code:OpTypeImage, a 542e5c31af7Sopenharmony_cicode:Dim operand of code:SubpassData, an code:Arrayed operand of 0, and a 543e5c31af7Sopenharmony_cicode:Sampled operand of 2. 544e5c31af7Sopenharmony_ciThe code:MS operand of the code:OpTypeImage must: be 0 if the pname:samples 545e5c31af7Sopenharmony_cifield of the corresponding slink:VkAttachmentDescription is 546e5c31af7Sopenharmony_ciename:VK_SAMPLE_COUNT_1_BIT and 547e5c31af7Sopenharmony_ciifdef::VK_EXT_multisampled_render_to_single_sampled[] 548e5c31af7Sopenharmony_ci<<subpass-multisampledrendertosinglesampled,multisampled-render-to-single-sampled>> 549e5c31af7Sopenharmony_ciis not enabled, and 550e5c31af7Sopenharmony_ciendif::VK_EXT_multisampled_render_to_single_sampled[] 551e5c31af7Sopenharmony_ci1 otherwise. 552e5c31af7Sopenharmony_ci 553e5c31af7Sopenharmony_ciA subpass input variable identified with an code:InputAttachmentIndex 554e5c31af7Sopenharmony_cidecoration of _i_ reads from the input attachment indicated by 555e5c31af7Sopenharmony_cipname:pInputAttachments[_i_] member of sname:VkSubpassDescription. 556e5c31af7Sopenharmony_ciIf the subpass input variable is declared as an array of size N, it consumes 557e5c31af7Sopenharmony_ciN consecutive input attachments, starting with the index specified. 558e5c31af7Sopenharmony_ciThere must: not be more than one input variable with the same 559e5c31af7Sopenharmony_cicode:InputAttachmentIndex whether explicitly declared or implied by an array 560e5c31af7Sopenharmony_cideclaration per image aspect. 561e5c31af7Sopenharmony_ciA multi-aspect image (e.g. a depth/stencil format) can: use the same input 562e5c31af7Sopenharmony_civariable. 563e5c31af7Sopenharmony_ciThe number of available input attachment indices is given by the 564e5c31af7Sopenharmony_cipname:maxPerStageDescriptorInputAttachments member of the 565e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits structure. 566e5c31af7Sopenharmony_ci 567e5c31af7Sopenharmony_ciVariables identified with the code:InputAttachmentIndex must: only be used 568e5c31af7Sopenharmony_ciby a fragment stage. 569e5c31af7Sopenharmony_ciThe <<formats-numericformat, numeric format>> of the subpass input must: 570e5c31af7Sopenharmony_cimatch the format of the corresponding input attachment, or the values of 571e5c31af7Sopenharmony_cisubpass loads from these variables are undefined:. 572e5c31af7Sopenharmony_ciIf the framebuffer attachment contains both depth and stencil aspects, the 573e5c31af7Sopenharmony_cinumeric format of the subpass input determines if depth or stencil aspect is 574e5c31af7Sopenharmony_ciaccessed by the shader. 575e5c31af7Sopenharmony_ci 576e5c31af7Sopenharmony_ciSee <<descriptorsets-inputattachment>> for more details. 577e5c31af7Sopenharmony_ci 578e5c31af7Sopenharmony_ci 579e5c31af7Sopenharmony_ci[[compatibility-inputattachment]] 580e5c31af7Sopenharmony_ci=== Fragment Input Attachment Compatibility 581e5c31af7Sopenharmony_ciAn input attachment that is statically accessed by a fragment shader must: 582e5c31af7Sopenharmony_cibe backed by a descriptor that is equivalent to the slink:VkImageView in the 583e5c31af7Sopenharmony_cislink:VkFramebuffer, except for pname:subresourceRange.aspectMask. 584e5c31af7Sopenharmony_ciThe pname:aspectMask must: be equal to the aspect accessed by the shader. 585e5c31af7Sopenharmony_ci 586e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 587e5c31af7Sopenharmony_ci[[interfaces-raypipeline]] 588e5c31af7Sopenharmony_ci== Ray Tracing Pipeline Interface 589e5c31af7Sopenharmony_ci 590e5c31af7Sopenharmony_ciRay tracing pipelines may: have more stages than other pipelines with 591e5c31af7Sopenharmony_cimultiple instances of each stage and more dynamic interactions between the 592e5c31af7Sopenharmony_cistages, but still have interface structures that obey the same general rules 593e5c31af7Sopenharmony_cias interfaces between shader stages in other pipelines. 594e5c31af7Sopenharmony_ciThe three types of inter-stage interface variables for ray tracing pipelines 595e5c31af7Sopenharmony_ciare: 596e5c31af7Sopenharmony_ci 597e5c31af7Sopenharmony_ci * Ray payloads containing data tracked for the entire lifetime of the ray. 598e5c31af7Sopenharmony_ci * Hit attributes containing data about a specific hit for the duration of 599e5c31af7Sopenharmony_ci its processing. 600e5c31af7Sopenharmony_ci * Callable data for passing data into and out of a callable shader. 601e5c31af7Sopenharmony_ci 602e5c31af7Sopenharmony_ciRay payloads and callable data are used in explicit shader call 603e5c31af7Sopenharmony_ciinstructions, so they have an incoming variant to distinguish the parameter 604e5c31af7Sopenharmony_cipassed to the invocation from any other payloads or data being used by 605e5c31af7Sopenharmony_cisubsequent shader call instructions. 606e5c31af7Sopenharmony_ci 607e5c31af7Sopenharmony_ciAn interface structure used between stages must: match between the stages 608e5c31af7Sopenharmony_ciusing it. 609e5c31af7Sopenharmony_ciSpecifically: 610e5c31af7Sopenharmony_ci 611e5c31af7Sopenharmony_ci * The hit attribute structure read in an any-hit or closest hit shader 612e5c31af7Sopenharmony_ci must: be the same structure as the hit attribute structure written in 613e5c31af7Sopenharmony_ci the corresponding intersection shader in the same hit group. 614e5c31af7Sopenharmony_ci * The incoming callable data for a callable shader must: be the same 615e5c31af7Sopenharmony_ci structure as the callable data referenced by the execute callable 616e5c31af7Sopenharmony_ci instruction in the calling shader. 617e5c31af7Sopenharmony_ci * The ray payload for a shader invoked by a ray tracing command must: be 618e5c31af7Sopenharmony_ci the same structure for all shader stages using the payload for that ray. 619e5c31af7Sopenharmony_ci 620e5c31af7Sopenharmony_ciAny shader with an incoming ray payload, incoming callable data, or hit 621e5c31af7Sopenharmony_ciattribute must: only declare one variable of that type. 622e5c31af7Sopenharmony_ci 623e5c31af7Sopenharmony_ci.Ray Pipeline Shader Interface 624e5c31af7Sopenharmony_ci[width="90%",options="header"] 625e5c31af7Sopenharmony_ci|==== 626e5c31af7Sopenharmony_ci| Shader Stage | Ray Payload | Incoming Ray Payload | Hit Attribute | Callable Data | Incoming Callable Data 627e5c31af7Sopenharmony_ci| Ray Generation | r/w | | | r/w | 628e5c31af7Sopenharmony_ci| Intersection | | | r/w | | 629e5c31af7Sopenharmony_ci| Any-Hit | | r/w | r | | 630e5c31af7Sopenharmony_ci| Closest Hit | r/w | r/w | r | r/w | 631e5c31af7Sopenharmony_ci| Miss | r/w | r/w | | r/w | 632e5c31af7Sopenharmony_ci| Callable | | | | r/w | r/w 633e5c31af7Sopenharmony_ci|==== 634e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 635e5c31af7Sopenharmony_ci 636e5c31af7Sopenharmony_ci 637e5c31af7Sopenharmony_ci[[interfaces-resources]] 638e5c31af7Sopenharmony_ci== Shader Resource Interface 639e5c31af7Sopenharmony_ci 640e5c31af7Sopenharmony_ciWhen a shader stage accesses buffer or image resources, as described in the 641e5c31af7Sopenharmony_ci<<descriptorsets,Resource Descriptors>> section, the shader resource 642e5c31af7Sopenharmony_civariables must: be matched with the <<descriptorsets-pipelinelayout,pipeline 643e5c31af7Sopenharmony_cilayout>> that is provided at pipeline creation time. 644e5c31af7Sopenharmony_ci 645e5c31af7Sopenharmony_ciThe set of shader variables that form the _shader resource interface_ for a 646e5c31af7Sopenharmony_cistage are the variables statically used by that stage's code:OpEntryPoint 647e5c31af7Sopenharmony_ciwith a storage class of code:Uniform, code:UniformConstant, 648e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 649e5c31af7Sopenharmony_cicode:StorageBuffer, 650e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 651e5c31af7Sopenharmony_cior code:PushConstant. 652e5c31af7Sopenharmony_ciFor the fragment shader, this includes the <<interfaces-inputattachment, 653e5c31af7Sopenharmony_cifragment input attachment interface>>. 654e5c31af7Sopenharmony_ci 655e5c31af7Sopenharmony_ciThe shader resource interface consists of two sub-interfaces: the push 656e5c31af7Sopenharmony_ciconstant interface and the descriptor set interface. 657e5c31af7Sopenharmony_ci 658e5c31af7Sopenharmony_ci 659e5c31af7Sopenharmony_ci[[interfaces-resources-pushconst]] 660e5c31af7Sopenharmony_ci=== Push Constant Interface 661e5c31af7Sopenharmony_ci 662e5c31af7Sopenharmony_ciThe shader variables defined with a storage class of code:PushConstant that 663e5c31af7Sopenharmony_ciare statically used by the shader entry points for the pipeline define the 664e5c31af7Sopenharmony_ci_push constant interface_. 665e5c31af7Sopenharmony_ciThey must: be: 666e5c31af7Sopenharmony_ci 667e5c31af7Sopenharmony_ci * typed as code:OpTypeStruct, 668e5c31af7Sopenharmony_ci * identified with a code:Block decoration, and 669e5c31af7Sopenharmony_ci * laid out explicitly using the code:Offset, code:ArrayStride, and 670e5c31af7Sopenharmony_ci code:MatrixStride decorations as specified in 671e5c31af7Sopenharmony_ci <<interfaces-resources-layout,Offset and Stride Assignment>>. 672e5c31af7Sopenharmony_ci 673e5c31af7Sopenharmony_ciThere must: be no more than one push constant block statically used per 674e5c31af7Sopenharmony_cishader entry point. 675e5c31af7Sopenharmony_ci 676e5c31af7Sopenharmony_ciEach statically used member of a push constant block must: be placed at an 677e5c31af7Sopenharmony_cicode:Offset such that the entire member is entirely contained within the 678e5c31af7Sopenharmony_cislink:VkPushConstantRange for each code:OpEntryPoint that uses it, and the 679e5c31af7Sopenharmony_cipname:stageFlags for that range must: specify the appropriate 680e5c31af7Sopenharmony_cielink:VkShaderStageFlagBits for that stage. 681e5c31af7Sopenharmony_ciThe code:Offset decoration for any member of a push constant block must: not 682e5c31af7Sopenharmony_cicause the space required for that member to extend outside the range 683e5c31af7Sopenharmony_ci[eq]#[0, pname:maxPushConstantsSize)#. 684e5c31af7Sopenharmony_ci 685e5c31af7Sopenharmony_ciAny member of a push constant block that is declared as an array must: only 686e5c31af7Sopenharmony_cibe accessed with _dynamically uniform_ indices. 687e5c31af7Sopenharmony_ci 688e5c31af7Sopenharmony_ci 689e5c31af7Sopenharmony_ci[[interfaces-resources-descset]] 690e5c31af7Sopenharmony_ci=== Descriptor Set Interface 691e5c31af7Sopenharmony_ci 692e5c31af7Sopenharmony_ciThe _descriptor set interface_ is comprised of the shader variables with the 693e5c31af7Sopenharmony_cistorage class of 694e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 695e5c31af7Sopenharmony_cicode:StorageBuffer, 696e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 697e5c31af7Sopenharmony_cicode:Uniform or code:UniformConstant (including the variables in the 698e5c31af7Sopenharmony_ci<<interfaces-inputattachment,fragment input attachment interface>>) that are 699e5c31af7Sopenharmony_cistatically used by the shader entry points for the pipeline. 700e5c31af7Sopenharmony_ci 701e5c31af7Sopenharmony_ciThese variables must: have code:DescriptorSet and code:Binding decorations 702e5c31af7Sopenharmony_cispecified, which are assigned and matched with the 703e5c31af7Sopenharmony_cisname:VkDescriptorSetLayout objects in the pipeline layout as described in 704e5c31af7Sopenharmony_ci<<interfaces-resources-setandbinding,DescriptorSet and Binding Assignment>>. 705e5c31af7Sopenharmony_ci 706e5c31af7Sopenharmony_ciThe code:Image code:Format of an code:OpTypeImage declaration must: not be 707e5c31af7Sopenharmony_ci*Unknown*, for variables which are used for code:OpImageRead, 708e5c31af7Sopenharmony_cicode:OpImageSparseRead, or code:OpImageWrite operations, except under the 709e5c31af7Sopenharmony_cifollowing conditions: 710e5c31af7Sopenharmony_ci 711e5c31af7Sopenharmony_ci * For code:OpImageWrite, if the image format is listed in the 712e5c31af7Sopenharmony_ci <<formats-without-shader-storage-format,storage without format>> list 713e5c31af7Sopenharmony_ci and if the pname:shaderStorageImageWriteWithoutFormat feature is enabled 714e5c31af7Sopenharmony_ci and the shader module declares the code:StorageImageWriteWithoutFormat 715e5c31af7Sopenharmony_ci capability. 716e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_format_feature_flags2[] 717e5c31af7Sopenharmony_ci * For code:OpImageWrite, if the image format supports 718e5c31af7Sopenharmony_ci ename:VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT and the 719e5c31af7Sopenharmony_ci shader module declares the code:StorageImageWriteWithoutFormat 720e5c31af7Sopenharmony_ci capability. 721e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_format_feature_flags2[] 722e5c31af7Sopenharmony_ci * For code:OpImageRead or code:OpImageSparseRead, if the image format is 723e5c31af7Sopenharmony_ci listed in the <<formats-without-shader-storage-format,storage without 724e5c31af7Sopenharmony_ci format>> list and if the pname:shaderStorageImageReadWithoutFormat 725e5c31af7Sopenharmony_ci feature is enabled and the shader module declares the 726e5c31af7Sopenharmony_ci code:StorageImageReadWithoutFormat capability. 727e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_format_feature_flags2[] 728e5c31af7Sopenharmony_ci * For code:OpImageRead or code:OpImageSparseRead, if the image format 729e5c31af7Sopenharmony_ci supports ename:VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT and 730e5c31af7Sopenharmony_ci the shader module declares the code:StorageImageReadWithoutFormat 731e5c31af7Sopenharmony_ci capability. 732e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_KHR_format_feature_flags2[] 733e5c31af7Sopenharmony_ci * For code:OpImageRead, if code:Dim is code:SubpassData (indicating a read 734e5c31af7Sopenharmony_ci from an input attachment). 735e5c31af7Sopenharmony_ci 736e5c31af7Sopenharmony_ciThe code:Image code:Format of an code:OpTypeImage declaration must: not be 737e5c31af7Sopenharmony_ci*Unknown*, for variables which are used for code:OpAtomic* operations. 738e5c31af7Sopenharmony_ci 739e5c31af7Sopenharmony_ciVariables identified with the code:Uniform storage class are used to access 740e5c31af7Sopenharmony_citransparent buffer backed resources. 741e5c31af7Sopenharmony_ciSuch variables must: be: 742e5c31af7Sopenharmony_ci 743e5c31af7Sopenharmony_ci * typed as code:OpTypeStruct, or an array of this type, 744e5c31af7Sopenharmony_ci * identified with a code:Block or code:BufferBlock decoration, and 745e5c31af7Sopenharmony_ci * laid out explicitly using the code:Offset, code:ArrayStride, and 746e5c31af7Sopenharmony_ci code:MatrixStride decorations as specified in 747e5c31af7Sopenharmony_ci <<interfaces-resources-layout,Offset and Stride Assignment>>. 748e5c31af7Sopenharmony_ci 749e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 750e5c31af7Sopenharmony_ciVariables identified with the code:StorageBuffer storage class are used to 751e5c31af7Sopenharmony_ciaccess transparent buffer backed resources. 752e5c31af7Sopenharmony_ciSuch variables must: be: 753e5c31af7Sopenharmony_ci 754e5c31af7Sopenharmony_ci * typed as code:OpTypeStruct, or an array of this type, 755e5c31af7Sopenharmony_ci * identified with a code:Block decoration, and 756e5c31af7Sopenharmony_ci * laid out explicitly using the code:Offset, code:ArrayStride, and 757e5c31af7Sopenharmony_ci code:MatrixStride decorations as specified in 758e5c31af7Sopenharmony_ci <<interfaces-resources-layout,Offset and Stride Assignment>>. 759e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 760e5c31af7Sopenharmony_ci 761e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 762e5c31af7Sopenharmony_ciThe code:Offset decoration for any variable in a code:Block must: not cause 763e5c31af7Sopenharmony_cithe space required for that variable to extend outside the range [eq]#[0, 764e5c31af7Sopenharmony_cipname:maxUniformBufferRange)#. 765e5c31af7Sopenharmony_ciThe code:Offset decoration for any variable in a code:BufferBlock must: not 766e5c31af7Sopenharmony_cicause the space required for that variable to extend outside the range 767e5c31af7Sopenharmony_ci[eq]#[0, pname:maxStorageBufferRange)#. 768e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 769e5c31af7Sopenharmony_ci 770e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 771e5c31af7Sopenharmony_ciThe code:Offset decoration for any member of a code:Block-decorated variable 772e5c31af7Sopenharmony_ciin the code:Uniform storage class must: not cause the space required for 773e5c31af7Sopenharmony_cithat variable to extend outside the range [eq]#[0, 774e5c31af7Sopenharmony_cipname:maxUniformBufferRange)#. 775e5c31af7Sopenharmony_ciThe code:Offset decoration for any member of a code:Block-decorated variable 776e5c31af7Sopenharmony_ciin the code:StorageBuffer storage class must: not cause the space required 777e5c31af7Sopenharmony_cifor that variable to extend outside the range [eq]#[0, 778e5c31af7Sopenharmony_cipname:maxStorageBufferRange)#. 779e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 780e5c31af7Sopenharmony_ci 781e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 782e5c31af7Sopenharmony_ciVariables identified with the code:Uniform storage class can: also be used 783e5c31af7Sopenharmony_cito access transparent descriptor set backed resources when the variable is 784e5c31af7Sopenharmony_ciassigned to a descriptor set layout binding with a pname:descriptorType of 785e5c31af7Sopenharmony_ciename:VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK. 786e5c31af7Sopenharmony_ciIn this case the variable must: be typed as code:OpTypeStruct and cannot: be 787e5c31af7Sopenharmony_ciaggregated into arrays of that type. 788e5c31af7Sopenharmony_ciFurther, the code:Offset decoration for any member of such a variable must: 789e5c31af7Sopenharmony_cinot cause the space required for that variable to extend outside the range 790e5c31af7Sopenharmony_ci[eq]#[0,pname:maxInlineUniformBlockSize)#. 791e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 792e5c31af7Sopenharmony_ci 793e5c31af7Sopenharmony_ciVariables identified with a storage class of code:UniformConstant and a 794e5c31af7Sopenharmony_cidecoration of code:InputAttachmentIndex must: be declared as described in 795e5c31af7Sopenharmony_ci<<interfaces-inputattachment,Fragment Input Attachment Interface>>. 796e5c31af7Sopenharmony_ci 797e5c31af7Sopenharmony_ciSPIR-V variables decorated with a descriptor set and binding that identify a 798e5c31af7Sopenharmony_ci<<descriptorsets-combinedimagesampler, combined image sampler descriptor>> 799e5c31af7Sopenharmony_cican: have a type of code:OpTypeImage, code:OpTypeSampler (code:Sampled=1), 800e5c31af7Sopenharmony_cior code:OpTypeSampledImage. 801e5c31af7Sopenharmony_ci 802e5c31af7Sopenharmony_ciArrays of any of these types can: be indexed with _constant integral 803e5c31af7Sopenharmony_ciexpressions_. 804e5c31af7Sopenharmony_ciThe following features must: be enabled and capabilities must: be declared 805e5c31af7Sopenharmony_ciin order to index such arrays with dynamically uniform or non-uniform 806e5c31af7Sopenharmony_ciindices: 807e5c31af7Sopenharmony_ci 808e5c31af7Sopenharmony_ci * Storage images (except storage texel buffers and input attachments): 809e5c31af7Sopenharmony_ci ** Dynamically uniform: pname:shaderStorageImageArrayDynamicIndexing and 810e5c31af7Sopenharmony_ci code:StorageImageArrayDynamicIndexing 811e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 812e5c31af7Sopenharmony_ci ** Non-uniform: pname:shaderStorageImageArrayNonUniformIndexing and 813e5c31af7Sopenharmony_ci code:StorageImageArrayNonUniformIndexing 814e5c31af7Sopenharmony_ci * Storage texel buffers: 815e5c31af7Sopenharmony_ci ** Dynamically uniform: pname:shaderStorageTexelBufferArrayDynamicIndexing 816e5c31af7Sopenharmony_ci and code:StorageTexelBufferArrayDynamicIndexing 817e5c31af7Sopenharmony_ci ** Non-uniform: pname:shaderStorageTexelBufferArrayNonUniformIndexing and 818e5c31af7Sopenharmony_ci code:StorageTexelBufferArrayNonUniformIndexing 819e5c31af7Sopenharmony_ci * Input attachments: 820e5c31af7Sopenharmony_ci ** Dynamically uniform: pname:shaderInputAttachmentArrayDynamicIndexing 821e5c31af7Sopenharmony_ci and code:InputAttachmentArrayDynamicIndexing 822e5c31af7Sopenharmony_ci ** Non-uniform: pname:shaderInputAttachmentArrayNonUniformIndexing and 823e5c31af7Sopenharmony_ci code:InputAttachmentArrayNonUniformIndexing 824e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 825e5c31af7Sopenharmony_ci * Sampled images (except uniform texel buffers), samplers and combined 826e5c31af7Sopenharmony_ci image samplers: 827e5c31af7Sopenharmony_ci ** Dynamically uniform: pname:shaderSampledImageArrayDynamicIndexing and 828e5c31af7Sopenharmony_ci code:SampledImageArrayDynamicIndexing 829e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 830e5c31af7Sopenharmony_ci ** Non-uniform: pname:shaderSampledImageArrayNonUniformIndexing and 831e5c31af7Sopenharmony_ci code:SampledImageArrayNonUniformIndexing 832e5c31af7Sopenharmony_ci * Uniform texel buffers: 833e5c31af7Sopenharmony_ci ** Dynamically uniform: pname:shaderUniformTexelBufferArrayDynamicIndexing 834e5c31af7Sopenharmony_ci and code:UniformTexelBufferArrayDynamicIndexing 835e5c31af7Sopenharmony_ci ** Non-uniform: pname:shaderUniformTexelBufferArrayNonUniformIndexing and 836e5c31af7Sopenharmony_ci code:UniformTexelBufferArrayNonUniformIndexing 837e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 838e5c31af7Sopenharmony_ci * Uniform buffers: 839e5c31af7Sopenharmony_ci ** Dynamically uniform: pname:shaderUniformBufferArrayDynamicIndexing and 840e5c31af7Sopenharmony_ci code:UniformBufferArrayDynamicIndexing 841e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 842e5c31af7Sopenharmony_ci ** Non-uniform: pname:shaderUniformBufferArrayNonUniformIndexing and 843e5c31af7Sopenharmony_ci code:UniformBufferArrayNonUniformIndexing 844e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 845e5c31af7Sopenharmony_ci * Storage buffers: 846e5c31af7Sopenharmony_ci ** Dynamically uniform: pname:shaderStorageBufferArrayDynamicIndexing and 847e5c31af7Sopenharmony_ci code:StorageBufferArrayDynamicIndexing 848e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 849e5c31af7Sopenharmony_ci ** Non-uniform: pname:shaderStorageBufferArrayNonUniformIndexing and 850e5c31af7Sopenharmony_ci code:StorageBufferArrayNonUniformIndexing 851e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 852e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 853e5c31af7Sopenharmony_ci * Acceleration structures: 854e5c31af7Sopenharmony_ci ** Dynamically uniform: Always supported. 855e5c31af7Sopenharmony_ci ** Non-uniform: Always supported. 856e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 857e5c31af7Sopenharmony_ciifdef::VK_QCOM_image_processing[] 858e5c31af7Sopenharmony_ci * <<descriptorsets-weightimage,weight image>>: 859e5c31af7Sopenharmony_ci ** Dynamically uniform: Always supported. 860e5c31af7Sopenharmony_ci ** Non-uniform: Never supported. 861e5c31af7Sopenharmony_ci * <<descriptorsets-blockmatch, Block matching image>>: 862e5c31af7Sopenharmony_ci ** Dynamically uniform: Always supported. 863e5c31af7Sopenharmony_ci ** Non-uniform: Never supported. 864e5c31af7Sopenharmony_ciendif::VK_QCOM_image_processing[] 865e5c31af7Sopenharmony_ci 866e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 867e5c31af7Sopenharmony_ciIf an instruction loads from or stores to a resource (including atomics and 868e5c31af7Sopenharmony_ciimage instructions) and the resource descriptor being accessed is not 869e5c31af7Sopenharmony_cidynamically uniform, then the corresponding non-uniform indexing feature 870e5c31af7Sopenharmony_cimust: be enabled and the capability must: be declared. 871e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 872e5c31af7Sopenharmony_ciIf an instruction loads from or stores to a resource (including atomics and 873e5c31af7Sopenharmony_ciimage instructions) and the resource descriptor being accessed is loaded 874e5c31af7Sopenharmony_cifrom an array element with a non-constant index, then the corresponding 875e5c31af7Sopenharmony_cidynamic 876e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 877e5c31af7Sopenharmony_cior non-uniform 878e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 879e5c31af7Sopenharmony_ciindexing feature must: be enabled and the capability must: be declared. 880e5c31af7Sopenharmony_ci 881e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 882e5c31af7Sopenharmony_ciIf the combined image sampler enables sampler {YCbCr} 883e5c31af7Sopenharmony_ciifndef::VK_EXT_fragment_density_map[] 884e5c31af7Sopenharmony_ciconversion, 885e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 886e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 887e5c31af7Sopenharmony_ciconversion or samples a <<samplers-subsamplesampler,subsampled image>>, 888e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 889e5c31af7Sopenharmony_ciit must: be indexed only by constant integral expressions when aggregated 890e5c31af7Sopenharmony_ciinto arrays in shader code, irrespective of the 891e5c31af7Sopenharmony_cipname:shaderSampledImageArrayDynamicIndexing feature. 892e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 893e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 894e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 895e5c31af7Sopenharmony_ciIf the combined image sampler samples a 896e5c31af7Sopenharmony_ci<<samplers-subsamplesampler,subsampled image>>, it must: be indexed only by 897e5c31af7Sopenharmony_ciconstant integral expressions when aggregated into arrays in shader code, 898e5c31af7Sopenharmony_ciirrespective of the pname:shaderSampledImageArrayDynamicIndexing feature. 899e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 900e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion[] 901e5c31af7Sopenharmony_ci 902e5c31af7Sopenharmony_ci[[interfaces-resources-correspondence]] 903e5c31af7Sopenharmony_ci.Shader Resource and Descriptor Type Correspondence 904e5c31af7Sopenharmony_ci[width="90%",cols="<1,<2",options="header"] 905e5c31af7Sopenharmony_ci|==== 906e5c31af7Sopenharmony_ci| Resource type | Descriptor Type 907e5c31af7Sopenharmony_ci| sampler | ename:VK_DESCRIPTOR_TYPE_SAMPLER or 908e5c31af7Sopenharmony_ci ename:VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER 909e5c31af7Sopenharmony_ci| sampled image | ename:VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE or 910e5c31af7Sopenharmony_ci ename:VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER 911e5c31af7Sopenharmony_ci| storage image | ename:VK_DESCRIPTOR_TYPE_STORAGE_IMAGE 912e5c31af7Sopenharmony_ci| combined image sampler | ename:VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER 913e5c31af7Sopenharmony_ci| uniform texel buffer | ename:VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER 914e5c31af7Sopenharmony_ci| storage texel buffer | ename:VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER 915e5c31af7Sopenharmony_ci| uniform buffer | ename:VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER or 916e5c31af7Sopenharmony_ci ename:VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC 917e5c31af7Sopenharmony_ci| storage buffer | ename:VK_DESCRIPTOR_TYPE_STORAGE_BUFFER or 918e5c31af7Sopenharmony_ci ename:VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC 919e5c31af7Sopenharmony_ci| input attachment | ename:VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT 920e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 921e5c31af7Sopenharmony_ci| inline uniform block | ename:VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK 922e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 923e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 924e5c31af7Sopenharmony_ci| acceleration structure | 925e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[ename:VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR] 926e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing+VK_KHR_acceleration_structure[or] 927e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[ename:VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV] 928e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 929e5c31af7Sopenharmony_ciifdef::VK_QCOM_image_processing[] 930e5c31af7Sopenharmony_ci| weight image | ename:VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM 931e5c31af7Sopenharmony_ci| block matching image | ename:VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM 932e5c31af7Sopenharmony_ciendif::VK_QCOM_image_processing[] 933e5c31af7Sopenharmony_ci|==== 934e5c31af7Sopenharmony_ci 935e5c31af7Sopenharmony_ci[[interfaces-resources-storage-class-correspondence]] 936e5c31af7Sopenharmony_ci.Shader Resource and Storage Class Correspondence 937e5c31af7Sopenharmony_ci[width="100%",cols="<21%,<22%,<27%,<30%",options="header"] 938e5c31af7Sopenharmony_ci|==== 939e5c31af7Sopenharmony_ci| Resource type | Storage Class | Type^1^ | Decoration(s)^2^ 940e5c31af7Sopenharmony_ci| sampler 941e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeSampler | 942e5c31af7Sopenharmony_ci| sampled image 943e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeImage (code:Sampled=1)| 944e5c31af7Sopenharmony_ci| storage image 945e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeImage (code:Sampled=2) | 946e5c31af7Sopenharmony_ci| combined image sampler 947e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeSampledImage + 948e5c31af7Sopenharmony_ci code:OpTypeImage (code:Sampled=1) + 949e5c31af7Sopenharmony_ci code:OpTypeSampler | 950e5c31af7Sopenharmony_ci| uniform texel buffer 951e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeImage (code:Dim=code:Buffer, code:Sampled=1) | 952e5c31af7Sopenharmony_ci| storage texel buffer 953e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeImage (code:Dim=code:Buffer, code:Sampled=2) | 954e5c31af7Sopenharmony_ci| uniform buffer 955e5c31af7Sopenharmony_ci | code:Uniform | code:OpTypeStruct 956e5c31af7Sopenharmony_ci | code:Block, code:Offset, (code:ArrayStride), (code:MatrixStride) 957e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 958e5c31af7Sopenharmony_ci| storage buffer 959e5c31af7Sopenharmony_ci | code:Uniform | code:OpTypeStruct 960e5c31af7Sopenharmony_ci | code:BufferBlock, code:Offset, (code:ArrayStride), (code:MatrixStride) 961e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 962e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 963e5c31af7Sopenharmony_ci.2+<.^| storage buffer 964e5c31af7Sopenharmony_ci | code:Uniform .2+<.^| code:OpTypeStruct 965e5c31af7Sopenharmony_ci | code:BufferBlock, code:Offset, (code:ArrayStride), (code:MatrixStride) 966e5c31af7Sopenharmony_ci | code:StorageBuffer | code:Block, code:Offset, (code:ArrayStride), (code:MatrixStride) 967e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_storage_buffer_storage_class[] 968e5c31af7Sopenharmony_ci| input attachment 969e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeImage (code:Dim=code:SubpassData, code:Sampled=2) 970e5c31af7Sopenharmony_ci | code:InputAttachmentIndex 971e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 972e5c31af7Sopenharmony_ci| inline uniform block 973e5c31af7Sopenharmony_ci | code:Uniform | code:OpTypeStruct 974e5c31af7Sopenharmony_ci | code:Block, code:Offset, (code:ArrayStride), (code:MatrixStride) 975e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 976e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 977e5c31af7Sopenharmony_ci| acceleration structure 978e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeAccelerationStructureKHR | 979e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 980e5c31af7Sopenharmony_ciifdef::VK_QCOM_image_processing[] 981e5c31af7Sopenharmony_ci| sample weight image 982e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeImage (code:Depth=0, code:Dim=code:2D, + 983e5c31af7Sopenharmony_ci code:Arrayed=1, code:MS=0, code:Sampled=1) 984e5c31af7Sopenharmony_ci | code:WeightTextureQCOM 985e5c31af7Sopenharmony_ci| block matching image 986e5c31af7Sopenharmony_ci | code:UniformConstant | code:OpTypeImage (code:Depth=0, code:Dim=code:2D, + 987e5c31af7Sopenharmony_ci code:Arrayed=0, code:MS=0, code:Sampled=1) 988e5c31af7Sopenharmony_ci | code:BlockMatchTextureQCOM 989e5c31af7Sopenharmony_ciendif::VK_QCOM_image_processing[] 990e5c31af7Sopenharmony_ci|==== 991e5c31af7Sopenharmony_ci 992e5c31af7Sopenharmony_ci1:: 993e5c31af7Sopenharmony_ci Where code:OpTypeImage is referenced, the code:Dim values code:Buffer 994e5c31af7Sopenharmony_ci and code:Subpassdata are only accepted where they are specifically 995e5c31af7Sopenharmony_ci referenced. 996e5c31af7Sopenharmony_ci They do not correspond to resource types where a generic 997e5c31af7Sopenharmony_ci code:OpTypeImage is specified. 998e5c31af7Sopenharmony_ci2:: 999e5c31af7Sopenharmony_ci In addition to code:DescriptorSet and code:Binding. 1000e5c31af7Sopenharmony_ci 1001e5c31af7Sopenharmony_ci 1002e5c31af7Sopenharmony_ci[[interfaces-resources-setandbinding]] 1003e5c31af7Sopenharmony_ci=== DescriptorSet and Binding Assignment 1004e5c31af7Sopenharmony_ci 1005e5c31af7Sopenharmony_ciA variable decorated with a code:DescriptorSet decoration of [eq]#s# and a 1006e5c31af7Sopenharmony_cicode:Binding decoration of [eq]#b# indicates that this variable is 1007e5c31af7Sopenharmony_ciassociated with the slink:VkDescriptorSetLayoutBinding that has a 1008e5c31af7Sopenharmony_cipname:binding equal to [eq]#b# in pname:pSetLayouts[_s_] that was specified 1009e5c31af7Sopenharmony_ciin slink:VkPipelineLayoutCreateInfo. 1010e5c31af7Sopenharmony_ci 1011e5c31af7Sopenharmony_cicode:DescriptorSet decoration values must: be between zero and 1012e5c31af7Sopenharmony_cipname:maxBoundDescriptorSets minus one, inclusive. 1013e5c31af7Sopenharmony_cicode:Binding decoration values can: be any 32-bit unsigned integer value, as 1014e5c31af7Sopenharmony_cidescribed in <<descriptorsets-setlayout>>. 1015e5c31af7Sopenharmony_ciEach descriptor set has its own binding name space. 1016e5c31af7Sopenharmony_ci 1017e5c31af7Sopenharmony_ciIf the code:Binding decoration is used with an array, the entire array is 1018e5c31af7Sopenharmony_ciassigned that binding value. 1019e5c31af7Sopenharmony_ciThe array must: be a single-dimensional array and size of the array must: be 1020e5c31af7Sopenharmony_cino larger than the number of descriptors in the binding. 1021e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1022e5c31af7Sopenharmony_ciIf the array is runtime-sized, then array elements greater than or equal to 1023e5c31af7Sopenharmony_cithe size of that binding in the bound descriptor set must: not be used. 1024e5c31af7Sopenharmony_ciIf the array is runtime-sized, the pname:runtimeDescriptorArray feature 1025e5c31af7Sopenharmony_cimust: be enabled and the code:RuntimeDescriptorArray capability must: be 1026e5c31af7Sopenharmony_cideclared. 1027e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1028e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1029e5c31af7Sopenharmony_ciThe array must: not be runtime-sized. 1030e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1031e5c31af7Sopenharmony_ciThe index of each element of the array is referred to as the _arrayElement_. 1032e5c31af7Sopenharmony_ciFor the purposes of interface matching and descriptor set 1033e5c31af7Sopenharmony_ci<<descriptorsets-updates,operations>>, if a resource variable is not an 1034e5c31af7Sopenharmony_ciarray, it is treated as if it has an arrayElement of zero. 1035e5c31af7Sopenharmony_ci 1036e5c31af7Sopenharmony_ciThere is a limit on the number of resources of each type that can: be 1037e5c31af7Sopenharmony_ciaccessed by a pipeline stage as shown in 1038e5c31af7Sopenharmony_ci<<interfaces-resources-limits,Shader Resource Limits>>. 1039e5c31af7Sopenharmony_ciThe "`Resources Per Stage`" column gives the limit on the number each type 1040e5c31af7Sopenharmony_ciof resource that can: be statically used for an entry point in any given 1041e5c31af7Sopenharmony_cistage in a pipeline. 1042e5c31af7Sopenharmony_ciThe "`Resource Types`" column lists which resource types are counted against 1043e5c31af7Sopenharmony_cithe limit. 1044e5c31af7Sopenharmony_ciSome resource types count against multiple limits. 1045e5c31af7Sopenharmony_ciifdef::VK_EXT_mutable_descriptor_type,VK_VALVE_mutable_descriptor_type[] 1046e5c31af7Sopenharmony_ciThe ename:VK_DESCRIPTOR_TYPE_MUTABLE_EXT descriptor type counts as one 1047e5c31af7Sopenharmony_ciindividual resource and one for every unique resource limit per descriptor 1048e5c31af7Sopenharmony_ciset type that is present in the associated binding's 1049e5c31af7Sopenharmony_cislink:VkMutableDescriptorTypeListEXT. 1050e5c31af7Sopenharmony_ciIf multiple descriptor types in slink:VkMutableDescriptorTypeListEXT map to 1051e5c31af7Sopenharmony_cithe same resource limit, only one descriptor is consumed for purposes of 1052e5c31af7Sopenharmony_cicomputing resource limits. 1053e5c31af7Sopenharmony_ciendif::VK_EXT_mutable_descriptor_type,VK_VALVE_mutable_descriptor_type[] 1054e5c31af7Sopenharmony_ci 1055e5c31af7Sopenharmony_ciThe pipeline layout may: include descriptor sets and bindings which are not 1056e5c31af7Sopenharmony_cireferenced by any variables statically used by the entry points for the 1057e5c31af7Sopenharmony_cishader stages in the binding's pname:stageFlags. 1058e5c31af7Sopenharmony_ci 1059e5c31af7Sopenharmony_ciHowever, if a variable assigned to a given code:DescriptorSet and 1060e5c31af7Sopenharmony_cicode:Binding is statically used by the entry point for a shader stage, the 1061e5c31af7Sopenharmony_cipipeline layout must: contain a descriptor set layout binding in that 1062e5c31af7Sopenharmony_cidescriptor set layout and for that binding number, and that binding's 1063e5c31af7Sopenharmony_cipname:stageFlags must: include the appropriate elink:VkShaderStageFlagBits 1064e5c31af7Sopenharmony_cifor that stage. 1065e5c31af7Sopenharmony_ciThe variable must: be of a valid resource type determined by its SPIR-V type 1066e5c31af7Sopenharmony_ciand storage class, as defined in 1067e5c31af7Sopenharmony_ci<<interfaces-resources-storage-class-correspondence,Shader Resource and 1068e5c31af7Sopenharmony_ciStorage Class Correspondence>>. 1069e5c31af7Sopenharmony_ciThe descriptor set layout binding must: be of a corresponding descriptor 1070e5c31af7Sopenharmony_citype, as defined in <<interfaces-resources-correspondence,Shader Resource 1071e5c31af7Sopenharmony_ciand Descriptor Type Correspondence>>. 1072e5c31af7Sopenharmony_ci 1073e5c31af7Sopenharmony_ci[NOTE] 1074e5c31af7Sopenharmony_ci.Note 1075e5c31af7Sopenharmony_ci==== 1076e5c31af7Sopenharmony_ciThere are no limits on the number of shader variables that can have 1077e5c31af7Sopenharmony_cioverlapping set and binding values in a shader; but which resources are 1078e5c31af7Sopenharmony_ci<<shaders-staticuse,statically used>> has an impact. 1079e5c31af7Sopenharmony_ciIf any shader variable identifying a resource is 1080e5c31af7Sopenharmony_ci<<shaders-staticuse,statically used>> in a shader, then the underlying 1081e5c31af7Sopenharmony_cidescriptor bound at the declared set and binding must 1082e5c31af7Sopenharmony_ci<<interfaces-resources-correspondence,support the declared type in the 1083e5c31af7Sopenharmony_cishader>> when the shader executes. 1084e5c31af7Sopenharmony_ci 1085e5c31af7Sopenharmony_ciIf multiple shader variables are declared with the same set and binding 1086e5c31af7Sopenharmony_civalues, and with the same underlying descriptor type, they can all be 1087e5c31af7Sopenharmony_cistatically used within the same shader. 1088e5c31af7Sopenharmony_ciHowever, accesses are not automatically synchronized, and code:Aliased 1089e5c31af7Sopenharmony_cidecorations should be used to avoid data hazards (see 1090e5c31af7Sopenharmony_cihttps://registry.khronos.org/spir-v/specs/unified1/SPIRV.html#_a_id_aliasingsection_a_aliasing[section 1091e5c31af7Sopenharmony_ci2.18.2 Aliasing in the SPIR-V specification]). 1092e5c31af7Sopenharmony_ci 1093e5c31af7Sopenharmony_ciIf multiple shader variables with the same set and binding values are 1094e5c31af7Sopenharmony_cideclared in a single shader, but with different declared types, where any of 1095e5c31af7Sopenharmony_cithose are not supported by the relevant bound descriptor, that shader can 1096e5c31af7Sopenharmony_cionly be executed if the variables with the unsupported type are not 1097e5c31af7Sopenharmony_cistatically used. 1098e5c31af7Sopenharmony_ci 1099e5c31af7Sopenharmony_ciA noteworthy example of using multiple statically-used shader variables 1100e5c31af7Sopenharmony_cisharing the same descriptor set and binding values is a descriptor of type 1101e5c31af7Sopenharmony_ciename:VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER that has multiple 1102e5c31af7Sopenharmony_cicorresponding shader variables in the code:UniformConstant storage class, 1103e5c31af7Sopenharmony_ciwhere some could be code:OpTypeImage (code:Sampled=1), some could be 1104e5c31af7Sopenharmony_cicode:OpTypeSampler, and some could be code:OpTypeSampledImage. 1105e5c31af7Sopenharmony_ci==== 1106e5c31af7Sopenharmony_ci 1107e5c31af7Sopenharmony_ci[[interfaces-resources-limits]] 1108e5c31af7Sopenharmony_ci.Shader Resource Limits 1109e5c31af7Sopenharmony_ci[width="80%",cols="<35,<23",options="header"] 1110e5c31af7Sopenharmony_ci|==== 1111e5c31af7Sopenharmony_ci| Resources per Stage | Resource Types 1112e5c31af7Sopenharmony_ci.2+<.^| pname:maxPerStageDescriptorSamplers 1113e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1114e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindSamplers 1115e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1116e5c31af7Sopenharmony_ci | sampler | combined image sampler 1117e5c31af7Sopenharmony_ciifndef::VK_QCOM_image_processing[] 1118e5c31af7Sopenharmony_ci.3+<.^| pname:maxPerStageDescriptorSampledImages 1119e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1120e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindSampledImages 1121e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1122e5c31af7Sopenharmony_ci | sampled image | combined image sampler | uniform texel buffer 1123e5c31af7Sopenharmony_ciendif::VK_QCOM_image_processing[] 1124e5c31af7Sopenharmony_ciifdef::VK_QCOM_image_processing[] 1125e5c31af7Sopenharmony_ci.5+<.^| pname:maxPerStageDescriptorSampledImages 1126e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1127e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindSampledImages 1128e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1129e5c31af7Sopenharmony_ci | sampled image | combined image sampler | uniform texel buffer + 1130e5c31af7Sopenharmony_ci | sample weight image | block matching image 1131e5c31af7Sopenharmony_ciendif::VK_QCOM_image_processing[] 1132e5c31af7Sopenharmony_ci.2+<.^| pname:maxPerStageDescriptorStorageImages 1133e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1134e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindStorageImages 1135e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1136e5c31af7Sopenharmony_ci | storage image | storage texel buffer 1137e5c31af7Sopenharmony_ci.2+<.^| pname:maxPerStageDescriptorUniformBuffers 1138e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1139e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindUniformBuffers 1140e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1141e5c31af7Sopenharmony_ci | uniform buffer | uniform buffer dynamic 1142e5c31af7Sopenharmony_ci.2+<.^| pname:maxPerStageDescriptorStorageBuffers 1143e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1144e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindStorageBuffers 1145e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1146e5c31af7Sopenharmony_ci | storage buffer | storage buffer dynamic 1147e5c31af7Sopenharmony_ci| pname:maxPerStageDescriptorInputAttachments 1148e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1149e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindInputAttachments 1150e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1151e5c31af7Sopenharmony_ci | input attachment^1^ 1152e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 1153e5c31af7Sopenharmony_ci| pname:maxPerStageDescriptorInlineUniformBlocks 1154e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1155e5c31af7Sopenharmony_cior pname:maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks 1156e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_descriptor_indexing[] 1157e5c31af7Sopenharmony_ci | inline uniform block 1158e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_inline_uniform_block[] 1159e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 1160e5c31af7Sopenharmony_ci| 1161e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[sname:VkPhysicalDeviceRayTracingPropertiesNV::pname:maxDescriptorSetAccelerationStructures] 1162e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing+VK_KHR_acceleration_structure[or] 1163e5c31af7Sopenharmony_ciifdef::VK_KHR_acceleration_structure[] 1164e5c31af7Sopenharmony_cipname:maxPerStageDescriptorAccelerationStructures or 1165e5c31af7Sopenharmony_cipname:maxPerStageDescriptorUpdateAfterBindAccelerationStructures 1166e5c31af7Sopenharmony_ciendif::VK_KHR_acceleration_structure[] 1167e5c31af7Sopenharmony_ci | acceleration structure 1168e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[] 1169e5c31af7Sopenharmony_ci|==== 1170e5c31af7Sopenharmony_ci 1171e5c31af7Sopenharmony_ci1:: 1172e5c31af7Sopenharmony_ci Input attachments can: only be used in the fragment shader stage 1173e5c31af7Sopenharmony_ci 1174e5c31af7Sopenharmony_ci 1175e5c31af7Sopenharmony_ci[[interfaces-resources-layout]] 1176e5c31af7Sopenharmony_ci=== Offset and Stride Assignment 1177e5c31af7Sopenharmony_ci 1178e5c31af7Sopenharmony_ciCertain objects must: be explicitly laid out using the code:Offset, 1179e5c31af7Sopenharmony_cicode:ArrayStride, and code:MatrixStride, as described in 1180e5c31af7Sopenharmony_cihttps://registry.khronos.org/spir-v/specs/unified1/SPIRV.html#ShaderValidation[SPIR-V 1181e5c31af7Sopenharmony_ciexplicit layout validation rules]. 1182e5c31af7Sopenharmony_ciAll such layouts also must: conform to the following requirements. 1183e5c31af7Sopenharmony_ci 1184e5c31af7Sopenharmony_ci[NOTE] 1185e5c31af7Sopenharmony_ci.Note 1186e5c31af7Sopenharmony_ci==== 1187e5c31af7Sopenharmony_ciThe numeric order of code:Offset decorations does not need to follow member 1188e5c31af7Sopenharmony_cideclaration order. 1189e5c31af7Sopenharmony_ci==== 1190e5c31af7Sopenharmony_ci 1191e5c31af7Sopenharmony_ci 1192e5c31af7Sopenharmony_ci[[interfaces-alignment-requirements]] 1193e5c31af7Sopenharmony_ci*Alignment Requirements* 1194e5c31af7Sopenharmony_ci 1195e5c31af7Sopenharmony_ciThere are different alignment requirements depending on the specific 1196e5c31af7Sopenharmony_ciresources and on the features enabled on the device. 1197e5c31af7Sopenharmony_ci 1198e5c31af7Sopenharmony_ciMatrix types are defined in terms of arrays as follows: 1199e5c31af7Sopenharmony_ci 1200e5c31af7Sopenharmony_ci * A column-major matrix with [eq]#C# columns and [eq]#R# rows is 1201e5c31af7Sopenharmony_ci equivalent to a [eq]#C# element array of vectors with [eq]#R# 1202e5c31af7Sopenharmony_ci components. 1203e5c31af7Sopenharmony_ci * A row-major matrix with [eq]#C# columns and [eq]#R# rows is equivalent 1204e5c31af7Sopenharmony_ci to an [eq]#R# element array of vectors with [eq]#C# components. 1205e5c31af7Sopenharmony_ci 1206e5c31af7Sopenharmony_ciThe _scalar alignment_ of the type of an code:OpTypeStruct member is defined 1207e5c31af7Sopenharmony_cirecursively as follows: 1208e5c31af7Sopenharmony_ci 1209e5c31af7Sopenharmony_ci * A scalar of size [eq]#N# has a scalar alignment of [eq]#N#. 1210e5c31af7Sopenharmony_ci * A vector type has a scalar alignment equal to that of its component 1211e5c31af7Sopenharmony_ci type. 1212e5c31af7Sopenharmony_ci * An array type has a scalar alignment equal to that of its element type. 1213e5c31af7Sopenharmony_ci * A structure has a scalar alignment equal to the largest scalar alignment 1214e5c31af7Sopenharmony_ci of any of its members. 1215e5c31af7Sopenharmony_ci * A matrix type inherits _scalar alignment_ from the equivalent array 1216e5c31af7Sopenharmony_ci declaration. 1217e5c31af7Sopenharmony_ci 1218e5c31af7Sopenharmony_ciThe _base alignment_ of the type of an code:OpTypeStruct member is defined 1219e5c31af7Sopenharmony_cirecursively as follows: 1220e5c31af7Sopenharmony_ci 1221e5c31af7Sopenharmony_ci * A scalar has a base alignment equal to its scalar alignment. 1222e5c31af7Sopenharmony_ci * A two-component vector has a base alignment equal to twice its scalar 1223e5c31af7Sopenharmony_ci alignment. 1224e5c31af7Sopenharmony_ci * A three- or four-component vector has a base alignment equal to four 1225e5c31af7Sopenharmony_ci times its scalar alignment. 1226e5c31af7Sopenharmony_ci * An array has a base alignment equal to the base alignment of its element 1227e5c31af7Sopenharmony_ci type. 1228e5c31af7Sopenharmony_ci * A structure has a base alignment equal to the largest base alignment of 1229e5c31af7Sopenharmony_ci any of its members. 1230e5c31af7Sopenharmony_ci An empty structure has a base alignment equal to the size of the 1231e5c31af7Sopenharmony_ci smallest scalar type permitted by the capabilities declared in the 1232e5c31af7Sopenharmony_ci SPIR-V module. 1233e5c31af7Sopenharmony_ci (e.g., for a 1 byte aligned empty struct in the code:StorageBuffer 1234e5c31af7Sopenharmony_ci storage class, code:StorageBuffer8BitAccess or 1235e5c31af7Sopenharmony_ci code:UniformAndStorageBuffer8BitAccess must: be declared in the SPIR-V 1236e5c31af7Sopenharmony_ci module.) 1237e5c31af7Sopenharmony_ci * A matrix type inherits _base alignment_ from the equivalent array 1238e5c31af7Sopenharmony_ci declaration. 1239e5c31af7Sopenharmony_ci 1240e5c31af7Sopenharmony_ciThe _extended alignment_ of the type of an code:OpTypeStruct member is 1241e5c31af7Sopenharmony_cisimilarly defined as follows: 1242e5c31af7Sopenharmony_ci 1243e5c31af7Sopenharmony_ci * A scalar or vector type has an extended alignment equal to its base 1244e5c31af7Sopenharmony_ci alignment. 1245e5c31af7Sopenharmony_ci * An array or structure type has an extended alignment equal to the 1246e5c31af7Sopenharmony_ci largest extended alignment of any of its members, rounded up to a 1247e5c31af7Sopenharmony_ci multiple of 16. 1248e5c31af7Sopenharmony_ci * A matrix type inherits extended alignment from the equivalent array 1249e5c31af7Sopenharmony_ci declaration. 1250e5c31af7Sopenharmony_ci 1251e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_relaxed_block_layout[] 1252e5c31af7Sopenharmony_ci 1253e5c31af7Sopenharmony_ciA member is defined to _improperly straddle_ if either of the following are 1254e5c31af7Sopenharmony_citrue: 1255e5c31af7Sopenharmony_ci 1256e5c31af7Sopenharmony_ci * It is a vector with total size less than or equal to 16 bytes, and has 1257e5c31af7Sopenharmony_ci code:Offset decorations placing its first byte at [eq]#F# and its last 1258e5c31af7Sopenharmony_ci byte at [eq]#L#, where [eq]#floor(F / 16) != floor(L / 16)#. 1259e5c31af7Sopenharmony_ci * It is a vector with total size greater than 16 bytes and has its 1260e5c31af7Sopenharmony_ci code:Offset decorations placing its first byte at a non-integer multiple 1261e5c31af7Sopenharmony_ci of 16. 1262e5c31af7Sopenharmony_ci 1263e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_relaxed_block_layout[] 1264e5c31af7Sopenharmony_ci 1265e5c31af7Sopenharmony_ci[[interfaces-resources-standard-layout]] 1266e5c31af7Sopenharmony_ci*Standard Buffer Layout* 1267e5c31af7Sopenharmony_ci 1268e5c31af7Sopenharmony_ciEvery member of an code:OpTypeStruct that is required to be explicitly laid 1269e5c31af7Sopenharmony_ciout must: be aligned according to the first matching rule as follows. 1270e5c31af7Sopenharmony_ciIf the struct is contained in pointer types of multiple storage classes, it 1271e5c31af7Sopenharmony_cimust: satisfy the requirements for every storage class used to reference it. 1272e5c31af7Sopenharmony_ci 1273e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_scalar_block_layout[] 1274e5c31af7Sopenharmony_ci . If the code:scalarBlockLayout feature is enabled on the device and the 1275e5c31af7Sopenharmony_ci storage class is code:Uniform, code:StorageBuffer, 1276e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1277e5c31af7Sopenharmony_ci code:PhysicalStorageBuffer, 1278e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1279e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 1280e5c31af7Sopenharmony_ci code:ShaderRecordBufferKHR, 1281e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 1282e5c31af7Sopenharmony_ci or code:PushConstant then every member must: be aligned according to its 1283e5c31af7Sopenharmony_ci scalar alignment. 1284e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_scalar_block_layout[] 1285e5c31af7Sopenharmony_ciifdef::VK_KHR_workgroup_memory_explicit_layout[] 1286e5c31af7Sopenharmony_ci . If the code:workgroupMemoryExplicitLayoutScalarBlockLayout feature is 1287e5c31af7Sopenharmony_ci enabled on the device and the storage class is code:Workgroup then every 1288e5c31af7Sopenharmony_ci member must: be aligned according to its scalar alignment. 1289e5c31af7Sopenharmony_ciendif::VK_KHR_workgroup_memory_explicit_layout[] 1290e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_relaxed_block_layout[] 1291e5c31af7Sopenharmony_ci . All vectors must: be aligned according to their scalar alignment. 1292e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_relaxed_block_layout[] 1293e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_uniform_buffer_standard_layout[] 1294e5c31af7Sopenharmony_ci . If the pname:uniformBufferStandardLayout feature is not enabled on the 1295e5c31af7Sopenharmony_ci device, then any 1296e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_uniform_buffer_standard_layout[] 1297e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_KHR_uniform_buffer_standard_layout[] 1298e5c31af7Sopenharmony_ci . Any 1299e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_uniform_buffer_standard_layout[] 1300e5c31af7Sopenharmony_ci member of an code:OpTypeStruct with a storage class of code:Uniform and 1301e5c31af7Sopenharmony_ci a decoration of code:Block must: be aligned according to its extended 1302e5c31af7Sopenharmony_ci alignment. 1303e5c31af7Sopenharmony_ci . Every other member must: be aligned according to its base alignment. 1304e5c31af7Sopenharmony_ci 1305e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_scalar_block_layout[] 1306e5c31af7Sopenharmony_ci[NOTE] 1307e5c31af7Sopenharmony_ci.Note 1308e5c31af7Sopenharmony_ci==== 1309e5c31af7Sopenharmony_ciEven if scalar alignment is supported, it is generally more performant to 1310e5c31af7Sopenharmony_ciuse the _base alignment_. 1311e5c31af7Sopenharmony_ci==== 1312e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_scalar_block_layout[] 1313e5c31af7Sopenharmony_ci 1314e5c31af7Sopenharmony_ciThe memory layout must: obey the following rules: 1315e5c31af7Sopenharmony_ci 1316e5c31af7Sopenharmony_ci * The code:Offset decoration of any member must: be a multiple of its 1317e5c31af7Sopenharmony_ci alignment. 1318e5c31af7Sopenharmony_ci * Any code:ArrayStride or code:MatrixStride decoration must: be a multiple 1319e5c31af7Sopenharmony_ci of the alignment of the array or matrix as defined above. 1320e5c31af7Sopenharmony_ci 1321e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_scalar_block_layout,VK_KHR_workgroup_memory_explicit_layout[] 1322e5c31af7Sopenharmony_ciIf one of the conditions below applies 1323e5c31af7Sopenharmony_ci 1324e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_scalar_block_layout[] 1325e5c31af7Sopenharmony_ci * The storage class is code:Uniform, code:StorageBuffer, 1326e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1327e5c31af7Sopenharmony_ci code:PhysicalStorageBuffer, 1328e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_buffer_device_address,VK_KHR_buffer_device_address[] 1329e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 1330e5c31af7Sopenharmony_ci code:ShaderRecordBufferKHR, 1331e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 1332e5c31af7Sopenharmony_ci or code:PushConstant, and the code:scalarBlockLayout feature is not 1333e5c31af7Sopenharmony_ci enabled on the device. 1334e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_scalar_block_layout[] 1335e5c31af7Sopenharmony_ciifdef::VK_KHR_workgroup_memory_explicit_layout[] 1336e5c31af7Sopenharmony_ci * The storage class is code:Workgroup, and either the struct member is not 1337e5c31af7Sopenharmony_ci part of a code:Block or the 1338e5c31af7Sopenharmony_ci code:workgroupMemoryExplicitLayoutScalarBlockLayout feature is not 1339e5c31af7Sopenharmony_ci enabled on the device. 1340e5c31af7Sopenharmony_ciendif::VK_KHR_workgroup_memory_explicit_layout[] 1341e5c31af7Sopenharmony_ci * The storage class is any other storage class. 1342e5c31af7Sopenharmony_ci 1343e5c31af7Sopenharmony_cithe memory layout must: also obey the following rules: 1344e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_scalar_block_layout,VK_KHR_workgroup_memory_explicit_layout[] 1345e5c31af7Sopenharmony_ci 1346e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_relaxed_block_layout[] 1347e5c31af7Sopenharmony_ci * Vectors must: not improperly straddle, as defined above. 1348e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_relaxed_block_layout[] 1349e5c31af7Sopenharmony_ci * The code:Offset decoration of a member must: not place it between the 1350e5c31af7Sopenharmony_ci end of a structure, an array or a matrix and the next multiple of the 1351e5c31af7Sopenharmony_ci alignment of that structure, array or matrix. 1352e5c31af7Sopenharmony_ci 1353e5c31af7Sopenharmony_ci[NOTE] 1354e5c31af7Sopenharmony_ci.Note 1355e5c31af7Sopenharmony_ci==== 1356e5c31af7Sopenharmony_ciThe *std430 layout* in GLSL satisfies these rules for types using the base 1357e5c31af7Sopenharmony_cialignment. 1358e5c31af7Sopenharmony_ciThe *std140 layout* satisfies the rules for types using the extended 1359e5c31af7Sopenharmony_cialignment. 1360e5c31af7Sopenharmony_ci==== 1361e5c31af7Sopenharmony_ci 1362e5c31af7Sopenharmony_ci 1363e5c31af7Sopenharmony_ci[[interfaces-builtin-variables]] 1364e5c31af7Sopenharmony_ci== Built-In Variables 1365e5c31af7Sopenharmony_ci 1366e5c31af7Sopenharmony_ciBuilt-in variables are accessed in shaders by declaring a variable decorated 1367e5c31af7Sopenharmony_ciwith a code:BuiltIn SPIR-V decoration. 1368e5c31af7Sopenharmony_ciThe meaning of each code:BuiltIn decoration is as follows. 1369e5c31af7Sopenharmony_ciIn the remainder of this section, the name of a built-in is used 1370e5c31af7Sopenharmony_ciinterchangeably with a term equivalent to a variable decorated with that 1371e5c31af7Sopenharmony_ciparticular built-in. 1372e5c31af7Sopenharmony_ciBuilt-ins that represent integer values can: be declared as either signed or 1373e5c31af7Sopenharmony_ciunsigned 32-bit integers. 1374e5c31af7Sopenharmony_ci 1375e5c31af7Sopenharmony_ci<<interfaces-iointerfaces-matching, As mentioned above>>, some inputs and 1376e5c31af7Sopenharmony_cioutputs have an additional level of arrayness relative to other shader 1377e5c31af7Sopenharmony_ciinputs and outputs. 1378e5c31af7Sopenharmony_ciThis level of arrayness is not included in the type descriptions below, but 1379e5c31af7Sopenharmony_cimust be included when declaring the built-in. 1380e5c31af7Sopenharmony_ci 1381e5c31af7Sopenharmony_ciifdef::VK_NV_fragment_shader_barycentric,VK_KHR_fragment_shader_barycentric[] 1382e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-barycoordkhr]] 1383e5c31af7Sopenharmony_ci[open,refpage='BaryCoordKHR',desc='Barycentric coordinates of a fragment',type='builtins'] 1384e5c31af7Sopenharmony_ci-- 1385e5c31af7Sopenharmony_ci:refpage: BaryCoordKHR 1386e5c31af7Sopenharmony_ci 1387e5c31af7Sopenharmony_cicode:BaryCoordKHR:: 1388e5c31af7Sopenharmony_ci 1389e5c31af7Sopenharmony_ciThe code:BaryCoordKHR decoration can: be used to decorate a fragment shader 1390e5c31af7Sopenharmony_ciinput variable. 1391e5c31af7Sopenharmony_ciThis variable will contain a three-component floating-point vector with 1392e5c31af7Sopenharmony_cibarycentric weights that indicate the location of the fragment relative to 1393e5c31af7Sopenharmony_cithe screen-space locations of vertices of its primitive, obtained using 1394e5c31af7Sopenharmony_ciperspective interpolation. 1395e5c31af7Sopenharmony_ci 1396e5c31af7Sopenharmony_ci.Valid Usage 1397e5c31af7Sopenharmony_ci**** 1398e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordKHR-04154]] 1399e5c31af7Sopenharmony_ci The code:BaryCoordKHR decoration must: be used only within the 1400e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 1401e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordKHR-04155]] 1402e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordKHR must: be declared using 1403e5c31af7Sopenharmony_ci the code:Input {StorageClass} 1404e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordKHR-04156]] 1405e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordKHR must: be declared as a 1406e5c31af7Sopenharmony_ci three-component vector of 32-bit floating-point values 1407e5c31af7Sopenharmony_ci**** 1408e5c31af7Sopenharmony_ci-- 1409e5c31af7Sopenharmony_ciendif::VK_NV_fragment_shader_barycentric,VK_KHR_fragment_shader_barycentric[] 1410e5c31af7Sopenharmony_ci 1411e5c31af7Sopenharmony_ciifdef::VK_AMD_shader_explicit_vertex_parameter[] 1412e5c31af7Sopenharmony_ci[open,refpage='BaryCoordNoPerspAMD',desc='Barycentric coordinates of a fragment center in screen-space',type='builtins'] 1413e5c31af7Sopenharmony_ci-- 1414e5c31af7Sopenharmony_ci:refpage: BaryCoordNoPerspAMD 1415e5c31af7Sopenharmony_ci 1416e5c31af7Sopenharmony_cicode:BaryCoordNoPerspAMD:: 1417e5c31af7Sopenharmony_ci 1418e5c31af7Sopenharmony_ciThe code:BaryCoordNoPerspAMD decoration can: be used to decorate a fragment 1419e5c31af7Sopenharmony_cishader input variable. 1420e5c31af7Sopenharmony_ciThis variable will contain the (I,J) pair of the barycentric coordinates 1421e5c31af7Sopenharmony_cicorresponding to the fragment evaluated using linear interpolation at the 1422e5c31af7Sopenharmony_cifragment's center. 1423e5c31af7Sopenharmony_ciThe K coordinate of the barycentric coordinates can: be derived given the 1424e5c31af7Sopenharmony_ciidentity I {plus} J {plus} K = 1.0. 1425e5c31af7Sopenharmony_ci 1426e5c31af7Sopenharmony_ci.Valid Usage 1427e5c31af7Sopenharmony_ci**** 1428e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspAMD-04157]] 1429e5c31af7Sopenharmony_ci The code:BaryCoordNoPerspAMD decoration must: be used only within the 1430e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 1431e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspAMD-04158]] 1432e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspAMD must: be declared 1433e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 1434e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspAMD-04159]] 1435e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspAMD must: be declared 1436e5c31af7Sopenharmony_ci as a two-component vector of 32-bit floating-point values 1437e5c31af7Sopenharmony_ci**** 1438e5c31af7Sopenharmony_ci-- 1439e5c31af7Sopenharmony_ciendif::VK_AMD_shader_explicit_vertex_parameter[] 1440e5c31af7Sopenharmony_ci 1441e5c31af7Sopenharmony_ciifdef::VK_NV_fragment_shader_barycentric,VK_KHR_fragment_shader_barycentric[] 1442e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-barycoordnoperspkhr]] 1443e5c31af7Sopenharmony_ci[open,refpage='BaryCoordNoPerspKHR',desc='Barycentric coordinates of a fragment in screen-space',type='builtins'] 1444e5c31af7Sopenharmony_ci-- 1445e5c31af7Sopenharmony_ci:refpage: BaryCoordNoPerspKHR 1446e5c31af7Sopenharmony_ci 1447e5c31af7Sopenharmony_cicode:BaryCoordNoPerspKHR:: 1448e5c31af7Sopenharmony_ci 1449e5c31af7Sopenharmony_ciThe code:BaryCoordNoPerspKHR decoration can: be used to decorate a fragment 1450e5c31af7Sopenharmony_cishader input variable. 1451e5c31af7Sopenharmony_ciThis variable will contain a three-component floating-point vector with 1452e5c31af7Sopenharmony_cibarycentric weights that indicate the location of the fragment relative to 1453e5c31af7Sopenharmony_cithe screen-space locations of vertices of its primitive, obtained using 1454e5c31af7Sopenharmony_cilinear interpolation. 1455e5c31af7Sopenharmony_ci 1456e5c31af7Sopenharmony_ci.Valid Usage 1457e5c31af7Sopenharmony_ci**** 1458e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspKHR-04160]] 1459e5c31af7Sopenharmony_ci The code:BaryCoordNoPerspKHR decoration must: be used only within the 1460e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 1461e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspKHR-04161]] 1462e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspKHR must: be declared 1463e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 1464e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspKHR-04162]] 1465e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspKHR must: be declared 1466e5c31af7Sopenharmony_ci as a three-component vector of 32-bit floating-point values 1467e5c31af7Sopenharmony_ci**** 1468e5c31af7Sopenharmony_ci-- 1469e5c31af7Sopenharmony_ciendif::VK_NV_fragment_shader_barycentric,VK_KHR_fragment_shader_barycentric[] 1470e5c31af7Sopenharmony_ci 1471e5c31af7Sopenharmony_ciifdef::VK_AMD_shader_explicit_vertex_parameter[] 1472e5c31af7Sopenharmony_ci[open,refpage='BaryCoordNoPerspCentroidAMD',desc='Barycentric coordinates of a fragment centroid in screen-space',type='builtins'] 1473e5c31af7Sopenharmony_ci-- 1474e5c31af7Sopenharmony_ci:refpage: BaryCoordNoPerspCentroidAMD 1475e5c31af7Sopenharmony_ci 1476e5c31af7Sopenharmony_cicode:BaryCoordNoPerspCentroidAMD:: 1477e5c31af7Sopenharmony_ci 1478e5c31af7Sopenharmony_ciThe code:BaryCoordNoPerspCentroidAMD decoration can: be used to decorate a 1479e5c31af7Sopenharmony_cifragment shader input variable. 1480e5c31af7Sopenharmony_ciThis variable will contain the (I,J) pair of the barycentric coordinates 1481e5c31af7Sopenharmony_cicorresponding to the fragment evaluated using linear interpolation at the 1482e5c31af7Sopenharmony_cicentroid. 1483e5c31af7Sopenharmony_ciThe K coordinate of the barycentric coordinates can: be derived given the 1484e5c31af7Sopenharmony_ciidentity I {plus} J {plus} K = 1.0. 1485e5c31af7Sopenharmony_ci 1486e5c31af7Sopenharmony_ci.Valid Usage 1487e5c31af7Sopenharmony_ci**** 1488e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspCentroidAMD-04163]] 1489e5c31af7Sopenharmony_ci The code:BaryCoordNoPerspCentroidAMD decoration must: be used only 1490e5c31af7Sopenharmony_ci within the code:Fragment {ExecutionModel} 1491e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspCentroidAMD-04164]] 1492e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspCentroidAMD must: be 1493e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 1494e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspCentroidAMD-04165]] 1495e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspCentroidAMD must: be 1496e5c31af7Sopenharmony_ci declared as a three-component vector of 32-bit floating-point values 1497e5c31af7Sopenharmony_ci**** 1498e5c31af7Sopenharmony_ci-- 1499e5c31af7Sopenharmony_ci 1500e5c31af7Sopenharmony_ci[open,refpage='BaryCoordNoPerspSampleAMD',desc='Barycentric coordinates of a sample center in screen-space',type='builtins'] 1501e5c31af7Sopenharmony_ci-- 1502e5c31af7Sopenharmony_ci:refpage: BaryCoordNoPerspSampleAMD 1503e5c31af7Sopenharmony_ci 1504e5c31af7Sopenharmony_cicode:BaryCoordNoPerspSampleAMD:: 1505e5c31af7Sopenharmony_ci 1506e5c31af7Sopenharmony_ciThe code:BaryCoordNoPerspSampleAMD decoration can: be used to decorate a 1507e5c31af7Sopenharmony_cifragment shader input variable. 1508e5c31af7Sopenharmony_ciThis variable will contain the (I,J) pair of the barycentric coordinates 1509e5c31af7Sopenharmony_cicorresponding to the fragment evaluated using linear interpolation at each 1510e5c31af7Sopenharmony_cicovered sample. 1511e5c31af7Sopenharmony_ciThe K coordinate of the barycentric coordinates can: be derived given the 1512e5c31af7Sopenharmony_ciidentity I {plus} J {plus} K = 1.0. 1513e5c31af7Sopenharmony_ci 1514e5c31af7Sopenharmony_ci.Valid Usage 1515e5c31af7Sopenharmony_ci**** 1516e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspSampleAMD-04166]] 1517e5c31af7Sopenharmony_ci The code:BaryCoordNoPerspSampleAMD decoration must: be used only within 1518e5c31af7Sopenharmony_ci the code:Fragment {ExecutionModel} 1519e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspSampleAMD-04167]] 1520e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspSampleAMD must: be 1521e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 1522e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordNoPerspSampleAMD-04168]] 1523e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordNoPerspSampleAMD must: be 1524e5c31af7Sopenharmony_ci declared as a two-component vector of 32-bit floating-point values 1525e5c31af7Sopenharmony_ci**** 1526e5c31af7Sopenharmony_ci-- 1527e5c31af7Sopenharmony_ci 1528e5c31af7Sopenharmony_ci[open,refpage='BaryCoordPullModelAMD',desc='Inverse barycentric coordinates of a fragment center',type='builtins'] 1529e5c31af7Sopenharmony_ci-- 1530e5c31af7Sopenharmony_ci:refpage: BaryCoordPullModelAMD 1531e5c31af7Sopenharmony_ci 1532e5c31af7Sopenharmony_cicode:BaryCoordPullModelAMD:: 1533e5c31af7Sopenharmony_ci 1534e5c31af7Sopenharmony_ciThe code:BaryCoordPullModelAMD decoration can: be used to decorate a 1535e5c31af7Sopenharmony_cifragment shader input variable. 1536e5c31af7Sopenharmony_ciThis variable will contain (1/W, 1/I, 1/J) evaluated at the fragment center 1537e5c31af7Sopenharmony_ciand can: be used to calculate gradients and then interpolate I, J, and W at 1538e5c31af7Sopenharmony_ciany desired sample location. 1539e5c31af7Sopenharmony_ci 1540e5c31af7Sopenharmony_ci.Valid Usage 1541e5c31af7Sopenharmony_ci**** 1542e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordPullModelAMD-04169]] 1543e5c31af7Sopenharmony_ci The code:BaryCoordPullModelAMD decoration must: be used only within the 1544e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 1545e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordPullModelAMD-04170]] 1546e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordPullModelAMD must: be declared 1547e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 1548e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordPullModelAMD-04171]] 1549e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordPullModelAMD must: be declared 1550e5c31af7Sopenharmony_ci as a three-component vector of 32-bit floating-point values 1551e5c31af7Sopenharmony_ci**** 1552e5c31af7Sopenharmony_ci-- 1553e5c31af7Sopenharmony_ci 1554e5c31af7Sopenharmony_ci[open,refpage='BaryCoordSmoothAMD',desc='Barycentric coordinates of a fragment center',type='builtins'] 1555e5c31af7Sopenharmony_ci-- 1556e5c31af7Sopenharmony_ci:refpage: BaryCoordSmoothAMD 1557e5c31af7Sopenharmony_ci 1558e5c31af7Sopenharmony_cicode:BaryCoordSmoothAMD:: 1559e5c31af7Sopenharmony_ci 1560e5c31af7Sopenharmony_ciThe code:BaryCoordSmoothAMD decoration can: be used to decorate a fragment 1561e5c31af7Sopenharmony_cishader input variable. 1562e5c31af7Sopenharmony_ciThis variable will contain the (I,J) pair of the barycentric coordinates 1563e5c31af7Sopenharmony_cicorresponding to the fragment evaluated using perspective interpolation at 1564e5c31af7Sopenharmony_cithe fragment's center. 1565e5c31af7Sopenharmony_ciThe K coordinate of the barycentric coordinates can: be derived given the 1566e5c31af7Sopenharmony_ciidentity I {plus} J {plus} K = 1.0. 1567e5c31af7Sopenharmony_ci 1568e5c31af7Sopenharmony_ci.Valid Usage 1569e5c31af7Sopenharmony_ci**** 1570e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothAMD-04172]] 1571e5c31af7Sopenharmony_ci The code:BaryCoordSmoothAMD decoration must: be used only within the 1572e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 1573e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothAMD-04173]] 1574e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordSmoothAMD must: be declared 1575e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 1576e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothAMD-04174]] 1577e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordSmoothAMD must: be declared as 1578e5c31af7Sopenharmony_ci a two-component vector of 32-bit floating-point values 1579e5c31af7Sopenharmony_ci**** 1580e5c31af7Sopenharmony_ci-- 1581e5c31af7Sopenharmony_ci 1582e5c31af7Sopenharmony_ci[open,refpage='BaryCoordSmoothCentroidAMD',desc='Barycentric coordinates of a fragment centroid',type='builtins'] 1583e5c31af7Sopenharmony_ci-- 1584e5c31af7Sopenharmony_ci:refpage: BaryCoordSmoothCentroidAMD 1585e5c31af7Sopenharmony_ci 1586e5c31af7Sopenharmony_cicode:BaryCoordSmoothCentroidAMD:: 1587e5c31af7Sopenharmony_ci 1588e5c31af7Sopenharmony_ciThe code:BaryCoordSmoothCentroidAMD decoration can: be used to decorate a 1589e5c31af7Sopenharmony_cifragment shader input variable. 1590e5c31af7Sopenharmony_ciThis variable will contain the (I,J) pair of the barycentric coordinates 1591e5c31af7Sopenharmony_cicorresponding to the fragment evaluated using perspective interpolation at 1592e5c31af7Sopenharmony_cithe centroid. 1593e5c31af7Sopenharmony_ciThe K coordinate of the barycentric coordinates can: be derived given the 1594e5c31af7Sopenharmony_ciidentity I {plus} J {plus} K = 1.0. 1595e5c31af7Sopenharmony_ci 1596e5c31af7Sopenharmony_ci.Valid Usage 1597e5c31af7Sopenharmony_ci**** 1598e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothCentroidAMD-04175]] 1599e5c31af7Sopenharmony_ci The code:BaryCoordSmoothCentroidAMD decoration must: be used only within 1600e5c31af7Sopenharmony_ci the code:Fragment {ExecutionModel} 1601e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothCentroidAMD-04176]] 1602e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordSmoothCentroidAMD must: be 1603e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 1604e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothCentroidAMD-04177]] 1605e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordSmoothCentroidAMD must: be 1606e5c31af7Sopenharmony_ci declared as a two-component vector of 32-bit floating-point values 1607e5c31af7Sopenharmony_ci**** 1608e5c31af7Sopenharmony_ci-- 1609e5c31af7Sopenharmony_ci 1610e5c31af7Sopenharmony_ci[open,refpage='BaryCoordSmoothSampleAMD',desc='Barycentric coordinates of a sample center',type='builtins'] 1611e5c31af7Sopenharmony_ci-- 1612e5c31af7Sopenharmony_ci:refpage: BaryCoordSmoothSampleAMD 1613e5c31af7Sopenharmony_ci 1614e5c31af7Sopenharmony_cicode:BaryCoordSmoothSampleAMD:: 1615e5c31af7Sopenharmony_ci 1616e5c31af7Sopenharmony_ciThe code:BaryCoordSmoothSampleAMD decoration can: be used to decorate a 1617e5c31af7Sopenharmony_cifragment shader input variable. 1618e5c31af7Sopenharmony_ciThis variable will contain the (I,J) pair of the barycentric coordinates 1619e5c31af7Sopenharmony_cicorresponding to the fragment evaluated using perspective interpolation at 1620e5c31af7Sopenharmony_cieach covered sample. 1621e5c31af7Sopenharmony_ciThe K coordinate of the barycentric coordinates can: be derived given the 1622e5c31af7Sopenharmony_ciidentity I {plus} J {plus} K = 1.0. 1623e5c31af7Sopenharmony_ci 1624e5c31af7Sopenharmony_ci.Valid Usage 1625e5c31af7Sopenharmony_ci**** 1626e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothSampleAMD-04178]] 1627e5c31af7Sopenharmony_ci The code:BaryCoordSmoothSampleAMD decoration must: be used only within 1628e5c31af7Sopenharmony_ci the code:Fragment {ExecutionModel} 1629e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothSampleAMD-04179]] 1630e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordSmoothSampleAMD must: be 1631e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 1632e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaryCoordSmoothSampleAMD-04180]] 1633e5c31af7Sopenharmony_ci The variable decorated with code:BaryCoordSmoothSampleAMD must: be 1634e5c31af7Sopenharmony_ci declared as a two-component vector of 32-bit floating-point values 1635e5c31af7Sopenharmony_ci**** 1636e5c31af7Sopenharmony_ci-- 1637e5c31af7Sopenharmony_ciendif::VK_AMD_shader_explicit_vertex_parameter[] 1638e5c31af7Sopenharmony_ci 1639e5c31af7Sopenharmony_ci 1640e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[] 1641e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-baseinstance]] 1642e5c31af7Sopenharmony_ci[open,refpage='BaseInstance',desc='First instance being rendered',type='builtins'] 1643e5c31af7Sopenharmony_ci-- 1644e5c31af7Sopenharmony_ci:refpage: BaseInstance 1645e5c31af7Sopenharmony_ci 1646e5c31af7Sopenharmony_cicode:BaseInstance:: 1647e5c31af7Sopenharmony_ci 1648e5c31af7Sopenharmony_ciDecorating a variable with the code:BaseInstance built-in will make that 1649e5c31af7Sopenharmony_civariable contain the integer value corresponding to the first instance that 1650e5c31af7Sopenharmony_ciwas passed to the command that invoked the current vertex shader invocation. 1651e5c31af7Sopenharmony_cicode:BaseInstance is the pname:firstInstance parameter to a _direct drawing 1652e5c31af7Sopenharmony_cicommand_ or the pname:firstInstance member of a structure consumed by an 1653e5c31af7Sopenharmony_ci_indirect drawing command_. 1654e5c31af7Sopenharmony_ci 1655e5c31af7Sopenharmony_ci.Valid Usage 1656e5c31af7Sopenharmony_ci**** 1657e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaseInstance-04181]] 1658e5c31af7Sopenharmony_ci The code:BaseInstance decoration must: be used only within the 1659e5c31af7Sopenharmony_ci code:Vertex {ExecutionModel} 1660e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaseInstance-04182]] 1661e5c31af7Sopenharmony_ci The variable decorated with code:BaseInstance must: be declared using 1662e5c31af7Sopenharmony_ci the code:Input {StorageClass} 1663e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaseInstance-04183]] 1664e5c31af7Sopenharmony_ci The variable decorated with code:BaseInstance must: be declared as a 1665e5c31af7Sopenharmony_ci scalar 32-bit integer value 1666e5c31af7Sopenharmony_ci**** 1667e5c31af7Sopenharmony_ci-- 1668e5c31af7Sopenharmony_ci 1669e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-basevertex]] 1670e5c31af7Sopenharmony_ci[open,refpage='BaseVertex',desc='First vertex being rendered',type='builtins'] 1671e5c31af7Sopenharmony_ci-- 1672e5c31af7Sopenharmony_ci:refpage: BaseVertex 1673e5c31af7Sopenharmony_ci 1674e5c31af7Sopenharmony_cicode:BaseVertex:: 1675e5c31af7Sopenharmony_ci 1676e5c31af7Sopenharmony_ciDecorating a variable with the code:BaseVertex built-in will make that 1677e5c31af7Sopenharmony_civariable contain the integer value corresponding to the first vertex or 1678e5c31af7Sopenharmony_civertex offset that was passed to the command that invoked the current vertex 1679e5c31af7Sopenharmony_cishader invocation. 1680e5c31af7Sopenharmony_ciFor _non-indexed drawing commands_, this variable is the pname:firstVertex 1681e5c31af7Sopenharmony_ciparameter to a _direct drawing command_ or the pname:firstVertex member of 1682e5c31af7Sopenharmony_cithe structure consumed by an _indirect drawing command_. 1683e5c31af7Sopenharmony_ciFor _indexed drawing commands_, this variable is the pname:vertexOffset 1684e5c31af7Sopenharmony_ciparameter to a _direct drawing command_ or the pname:vertexOffset member of 1685e5c31af7Sopenharmony_cithe structure consumed by an _indirect drawing command_. 1686e5c31af7Sopenharmony_ci 1687e5c31af7Sopenharmony_ci.Valid Usage 1688e5c31af7Sopenharmony_ci**** 1689e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaseVertex-04184]] 1690e5c31af7Sopenharmony_ci The code:BaseVertex decoration must: be used only within the code:Vertex 1691e5c31af7Sopenharmony_ci {ExecutionModel} 1692e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaseVertex-04185]] 1693e5c31af7Sopenharmony_ci The variable decorated with code:BaseVertex must: be declared using the 1694e5c31af7Sopenharmony_ci code:Input {StorageClass} 1695e5c31af7Sopenharmony_ci * [[VUID-{refpage}-BaseVertex-04186]] 1696e5c31af7Sopenharmony_ci The variable decorated with code:BaseVertex must: be declared as a 1697e5c31af7Sopenharmony_ci scalar 32-bit integer value 1698e5c31af7Sopenharmony_ci**** 1699e5c31af7Sopenharmony_ci-- 1700e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[] 1701e5c31af7Sopenharmony_ci 1702e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-clipdistance]] 1703e5c31af7Sopenharmony_ci[open,refpage='ClipDistance',desc='Application-specified clip distances',type='builtins'] 1704e5c31af7Sopenharmony_ci-- 1705e5c31af7Sopenharmony_ci:refpage: ClipDistance 1706e5c31af7Sopenharmony_ci 1707e5c31af7Sopenharmony_cicode:ClipDistance:: 1708e5c31af7Sopenharmony_ci 1709e5c31af7Sopenharmony_ciDecorating a variable with the code:ClipDistance built-in decoration will 1710e5c31af7Sopenharmony_cimake that variable contain the mechanism for controlling user clipping. 1711e5c31af7Sopenharmony_cicode:ClipDistance is an array such that the i^th^ element of the array 1712e5c31af7Sopenharmony_cispecifies the clip distance for plane i. 1713e5c31af7Sopenharmony_ciA clip distance of 0 means the vertex is on the plane, a positive distance 1714e5c31af7Sopenharmony_cimeans the vertex is inside the clip half-space, and a negative distance 1715e5c31af7Sopenharmony_cimeans the vertex is outside the clip half-space. 1716e5c31af7Sopenharmony_ci 1717e5c31af7Sopenharmony_ci[NOTE] 1718e5c31af7Sopenharmony_ci.Note 1719e5c31af7Sopenharmony_ci==== 1720e5c31af7Sopenharmony_ciThe array variable decorated with code:ClipDistance is explicitly sized by 1721e5c31af7Sopenharmony_cithe shader. 1722e5c31af7Sopenharmony_ci==== 1723e5c31af7Sopenharmony_ci 1724e5c31af7Sopenharmony_ci[NOTE] 1725e5c31af7Sopenharmony_ci.Note 1726e5c31af7Sopenharmony_ci==== 1727e5c31af7Sopenharmony_ciIn the last <<pipelines-graphics-subsets-pre-rasterization,pre-rasterization 1728e5c31af7Sopenharmony_cishader stage>>, these values will be linearly interpolated across the 1729e5c31af7Sopenharmony_ciprimitive and the portion of the primitive with interpolated distances less 1730e5c31af7Sopenharmony_cithan 0 will be considered outside the clip volume. 1731e5c31af7Sopenharmony_ciIf code:ClipDistance is then used by a fragment shader, code:ClipDistance 1732e5c31af7Sopenharmony_cicontains these linearly interpolated values. 1733e5c31af7Sopenharmony_ci==== 1734e5c31af7Sopenharmony_ci 1735e5c31af7Sopenharmony_ci.Valid Usage 1736e5c31af7Sopenharmony_ci**** 1737e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistance-04187]] 1738e5c31af7Sopenharmony_ci The code:ClipDistance decoration must: be used only within the 1739e5c31af7Sopenharmony_ci code:MeshEXT, code:MeshNV, code:Vertex, code:Fragment, 1740e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, or code:Geometry 1741e5c31af7Sopenharmony_ci {ExecutionModel} 1742e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistance-04188]] 1743e5c31af7Sopenharmony_ci The variable decorated with code:ClipDistance within the code:MeshEXT, 1744e5c31af7Sopenharmony_ci code:MeshNV, or code:Vertex {ExecutionModel} must: be declared using the 1745e5c31af7Sopenharmony_ci code:Output {StorageClass} 1746e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistance-04189]] 1747e5c31af7Sopenharmony_ci The variable decorated with code:ClipDistance within the code:Fragment 1748e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Input {StorageClass} 1749e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistance-04190]] 1750e5c31af7Sopenharmony_ci The variable decorated with code:ClipDistance within the 1751e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, or code:Geometry 1752e5c31af7Sopenharmony_ci {ExecutionModel} must: not be declared in a {StorageClass} other than 1753e5c31af7Sopenharmony_ci code:Input or code:Output 1754e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistance-04191]] 1755e5c31af7Sopenharmony_ci The variable decorated with code:ClipDistance must: be declared as an 1756e5c31af7Sopenharmony_ci array of 32-bit floating-point values 1757e5c31af7Sopenharmony_ci**** 1758e5c31af7Sopenharmony_ci-- 1759e5c31af7Sopenharmony_ci 1760e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 1761e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-clipdistancepv]] 1762e5c31af7Sopenharmony_ci[open,refpage='ClipDistancePerViewNV',desc='Application-specified clip distances per view',type='builtins'] 1763e5c31af7Sopenharmony_ci-- 1764e5c31af7Sopenharmony_ci:refpage: ClipDistancePerViewNV 1765e5c31af7Sopenharmony_ci 1766e5c31af7Sopenharmony_cicode:ClipDistancePerViewNV:: 1767e5c31af7Sopenharmony_ci 1768e5c31af7Sopenharmony_ciDecorating a variable with the code:ClipDistancePerViewNV built-in 1769e5c31af7Sopenharmony_cidecoration will make that variable contain the per-view clip distances. 1770e5c31af7Sopenharmony_ciThe per-view clip distances have the same semantics as code:ClipDistance. 1771e5c31af7Sopenharmony_ci 1772e5c31af7Sopenharmony_ci.Valid Usage 1773e5c31af7Sopenharmony_ci**** 1774e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistancePerViewNV-04192]] 1775e5c31af7Sopenharmony_ci The code:ClipDistancePerViewNV decoration must: be used only within the 1776e5c31af7Sopenharmony_ci code:MeshNV {ExecutionModel} 1777e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistancePerViewNV-04193]] 1778e5c31af7Sopenharmony_ci The variable decorated with code:ClipDistancePerViewNV must: be declared 1779e5c31af7Sopenharmony_ci using the code:Output {StorageClass} 1780e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistancePerViewNV-04194]] 1781e5c31af7Sopenharmony_ci The variable decorated with code:ClipDistancePerViewNV must: also be 1782e5c31af7Sopenharmony_ci decorated with the code:PerViewNV decoration 1783e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClipDistancePerViewNV-04195]] 1784e5c31af7Sopenharmony_ci The variable decorated with code:ClipDistancePerViewNV must: be declared 1785e5c31af7Sopenharmony_ci as a two-dimensional array of 32-bit floating-point values 1786e5c31af7Sopenharmony_ci**** 1787e5c31af7Sopenharmony_ci-- 1788e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 1789e5c31af7Sopenharmony_ci 1790e5c31af7Sopenharmony_ci 1791e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 1792e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-clusteridhuawei]] 1793e5c31af7Sopenharmony_ci[open,refpage='ClusterIDHUAWEI',desc='cluster culling shader output variable',type='builtins'] 1794e5c31af7Sopenharmony_ci-- 1795e5c31af7Sopenharmony_ci:refpage: ClusterIDHUAWEI 1796e5c31af7Sopenharmony_ci 1797e5c31af7Sopenharmony_cicode:ClusterIDHUAWEI:: 1798e5c31af7Sopenharmony_ci 1799e5c31af7Sopenharmony_ciThe code:ClusterIDHUAWEI decoration can be used to decorate a cluster 1800e5c31af7Sopenharmony_ciculling shader output variable,this variable will contain an integer value 1801e5c31af7Sopenharmony_cithat specifies the id of cluster being rendered by this drawing command. 1802e5c31af7Sopenharmony_ciWhen Cluster Culling Shader enable, code:ClusterIDHUAWEI will replace 1803e5c31af7Sopenharmony_cigl_DrawID pass to vertex shader for cluster-related information fetching. 1804e5c31af7Sopenharmony_ci 1805e5c31af7Sopenharmony_ci 1806e5c31af7Sopenharmony_ci.Valid Usage 1807e5c31af7Sopenharmony_ci**** 1808e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClusterIDHUAWEI-07797]] 1809e5c31af7Sopenharmony_ci The code:ClusterIDHUAWEI decoration must: be used only within the 1810e5c31af7Sopenharmony_ci code:ClusterCullingHUAWEI {ExecutionModel} 1811e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClusterIDHUAWEI-07798]] 1812e5c31af7Sopenharmony_ci The variable decorated with code:ClusterIDHUAWEI must: be declared as a 1813e5c31af7Sopenharmony_ci scalar 32-bit integer value 1814e5c31af7Sopenharmony_ci**** 1815e5c31af7Sopenharmony_ci-- 1816e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 1817e5c31af7Sopenharmony_ci 1818e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 1819e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-clustershadingratehuawei]] 1820e5c31af7Sopenharmony_ci[open,refpage='ClusterShadingRateHUAWEI',desc='cluster culling shader output variable',type='builtins'] 1821e5c31af7Sopenharmony_ci-- 1822e5c31af7Sopenharmony_ci:refpage: ClusterShadingRateHUAWEI 1823e5c31af7Sopenharmony_ci 1824e5c31af7Sopenharmony_cicode:ClusterShadingRateHUAWEI:: 1825e5c31af7Sopenharmony_ci 1826e5c31af7Sopenharmony_ciThe code:ClusterShadingRateHUAWEI decoration can be used to decorate a 1827e5c31af7Sopenharmony_cicluster culling shader output variable. 1828e5c31af7Sopenharmony_ciThis variable will contain an integer value specifying the shading rate of a 1829e5c31af7Sopenharmony_cirendering cluster. 1830e5c31af7Sopenharmony_ci 1831e5c31af7Sopenharmony_ci.Valid Usage 1832e5c31af7Sopenharmony_ci**** 1833e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClusterShadingRateHUAWEI-09448]] 1834e5c31af7Sopenharmony_ci The code:ClusterShadingRateHUAWEI decoration must: be used only within 1835e5c31af7Sopenharmony_ci the code:ClusterCullingHUAWEI {ExecutionModel} 1836e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ClusterShadingRateHUAWEI-09449]] 1837e5c31af7Sopenharmony_ci The variable decorated with code:ClusterShadingRateHUAWEI must: be 1838e5c31af7Sopenharmony_ci declared as a scalar 32-bit integer value 1839e5c31af7Sopenharmony_ci**** 1840e5c31af7Sopenharmony_ci-- 1841e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 1842e5c31af7Sopenharmony_ci 1843e5c31af7Sopenharmony_ci 1844e5c31af7Sopenharmony_ci 1845e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-culldistance]] 1846e5c31af7Sopenharmony_ci[open,refpage='CullDistance',desc='Application-specified cull distances',type='builtins'] 1847e5c31af7Sopenharmony_ci-- 1848e5c31af7Sopenharmony_ci:refpage: CullDistance 1849e5c31af7Sopenharmony_ci 1850e5c31af7Sopenharmony_cicode:CullDistance:: 1851e5c31af7Sopenharmony_ci 1852e5c31af7Sopenharmony_ciDecorating a variable with the code:CullDistance built-in decoration will 1853e5c31af7Sopenharmony_cimake that variable contain the mechanism for controlling user culling. 1854e5c31af7Sopenharmony_ciIf any member of this array is assigned a negative value for all vertices 1855e5c31af7Sopenharmony_cibelonging to a primitive, then the primitive is discarded before 1856e5c31af7Sopenharmony_cirasterization. 1857e5c31af7Sopenharmony_ci 1858e5c31af7Sopenharmony_ci[NOTE] 1859e5c31af7Sopenharmony_ci.Note 1860e5c31af7Sopenharmony_ci==== 1861e5c31af7Sopenharmony_ciIn fragment shaders, the values of the code:CullDistance array are linearly 1862e5c31af7Sopenharmony_ciinterpolated across each primitive. 1863e5c31af7Sopenharmony_ci==== 1864e5c31af7Sopenharmony_ci 1865e5c31af7Sopenharmony_ci[NOTE] 1866e5c31af7Sopenharmony_ci.Note 1867e5c31af7Sopenharmony_ci==== 1868e5c31af7Sopenharmony_ciIf code:CullDistance decorates an input variable, that variable will contain 1869e5c31af7Sopenharmony_cithe corresponding value from the code:CullDistance decorated output variable 1870e5c31af7Sopenharmony_cifrom the previous shader stage. 1871e5c31af7Sopenharmony_ci==== 1872e5c31af7Sopenharmony_ci 1873e5c31af7Sopenharmony_ci.Valid Usage 1874e5c31af7Sopenharmony_ci**** 1875e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistance-04196]] 1876e5c31af7Sopenharmony_ci The code:CullDistance decoration must: be used only within the 1877e5c31af7Sopenharmony_ci code:MeshEXT, code:MeshNV, code:Vertex, code:Fragment, 1878e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, or code:Geometry 1879e5c31af7Sopenharmony_ci {ExecutionModel} 1880e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistance-04197]] 1881e5c31af7Sopenharmony_ci The variable decorated with code:CullDistance within the code:MeshEXT, 1882e5c31af7Sopenharmony_ci code:MeshNV or code:Vertex {ExecutionModel} must: be declared using the 1883e5c31af7Sopenharmony_ci code:Output {StorageClass} 1884e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistance-04198]] 1885e5c31af7Sopenharmony_ci The variable decorated with code:CullDistance within the code:Fragment 1886e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Input {StorageClass} 1887e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistance-04199]] 1888e5c31af7Sopenharmony_ci The variable decorated with code:CullDistance within the 1889e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, or code:Geometry 1890e5c31af7Sopenharmony_ci {ExecutionModel} must: not be declared using a {StorageClass} other than 1891e5c31af7Sopenharmony_ci code:Input or code:Output 1892e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistance-04200]] 1893e5c31af7Sopenharmony_ci The variable decorated with code:CullDistance must: be declared as an 1894e5c31af7Sopenharmony_ci array of 32-bit floating-point values 1895e5c31af7Sopenharmony_ci**** 1896e5c31af7Sopenharmony_ci-- 1897e5c31af7Sopenharmony_ci 1898e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 1899e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-culldistancepv]] 1900e5c31af7Sopenharmony_ci[open,refpage='CullDistancePerViewNV',desc='Application-specified cull distances per view',type='builtins'] 1901e5c31af7Sopenharmony_ci-- 1902e5c31af7Sopenharmony_ci:refpage: CullDistancePerViewNV 1903e5c31af7Sopenharmony_ci 1904e5c31af7Sopenharmony_cicode:CullDistancePerViewNV:: 1905e5c31af7Sopenharmony_ci 1906e5c31af7Sopenharmony_ciDecorating a variable with the code:CullDistancePerViewNV built-in 1907e5c31af7Sopenharmony_cidecoration will make that variable contain the per-view cull distances. 1908e5c31af7Sopenharmony_ciThe per-view cull distances have the same semantics as code:CullDistance. 1909e5c31af7Sopenharmony_ci 1910e5c31af7Sopenharmony_ci.Valid Usage 1911e5c31af7Sopenharmony_ci**** 1912e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistancePerViewNV-04201]] 1913e5c31af7Sopenharmony_ci The code:CullDistancePerViewNV decoration must: be used only within the 1914e5c31af7Sopenharmony_ci code:MeshNV {ExecutionModel} 1915e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistancePerViewNV-04202]] 1916e5c31af7Sopenharmony_ci The variable decorated with code:CullDistancePerViewNV must: be declared 1917e5c31af7Sopenharmony_ci using the code:Output {StorageClass} 1918e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistancePerViewNV-04203]] 1919e5c31af7Sopenharmony_ci The variable decorated with code:CullDistancePerViewNV must: also be 1920e5c31af7Sopenharmony_ci decorated with the code:PerViewNV decoration 1921e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullDistancePerViewNV-04204]] 1922e5c31af7Sopenharmony_ci The variable decorated with code:CullDistancePerViewNV must: be declared 1923e5c31af7Sopenharmony_ci as a two-dimensional array of 32-bit floating-point values 1924e5c31af7Sopenharmony_ci**** 1925e5c31af7Sopenharmony_ci-- 1926e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 1927e5c31af7Sopenharmony_ci 1928e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 1929e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-cullprimitive]] 1930e5c31af7Sopenharmony_ci[open,refpage='CullPrimitiveEXT',desc='Application-specified culling state per primitive',type='builtins'] 1931e5c31af7Sopenharmony_ci-- 1932e5c31af7Sopenharmony_ci:refpage: CullPrimitiveEXT 1933e5c31af7Sopenharmony_ci 1934e5c31af7Sopenharmony_cicode:CullPrimitiveEXT:: 1935e5c31af7Sopenharmony_ci 1936e5c31af7Sopenharmony_ciDecorating a variable with the code:CullPrimitiveEXT built-in decoration 1937e5c31af7Sopenharmony_ciwill make that variable contain the culling state of output primitives. 1938e5c31af7Sopenharmony_ciIf the per-primitive boolean value is code:true, the primitive will be 1939e5c31af7Sopenharmony_ciculled, if it is code:false it will not be culled. 1940e5c31af7Sopenharmony_ci 1941e5c31af7Sopenharmony_ci.Valid Usage 1942e5c31af7Sopenharmony_ci**** 1943e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullPrimitiveEXT-07034]] 1944e5c31af7Sopenharmony_ci The code:CullPrimitiveEXT decoration must: be used only within the 1945e5c31af7Sopenharmony_ci code:MeshEXT {ExecutionModel} 1946e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullPrimitiveEXT-07035]] 1947e5c31af7Sopenharmony_ci The variable decorated with code:CullPrimitiveEXT must: be declared 1948e5c31af7Sopenharmony_ci using the code:Output {StorageClass} 1949e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullPrimitiveEXT-07036]] 1950e5c31af7Sopenharmony_ci The variable decorated with code:CullPrimitiveEXT must: be declared as 1951e5c31af7Sopenharmony_ci an array of boolean values 1952e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullPrimitiveEXT-07037]] 1953e5c31af7Sopenharmony_ci The size of the array decorated with code:CullPrimitiveEXT must: match 1954e5c31af7Sopenharmony_ci the value specified by code:OutputPrimitivesEXT 1955e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullPrimitiveEXT-07038]] 1956e5c31af7Sopenharmony_ci The variable decorated with code:CullPrimitiveEXT within the 1957e5c31af7Sopenharmony_ci code:MeshEXT {ExecutionModel} must: also be decorated with the 1958e5c31af7Sopenharmony_ci code:PerPrimitiveEXT decoration 1959e5c31af7Sopenharmony_ci**** 1960e5c31af7Sopenharmony_ci-- 1961e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 1962e5c31af7Sopenharmony_ci 1963e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline,VK_KHR_ray_tracing_maintenance1[] 1964e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-cullmask]] 1965e5c31af7Sopenharmony_ci[open,refpage='CullMaskKHR',desc='OpTrace specified ray cull mask',type='builtins'] 1966e5c31af7Sopenharmony_ci-- 1967e5c31af7Sopenharmony_ci:refpage: CullMaskKHR 1968e5c31af7Sopenharmony_ci 1969e5c31af7Sopenharmony_cicode:CullMaskKHR:: 1970e5c31af7Sopenharmony_ci 1971e5c31af7Sopenharmony_ciA variable decorated with the code:CullMaskKHR decoration will specify the 1972e5c31af7Sopenharmony_cicull mask of the ray being processed. 1973e5c31af7Sopenharmony_ciThe value is given by the `Cull Mask` parameter passed into one of the 1974e5c31af7Sopenharmony_cicode:OpTrace* instructions. 1975e5c31af7Sopenharmony_ci 1976e5c31af7Sopenharmony_ci.Valid Usage 1977e5c31af7Sopenharmony_ci**** 1978e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullMaskKHR-06735]] 1979e5c31af7Sopenharmony_ci The code:CullMaskKHR decoration must: be used only within the 1980e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, code:ClosestHitKHR, or 1981e5c31af7Sopenharmony_ci code:MissKHR {ExecutionModel} 1982e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullMaskKHR-06736]] 1983e5c31af7Sopenharmony_ci The variable decorated with code:CullMaskKHR must: be declared using the 1984e5c31af7Sopenharmony_ci code:Input {StorageClass} 1985e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CullMaskKHR-06737]] 1986e5c31af7Sopenharmony_ci The variable decorated with code:CullMaskKHR must: be declared as a 1987e5c31af7Sopenharmony_ci scalar 32-bit integer value 1988e5c31af7Sopenharmony_ci**** 1989e5c31af7Sopenharmony_ci-- 1990e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline,VK_KHR_ray_tracing_maintenance1[] 1991e5c31af7Sopenharmony_ci 1992e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing_motion_blur[] 1993e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-currentraytime]] 1994e5c31af7Sopenharmony_ci[open,refpage='CurrentRayTimeNV',desc='Time value of a ray intersection',type='builtins'] 1995e5c31af7Sopenharmony_ci-- 1996e5c31af7Sopenharmony_ci:refpage: CurrentRayTimeNV 1997e5c31af7Sopenharmony_ci 1998e5c31af7Sopenharmony_cicode:CurrentRayTimeNV:: 1999e5c31af7Sopenharmony_ci 2000e5c31af7Sopenharmony_ciA variable decorated with the code:CurrentRayTimeNV decoration contains the 2001e5c31af7Sopenharmony_citime value passed in to code:OpTraceRayMotionNV which called this shader. 2002e5c31af7Sopenharmony_ci 2003e5c31af7Sopenharmony_ci.Valid Usage 2004e5c31af7Sopenharmony_ci**** 2005e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CurrentRayTimeNV-04942]] 2006e5c31af7Sopenharmony_ci The code:CurrentRayTimeNV decoration must: be used only within the 2007e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, code:ClosestHitKHR, or 2008e5c31af7Sopenharmony_ci code:MissKHR {ExecutionModel} 2009e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CurrentRayTimeNV-04943]] 2010e5c31af7Sopenharmony_ci The variable decorated with code:CurrentRayTimeNV must: be declared 2011e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 2012e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CurrentRayTimeNV-04944]] 2013e5c31af7Sopenharmony_ci The variable decorated with code:CurrentRayTimeNV must: be declared as a 2014e5c31af7Sopenharmony_ci scalar 32-bit floating-point value 2015e5c31af7Sopenharmony_ci**** 2016e5c31af7Sopenharmony_ci-- 2017e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing_motion_blur[] 2018e5c31af7Sopenharmony_ci 2019e5c31af7Sopenharmony_ci 2020e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_device_group[] 2021e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-deviceindex]] 2022e5c31af7Sopenharmony_ci[open,refpage='DeviceIndex',desc='Index of the device executing the shader',type='builtins'] 2023e5c31af7Sopenharmony_ci-- 2024e5c31af7Sopenharmony_ci:refpage: DeviceIndex 2025e5c31af7Sopenharmony_ci 2026e5c31af7Sopenharmony_cicode:DeviceIndex:: 2027e5c31af7Sopenharmony_ci 2028e5c31af7Sopenharmony_ciThe code:DeviceIndex decoration can: be applied to a shader input which will 2029e5c31af7Sopenharmony_cibe filled with the device index of the physical device that is executing the 2030e5c31af7Sopenharmony_cicurrent shader invocation. 2031e5c31af7Sopenharmony_ciThis value will be in the range latexmath:[[0,max(1,physicalDeviceCount))], 2032e5c31af7Sopenharmony_ciwhere physicalDeviceCount is the pname:physicalDeviceCount member of 2033e5c31af7Sopenharmony_cislink:VkDeviceGroupDeviceCreateInfo. 2034e5c31af7Sopenharmony_ci 2035e5c31af7Sopenharmony_ci.Valid Usage 2036e5c31af7Sopenharmony_ci**** 2037e5c31af7Sopenharmony_ci * [[VUID-{refpage}-DeviceIndex-04205]] 2038e5c31af7Sopenharmony_ci The variable decorated with code:DeviceIndex must: be declared using the 2039e5c31af7Sopenharmony_ci code:Input {StorageClass} 2040e5c31af7Sopenharmony_ci * [[VUID-{refpage}-DeviceIndex-04206]] 2041e5c31af7Sopenharmony_ci The variable decorated with code:DeviceIndex must: be declared as a 2042e5c31af7Sopenharmony_ci scalar 32-bit integer value 2043e5c31af7Sopenharmony_ci**** 2044e5c31af7Sopenharmony_ci-- 2045e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_device_group[] 2046e5c31af7Sopenharmony_ci 2047e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[] 2048e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-drawindex]] 2049e5c31af7Sopenharmony_ci[open,refpage='DrawIndex',desc='Index of the current draw',type='builtins'] 2050e5c31af7Sopenharmony_ci-- 2051e5c31af7Sopenharmony_ci:refpage: DrawIndex 2052e5c31af7Sopenharmony_ci 2053e5c31af7Sopenharmony_cicode:DrawIndex:: 2054e5c31af7Sopenharmony_ci 2055e5c31af7Sopenharmony_ciDecorating a variable with the code:DrawIndex built-in will make that 2056e5c31af7Sopenharmony_civariable contain the integer value corresponding to the zero-based index of 2057e5c31af7Sopenharmony_cithe draw that invoked the current 2058e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[task, mesh, or] 2059e5c31af7Sopenharmony_civertex shader invocation. 2060e5c31af7Sopenharmony_ciFor _indirect drawing commands_, code:DrawIndex begins at zero and 2061e5c31af7Sopenharmony_ciincrements by one for each draw executed. 2062e5c31af7Sopenharmony_ciThe number of draws is given by the pname:drawCount parameter. 2063e5c31af7Sopenharmony_ciFor _direct drawing commands_, 2064e5c31af7Sopenharmony_ciifdef::VK_EXT_multi_draw[] 2065e5c31af7Sopenharmony_ciif flink:vkCmdDrawMultiEXT or flink:vkCmdDrawMultiIndexedEXT is used, this 2066e5c31af7Sopenharmony_civariable contains the integer value corresponding to the zero-based index of 2067e5c31af7Sopenharmony_cithe draw. 2068e5c31af7Sopenharmony_ciOtherwise 2069e5c31af7Sopenharmony_ciendif::VK_EXT_multi_draw[] 2070e5c31af7Sopenharmony_cicode:DrawIndex is always zero. 2071e5c31af7Sopenharmony_cicode:DrawIndex is dynamically uniform. 2072e5c31af7Sopenharmony_ci 2073e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 2074e5c31af7Sopenharmony_ciWhen task or mesh shaders are used, only the first active stage will have 2075e5c31af7Sopenharmony_ciproper access to the variable. 2076e5c31af7Sopenharmony_ciThe value read by other stages is undefined:. 2077e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 2078e5c31af7Sopenharmony_ci 2079e5c31af7Sopenharmony_ci.Valid Usage 2080e5c31af7Sopenharmony_ci**** 2081e5c31af7Sopenharmony_ci * [[VUID-{refpage}-DrawIndex-04207]] 2082e5c31af7Sopenharmony_ci The code:DrawIndex decoration must: be used only within the code:Vertex, 2083e5c31af7Sopenharmony_ci code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV {ExecutionModel} 2084e5c31af7Sopenharmony_ci * [[VUID-{refpage}-DrawIndex-04208]] 2085e5c31af7Sopenharmony_ci The variable decorated with code:DrawIndex must: be declared using the 2086e5c31af7Sopenharmony_ci code:Input {StorageClass} 2087e5c31af7Sopenharmony_ci * [[VUID-{refpage}-DrawIndex-04209]] 2088e5c31af7Sopenharmony_ci The variable decorated with code:DrawIndex must: be declared as a scalar 2089e5c31af7Sopenharmony_ci 32-bit integer value 2090e5c31af7Sopenharmony_ci**** 2091e5c31af7Sopenharmony_ci-- 2092e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_shader_draw_parameters[] 2093e5c31af7Sopenharmony_ci 2094e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 2095e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-firstindexhuawei]] 2096e5c31af7Sopenharmony_ci[open,refpage='FirstIndexHUAWEI',desc='cluster culling shader output variable',type='builtins'] 2097e5c31af7Sopenharmony_ci-- 2098e5c31af7Sopenharmony_ci:refpage: FirstIndexHUAWEI 2099e5c31af7Sopenharmony_ci 2100e5c31af7Sopenharmony_cicode:FirstIndexHUAWEI:: 2101e5c31af7Sopenharmony_ci 2102e5c31af7Sopenharmony_ciThe code:FirstIndexHUAWEI decoration can be used to decorate a cluster 2103e5c31af7Sopenharmony_ciculling shader output variable,this indexed mode specific variable will 2104e5c31af7Sopenharmony_cicontain an integer value that specifies the base index within the index 2105e5c31af7Sopenharmony_cibuffer corresponding to a cluster. 2106e5c31af7Sopenharmony_ci 2107e5c31af7Sopenharmony_ci 2108e5c31af7Sopenharmony_ci.Valid Usage 2109e5c31af7Sopenharmony_ci**** 2110e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FirstIndexHUAWEI-07799]] 2111e5c31af7Sopenharmony_ci The code:FirstIndexHUAWEI decoration must: be used only within the 2112e5c31af7Sopenharmony_ci code:ClusterCullingHUAWEI {ExecutionModel} 2113e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FirstIndexHUAWEI-07800]] 2114e5c31af7Sopenharmony_ci The variable decorated with code:FirstIndexHUAWEI must: be declared as a 2115e5c31af7Sopenharmony_ci scalar 32-bit integer value 2116e5c31af7Sopenharmony_ci**** 2117e5c31af7Sopenharmony_ci-- 2118e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 2119e5c31af7Sopenharmony_ci 2120e5c31af7Sopenharmony_ci 2121e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-fragcoord]] 2122e5c31af7Sopenharmony_ci[open,refpage='FragCoord',desc='Screen-space coordinate of the fragment center',type='builtins'] 2123e5c31af7Sopenharmony_ci-- 2124e5c31af7Sopenharmony_ci:refpage: FragCoord 2125e5c31af7Sopenharmony_ci 2126e5c31af7Sopenharmony_cicode:FragCoord:: 2127e5c31af7Sopenharmony_ci 2128e5c31af7Sopenharmony_ciDecorating a variable with the code:FragCoord built-in decoration will make 2129e5c31af7Sopenharmony_cithat variable contain the framebuffer coordinate 2130e5c31af7Sopenharmony_cilatexmath:[(x,y,z,\frac{1}{w})] of the fragment being processed. 2131e5c31af7Sopenharmony_ciThe [eq]#(x,y)# coordinate [eq]#(0,0)# is the upper left corner of the upper 2132e5c31af7Sopenharmony_cileft pixel in the framebuffer. 2133e5c31af7Sopenharmony_ci+ 2134e5c31af7Sopenharmony_ciWhen <<primsrast-sampleshading,Sample Shading>> is enabled, the [eq]#x# and 2135e5c31af7Sopenharmony_ci[eq]#y# components of code:FragCoord reflect the location of one of the 2136e5c31af7Sopenharmony_cisamples corresponding to the shader invocation. 2137e5c31af7Sopenharmony_ci+ 2138e5c31af7Sopenharmony_ciOtherwise, the [eq]#x# and [eq]#y# components of code:FragCoord reflect the 2139e5c31af7Sopenharmony_cilocation of the center of the fragment. 2140e5c31af7Sopenharmony_ci+ 2141e5c31af7Sopenharmony_ciThe [eq]#z# component of code:FragCoord is the interpolated depth value of 2142e5c31af7Sopenharmony_cithe primitive. 2143e5c31af7Sopenharmony_ci+ 2144e5c31af7Sopenharmony_ciThe [eq]#w# component is the interpolated latexmath:[\frac{1}{w}]. 2145e5c31af7Sopenharmony_ci+ 2146e5c31af7Sopenharmony_ciThe code:Centroid interpolation decoration is ignored, but allowed, on 2147e5c31af7Sopenharmony_cicode:FragCoord. 2148e5c31af7Sopenharmony_ci 2149e5c31af7Sopenharmony_ci.Valid Usage 2150e5c31af7Sopenharmony_ci**** 2151e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragCoord-04210]] 2152e5c31af7Sopenharmony_ci The code:FragCoord decoration must: be used only within the 2153e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2154e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragCoord-04211]] 2155e5c31af7Sopenharmony_ci The variable decorated with code:FragCoord must: be declared using the 2156e5c31af7Sopenharmony_ci code:Input {StorageClass} 2157e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragCoord-04212]] 2158e5c31af7Sopenharmony_ci The variable decorated with code:FragCoord must: be declared as a 2159e5c31af7Sopenharmony_ci four-component vector of 32-bit floating-point values 2160e5c31af7Sopenharmony_ci**** 2161e5c31af7Sopenharmony_ci-- 2162e5c31af7Sopenharmony_ci 2163e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-fragdepth]] 2164e5c31af7Sopenharmony_ci[open,refpage='FragDepth',desc='Application-specified depth for depth testing',type='builtins'] 2165e5c31af7Sopenharmony_ci-- 2166e5c31af7Sopenharmony_ci:refpage: FragDepth 2167e5c31af7Sopenharmony_ci 2168e5c31af7Sopenharmony_cicode:FragDepth:: 2169e5c31af7Sopenharmony_ci 2170e5c31af7Sopenharmony_ciTo have a shader supply a fragment-depth value, the shader must: declare the 2171e5c31af7Sopenharmony_cicode:DepthReplacing execution mode. 2172e5c31af7Sopenharmony_ciSuch a shader's fragment-depth value will come from the variable decorated 2173e5c31af7Sopenharmony_ciwith the code:FragDepth built-in decoration. 2174e5c31af7Sopenharmony_ci+ 2175e5c31af7Sopenharmony_ciThis value will be used for any subsequent depth testing performed by the 2176e5c31af7Sopenharmony_ciimplementation or writes to the depth attachment. 2177e5c31af7Sopenharmony_ciSee <<fragops-shader-depthreplacement, fragment shader depth replacement>> 2178e5c31af7Sopenharmony_cifor details. 2179e5c31af7Sopenharmony_ci 2180e5c31af7Sopenharmony_ci.Valid Usage 2181e5c31af7Sopenharmony_ci**** 2182e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragDepth-04213]] 2183e5c31af7Sopenharmony_ci The code:FragDepth decoration must: be used only within the 2184e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2185e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragDepth-04214]] 2186e5c31af7Sopenharmony_ci The variable decorated with code:FragDepth must: be declared using the 2187e5c31af7Sopenharmony_ci code:Output {StorageClass} 2188e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragDepth-04215]] 2189e5c31af7Sopenharmony_ci The variable decorated with code:FragDepth must: be declared as a scalar 2190e5c31af7Sopenharmony_ci 32-bit floating-point value 2191e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragDepth-04216]] 2192e5c31af7Sopenharmony_ci If the shader dynamically writes to the variable decorated with 2193e5c31af7Sopenharmony_ci code:FragDepth, the code:DepthReplacing {ExecutionMode} must: be 2194e5c31af7Sopenharmony_ci declared 2195e5c31af7Sopenharmony_ci**** 2196e5c31af7Sopenharmony_ci-- 2197e5c31af7Sopenharmony_ci 2198e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 2199e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-firstinstancehuawei]] 2200e5c31af7Sopenharmony_ci[open,refpage='FirstInstanceHUAWEI',desc='cluster culling shader output variable',type='builtins'] 2201e5c31af7Sopenharmony_ci-- 2202e5c31af7Sopenharmony_ci:refpage: FirstInstanceHUAWEI 2203e5c31af7Sopenharmony_ci 2204e5c31af7Sopenharmony_cicode:FirstInstanceHUAWEI:: 2205e5c31af7Sopenharmony_ci 2206e5c31af7Sopenharmony_ciThe code:FirstInstanceHUAWEI decoration can be used to decorate a cluster 2207e5c31af7Sopenharmony_ciculling shader output variable,this variable will contain an integer value 2208e5c31af7Sopenharmony_cithat specifies the instance ID of the first instance to draw. 2209e5c31af7Sopenharmony_ci 2210e5c31af7Sopenharmony_ci.Valid Usage 2211e5c31af7Sopenharmony_ci**** 2212e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FirstInstanceHUAWEI-07801]] 2213e5c31af7Sopenharmony_ci The code:FirstInstanceHUAWEI decoration must: be used only within the 2214e5c31af7Sopenharmony_ci code:ClusterCullingHUAWEI {ExecutionModel} 2215e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FirstInstanceHUAWEI-07802]] 2216e5c31af7Sopenharmony_ci The variable decorated with code:FirstInstanceHUAWEI must: be declared 2217e5c31af7Sopenharmony_ci as a scalar 32-bit integer value 2218e5c31af7Sopenharmony_ci**** 2219e5c31af7Sopenharmony_ci-- 2220e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 2221e5c31af7Sopenharmony_ci 2222e5c31af7Sopenharmony_ci 2223e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 2224e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-firstvertexhuawei]] 2225e5c31af7Sopenharmony_ci[open,refpage='FirstVertexHUAWEI',desc='cluster culling shader output variable',type='builtins'] 2226e5c31af7Sopenharmony_ci-- 2227e5c31af7Sopenharmony_ci:refpage: FirstVertexHUAWEI 2228e5c31af7Sopenharmony_ci 2229e5c31af7Sopenharmony_cicode:FirstVertexHUAWEI:: 2230e5c31af7Sopenharmony_ci 2231e5c31af7Sopenharmony_ciThe code:FirstVertexHUAWEI decoration can be used to decorate a cluster 2232e5c31af7Sopenharmony_ciculling shader output variable,this non-indexed mode specific variable will 2233e5c31af7Sopenharmony_cicontain an integer value that specifies the index of the first vertex in a 2234e5c31af7Sopenharmony_cicluster to draw. 2235e5c31af7Sopenharmony_ci 2236e5c31af7Sopenharmony_ci.Valid Usage 2237e5c31af7Sopenharmony_ci**** 2238e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FirstVertexHUAWEI-07803]] 2239e5c31af7Sopenharmony_ci The code:FirstVertexHUAWEI decoration must: be used only within the 2240e5c31af7Sopenharmony_ci code:FirstVertexHUAWEI {ExecutionModel} 2241e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FirstVertexHUAWEI-07804]] 2242e5c31af7Sopenharmony_ci The variable decorated with code:FirstVertexHUAWEI must: be declared as 2243e5c31af7Sopenharmony_ci a scalar 32-bit integer value 2244e5c31af7Sopenharmony_ci**** 2245e5c31af7Sopenharmony_ci-- 2246e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 2247e5c31af7Sopenharmony_ci 2248e5c31af7Sopenharmony_ci 2249e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 2250e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-fraginvocationcount]] 2251e5c31af7Sopenharmony_ci[open,refpage='FragInvocationCountEXT',desc='Number of fragment shader invocations for a fragment',type='builtins'] 2252e5c31af7Sopenharmony_ci-- 2253e5c31af7Sopenharmony_ci:refpage: FragInvocationCountEXT 2254e5c31af7Sopenharmony_ci 2255e5c31af7Sopenharmony_cicode:FragInvocationCountEXT:: 2256e5c31af7Sopenharmony_ci 2257e5c31af7Sopenharmony_ciDecorating a variable with the code:FragInvocationCountEXT built-in 2258e5c31af7Sopenharmony_cidecoration will make that variable contain the maximum number of fragment 2259e5c31af7Sopenharmony_cishader invocations for the fragment, as determined by 2260e5c31af7Sopenharmony_cipname:minSampleShading. 2261e5c31af7Sopenharmony_ci+ 2262e5c31af7Sopenharmony_ciIf <<primsrast-sampleshading,Sample Shading>> is not enabled, 2263e5c31af7Sopenharmony_cicode:FragInvocationCountEXT will be filled with a value of 1. 2264e5c31af7Sopenharmony_ci 2265e5c31af7Sopenharmony_ci.Valid Usage 2266e5c31af7Sopenharmony_ci**** 2267e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragInvocationCountEXT-04217]] 2268e5c31af7Sopenharmony_ci The code:FragInvocationCountEXT decoration must: be used only within the 2269e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2270e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragInvocationCountEXT-04218]] 2271e5c31af7Sopenharmony_ci The variable decorated with code:FragInvocationCountEXT must: be 2272e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 2273e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragInvocationCountEXT-04219]] 2274e5c31af7Sopenharmony_ci The variable decorated with code:FragInvocationCountEXT must: be 2275e5c31af7Sopenharmony_ci declared as a scalar 32-bit integer value 2276e5c31af7Sopenharmony_ci**** 2277e5c31af7Sopenharmony_ci-- 2278e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 2279e5c31af7Sopenharmony_ci 2280e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 2281e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-fragsize]] 2282e5c31af7Sopenharmony_ci[open,refpage='FragSizeEXT',desc='Size of the screen-space area covered by the fragment',type='builtins'] 2283e5c31af7Sopenharmony_ci-- 2284e5c31af7Sopenharmony_ci:refpage: FragSizeEXT 2285e5c31af7Sopenharmony_ci 2286e5c31af7Sopenharmony_cicode:FragSizeEXT:: 2287e5c31af7Sopenharmony_ci 2288e5c31af7Sopenharmony_ciDecorating a variable with the code:FragSizeEXT built-in decoration will 2289e5c31af7Sopenharmony_cimake that variable contain the dimensions in pixels of the 2290e5c31af7Sopenharmony_ci<<glossary-fragment-area,area>> that the fragment covers for that 2291e5c31af7Sopenharmony_ciinvocation. 2292e5c31af7Sopenharmony_ci+ 2293e5c31af7Sopenharmony_ciIf fragment density map is not enabled, code:FragSizeEXT will be filled with 2294e5c31af7Sopenharmony_cia value of [eq]#(1,1)#. 2295e5c31af7Sopenharmony_ci 2296e5c31af7Sopenharmony_ci.Valid Usage 2297e5c31af7Sopenharmony_ci**** 2298e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragSizeEXT-04220]] 2299e5c31af7Sopenharmony_ci The code:FragSizeEXT decoration must: be used only within the 2300e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2301e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragSizeEXT-04221]] 2302e5c31af7Sopenharmony_ci The variable decorated with code:FragSizeEXT must: be declared using the 2303e5c31af7Sopenharmony_ci code:Input {StorageClass} 2304e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragSizeEXT-04222]] 2305e5c31af7Sopenharmony_ci The variable decorated with code:FragSizeEXT must: be declared as a 2306e5c31af7Sopenharmony_ci two-component vector of 32-bit integer values 2307e5c31af7Sopenharmony_ci**** 2308e5c31af7Sopenharmony_ci-- 2309e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 2310e5c31af7Sopenharmony_ci 2311e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_stencil_export[] 2312e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-fragstencilref]] 2313e5c31af7Sopenharmony_ci[open,refpage='FragStencilRefEXT',desc='Application-specified stencil reference value used in stencil tests',type='builtins'] 2314e5c31af7Sopenharmony_ci-- 2315e5c31af7Sopenharmony_ci:refpage: FragStencilRefEXT 2316e5c31af7Sopenharmony_ci 2317e5c31af7Sopenharmony_cicode:FragStencilRefEXT:: 2318e5c31af7Sopenharmony_ci 2319e5c31af7Sopenharmony_ciDecorating a variable with the code:FragStencilRefEXT built-in decoration 2320e5c31af7Sopenharmony_ciwill make that variable contain the new stencil reference value for all 2321e5c31af7Sopenharmony_cisamples covered by the fragment. 2322e5c31af7Sopenharmony_ciThis value will be used as the stencil reference value used in stencil 2323e5c31af7Sopenharmony_citesting. 2324e5c31af7Sopenharmony_ci+ 2325e5c31af7Sopenharmony_ciTo write to code:FragStencilRefEXT, a shader must: declare the 2326e5c31af7Sopenharmony_cicode:StencilRefReplacingEXT execution mode. 2327e5c31af7Sopenharmony_ciIf a shader declares the code:StencilRefReplacingEXT execution mode and 2328e5c31af7Sopenharmony_cithere is an execution path through the shader that does not set 2329e5c31af7Sopenharmony_cicode:FragStencilRefEXT, then the fragment's stencil reference value is 2330e5c31af7Sopenharmony_ciundefined: for executions of the shader that take that path. 2331e5c31af7Sopenharmony_ci+ 2332e5c31af7Sopenharmony_ciOnly the least significant *s* bits of the integer value of the variable 2333e5c31af7Sopenharmony_cidecorated with code:FragStencilRefEXT are considered for stencil testing, 2334e5c31af7Sopenharmony_ciwhere *s* is the number of bits in the stencil framebuffer attachment, and 2335e5c31af7Sopenharmony_cihigher order bits are discarded. 2336e5c31af7Sopenharmony_ci+ 2337e5c31af7Sopenharmony_ciSee <<fragops-shader-stencilrefreplacement, fragment shader stencil 2338e5c31af7Sopenharmony_cireference replacement>> for more details. 2339e5c31af7Sopenharmony_ci 2340e5c31af7Sopenharmony_ci.Valid Usage 2341e5c31af7Sopenharmony_ci**** 2342e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragStencilRefEXT-04223]] 2343e5c31af7Sopenharmony_ci The code:FragStencilRefEXT decoration must: be used only within the 2344e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2345e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragStencilRefEXT-04224]] 2346e5c31af7Sopenharmony_ci The variable decorated with code:FragStencilRefEXT must: be declared 2347e5c31af7Sopenharmony_ci using the code:Output {StorageClass} 2348e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragStencilRefEXT-04225]] 2349e5c31af7Sopenharmony_ci The variable decorated with code:FragStencilRefEXT must: be declared as 2350e5c31af7Sopenharmony_ci a scalar integer value 2351e5c31af7Sopenharmony_ci**** 2352e5c31af7Sopenharmony_ci-- 2353e5c31af7Sopenharmony_ciendif::VK_EXT_shader_stencil_export[] 2354e5c31af7Sopenharmony_ci 2355e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 2356e5c31af7Sopenharmony_ci[open,refpage='FragmentSizeNV',desc='Size of the screen-space area covered by the fragment',type='builtins'] 2357e5c31af7Sopenharmony_ci-- 2358e5c31af7Sopenharmony_ci:refpage: FragmentSizeNV 2359e5c31af7Sopenharmony_ci 2360e5c31af7Sopenharmony_cicode:FragmentSizeNV:: 2361e5c31af7Sopenharmony_ci 2362e5c31af7Sopenharmony_ciDecorating a variable with the code:FragmentSizeNV built-in decoration will 2363e5c31af7Sopenharmony_cimake that variable contain the width and height of the fragment. 2364e5c31af7Sopenharmony_ci 2365e5c31af7Sopenharmony_ci.Valid Usage 2366e5c31af7Sopenharmony_ci**** 2367e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragmentSizeNV-04226]] 2368e5c31af7Sopenharmony_ci The code:FragmentSizeNV decoration must: be used only within the 2369e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2370e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragmentSizeNV-04227]] 2371e5c31af7Sopenharmony_ci The variable decorated with code:FragmentSizeNV must: be declared using 2372e5c31af7Sopenharmony_ci the code:Input {StorageClass} 2373e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FragmentSizeNV-04228]] 2374e5c31af7Sopenharmony_ci The variable decorated with code:FragmentSizeNV must: be declared as a 2375e5c31af7Sopenharmony_ci two-component vector of 32-bit integer values 2376e5c31af7Sopenharmony_ci**** 2377e5c31af7Sopenharmony_ci-- 2378e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 2379e5c31af7Sopenharmony_ci 2380e5c31af7Sopenharmony_ci 2381e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-frontfacing]] 2382e5c31af7Sopenharmony_ci[open,refpage='FrontFacing',desc='Front face determination of a fragment',type='builtins'] 2383e5c31af7Sopenharmony_ci-- 2384e5c31af7Sopenharmony_ci:refpage: FrontFacing 2385e5c31af7Sopenharmony_ci 2386e5c31af7Sopenharmony_cicode:FrontFacing:: 2387e5c31af7Sopenharmony_ci 2388e5c31af7Sopenharmony_ciDecorating a variable with the code:FrontFacing built-in decoration will 2389e5c31af7Sopenharmony_cimake that variable contain whether the fragment is front or back facing. 2390e5c31af7Sopenharmony_ciThis variable is non-zero if the current fragment is considered to be part 2391e5c31af7Sopenharmony_ciof a <<primsrast-polygons-basic,front-facing>> polygon primitive or of a 2392e5c31af7Sopenharmony_cinon-polygon primitive and is zero if the fragment is considered to be part 2393e5c31af7Sopenharmony_ciof a back-facing polygon primitive. 2394e5c31af7Sopenharmony_ci 2395e5c31af7Sopenharmony_ci.Valid Usage 2396e5c31af7Sopenharmony_ci**** 2397e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FrontFacing-04229]] 2398e5c31af7Sopenharmony_ci The code:FrontFacing decoration must: be used only within the 2399e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2400e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FrontFacing-04230]] 2401e5c31af7Sopenharmony_ci The variable decorated with code:FrontFacing must: be declared using the 2402e5c31af7Sopenharmony_ci code:Input {StorageClass} 2403e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FrontFacing-04231]] 2404e5c31af7Sopenharmony_ci The variable decorated with code:FrontFacing must: be declared as a 2405e5c31af7Sopenharmony_ci boolean value 2406e5c31af7Sopenharmony_ci**** 2407e5c31af7Sopenharmony_ci-- 2408e5c31af7Sopenharmony_ci 2409e5c31af7Sopenharmony_ciifdef::VK_EXT_conservative_rasterization[] 2410e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-fullycoveredext]] 2411e5c31af7Sopenharmony_ci[open,refpage='FullyCoveredEXT',desc='Indication of whether a fragment is fully covered',type='builtins'] 2412e5c31af7Sopenharmony_ci-- 2413e5c31af7Sopenharmony_ci:refpage: FullyCoveredEXT 2414e5c31af7Sopenharmony_ci 2415e5c31af7Sopenharmony_cicode:FullyCoveredEXT:: 2416e5c31af7Sopenharmony_ci 2417e5c31af7Sopenharmony_ciDecorating a variable with the code:FullyCoveredEXT built-in decoration will 2418e5c31af7Sopenharmony_cimake that variable indicate whether the <<glossary-fragment-area,fragment 2419e5c31af7Sopenharmony_ciarea>> is fully covered by the generating primitive. 2420e5c31af7Sopenharmony_ciThis variable is non-zero if conservative rasterization is enabled and the 2421e5c31af7Sopenharmony_cicurrent fragment area is fully covered by the generating primitive, and is 2422e5c31af7Sopenharmony_cizero if the fragment is not covered or partially covered, or conservative 2423e5c31af7Sopenharmony_cirasterization is disabled. 2424e5c31af7Sopenharmony_ci 2425e5c31af7Sopenharmony_ci.Valid Usage 2426e5c31af7Sopenharmony_ci**** 2427e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FullyCoveredEXT-04232]] 2428e5c31af7Sopenharmony_ci The code:FullyCoveredEXT decoration must: be used only within the 2429e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2430e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FullyCoveredEXT-04233]] 2431e5c31af7Sopenharmony_ci The variable decorated with code:FullyCoveredEXT must: be declared using 2432e5c31af7Sopenharmony_ci the code:Input {StorageClass} 2433e5c31af7Sopenharmony_ci * [[VUID-{refpage}-FullyCoveredEXT-04234]] 2434e5c31af7Sopenharmony_ci The variable decorated with code:FullyCoveredEXT must: be declared as a 2435e5c31af7Sopenharmony_ci boolean value 2436e5c31af7Sopenharmony_ciifdef::VK_EXT_post_depth_coverage[] 2437e5c31af7Sopenharmony_ci * [[VUID-{refpage}-conservativeRasterizationPostDepthCoverage-04235]] 2438e5c31af7Sopenharmony_ci If 2439e5c31af7Sopenharmony_ci sname:VkPhysicalDeviceConservativeRasterizationPropertiesEXT::pname:conservativeRasterizationPostDepthCoverage 2440e5c31af7Sopenharmony_ci is not supported the code:PostDepthCoverage {ExecutionMode} must: not be 2441e5c31af7Sopenharmony_ci declared, when a variable with the code:FullyCoveredEXT decoration is 2442e5c31af7Sopenharmony_ci declared 2443e5c31af7Sopenharmony_ciendif::VK_EXT_post_depth_coverage[] 2444e5c31af7Sopenharmony_ci**** 2445e5c31af7Sopenharmony_ci-- 2446e5c31af7Sopenharmony_ciendif::VK_EXT_conservative_rasterization[] 2447e5c31af7Sopenharmony_ci 2448e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-globalinvocationid]] 2449e5c31af7Sopenharmony_ci[open,refpage='GlobalInvocationId',desc='Global invocation ID',type='builtins'] 2450e5c31af7Sopenharmony_ci-- 2451e5c31af7Sopenharmony_ci:refpage: GlobalInvocationId 2452e5c31af7Sopenharmony_ci 2453e5c31af7Sopenharmony_cicode:GlobalInvocationId:: 2454e5c31af7Sopenharmony_ci 2455e5c31af7Sopenharmony_ciDecorating a variable with the code:GlobalInvocationId built-in decoration 2456e5c31af7Sopenharmony_ciwill make that variable contain the location of the current invocation 2457e5c31af7Sopenharmony_ciwithin the global workgroup. 2458e5c31af7Sopenharmony_ciEach component is equal to the index of the local workgroup multiplied by 2459e5c31af7Sopenharmony_cithe size of the local workgroup plus code:LocalInvocationId. 2460e5c31af7Sopenharmony_ci 2461e5c31af7Sopenharmony_ci.Valid Usage 2462e5c31af7Sopenharmony_ci**** 2463e5c31af7Sopenharmony_ci * [[VUID-{refpage}-GlobalInvocationId-04236]] 2464e5c31af7Sopenharmony_ci The code:GlobalInvocationId decoration must: be used only within the 2465e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV 2466e5c31af7Sopenharmony_ci {ExecutionModel} 2467e5c31af7Sopenharmony_ci * [[VUID-{refpage}-GlobalInvocationId-04237]] 2468e5c31af7Sopenharmony_ci The variable decorated with code:GlobalInvocationId must: be declared 2469e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 2470e5c31af7Sopenharmony_ci * [[VUID-{refpage}-GlobalInvocationId-04238]] 2471e5c31af7Sopenharmony_ci The variable decorated with code:GlobalInvocationId must: be declared as 2472e5c31af7Sopenharmony_ci a three-component vector of 32-bit integer values 2473e5c31af7Sopenharmony_ci**** 2474e5c31af7Sopenharmony_ci-- 2475e5c31af7Sopenharmony_ci 2476e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-helperinvocation]] 2477e5c31af7Sopenharmony_ci[open,refpage='HelperInvocation',desc='Indication of whether a fragment shader is a helper invocation',type='builtins'] 2478e5c31af7Sopenharmony_ci-- 2479e5c31af7Sopenharmony_ci:refpage: HelperInvocation 2480e5c31af7Sopenharmony_ci 2481e5c31af7Sopenharmony_cicode:HelperInvocation:: 2482e5c31af7Sopenharmony_ci 2483e5c31af7Sopenharmony_ciDecorating a variable with the code:HelperInvocation built-in decoration 2484e5c31af7Sopenharmony_ciwill make that variable contain whether the current invocation is a helper 2485e5c31af7Sopenharmony_ciinvocation. 2486e5c31af7Sopenharmony_ciThis variable is non-zero if the current fragment being shaded is a helper 2487e5c31af7Sopenharmony_ciinvocation and zero otherwise. 2488e5c31af7Sopenharmony_ciA helper invocation is an invocation of the shader that is produced to 2489e5c31af7Sopenharmony_cisatisfy internal requirements such as the generation of derivatives. 2490e5c31af7Sopenharmony_ci 2491e5c31af7Sopenharmony_ci[NOTE] 2492e5c31af7Sopenharmony_ci.Note 2493e5c31af7Sopenharmony_ci==== 2494e5c31af7Sopenharmony_ciIt is very likely that a helper invocation will have a value of 2495e5c31af7Sopenharmony_cicode:SampleMask fragment shader input value that is zero. 2496e5c31af7Sopenharmony_ci==== 2497e5c31af7Sopenharmony_ci 2498e5c31af7Sopenharmony_ci.Valid Usage 2499e5c31af7Sopenharmony_ci**** 2500e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HelperInvocation-04239]] 2501e5c31af7Sopenharmony_ci The code:HelperInvocation decoration must: be used only within the 2502e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2503e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HelperInvocation-04240]] 2504e5c31af7Sopenharmony_ci The variable decorated with code:HelperInvocation must: be declared 2505e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 2506e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HelperInvocation-04241]] 2507e5c31af7Sopenharmony_ci The variable decorated with code:HelperInvocation must: be declared as a 2508e5c31af7Sopenharmony_ci boolean value 2509e5c31af7Sopenharmony_ci**** 2510e5c31af7Sopenharmony_ci-- 2511e5c31af7Sopenharmony_ci 2512e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 2513e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-hitkind]] 2514e5c31af7Sopenharmony_ci[open,refpage='HitKindKHR',desc='Kind of hit that triggered an any-hit or closest hit ray shader',type='builtins'] 2515e5c31af7Sopenharmony_ci-- 2516e5c31af7Sopenharmony_ci:refpage: HitKindKHR 2517e5c31af7Sopenharmony_ci 2518e5c31af7Sopenharmony_cicode:HitKindKHR:: 2519e5c31af7Sopenharmony_ci 2520e5c31af7Sopenharmony_ciA variable decorated with the code:HitKindKHR decoration will describe the 2521e5c31af7Sopenharmony_ciintersection that triggered the execution of the current shader. 2522e5c31af7Sopenharmony_ciThe values are determined by the intersection shader. 2523e5c31af7Sopenharmony_ciFor user-defined intersection shaders this is the value that was passed to 2524e5c31af7Sopenharmony_cithe "`Hit Kind`" operand of code:OpReportIntersectionKHR. 2525e5c31af7Sopenharmony_ciFor triangle intersection candidates, this will be one of 2526e5c31af7Sopenharmony_cicode:HitKindFrontFacingTriangleKHR or code:HitKindBackFacingTriangleKHR. 2527e5c31af7Sopenharmony_ci 2528e5c31af7Sopenharmony_ci.Valid Usage 2529e5c31af7Sopenharmony_ci**** 2530e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitKindKHR-04242]] 2531e5c31af7Sopenharmony_ci The code:HitKindKHR decoration must: be used only within the 2532e5c31af7Sopenharmony_ci code:AnyHitKHR or code:ClosestHitKHR {ExecutionModel} 2533e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitKindKHR-04243]] 2534e5c31af7Sopenharmony_ci The variable decorated with code:HitKindKHR must: be declared using the 2535e5c31af7Sopenharmony_ci code:Input {StorageClass} 2536e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitKindKHR-04244]] 2537e5c31af7Sopenharmony_ci The variable decorated with code:HitKindKHR must: be declared as a 2538e5c31af7Sopenharmony_ci scalar 32-bit integer value 2539e5c31af7Sopenharmony_ci**** 2540e5c31af7Sopenharmony_ci-- 2541e5c31af7Sopenharmony_ci 2542e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing[] 2543e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-hitt]] 2544e5c31af7Sopenharmony_ci[open,refpage='HitTNV',desc='T value of a ray intersection',type='builtins'] 2545e5c31af7Sopenharmony_ci-- 2546e5c31af7Sopenharmony_ci:refpage: HitTNV 2547e5c31af7Sopenharmony_ci 2548e5c31af7Sopenharmony_cicode:HitTNV:: 2549e5c31af7Sopenharmony_ci 2550e5c31af7Sopenharmony_ciA variable decorated with the code:HitTNV decoration is equivalent to a 2551e5c31af7Sopenharmony_civariable decorated with the code:RayTmaxKHR decoration. 2552e5c31af7Sopenharmony_ci 2553e5c31af7Sopenharmony_ci.Valid Usage 2554e5c31af7Sopenharmony_ci**** 2555e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitTNV-04245]] 2556e5c31af7Sopenharmony_ci The code:HitTNV decoration must: be used only within the code:AnyHitNV 2557e5c31af7Sopenharmony_ci or code:ClosestHitNV {ExecutionModel} 2558e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitTNV-04246]] 2559e5c31af7Sopenharmony_ci The variable decorated with code:HitTNV must: be declared using the 2560e5c31af7Sopenharmony_ci code:Input {StorageClass} 2561e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitTNV-04247]] 2562e5c31af7Sopenharmony_ci The variable decorated with code:HitTNV must: be declared as a scalar 2563e5c31af7Sopenharmony_ci 32-bit floating-point value 2564e5c31af7Sopenharmony_ci**** 2565e5c31af7Sopenharmony_ci-- 2566e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing[] 2567e5c31af7Sopenharmony_ci 2568e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_position_fetch[] 2569e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-hittrianglevertexpositions]] 2570e5c31af7Sopenharmony_ci[open,refpage='HitTriangleVertexPositionsKHR',desc='Vertices of an intersected triangle',type='builtins'] 2571e5c31af7Sopenharmony_ci-- 2572e5c31af7Sopenharmony_ci:refpage: HitTriangleVertexPositionsKHR 2573e5c31af7Sopenharmony_ci 2574e5c31af7Sopenharmony_cicode:HitTriangleVertexPositionsKHR:: 2575e5c31af7Sopenharmony_ci 2576e5c31af7Sopenharmony_ciA variable decorated with the code:HitTriangleVertexPositionsKHR decoration 2577e5c31af7Sopenharmony_ciwill specify the object space vertices of the triangle at the current 2578e5c31af7Sopenharmony_ciintersection in application-provided order. 2579e5c31af7Sopenharmony_ciThe positions returned are transformed by the geometry transform, which is 2580e5c31af7Sopenharmony_ciperformed at standard <<fundamentals-floatingpoint, floating point>> 2581e5c31af7Sopenharmony_ciprecision, but without a specifically defined order of floating point 2582e5c31af7Sopenharmony_cioperations to perform the matrix multiplication. 2583e5c31af7Sopenharmony_ci 2584e5c31af7Sopenharmony_ci.Valid Usage 2585e5c31af7Sopenharmony_ci**** 2586e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitTriangleVertexPositionsKHR-08747]] 2587e5c31af7Sopenharmony_ci The code:HitTriangleVertexPositionsKHR decoration must: be used only 2588e5c31af7Sopenharmony_ci within the code:AnyHitKHR or code:ClosestHitKHR {ExecutionModel} 2589e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitTriangleVertexPositionsKHR-08748]] 2590e5c31af7Sopenharmony_ci The variable decorated with code:HitTriangleVertexPositionsKHR must: be 2591e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 2592e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitTriangleVertexPositionsKHR-08749]] 2593e5c31af7Sopenharmony_ci The variable decorated with code:HitTriangleVertexPositionsKHR must: be 2594e5c31af7Sopenharmony_ci declared as an array of three vectors of three 32-bit float values 2595e5c31af7Sopenharmony_ci * [[VUID-{refpage}-HitTriangleVertexPositionsKHR-08750]] 2596e5c31af7Sopenharmony_ci The variable decorated with code:HitTriangleVertexPositionsKHR must: be 2597e5c31af7Sopenharmony_ci used only if the value of code:HitKindKHR is 2598e5c31af7Sopenharmony_ci code:HitKindFrontFacingTriangleKHR or code:HitKindBackFacingTriangleKHR 2599e5c31af7Sopenharmony_ci * [[VUID-{refpage}-None-08751]] 2600e5c31af7Sopenharmony_ci The acceleration structure corresponding to the current intersection 2601e5c31af7Sopenharmony_ci must: have been built with 2602e5c31af7Sopenharmony_ci ename:VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DATA_ACCESS_KHR 2603e5c31af7Sopenharmony_ci**** 2604e5c31af7Sopenharmony_ci-- 2605e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_position_fetch[] 2606e5c31af7Sopenharmony_ci 2607e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-incomingrayflags]] 2608e5c31af7Sopenharmony_ci[open,refpage='IncomingRayFlagsKHR',desc='Flags used to trace a ray',type='builtins'] 2609e5c31af7Sopenharmony_ci-- 2610e5c31af7Sopenharmony_ci:refpage: IncomingRayFlagsKHR 2611e5c31af7Sopenharmony_ci 2612e5c31af7Sopenharmony_cicode:IncomingRayFlagsKHR:: 2613e5c31af7Sopenharmony_ci 2614e5c31af7Sopenharmony_ciA variable with the code:IncomingRayFlagsKHR decoration will contain the ray 2615e5c31af7Sopenharmony_ciflags passed in to the trace call that invoked this particular shader. 2616e5c31af7Sopenharmony_ciSetting pipeline flags on the raytracing pipeline must: not cause any 2617e5c31af7Sopenharmony_cicorresponding flags to be set in variables with this decoration. 2618e5c31af7Sopenharmony_ci 2619e5c31af7Sopenharmony_ci.Valid Usage 2620e5c31af7Sopenharmony_ci**** 2621e5c31af7Sopenharmony_ci * [[VUID-{refpage}-IncomingRayFlagsKHR-04248]] 2622e5c31af7Sopenharmony_ci The code:IncomingRayFlagsKHR decoration must: be used only within the 2623e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, code:ClosestHitKHR, or 2624e5c31af7Sopenharmony_ci code:MissKHR {ExecutionModel} 2625e5c31af7Sopenharmony_ci * [[VUID-{refpage}-IncomingRayFlagsKHR-04249]] 2626e5c31af7Sopenharmony_ci The variable decorated with code:IncomingRayFlagsKHR must: be declared 2627e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 2628e5c31af7Sopenharmony_ci * [[VUID-{refpage}-IncomingRayFlagsKHR-04250]] 2629e5c31af7Sopenharmony_ci The variable decorated with code:IncomingRayFlagsKHR must: be declared 2630e5c31af7Sopenharmony_ci as a scalar 32-bit integer value 2631e5c31af7Sopenharmony_ci**** 2632e5c31af7Sopenharmony_ci-- 2633e5c31af7Sopenharmony_ci 2634e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 2635e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-indexcounthuawei]] 2636e5c31af7Sopenharmony_ci[open,refpage='IndexCountHUAWEI',desc='cluster culling shader output variable',type='builtins'] 2637e5c31af7Sopenharmony_ci-- 2638e5c31af7Sopenharmony_ci:refpage: IndexCountHUAWEI 2639e5c31af7Sopenharmony_ci 2640e5c31af7Sopenharmony_cicode:IndexCountHUAWEI:: 2641e5c31af7Sopenharmony_ci 2642e5c31af7Sopenharmony_ciThe code:IndexCountHUAWEI decoration can be used to decorate a cluster 2643e5c31af7Sopenharmony_ciculling shader output variable,this indexed mode specific variable will 2644e5c31af7Sopenharmony_cicontain an integer value that specifies the number of indexed vertices in a 2645e5c31af7Sopenharmony_cicluster to draw. 2646e5c31af7Sopenharmony_ci 2647e5c31af7Sopenharmony_ci.Valid Usage 2648e5c31af7Sopenharmony_ci**** 2649e5c31af7Sopenharmony_ci * [[VUID-{refpage}-IndexCountHUAWEI-07805]] 2650e5c31af7Sopenharmony_ci The code:IndexCountHUAWEI decoration must: be used only within the 2651e5c31af7Sopenharmony_ci code:ClusterCullingHUAWEI {ExecutionModel} 2652e5c31af7Sopenharmony_ci * [[VUID-{refpage}-IndexCountHUAWEI-07806]] 2653e5c31af7Sopenharmony_ci The variable decorated with code:IndexCountHUAWEI must: be declared as a 2654e5c31af7Sopenharmony_ci scalar 32-bit integer value 2655e5c31af7Sopenharmony_ci**** 2656e5c31af7Sopenharmony_ci-- 2657e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 2658e5c31af7Sopenharmony_ci 2659e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 2660e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-instancecounthuawei]] 2661e5c31af7Sopenharmony_ci[open,refpage='InstanceCountHUAWEI',desc='cluster culling shader output variable',type='builtins'] 2662e5c31af7Sopenharmony_ci-- 2663e5c31af7Sopenharmony_ci:refpage: InstanceCountHUAWEI 2664e5c31af7Sopenharmony_ci 2665e5c31af7Sopenharmony_cicode:InstanceCountHUAWEI:: 2666e5c31af7Sopenharmony_ci 2667e5c31af7Sopenharmony_ciThe code:InstanceCountHUAWEI decoration can be used to decorate a cluster 2668e5c31af7Sopenharmony_ciculling shader output variable,this variable will contain an integer value 2669e5c31af7Sopenharmony_cithat specifies the number of instance to draw in a cluster. 2670e5c31af7Sopenharmony_ci 2671e5c31af7Sopenharmony_ci.Valid Usage 2672e5c31af7Sopenharmony_ci**** 2673e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceCountHUAWEI-07807]] 2674e5c31af7Sopenharmony_ci The code:InstanceCountHUAWEI decoration must: be used only within the 2675e5c31af7Sopenharmony_ci code:ClusterCullingHUAWEI {ExecutionModel} 2676e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceCountHUAWEI-07808]] 2677e5c31af7Sopenharmony_ci The variable decorated with code:InstanceCountHUAWEI must: be declared 2678e5c31af7Sopenharmony_ci as a scalar 32-bit integer value 2679e5c31af7Sopenharmony_ci**** 2680e5c31af7Sopenharmony_ci-- 2681e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 2682e5c31af7Sopenharmony_ci 2683e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-instancecustomindex]] 2684e5c31af7Sopenharmony_ci[open,refpage='InstanceCustomIndexKHR',desc='Custom index associated with an intersected instance',type='builtins'] 2685e5c31af7Sopenharmony_ci-- 2686e5c31af7Sopenharmony_ci:refpage: InstanceCustomIndexKHR 2687e5c31af7Sopenharmony_ci 2688e5c31af7Sopenharmony_cicode:InstanceCustomIndexKHR:: 2689e5c31af7Sopenharmony_ci 2690e5c31af7Sopenharmony_ciA variable decorated with the code:InstanceCustomIndexKHR decoration will 2691e5c31af7Sopenharmony_cicontain the application-defined value of the instance that intersects the 2692e5c31af7Sopenharmony_cicurrent ray. 2693e5c31af7Sopenharmony_ciThis variable contains the value that was specified in 2694e5c31af7Sopenharmony_cislink:VkAccelerationStructureInstanceKHR::pname:instanceCustomIndex for the 2695e5c31af7Sopenharmony_cicurrent acceleration structure instance in the lower 24 bits and the upper 8 2696e5c31af7Sopenharmony_cibits will be zero. 2697e5c31af7Sopenharmony_ci 2698e5c31af7Sopenharmony_ci.Valid Usage 2699e5c31af7Sopenharmony_ci**** 2700e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceCustomIndexKHR-04251]] 2701e5c31af7Sopenharmony_ci The code:InstanceCustomIndexKHR decoration must: be used only within the 2702e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 2703e5c31af7Sopenharmony_ci {ExecutionModel} 2704e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceCustomIndexKHR-04252]] 2705e5c31af7Sopenharmony_ci The variable decorated with code:InstanceCustomIndexKHR must: be 2706e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 2707e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceCustomIndexKHR-04253]] 2708e5c31af7Sopenharmony_ci The variable decorated with code:InstanceCustomIndexKHR must: be 2709e5c31af7Sopenharmony_ci declared as a scalar 32-bit integer value 2710e5c31af7Sopenharmony_ci**** 2711e5c31af7Sopenharmony_ci-- 2712e5c31af7Sopenharmony_ci 2713e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-instanceid]] 2714e5c31af7Sopenharmony_ci[open,refpage='InstanceId',desc='Id associated with an intersected instance',type='builtins'] 2715e5c31af7Sopenharmony_ci-- 2716e5c31af7Sopenharmony_ci:refpage: InstanceId 2717e5c31af7Sopenharmony_ci 2718e5c31af7Sopenharmony_cicode:InstanceId:: 2719e5c31af7Sopenharmony_ci 2720e5c31af7Sopenharmony_ciDecorating a variable in an intersection, any-hit, or closest hit shader 2721e5c31af7Sopenharmony_ciwith the code:InstanceId decoration will make that variable contain the 2722e5c31af7Sopenharmony_ciindex of the instance that intersects the current ray. 2723e5c31af7Sopenharmony_ci 2724e5c31af7Sopenharmony_ci.Valid Usage 2725e5c31af7Sopenharmony_ci**** 2726e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceId-04254]] 2727e5c31af7Sopenharmony_ci The code:InstanceId decoration must: be used only within the 2728e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 2729e5c31af7Sopenharmony_ci {ExecutionModel} 2730e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceId-04255]] 2731e5c31af7Sopenharmony_ci The variable decorated with code:InstanceId must: be declared using the 2732e5c31af7Sopenharmony_ci code:Input {StorageClass} 2733e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceId-04256]] 2734e5c31af7Sopenharmony_ci The variable decorated with code:InstanceId must: be declared as a 2735e5c31af7Sopenharmony_ci scalar 32-bit integer value 2736e5c31af7Sopenharmony_ci**** 2737e5c31af7Sopenharmony_ci-- 2738e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 2739e5c31af7Sopenharmony_ci 2740e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-invocationid]] 2741e5c31af7Sopenharmony_ci[open,refpage='InvocationId',desc='Invocation ID in a geometry or tessellation control shader',type='builtins'] 2742e5c31af7Sopenharmony_ci-- 2743e5c31af7Sopenharmony_ci:refpage: InvocationId 2744e5c31af7Sopenharmony_ci 2745e5c31af7Sopenharmony_cicode:InvocationId:: 2746e5c31af7Sopenharmony_ci 2747e5c31af7Sopenharmony_ciDecorating a variable with the code:InvocationId built-in decoration will 2748e5c31af7Sopenharmony_cimake that variable contain the index of the current shader invocation in a 2749e5c31af7Sopenharmony_cigeometry shader, or the index of the output patch vertex in a tessellation 2750e5c31af7Sopenharmony_cicontrol shader. 2751e5c31af7Sopenharmony_ci+ 2752e5c31af7Sopenharmony_ciIn a geometry shader, the index of the current shader invocation ranges from 2753e5c31af7Sopenharmony_cizero to the number of <<geometry-invocations,instances>> declared in the 2754e5c31af7Sopenharmony_cishader minus one. 2755e5c31af7Sopenharmony_ciIf the instance count of the geometry shader is one or is not specified, 2756e5c31af7Sopenharmony_cithen code:InvocationId will be zero. 2757e5c31af7Sopenharmony_ci 2758e5c31af7Sopenharmony_ci.Valid Usage 2759e5c31af7Sopenharmony_ci**** 2760e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InvocationId-04257]] 2761e5c31af7Sopenharmony_ci The code:InvocationId decoration must: be used only within the 2762e5c31af7Sopenharmony_ci code:TessellationControl or code:Geometry {ExecutionModel} 2763e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InvocationId-04258]] 2764e5c31af7Sopenharmony_ci The variable decorated with code:InvocationId must: be declared using 2765e5c31af7Sopenharmony_ci the code:Input {StorageClass} 2766e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InvocationId-04259]] 2767e5c31af7Sopenharmony_ci The variable decorated with code:InvocationId must: be declared as a 2768e5c31af7Sopenharmony_ci scalar 32-bit integer value 2769e5c31af7Sopenharmony_ci**** 2770e5c31af7Sopenharmony_ci-- 2771e5c31af7Sopenharmony_ci 2772e5c31af7Sopenharmony_ciifdef::VK_NV_shading_rate_image[] 2773e5c31af7Sopenharmony_ci[open,refpage='InvocationsPerPixelNV',desc='Number of fragment shader invocations for the current pixel',type='builtins'] 2774e5c31af7Sopenharmony_ci-- 2775e5c31af7Sopenharmony_ci:refpage: InvocationsPerPixelNV 2776e5c31af7Sopenharmony_ci 2777e5c31af7Sopenharmony_cicode:InvocationsPerPixelNV:: 2778e5c31af7Sopenharmony_ci 2779e5c31af7Sopenharmony_ciDecorating a variable with the code:InvocationsPerPixelNV built-in 2780e5c31af7Sopenharmony_cidecoration will make that variable contain the maximum number of fragment 2781e5c31af7Sopenharmony_cishader invocations per pixel, as derived from the effective shading rate for 2782e5c31af7Sopenharmony_cithe fragment. 2783e5c31af7Sopenharmony_ciIf a primitive does not fully cover a pixel, the number of fragment shader 2784e5c31af7Sopenharmony_ciinvocations for that pixel may: be less than the value of 2785e5c31af7Sopenharmony_cicode:InvocationsPerPixelNV. 2786e5c31af7Sopenharmony_ciIf the shading rate indicates a fragment covering multiple pixels, then 2787e5c31af7Sopenharmony_cicode:InvocationsPerPixelNV will be one. 2788e5c31af7Sopenharmony_ci 2789e5c31af7Sopenharmony_ci.Valid Usage 2790e5c31af7Sopenharmony_ci**** 2791e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InvocationsPerPixelNV-04260]] 2792e5c31af7Sopenharmony_ci The code:InvocationsPerPixelNV decoration must: be used only within the 2793e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2794e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InvocationsPerPixelNV-04261]] 2795e5c31af7Sopenharmony_ci The variable decorated with code:InvocationsPerPixelNV must: be declared 2796e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 2797e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InvocationsPerPixelNV-04262]] 2798e5c31af7Sopenharmony_ci The variable decorated with code:InvocationsPerPixelNV must: be declared 2799e5c31af7Sopenharmony_ci as a scalar 32-bit integer value 2800e5c31af7Sopenharmony_ci**** 2801e5c31af7Sopenharmony_ci-- 2802e5c31af7Sopenharmony_ciendif::VK_NV_shading_rate_image[] 2803e5c31af7Sopenharmony_ci 2804e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-instanceindex]] 2805e5c31af7Sopenharmony_ci[open,refpage='InstanceIndex',desc='Index of an instance',type='builtins'] 2806e5c31af7Sopenharmony_ci-- 2807e5c31af7Sopenharmony_ci:refpage: InstanceIndex 2808e5c31af7Sopenharmony_ci 2809e5c31af7Sopenharmony_cicode:InstanceIndex:: 2810e5c31af7Sopenharmony_ci 2811e5c31af7Sopenharmony_ciDecorating a variable in a vertex shader with the code:InstanceIndex 2812e5c31af7Sopenharmony_cibuilt-in decoration will make that variable contain the index of the 2813e5c31af7Sopenharmony_ciinstance that is being processed by the current vertex shader invocation. 2814e5c31af7Sopenharmony_cicode:InstanceIndex begins at the pname:firstInstance parameter to 2815e5c31af7Sopenharmony_ciflink:vkCmdDraw or flink:vkCmdDrawIndexed or at the pname:firstInstance 2816e5c31af7Sopenharmony_cimember of a structure consumed by flink:vkCmdDrawIndirect or 2817e5c31af7Sopenharmony_ciflink:vkCmdDrawIndexedIndirect. 2818e5c31af7Sopenharmony_ci 2819e5c31af7Sopenharmony_ci.Valid Usage 2820e5c31af7Sopenharmony_ci**** 2821e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceIndex-04263]] 2822e5c31af7Sopenharmony_ci The code:InstanceIndex decoration must: be used only within the 2823e5c31af7Sopenharmony_ci code:Vertex {ExecutionModel} 2824e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceIndex-04264]] 2825e5c31af7Sopenharmony_ci The variable decorated with code:InstanceIndex must: be declared using 2826e5c31af7Sopenharmony_ci the code:Input {StorageClass} 2827e5c31af7Sopenharmony_ci * [[VUID-{refpage}-InstanceIndex-04265]] 2828e5c31af7Sopenharmony_ci The variable decorated with code:InstanceIndex must: be declared as a 2829e5c31af7Sopenharmony_ci scalar 32-bit integer value 2830e5c31af7Sopenharmony_ci**** 2831e5c31af7Sopenharmony_ci-- 2832e5c31af7Sopenharmony_ci 2833e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 2834e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-launchid]] 2835e5c31af7Sopenharmony_ci[open,refpage='LaunchIdKHR',desc='Launch Id for ray shaders',type='builtins'] 2836e5c31af7Sopenharmony_ci-- 2837e5c31af7Sopenharmony_ci:refpage: LaunchIdKHR 2838e5c31af7Sopenharmony_ci 2839e5c31af7Sopenharmony_cicode:LaunchIdKHR:: 2840e5c31af7Sopenharmony_ci 2841e5c31af7Sopenharmony_ciA variable decorated with the code:LaunchIdKHR decoration will specify the 2842e5c31af7Sopenharmony_ciindex of the work item being processed. 2843e5c31af7Sopenharmony_ciOne work item is generated for each of the pname:width {times} pname:height 2844e5c31af7Sopenharmony_ci{times} pname:depth items dispatched by a flink:vkCmdTraceRaysKHR command. 2845e5c31af7Sopenharmony_ciAll shader invocations inherit the same value for variables decorated with 2846e5c31af7Sopenharmony_cicode:LaunchIdKHR. 2847e5c31af7Sopenharmony_ci 2848e5c31af7Sopenharmony_ci.Valid Usage 2849e5c31af7Sopenharmony_ci**** 2850e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LaunchIdKHR-04266]] 2851e5c31af7Sopenharmony_ci The code:LaunchIdKHR decoration must: be used only within the 2852e5c31af7Sopenharmony_ci code:RayGenerationKHR, code:IntersectionKHR, code:AnyHitKHR, 2853e5c31af7Sopenharmony_ci code:ClosestHitKHR, code:MissKHR, or code:CallableKHR {ExecutionModel} 2854e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LaunchIdKHR-04267]] 2855e5c31af7Sopenharmony_ci The variable decorated with code:LaunchIdKHR must: be declared using the 2856e5c31af7Sopenharmony_ci code:Input {StorageClass} 2857e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LaunchIdKHR-04268]] 2858e5c31af7Sopenharmony_ci The variable decorated with code:LaunchIdKHR must: be declared as a 2859e5c31af7Sopenharmony_ci three-component vector of 32-bit integer values 2860e5c31af7Sopenharmony_ci**** 2861e5c31af7Sopenharmony_ci-- 2862e5c31af7Sopenharmony_ci 2863e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-launchsize]] 2864e5c31af7Sopenharmony_ci[open,refpage='LaunchSizeKHR',desc='Launch dimensions for ray shaders',type='builtins'] 2865e5c31af7Sopenharmony_ci-- 2866e5c31af7Sopenharmony_ci:refpage: LaunchSizeKHR 2867e5c31af7Sopenharmony_ci 2868e5c31af7Sopenharmony_cicode:LaunchSizeKHR:: 2869e5c31af7Sopenharmony_ci 2870e5c31af7Sopenharmony_ciA variable decorated with the code:LaunchSizeKHR decoration will contain the 2871e5c31af7Sopenharmony_cipname:width, pname:height, and pname:depth dimensions passed to the 2872e5c31af7Sopenharmony_ciflink:vkCmdTraceRaysKHR command that initiated this shader execution. 2873e5c31af7Sopenharmony_ciThe pname:width is in the first component, the pname:height is in the second 2874e5c31af7Sopenharmony_cicomponent, and the pname:depth is in the third component. 2875e5c31af7Sopenharmony_ci 2876e5c31af7Sopenharmony_ci.Valid Usage 2877e5c31af7Sopenharmony_ci**** 2878e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LaunchSizeKHR-04269]] 2879e5c31af7Sopenharmony_ci The code:LaunchSizeKHR decoration must: be used only within the 2880e5c31af7Sopenharmony_ci code:RayGenerationKHR, code:IntersectionKHR, code:AnyHitKHR, 2881e5c31af7Sopenharmony_ci code:ClosestHitKHR, code:MissKHR, or code:CallableKHR {ExecutionModel} 2882e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LaunchSizeKHR-04270]] 2883e5c31af7Sopenharmony_ci The variable decorated with code:LaunchSizeKHR must: be declared using 2884e5c31af7Sopenharmony_ci the code:Input {StorageClass} 2885e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LaunchSizeKHR-04271]] 2886e5c31af7Sopenharmony_ci The variable decorated with code:LaunchSizeKHR must: be declared as a 2887e5c31af7Sopenharmony_ci three-component vector of 32-bit integer values 2888e5c31af7Sopenharmony_ci**** 2889e5c31af7Sopenharmony_ci-- 2890e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 2891e5c31af7Sopenharmony_ci 2892e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-layer]] 2893e5c31af7Sopenharmony_ci[open,refpage='Layer',desc='Layer index for layered rendering',type='builtins'] 2894e5c31af7Sopenharmony_ci-- 2895e5c31af7Sopenharmony_ci:refpage: Layer 2896e5c31af7Sopenharmony_ci 2897e5c31af7Sopenharmony_cicode:Layer:: 2898e5c31af7Sopenharmony_ci+ 2899e5c31af7Sopenharmony_ci[open] 2900e5c31af7Sopenharmony_ci---- 2901e5c31af7Sopenharmony_ciDecorating a variable with the code:Layer built-in decoration will make that 2902e5c31af7Sopenharmony_civariable contain the select layer of a multi-layer framebuffer attachment. 2903e5c31af7Sopenharmony_ci 2904e5c31af7Sopenharmony_ciIn a 2905e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 2906e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[mesh,] 2907e5c31af7Sopenharmony_civertex, tessellation evaluation, or 2908e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 2909e5c31af7Sopenharmony_cigeometry shader, any variable decorated with code:Layer can be written with 2910e5c31af7Sopenharmony_cithe framebuffer layer index to which the primitive produced by that shader 2911e5c31af7Sopenharmony_ciwill be directed. 2912e5c31af7Sopenharmony_ci 2913e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 2914e5c31af7Sopenharmony_ciThe last active 2915e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 2916e5c31af7Sopenharmony_cistage>> (in pipeline order) controls the code:Layer that is used. 2917e5c31af7Sopenharmony_ciOutputs in previous shader stages are not used, even if the last stage fails 2918e5c31af7Sopenharmony_cito write the code:Layer. 2919e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 2920e5c31af7Sopenharmony_ci 2921e5c31af7Sopenharmony_ciIf the last active 2922e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 2923e5c31af7Sopenharmony_cistage>> shader entry point's interface does not include a variable decorated 2924e5c31af7Sopenharmony_ciwith code:Layer, then the first layer is used. 2925e5c31af7Sopenharmony_ciIf a <<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 2926e5c31af7Sopenharmony_cistage>> shader entry point's interface includes a variable decorated with 2927e5c31af7Sopenharmony_cicode:Layer, it must: write the same value to code:Layer for all output 2928e5c31af7Sopenharmony_civertices of a given primitive. 2929e5c31af7Sopenharmony_ciIf the code:Layer value is less than 0 or greater than or equal to the 2930e5c31af7Sopenharmony_cinumber of layers in the framebuffer, then primitives may: still be 2931e5c31af7Sopenharmony_cirasterized, fragment shaders may: be executed, and the framebuffer values 2932e5c31af7Sopenharmony_cifor all layers are undefined:. 2933e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 2934e5c31af7Sopenharmony_ciIn a mesh shader this also applies when the code:Layer value is greater than 2935e5c31af7Sopenharmony_cior equal to the pname:maxMeshOutputLayers limit. 2936e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 2937e5c31af7Sopenharmony_ci 2938e5c31af7Sopenharmony_ciifdef::VK_NV_viewport_array2[] 2939e5c31af7Sopenharmony_ciIf a variable with the code:Layer decoration is also decorated with 2940e5c31af7Sopenharmony_cicode:ViewportRelativeNV, then the code:ViewportIndex is added to the layer 2941e5c31af7Sopenharmony_cithat is used for rendering and that is made available in the fragment 2942e5c31af7Sopenharmony_cishader. 2943e5c31af7Sopenharmony_ci 2944e5c31af7Sopenharmony_ciIf the shader writes to a variable decorated code:ViewportMaskNV, then the 2945e5c31af7Sopenharmony_cilayer selected has a different value for each viewport a primitive is 2946e5c31af7Sopenharmony_cirendered to. 2947e5c31af7Sopenharmony_ciendif::VK_NV_viewport_array2[] 2948e5c31af7Sopenharmony_ci 2949e5c31af7Sopenharmony_ciIn a fragment shader, a variable decorated with code:Layer contains the 2950e5c31af7Sopenharmony_cilayer index of the primitive that the fragment invocation belongs to. 2951e5c31af7Sopenharmony_ci---- 2952e5c31af7Sopenharmony_ci 2953e5c31af7Sopenharmony_ci.Valid Usage 2954e5c31af7Sopenharmony_ci**** 2955e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Layer-04272]] 2956e5c31af7Sopenharmony_ci The code:Layer decoration must: be used only within the code:MeshEXT, 2957e5c31af7Sopenharmony_ci code:MeshNV, code:Vertex, code:TessellationEvaluation, code:Geometry, or 2958e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 2959e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 2960e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Layer-04273]] 2961e5c31af7Sopenharmony_ci If the <<features-shaderOutputLayer, pname:shaderOutputLayer>> feature 2962e5c31af7Sopenharmony_ci is not enabled then the code:Layer decoration must: be used only within 2963e5c31af7Sopenharmony_ci the code:Geometry or code:Fragment {ExecutionModel} 2964e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 2965e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Layer-04274]] 2966e5c31af7Sopenharmony_ci The variable decorated with code:Layer within the code:MeshEXT, 2967e5c31af7Sopenharmony_ci code:MeshNV, code:Vertex, code:TessellationEvaluation, or code:Geometry 2968e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Output {StorageClass} 2969e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Layer-04275]] 2970e5c31af7Sopenharmony_ci The variable decorated with code:Layer within the code:Fragment 2971e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Input {StorageClass} 2972e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Layer-04276]] 2973e5c31af7Sopenharmony_ci The variable decorated with code:Layer must: be declared as a scalar 2974e5c31af7Sopenharmony_ci 32-bit integer value 2975e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Layer-07039]] 2976e5c31af7Sopenharmony_ci The variable decorated with code:Layer within the code:MeshEXT 2977e5c31af7Sopenharmony_ci {ExecutionModel} must: also be decorated with the code:PerPrimitiveEXT 2978e5c31af7Sopenharmony_ci decoration 2979e5c31af7Sopenharmony_ci**** 2980e5c31af7Sopenharmony_ci-- 2981e5c31af7Sopenharmony_ci 2982e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 2983e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-layerpv]] 2984e5c31af7Sopenharmony_ci[open,refpage='LayerPerViewNV',desc='Layer index per view for layered rendering',type='builtins'] 2985e5c31af7Sopenharmony_ci-- 2986e5c31af7Sopenharmony_ci:refpage: LayerPerViewNV 2987e5c31af7Sopenharmony_ci 2988e5c31af7Sopenharmony_cicode:LayerPerViewNV:: 2989e5c31af7Sopenharmony_ci 2990e5c31af7Sopenharmony_ciDecorating a variable with the code:LayerPerViewNV built-in decoration will 2991e5c31af7Sopenharmony_cimake that variable contain the per-view layer information. 2992e5c31af7Sopenharmony_ciThe per-view layer has the same semantics as code:Layer, for each view. 2993e5c31af7Sopenharmony_ci 2994e5c31af7Sopenharmony_ci.Valid Usage 2995e5c31af7Sopenharmony_ci**** 2996e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LayerPerViewNV-04277]] 2997e5c31af7Sopenharmony_ci The code:LayerPerViewNV decoration must: be used only within the 2998e5c31af7Sopenharmony_ci code:MeshNV {ExecutionModel} 2999e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LayerPerViewNV-04278]] 3000e5c31af7Sopenharmony_ci The variable decorated with code:LayerPerViewNV must: be declared using 3001e5c31af7Sopenharmony_ci the code:Output {StorageClass} 3002e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LayerPerViewNV-04279]] 3003e5c31af7Sopenharmony_ci The variable decorated with code:LayerPerViewNV must: also be decorated 3004e5c31af7Sopenharmony_ci with the code:PerViewNV decoration 3005e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LayerPerViewNV-04280]] 3006e5c31af7Sopenharmony_ci The variable decorated with code:LayerPerViewNV must: be declared as an 3007e5c31af7Sopenharmony_ci array of scalar 32-bit integer values 3008e5c31af7Sopenharmony_ci**** 3009e5c31af7Sopenharmony_ci-- 3010e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 3011e5c31af7Sopenharmony_ci 3012e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-localinvocationid]] 3013e5c31af7Sopenharmony_ci[open,refpage='LocalInvocationId',desc='Local invocation ID',type='builtins'] 3014e5c31af7Sopenharmony_ci-- 3015e5c31af7Sopenharmony_ci:refpage: LocalInvocationId 3016e5c31af7Sopenharmony_ci 3017e5c31af7Sopenharmony_cicode:LocalInvocationId:: 3018e5c31af7Sopenharmony_ci 3019e5c31af7Sopenharmony_ciDecorating a variable with the code:LocalInvocationId built-in decoration 3020e5c31af7Sopenharmony_ciwill make that variable contain the location of the current 3021e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[cluster culling, ] 3022e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[task, mesh, or] 3023e5c31af7Sopenharmony_cicompute shader invocation within the local workgroup. 3024e5c31af7Sopenharmony_ciEach component ranges from zero through to the size of the workgroup in that 3025e5c31af7Sopenharmony_cidimension minus one. 3026e5c31af7Sopenharmony_ci 3027e5c31af7Sopenharmony_ci[NOTE] 3028e5c31af7Sopenharmony_ci.Note 3029e5c31af7Sopenharmony_ci==== 3030e5c31af7Sopenharmony_ciIf the size of the workgroup in a particular dimension is one, then the 3031e5c31af7Sopenharmony_cicode:LocalInvocationId in that dimension will be zero. 3032e5c31af7Sopenharmony_ciIf the workgroup is effectively two-dimensional, then 3033e5c31af7Sopenharmony_cicode:LocalInvocationId.z will be zero. 3034e5c31af7Sopenharmony_ciIf the workgroup is effectively one-dimensional, then both 3035e5c31af7Sopenharmony_cicode:LocalInvocationId.y and code:LocalInvocationId.z will be zero. 3036e5c31af7Sopenharmony_ci==== 3037e5c31af7Sopenharmony_ci 3038e5c31af7Sopenharmony_ci.Valid Usage 3039e5c31af7Sopenharmony_ci**** 3040e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LocalInvocationId-04281]] 3041e5c31af7Sopenharmony_ci The code:LocalInvocationId decoration must: be used only within the 3042e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV 3043e5c31af7Sopenharmony_ci {ExecutionModel} 3044e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LocalInvocationId-04282]] 3045e5c31af7Sopenharmony_ci The variable decorated with code:LocalInvocationId must: be declared 3046e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 3047e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LocalInvocationId-04283]] 3048e5c31af7Sopenharmony_ci The variable decorated with code:LocalInvocationId must: be declared as 3049e5c31af7Sopenharmony_ci a three-component vector of 32-bit integer values 3050e5c31af7Sopenharmony_ci**** 3051e5c31af7Sopenharmony_ci-- 3052e5c31af7Sopenharmony_ci 3053e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-localinvocationindex]] 3054e5c31af7Sopenharmony_ci[open,refpage='LocalInvocationIndex',desc='Linear local invocation index',type='builtins'] 3055e5c31af7Sopenharmony_ci-- 3056e5c31af7Sopenharmony_ci:refpage: LocalInvocationIndex 3057e5c31af7Sopenharmony_ci 3058e5c31af7Sopenharmony_cicode:LocalInvocationIndex:: 3059e5c31af7Sopenharmony_ci 3060e5c31af7Sopenharmony_ciDecorating a variable with the code:LocalInvocationIndex built-in decoration 3061e5c31af7Sopenharmony_ciwill make that variable contain a one-dimensional representation of 3062e5c31af7Sopenharmony_cicode:LocalInvocationId. 3063e5c31af7Sopenharmony_ciThis is computed as: 3064e5c31af7Sopenharmony_ci+ 3065e5c31af7Sopenharmony_ci[source,c++] 3066e5c31af7Sopenharmony_ci---- 3067e5c31af7Sopenharmony_ciLocalInvocationIndex = 3068e5c31af7Sopenharmony_ci LocalInvocationId.z * WorkgroupSize.x * WorkgroupSize.y + 3069e5c31af7Sopenharmony_ci LocalInvocationId.y * WorkgroupSize.x + 3070e5c31af7Sopenharmony_ci LocalInvocationId.x; 3071e5c31af7Sopenharmony_ci---- 3072e5c31af7Sopenharmony_ci 3073e5c31af7Sopenharmony_ci.Valid Usage 3074e5c31af7Sopenharmony_ci**** 3075e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LocalInvocationIndex-04284]] 3076e5c31af7Sopenharmony_ci The code:LocalInvocationIndex decoration must: be used only within the 3077e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV 3078e5c31af7Sopenharmony_ci {ExecutionModel} 3079e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LocalInvocationIndex-04285]] 3080e5c31af7Sopenharmony_ci The variable decorated with code:LocalInvocationIndex must: be declared 3081e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 3082e5c31af7Sopenharmony_ci * [[VUID-{refpage}-LocalInvocationIndex-04286]] 3083e5c31af7Sopenharmony_ci The variable decorated with code:LocalInvocationIndex must: be declared 3084e5c31af7Sopenharmony_ci as a scalar 32-bit integer value 3085e5c31af7Sopenharmony_ci**** 3086e5c31af7Sopenharmony_ci-- 3087e5c31af7Sopenharmony_ci 3088e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 3089e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-meshviewcount]] 3090e5c31af7Sopenharmony_ci[open,refpage='MeshViewCountNV',desc='Number of views processed by a mesh or task shader',type='builtins'] 3091e5c31af7Sopenharmony_ci-- 3092e5c31af7Sopenharmony_ci:refpage: MeshViewCountNV 3093e5c31af7Sopenharmony_ci 3094e5c31af7Sopenharmony_cicode:MeshViewCountNV:: 3095e5c31af7Sopenharmony_ci 3096e5c31af7Sopenharmony_ciDecorating a variable with the code:MeshViewCountNV built-in decoration will 3097e5c31af7Sopenharmony_cimake that variable contain the number of views processed by the current mesh 3098e5c31af7Sopenharmony_cior task shader invocations. 3099e5c31af7Sopenharmony_ci 3100e5c31af7Sopenharmony_ci.Valid Usage 3101e5c31af7Sopenharmony_ci**** 3102e5c31af7Sopenharmony_ci * [[VUID-{refpage}-MeshViewCountNV-04287]] 3103e5c31af7Sopenharmony_ci The code:MeshViewCountNV decoration must: be used only within the 3104e5c31af7Sopenharmony_ci code:MeshNV or code:TaskNV {ExecutionModel} 3105e5c31af7Sopenharmony_ci * [[VUID-{refpage}-MeshViewCountNV-04288]] 3106e5c31af7Sopenharmony_ci The variable decorated with code:MeshViewCountNV must: be declared using 3107e5c31af7Sopenharmony_ci the code:Input {StorageClass} 3108e5c31af7Sopenharmony_ci * [[VUID-{refpage}-MeshViewCountNV-04289]] 3109e5c31af7Sopenharmony_ci The variable decorated with code:MeshViewCountNV must: be declared as a 3110e5c31af7Sopenharmony_ci scalar 32-bit integer value 3111e5c31af7Sopenharmony_ci**** 3112e5c31af7Sopenharmony_ci-- 3113e5c31af7Sopenharmony_ci 3114e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-meshviewindices]] 3115e5c31af7Sopenharmony_ci[open,refpage='MeshViewIndicesNV',desc='Indices of views processed by a mesh or task shader',type='builtins'] 3116e5c31af7Sopenharmony_ci-- 3117e5c31af7Sopenharmony_ci:refpage: MeshViewIndicesNV 3118e5c31af7Sopenharmony_ci 3119e5c31af7Sopenharmony_cicode:MeshViewIndicesNV:: 3120e5c31af7Sopenharmony_ci 3121e5c31af7Sopenharmony_ciDecorating a variable with the code:MeshViewIndicesNV built-in decoration 3122e5c31af7Sopenharmony_ciwill make that variable contain the mesh view indices. 3123e5c31af7Sopenharmony_ciThe mesh view indices is an array of values where each element holds the 3124e5c31af7Sopenharmony_ciview number of one of the views being processed by the current mesh or task 3125e5c31af7Sopenharmony_cishader invocations. 3126e5c31af7Sopenharmony_ciThe values of array elements with indices greater than or equal to 3127e5c31af7Sopenharmony_cicode:MeshViewCountNV are undefined:. 3128e5c31af7Sopenharmony_ciIf the value of code:MeshViewIndicesNV[i] is [eq]#j#, then any outputs 3129e5c31af7Sopenharmony_cidecorated with code:PerViewNV will take on the value of array element 3130e5c31af7Sopenharmony_ci[eq]#i# when processing primitives for view index [eq]#j#. 3131e5c31af7Sopenharmony_ci 3132e5c31af7Sopenharmony_ci.Valid Usage 3133e5c31af7Sopenharmony_ci**** 3134e5c31af7Sopenharmony_ci * [[VUID-{refpage}-MeshViewIndicesNV-04290]] 3135e5c31af7Sopenharmony_ci The code:MeshViewIndicesNV decoration must: be used only within the 3136e5c31af7Sopenharmony_ci code:MeshNV or code:TaskNV {ExecutionModel} 3137e5c31af7Sopenharmony_ci * [[VUID-{refpage}-MeshViewIndicesNV-04291]] 3138e5c31af7Sopenharmony_ci The variable decorated with code:MeshViewIndicesNV must: be declared 3139e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 3140e5c31af7Sopenharmony_ci * [[VUID-{refpage}-MeshViewIndicesNV-04292]] 3141e5c31af7Sopenharmony_ci The variable decorated with code:MeshViewIndicesNV must: be declared as 3142e5c31af7Sopenharmony_ci an array of scalar 32-bit integer values 3143e5c31af7Sopenharmony_ci**** 3144e5c31af7Sopenharmony_ci-- 3145e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 3146e5c31af7Sopenharmony_ci 3147e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 3148e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-numsubgroups]] 3149e5c31af7Sopenharmony_ci[open,refpage='NumSubgroups',desc='Number of subgroups in a workgroup',type='builtins'] 3150e5c31af7Sopenharmony_ci-- 3151e5c31af7Sopenharmony_ci:refpage: NumSubgroups 3152e5c31af7Sopenharmony_ci 3153e5c31af7Sopenharmony_cicode:NumSubgroups:: 3154e5c31af7Sopenharmony_ci 3155e5c31af7Sopenharmony_ciDecorating a variable with the code:NumSubgroups built-in decoration will 3156e5c31af7Sopenharmony_cimake that variable contain the number of subgroups in the local workgroup. 3157e5c31af7Sopenharmony_ci 3158e5c31af7Sopenharmony_ci.Valid Usage 3159e5c31af7Sopenharmony_ci**** 3160e5c31af7Sopenharmony_ci * [[VUID-{refpage}-NumSubgroups-04293]] 3161e5c31af7Sopenharmony_ci The code:NumSubgroups decoration must: be used only within the 3162e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV 3163e5c31af7Sopenharmony_ci {ExecutionModel} 3164e5c31af7Sopenharmony_ci * [[VUID-{refpage}-NumSubgroups-04294]] 3165e5c31af7Sopenharmony_ci The variable decorated with code:NumSubgroups must: be declared using 3166e5c31af7Sopenharmony_ci the code:Input {StorageClass} 3167e5c31af7Sopenharmony_ci * [[VUID-{refpage}-NumSubgroups-04295]] 3168e5c31af7Sopenharmony_ci The variable decorated with code:NumSubgroups must: be declared as a 3169e5c31af7Sopenharmony_ci scalar 32-bit integer value 3170e5c31af7Sopenharmony_ci**** 3171e5c31af7Sopenharmony_ci-- 3172e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 3173e5c31af7Sopenharmony_ci 3174e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-numworkgroups]] 3175e5c31af7Sopenharmony_ci[open,refpage='NumWorkgroups',desc='Number of workgroups in a dispatch',type='builtins'] 3176e5c31af7Sopenharmony_ci-- 3177e5c31af7Sopenharmony_ci:refpage: NumWorkgroups 3178e5c31af7Sopenharmony_ci 3179e5c31af7Sopenharmony_cicode:NumWorkgroups:: 3180e5c31af7Sopenharmony_ci 3181e5c31af7Sopenharmony_ciDecorating a variable with the code:NumWorkgroups built-in decoration will 3182e5c31af7Sopenharmony_cimake that variable contain the number of local workgroups that are part of 3183e5c31af7Sopenharmony_cithe dispatch that the invocation belongs to. 3184e5c31af7Sopenharmony_ciEach component is equal to the values of the workgroup count parameters 3185e5c31af7Sopenharmony_cipassed into the dispatching commands. 3186e5c31af7Sopenharmony_ci 3187e5c31af7Sopenharmony_ci.Valid Usage 3188e5c31af7Sopenharmony_ci**** 3189e5c31af7Sopenharmony_ci * [[VUID-{refpage}-NumWorkgroups-04296]] 3190e5c31af7Sopenharmony_ci The code:NumWorkgroups decoration must: be used only within the 3191e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, or code:TaskEXT {ExecutionModel} 3192e5c31af7Sopenharmony_ci * [[VUID-{refpage}-NumWorkgroups-04297]] 3193e5c31af7Sopenharmony_ci The variable decorated with code:NumWorkgroups must: be declared using 3194e5c31af7Sopenharmony_ci the code:Input {StorageClass} 3195e5c31af7Sopenharmony_ci * [[VUID-{refpage}-NumWorkgroups-04298]] 3196e5c31af7Sopenharmony_ci The variable decorated with code:NumWorkgroups must: be declared as a 3197e5c31af7Sopenharmony_ci three-component vector of 32-bit integer values 3198e5c31af7Sopenharmony_ci**** 3199e5c31af7Sopenharmony_ci-- 3200e5c31af7Sopenharmony_ci 3201e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 3202e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-objectraydirection]] 3203e5c31af7Sopenharmony_ci[open,refpage='ObjectRayDirectionKHR',desc='Ray direction in object space',type='builtins'] 3204e5c31af7Sopenharmony_ci-- 3205e5c31af7Sopenharmony_ci:refpage: ObjectRayDirectionKHR 3206e5c31af7Sopenharmony_ci 3207e5c31af7Sopenharmony_cicode:ObjectRayDirectionKHR:: 3208e5c31af7Sopenharmony_ci 3209e5c31af7Sopenharmony_ciA variable decorated with the code:ObjectRayDirectionKHR decoration will 3210e5c31af7Sopenharmony_cispecify the direction of the ray being processed, in object space. 3211e5c31af7Sopenharmony_ci 3212e5c31af7Sopenharmony_ci.Valid Usage 3213e5c31af7Sopenharmony_ci**** 3214e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectRayDirectionKHR-04299]] 3215e5c31af7Sopenharmony_ci The code:ObjectRayDirectionKHR decoration must: be used only within the 3216e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 3217e5c31af7Sopenharmony_ci {ExecutionModel} 3218e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectRayDirectionKHR-04300]] 3219e5c31af7Sopenharmony_ci The variable decorated with code:ObjectRayDirectionKHR must: be declared 3220e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 3221e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectRayDirectionKHR-04301]] 3222e5c31af7Sopenharmony_ci The variable decorated with code:ObjectRayDirectionKHR must: be declared 3223e5c31af7Sopenharmony_ci as a three-component vector of 32-bit floating-point values 3224e5c31af7Sopenharmony_ci**** 3225e5c31af7Sopenharmony_ci-- 3226e5c31af7Sopenharmony_ci 3227e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-objectrayorigin]] 3228e5c31af7Sopenharmony_ci[open,refpage='ObjectRayOriginKHR',desc='Ray origin in object space',type='builtins'] 3229e5c31af7Sopenharmony_ci-- 3230e5c31af7Sopenharmony_ci:refpage: ObjectRayOriginKHR 3231e5c31af7Sopenharmony_ci 3232e5c31af7Sopenharmony_cicode:ObjectRayOriginKHR:: 3233e5c31af7Sopenharmony_ci 3234e5c31af7Sopenharmony_ciA variable decorated with the code:ObjectRayOriginKHR decoration will 3235e5c31af7Sopenharmony_cispecify the origin of the ray being processed, in object space. 3236e5c31af7Sopenharmony_ci 3237e5c31af7Sopenharmony_ci.Valid Usage 3238e5c31af7Sopenharmony_ci**** 3239e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectRayOriginKHR-04302]] 3240e5c31af7Sopenharmony_ci The code:ObjectRayOriginKHR decoration must: be used only within the 3241e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 3242e5c31af7Sopenharmony_ci {ExecutionModel} 3243e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectRayOriginKHR-04303]] 3244e5c31af7Sopenharmony_ci The variable decorated with code:ObjectRayOriginKHR must: be declared 3245e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 3246e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectRayOriginKHR-04304]] 3247e5c31af7Sopenharmony_ci The variable decorated with code:ObjectRayOriginKHR must: be declared as 3248e5c31af7Sopenharmony_ci a three-component vector of 32-bit floating-point values 3249e5c31af7Sopenharmony_ci**** 3250e5c31af7Sopenharmony_ci-- 3251e5c31af7Sopenharmony_ci 3252e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-objecttoworld]] 3253e5c31af7Sopenharmony_ci[open,refpage='ObjectToWorldKHR',desc='Transformation matrix from object to world space',type='builtins'] 3254e5c31af7Sopenharmony_ci-- 3255e5c31af7Sopenharmony_ci:refpage: ObjectToWorldKHR 3256e5c31af7Sopenharmony_ci 3257e5c31af7Sopenharmony_cicode:ObjectToWorldKHR:: 3258e5c31af7Sopenharmony_ci 3259e5c31af7Sopenharmony_ciA variable decorated with the code:ObjectToWorldKHR decoration will contain 3260e5c31af7Sopenharmony_cithe current object-to-world transformation matrix, which is determined by 3261e5c31af7Sopenharmony_cithe instance of the current intersection. 3262e5c31af7Sopenharmony_ci 3263e5c31af7Sopenharmony_ci.Valid Usage 3264e5c31af7Sopenharmony_ci**** 3265e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectToWorldKHR-04305]] 3266e5c31af7Sopenharmony_ci The code:ObjectToWorldKHR decoration must: be used only within the 3267e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 3268e5c31af7Sopenharmony_ci {ExecutionModel} 3269e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectToWorldKHR-04306]] 3270e5c31af7Sopenharmony_ci The variable decorated with code:ObjectToWorldKHR must: be declared 3271e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 3272e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ObjectToWorldKHR-04307]] 3273e5c31af7Sopenharmony_ci The variable decorated with code:ObjectToWorldKHR must: be declared as a 3274e5c31af7Sopenharmony_ci matrix with four columns of three-component vectors of 32-bit 3275e5c31af7Sopenharmony_ci floating-point values 3276e5c31af7Sopenharmony_ci**** 3277e5c31af7Sopenharmony_ci-- 3278e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 3279e5c31af7Sopenharmony_ci 3280e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-patchvertices]] 3281e5c31af7Sopenharmony_ci[open,refpage='PatchVertices',desc='Number of vertices in an input patch',type='builtins'] 3282e5c31af7Sopenharmony_ci-- 3283e5c31af7Sopenharmony_ci:refpage: PatchVertices 3284e5c31af7Sopenharmony_ci 3285e5c31af7Sopenharmony_cicode:PatchVertices:: 3286e5c31af7Sopenharmony_ci 3287e5c31af7Sopenharmony_ciDecorating a variable with the code:PatchVertices built-in decoration will 3288e5c31af7Sopenharmony_cimake that variable contain the number of vertices in the input patch being 3289e5c31af7Sopenharmony_ciprocessed by the shader. 3290e5c31af7Sopenharmony_ciIn a Tessellation Control Shader, this is the same as the 3291e5c31af7Sopenharmony_ciname:patchControlPoints member of 3292e5c31af7Sopenharmony_cislink:VkPipelineTessellationStateCreateInfo. 3293e5c31af7Sopenharmony_ciIn a Tessellation Evaluation Shader, code:PatchVertices is equal to the 3294e5c31af7Sopenharmony_citessellation control output patch size. 3295e5c31af7Sopenharmony_ciWhen the same shader is used in different pipelines where the patch sizes 3296e5c31af7Sopenharmony_ciare configured differently, the value of the code:PatchVertices variable 3297e5c31af7Sopenharmony_ciwill also differ. 3298e5c31af7Sopenharmony_ci 3299e5c31af7Sopenharmony_ci.Valid Usage 3300e5c31af7Sopenharmony_ci**** 3301e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PatchVertices-04308]] 3302e5c31af7Sopenharmony_ci The code:PatchVertices decoration must: be used only within the 3303e5c31af7Sopenharmony_ci code:TessellationControl or code:TessellationEvaluation {ExecutionModel} 3304e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PatchVertices-04309]] 3305e5c31af7Sopenharmony_ci The variable decorated with code:PatchVertices must: be declared using 3306e5c31af7Sopenharmony_ci the code:Input {StorageClass} 3307e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PatchVertices-04310]] 3308e5c31af7Sopenharmony_ci The variable decorated with code:PatchVertices must: be declared as a 3309e5c31af7Sopenharmony_ci scalar 32-bit integer value 3310e5c31af7Sopenharmony_ci**** 3311e5c31af7Sopenharmony_ci-- 3312e5c31af7Sopenharmony_ci 3313e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-pointcoord]] 3314e5c31af7Sopenharmony_ci[open,refpage='PointCoord',desc='Fragment coordinates in screen-space within a point primitive',type='builtins'] 3315e5c31af7Sopenharmony_ci-- 3316e5c31af7Sopenharmony_ci:refpage: PointCoord 3317e5c31af7Sopenharmony_ci 3318e5c31af7Sopenharmony_cicode:PointCoord:: 3319e5c31af7Sopenharmony_ci 3320e5c31af7Sopenharmony_ciDecorating a variable with the code:PointCoord built-in decoration will make 3321e5c31af7Sopenharmony_cithat variable contain the coordinate of the current fragment within the 3322e5c31af7Sopenharmony_cipoint being rasterized, normalized to the size of the point with origin in 3323e5c31af7Sopenharmony_cithe upper left corner of the point, as described in 3324e5c31af7Sopenharmony_ci<<primsrast-points-basic,Basic Point Rasterization>>. 3325e5c31af7Sopenharmony_ciIf the primitive the fragment shader invocation belongs to is not a point, 3326e5c31af7Sopenharmony_cithen the variable decorated with code:PointCoord contains an undefined: 3327e5c31af7Sopenharmony_civalue. 3328e5c31af7Sopenharmony_ci 3329e5c31af7Sopenharmony_ci[NOTE] 3330e5c31af7Sopenharmony_ci.Note 3331e5c31af7Sopenharmony_ci==== 3332e5c31af7Sopenharmony_ciDepending on how the point is rasterized, code:PointCoord may: never reach 3333e5c31af7Sopenharmony_ci[eq]#(0,0)# or [eq]#(1,1)#. 3334e5c31af7Sopenharmony_ci==== 3335e5c31af7Sopenharmony_ci 3336e5c31af7Sopenharmony_ci.Valid Usage 3337e5c31af7Sopenharmony_ci**** 3338e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PointCoord-04311]] 3339e5c31af7Sopenharmony_ci The code:PointCoord decoration must: be used only within the 3340e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 3341e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PointCoord-04312]] 3342e5c31af7Sopenharmony_ci The variable decorated with code:PointCoord must: be declared using the 3343e5c31af7Sopenharmony_ci code:Input {StorageClass} 3344e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PointCoord-04313]] 3345e5c31af7Sopenharmony_ci The variable decorated with code:PointCoord must: be declared as a 3346e5c31af7Sopenharmony_ci two-component vector of 32-bit floating-point values 3347e5c31af7Sopenharmony_ci**** 3348e5c31af7Sopenharmony_ci-- 3349e5c31af7Sopenharmony_ci 3350e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-pointsize]] 3351e5c31af7Sopenharmony_ci[open,refpage='PointSize',desc='Size of a point primitive',type='builtins'] 3352e5c31af7Sopenharmony_ci-- 3353e5c31af7Sopenharmony_ci:refpage: PointSize 3354e5c31af7Sopenharmony_ci 3355e5c31af7Sopenharmony_cicode:PointSize:: 3356e5c31af7Sopenharmony_ci 3357e5c31af7Sopenharmony_ciDecorating a variable with the code:PointSize built-in decoration will make 3358e5c31af7Sopenharmony_cithat variable contain the size of point primitives 3359e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[] 3360e5c31af7Sopenharmony_cior the final rasterization of polygons if <<primsrast-polygonmode, polygon 3361e5c31af7Sopenharmony_cimode>> is ename:VK_POLYGON_MODE_POINT when 3362e5c31af7Sopenharmony_cisname:VkPhysicalDeviceMaintenance5PropertiesKHR::pname:polygonModePointSize 3363e5c31af7Sopenharmony_ciis set to ename:VK_TRUE 3364e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance5[] 3365e5c31af7Sopenharmony_ci. 3366e5c31af7Sopenharmony_ciThe value written to the variable decorated with code:PointSize by the last 3367e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 3368e5c31af7Sopenharmony_cistage>> in the pipeline is used as the framebuffer-space size of points 3369e5c31af7Sopenharmony_ciproduced by rasterization. 3370e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[] 3371e5c31af7Sopenharmony_ciIf <<features-maintenance5, pname:maintenance5>> is enabled and a value is 3372e5c31af7Sopenharmony_cinot written to a variable decorated with code:PointSize, a value of 1.0 is 3373e5c31af7Sopenharmony_ciused as the size of points. 3374e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance5[] 3375e5c31af7Sopenharmony_ci 3376e5c31af7Sopenharmony_ci[NOTE] 3377e5c31af7Sopenharmony_ci.Note 3378e5c31af7Sopenharmony_ci==== 3379e5c31af7Sopenharmony_ciWhen code:PointSize decorates a variable in the code:Input {StorageClass}, 3380e5c31af7Sopenharmony_ciit contains the data written to the output variable decorated with 3381e5c31af7Sopenharmony_cicode:PointSize from the previous shader stage. 3382e5c31af7Sopenharmony_ci==== 3383e5c31af7Sopenharmony_ci 3384e5c31af7Sopenharmony_ci.Valid Usage 3385e5c31af7Sopenharmony_ci**** 3386e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PointSize-04314]] 3387e5c31af7Sopenharmony_ci The code:PointSize decoration must: be used only within the 3388e5c31af7Sopenharmony_ci code:MeshEXT, code:MeshNV, code:Vertex, code:TessellationControl, 3389e5c31af7Sopenharmony_ci code:TessellationEvaluation, or code:Geometry {ExecutionModel} 3390e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PointSize-04315]] 3391e5c31af7Sopenharmony_ci The variable decorated with code:PointSize within the code:MeshEXT, 3392e5c31af7Sopenharmony_ci code:MeshNV, or code:Vertex {ExecutionModel} must: be declared using the 3393e5c31af7Sopenharmony_ci code:Output {StorageClass} 3394e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PointSize-04316]] 3395e5c31af7Sopenharmony_ci The variable decorated with code:PointSize within the 3396e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, or code:Geometry 3397e5c31af7Sopenharmony_ci {ExecutionModel} must: not be declared using a {StorageClass} other than 3398e5c31af7Sopenharmony_ci code:Input or code:Output 3399e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PointSize-04317]] 3400e5c31af7Sopenharmony_ci The variable decorated with code:PointSize must: be declared as a scalar 3401e5c31af7Sopenharmony_ci 32-bit floating-point value 3402e5c31af7Sopenharmony_ci**** 3403e5c31af7Sopenharmony_ci-- 3404e5c31af7Sopenharmony_ci 3405e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-position]] 3406e5c31af7Sopenharmony_ci[open,refpage='Position',desc='Vertex position',type='builtins'] 3407e5c31af7Sopenharmony_ci-- 3408e5c31af7Sopenharmony_ci:refpage: Position 3409e5c31af7Sopenharmony_ci 3410e5c31af7Sopenharmony_cicode:Position:: 3411e5c31af7Sopenharmony_ci 3412e5c31af7Sopenharmony_ciDecorating a variable with the code:Position built-in decoration will make 3413e5c31af7Sopenharmony_cithat variable contain the position of the current vertex. 3414e5c31af7Sopenharmony_ciIn the last <<pipelines-graphics-subsets-pre-rasterization,pre-rasterization 3415e5c31af7Sopenharmony_cishader stage>>, the value of the variable decorated with code:Position is 3416e5c31af7Sopenharmony_ciused in subsequent primitive assembly, clipping, and rasterization 3417e5c31af7Sopenharmony_cioperations. 3418e5c31af7Sopenharmony_ci 3419e5c31af7Sopenharmony_ci[NOTE] 3420e5c31af7Sopenharmony_ci.Note 3421e5c31af7Sopenharmony_ci==== 3422e5c31af7Sopenharmony_ciWhen code:Position decorates a variable in the code:Input {StorageClass}, it 3423e5c31af7Sopenharmony_cicontains the data written to the output variable decorated with 3424e5c31af7Sopenharmony_cicode:Position from the previous shader stage. 3425e5c31af7Sopenharmony_ci==== 3426e5c31af7Sopenharmony_ci 3427e5c31af7Sopenharmony_ci.Valid Usage 3428e5c31af7Sopenharmony_ci**** 3429e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Position-04318]] 3430e5c31af7Sopenharmony_ci The code:Position decoration must: be used only within the code:MeshEXT, 3431e5c31af7Sopenharmony_ci code:MeshNV, code:Vertex, code:TessellationControl, 3432e5c31af7Sopenharmony_ci code:TessellationEvaluation, or code:Geometry {ExecutionModel} 3433e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Position-04319]] 3434e5c31af7Sopenharmony_ci The variable decorated with code:Position within the code:MeshEXT, 3435e5c31af7Sopenharmony_ci code:MeshNV, or code:Vertex {ExecutionModel} must: be declared using the 3436e5c31af7Sopenharmony_ci code:Output {StorageClass} 3437e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Position-04320]] 3438e5c31af7Sopenharmony_ci The variable decorated with code:Position within the 3439e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, or code:Geometry 3440e5c31af7Sopenharmony_ci {ExecutionModel} must: not be declared using a {StorageClass} other than 3441e5c31af7Sopenharmony_ci code:Input or code:Output 3442e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Position-04321]] 3443e5c31af7Sopenharmony_ci The variable decorated with code:Position must: be declared as a 3444e5c31af7Sopenharmony_ci four-component vector of 32-bit floating-point values 3445e5c31af7Sopenharmony_ci**** 3446e5c31af7Sopenharmony_ci-- 3447e5c31af7Sopenharmony_ci 3448e5c31af7Sopenharmony_ciifdef::VK_NVX_multiview_per_view_attributes[] 3449e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-positionperview]] 3450e5c31af7Sopenharmony_ci[open,refpage='PositionPerViewNV',desc='Vertex position per view',type='builtins'] 3451e5c31af7Sopenharmony_ci-- 3452e5c31af7Sopenharmony_ci:refpage: PositionPerViewNV 3453e5c31af7Sopenharmony_ci 3454e5c31af7Sopenharmony_cicode:PositionPerViewNV:: 3455e5c31af7Sopenharmony_ci 3456e5c31af7Sopenharmony_ciDecorating a variable with the code:PositionPerViewNV built-in decoration 3457e5c31af7Sopenharmony_ciwill make that variable contain the position of the current vertex, for each 3458e5c31af7Sopenharmony_ciview. 3459e5c31af7Sopenharmony_ci+ 3460e5c31af7Sopenharmony_ciElements of the array correspond to views in a multiview subpass, and those 3461e5c31af7Sopenharmony_cielements corresponding to views in the view mask of the subpass the shader 3462e5c31af7Sopenharmony_ciis compiled against will be used as the position value for those views. 3463e5c31af7Sopenharmony_ciFor the final 3464e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 3465e5c31af7Sopenharmony_cistage>> in the pipeline, values written to an output variable decorated with 3466e5c31af7Sopenharmony_cicode:PositionPerViewNV are used in subsequent primitive assembly, clipping, 3467e5c31af7Sopenharmony_ciand rasterization operations, as with code:Position. 3468e5c31af7Sopenharmony_cicode:PositionPerViewNV output in an earlier 3469e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 3470e5c31af7Sopenharmony_cistage>> is available as an input in the subsequent 3471e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 3472e5c31af7Sopenharmony_cistage>>. 3473e5c31af7Sopenharmony_ci+ 3474e5c31af7Sopenharmony_ciIf a shader is compiled against a subpass that has the 3475e5c31af7Sopenharmony_ciename:VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX bit set, then 3476e5c31af7Sopenharmony_cithe position values for each view must: not differ in any component other 3477e5c31af7Sopenharmony_cithan the X component. 3478e5c31af7Sopenharmony_ciIf the values do differ, one will be chosen in an implementation-dependent 3479e5c31af7Sopenharmony_cimanner. 3480e5c31af7Sopenharmony_ci 3481e5c31af7Sopenharmony_ci.Valid Usage 3482e5c31af7Sopenharmony_ci**** 3483e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PositionPerViewNV-04322]] 3484e5c31af7Sopenharmony_ci The code:PositionPerViewNV decoration must: be used only within the 3485e5c31af7Sopenharmony_ci code:MeshNV, code:Vertex, code:TessellationControl, 3486e5c31af7Sopenharmony_ci code:TessellationEvaluation, or code:Geometry {ExecutionModel} 3487e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PositionPerViewNV-04323]] 3488e5c31af7Sopenharmony_ci The variable decorated with code:PositionPerViewNV within the 3489e5c31af7Sopenharmony_ci code:Vertex, or code:MeshNV {ExecutionModel} must: be declared using the 3490e5c31af7Sopenharmony_ci code:Output {StorageClass} 3491e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PositionPerViewNV-04324]] 3492e5c31af7Sopenharmony_ci The variable decorated with code:PositionPerViewNV within the 3493e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, or code:Geometry 3494e5c31af7Sopenharmony_ci {ExecutionModel} must: not be declared using a {StorageClass} other than 3495e5c31af7Sopenharmony_ci code:Input or code:Output 3496e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PositionPerViewNV-04325]] 3497e5c31af7Sopenharmony_ci The variable decorated with code:PositionPerViewNV must: be declared as 3498e5c31af7Sopenharmony_ci an array of four-component vector of 32-bit floating-point values with 3499e5c31af7Sopenharmony_ci at least as many elements as the maximum view in the subpass's view mask 3500e5c31af7Sopenharmony_ci plus one 3501e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PositionPerViewNV-04326]] 3502e5c31af7Sopenharmony_ci The array variable decorated with code:PositionPerViewNV must: only be 3503e5c31af7Sopenharmony_ci indexed by a constant or specialization constant 3504e5c31af7Sopenharmony_ci**** 3505e5c31af7Sopenharmony_ci-- 3506e5c31af7Sopenharmony_ciendif::VK_NVX_multiview_per_view_attributes[] 3507e5c31af7Sopenharmony_ci 3508e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 3509e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-primitivecount]] 3510e5c31af7Sopenharmony_ci[open,refpage='PrimitiveCountNV',desc='Number of primitives output by a mesh shader',type='builtins'] 3511e5c31af7Sopenharmony_ci-- 3512e5c31af7Sopenharmony_ci:refpage: PrimitiveCountNV 3513e5c31af7Sopenharmony_ci 3514e5c31af7Sopenharmony_cicode:PrimitiveCountNV:: 3515e5c31af7Sopenharmony_ci+ 3516e5c31af7Sopenharmony_ciDecorating a variable with the code:PrimitiveCountNV decoration will make 3517e5c31af7Sopenharmony_cithat variable contain the primitive count. 3518e5c31af7Sopenharmony_ciThe primitive count specifies the number of primitives in the output mesh 3519e5c31af7Sopenharmony_ciproduced by the mesh shader that will be processed by subsequent pipeline 3520e5c31af7Sopenharmony_cistages. 3521e5c31af7Sopenharmony_ci 3522e5c31af7Sopenharmony_ci.Valid Usage 3523e5c31af7Sopenharmony_ci**** 3524e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveCountNV-04327]] 3525e5c31af7Sopenharmony_ci The code:PrimitiveCountNV decoration must: be used only within the 3526e5c31af7Sopenharmony_ci code:MeshNV {ExecutionModel} 3527e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveCountNV-04328]] 3528e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveCountNV must: be declared 3529e5c31af7Sopenharmony_ci using the code:Output {StorageClass} 3530e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveCountNV-04329]] 3531e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveCountNV must: be declared as a 3532e5c31af7Sopenharmony_ci scalar 32-bit integer value 3533e5c31af7Sopenharmony_ci**** 3534e5c31af7Sopenharmony_ci-- 3535e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 3536e5c31af7Sopenharmony_ci 3537e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-primitiveid]] 3538e5c31af7Sopenharmony_ci[open,refpage='PrimitiveId',desc='Primitive ID',type='builtins'] 3539e5c31af7Sopenharmony_ci-- 3540e5c31af7Sopenharmony_ci:refpage: PrimitiveId 3541e5c31af7Sopenharmony_ci 3542e5c31af7Sopenharmony_cicode:PrimitiveId:: 3543e5c31af7Sopenharmony_ci 3544e5c31af7Sopenharmony_ciDecorating a variable with the code:PrimitiveId built-in decoration will 3545e5c31af7Sopenharmony_cimake that variable contain the index of the current primitive. 3546e5c31af7Sopenharmony_ci+ 3547e5c31af7Sopenharmony_ciThe index of the first primitive generated by a drawing command is zero, and 3548e5c31af7Sopenharmony_cithe index is incremented after every individual point, line, or triangle 3549e5c31af7Sopenharmony_ciprimitive is processed. 3550e5c31af7Sopenharmony_ci+ 3551e5c31af7Sopenharmony_ciFor triangles drawn as points or line segments (see <<primsrast-polygonmode, 3552e5c31af7Sopenharmony_ciPolygon Mode>>), the primitive index is incremented only once, even if 3553e5c31af7Sopenharmony_cimultiple points or lines are eventually drawn. 3554e5c31af7Sopenharmony_ci+ 3555e5c31af7Sopenharmony_ciVariables decorated with code:PrimitiveId are reset to zero between each 3556e5c31af7Sopenharmony_ciinstance drawn. 3557e5c31af7Sopenharmony_ci+ 3558e5c31af7Sopenharmony_ciRestarting a primitive topology using primitive restart has no effect on the 3559e5c31af7Sopenharmony_civalue of variables decorated with code:PrimitiveId. 3560e5c31af7Sopenharmony_ci+ 3561e5c31af7Sopenharmony_ciIn tessellation control and tessellation evaluation shaders, it will contain 3562e5c31af7Sopenharmony_cithe index of the patch within the current set of rendering primitives that 3563e5c31af7Sopenharmony_cicorresponds to the shader invocation. 3564e5c31af7Sopenharmony_ci+ 3565e5c31af7Sopenharmony_ciIn a geometry shader, it will contain the number of primitives presented as 3566e5c31af7Sopenharmony_ciinput to the shader since the current set of rendering primitives was 3567e5c31af7Sopenharmony_cistarted. 3568e5c31af7Sopenharmony_ci+ 3569e5c31af7Sopenharmony_ciIn a fragment shader, it will contain the primitive index written by the 3570e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 3571e5c31af7Sopenharmony_cimesh shader if a mesh shader is present, or the primitive index written by 3572e5c31af7Sopenharmony_cithe 3573e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[] 3574e5c31af7Sopenharmony_cigeometry shader if a geometry shader is present, or with the value that 3575e5c31af7Sopenharmony_ciwould have been presented as input to the geometry shader had it been 3576e5c31af7Sopenharmony_cipresent. 3577e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 3578e5c31af7Sopenharmony_ci+ 3579e5c31af7Sopenharmony_ciIn an intersection, any-hit, or closest hit shader, it will contain the 3580e5c31af7Sopenharmony_ciindex within the geometry of the triangle or bounding box being processed. 3581e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 3582e5c31af7Sopenharmony_ci 3583e5c31af7Sopenharmony_ci[NOTE] 3584e5c31af7Sopenharmony_ci.Note 3585e5c31af7Sopenharmony_ci==== 3586e5c31af7Sopenharmony_ciWhen the code:PrimitiveId decoration is applied to an output variable in the 3587e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[mesh shader or] 3588e5c31af7Sopenharmony_cigeometry shader, the resulting value is seen through the code:PrimitiveId 3589e5c31af7Sopenharmony_cidecorated input variable in the fragment shader. 3590e5c31af7Sopenharmony_ci 3591e5c31af7Sopenharmony_ciThe fragment shader using code:PrimitiveId will need to declare either the 3592e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[code:MeshShadingNV,] 3593e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[code:MeshShadingEXT,] 3594e5c31af7Sopenharmony_cicode:Geometry or code:Tessellation capability to satisfy the requirement 3595e5c31af7Sopenharmony_ciSPIR-V has to use code:PrimitiveId. 3596e5c31af7Sopenharmony_ci==== 3597e5c31af7Sopenharmony_ci 3598e5c31af7Sopenharmony_ci.Valid Usage 3599e5c31af7Sopenharmony_ci**** 3600e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveId-04330]] 3601e5c31af7Sopenharmony_ci The code:PrimitiveId decoration must: be used only within the 3602e5c31af7Sopenharmony_ci code:MeshEXT, code:MeshNV, code:IntersectionKHR, code:AnyHitKHR, 3603e5c31af7Sopenharmony_ci code:ClosestHitKHR, code:TessellationControl, 3604e5c31af7Sopenharmony_ci code:TessellationEvaluation, code:Geometry, or code:Fragment 3605e5c31af7Sopenharmony_ci {ExecutionModel} 3606e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Fragment-04331]] 3607e5c31af7Sopenharmony_ci If pipeline contains both the code:Fragment and code:Geometry 3608e5c31af7Sopenharmony_ci {ExecutionModel} and a variable decorated with code:PrimitiveId is read 3609e5c31af7Sopenharmony_ci from code:Fragment shader, then the code:Geometry shader must: write to 3610e5c31af7Sopenharmony_ci the output variables decorated with code:PrimitiveId in all execution 3611e5c31af7Sopenharmony_ci paths 3612e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Fragment-04332]] 3613e5c31af7Sopenharmony_ci If pipeline contains both the code:Fragment and code:MeshEXT or 3614e5c31af7Sopenharmony_ci code:MeshNV {ExecutionModel} and a variable decorated with 3615e5c31af7Sopenharmony_ci code:PrimitiveId is read from code:Fragment shader, then the 3616e5c31af7Sopenharmony_ci code:MeshEXT or code:MeshNV shader must: write to the output variables 3617e5c31af7Sopenharmony_ci decorated with code:PrimitiveId in all execution paths 3618e5c31af7Sopenharmony_ci * [[VUID-{refpage}-Fragment-04333]] 3619e5c31af7Sopenharmony_ci If code:Fragment {ExecutionModel} contains a variable decorated with 3620e5c31af7Sopenharmony_ci code:PrimitiveId, then either the code:MeshShadingEXT, 3621e5c31af7Sopenharmony_ci code:MeshShadingNV, code:Geometry or code:Tessellation capability must: 3622e5c31af7Sopenharmony_ci also be declared 3623e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveId-04334]] 3624e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveId within the 3625e5c31af7Sopenharmony_ci code:TessellationControl, code:TessellationEvaluation, code:Fragment, 3626e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 3627e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Input {StorageClass} 3628e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveId-04335]] 3629e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveId within the code:Geometry 3630e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Input or code:Output 3631e5c31af7Sopenharmony_ci {StorageClass} 3632e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveId-04336]] 3633e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveId within the code:MeshEXT or 3634e5c31af7Sopenharmony_ci code:MeshNV {ExecutionModel} must: be declared using the code:Output 3635e5c31af7Sopenharmony_ci {StorageClass} 3636e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveId-04337]] 3637e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveId must: be declared as a 3638e5c31af7Sopenharmony_ci scalar 32-bit integer value 3639e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveId-07040]] 3640e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveId within the code:MeshEXT 3641e5c31af7Sopenharmony_ci {ExecutionModel} must: also be decorated with the code:PerPrimitiveEXT 3642e5c31af7Sopenharmony_ci decoration 3643e5c31af7Sopenharmony_ci**** 3644e5c31af7Sopenharmony_ci-- 3645e5c31af7Sopenharmony_ci 3646e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 3647e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-primitiveindices]] 3648e5c31af7Sopenharmony_ci[open,refpage='PrimitiveIndicesNV',desc='Indices of primitives in a mesh shader',type='builtins'] 3649e5c31af7Sopenharmony_ci-- 3650e5c31af7Sopenharmony_ci:refpage: PrimitiveIndicesNV 3651e5c31af7Sopenharmony_ci 3652e5c31af7Sopenharmony_cicode:PrimitiveIndicesNV:: 3653e5c31af7Sopenharmony_ci+ 3654e5c31af7Sopenharmony_ciDecorating a variable with the code:PrimitiveIndicesNV decoration will make 3655e5c31af7Sopenharmony_cithat variable contain the output array of vertex index values. 3656e5c31af7Sopenharmony_ciDepending on the output primitive type declared using the execution mode, 3657e5c31af7Sopenharmony_cithe indices are split into groups of one (code:OutputPoints), two 3658e5c31af7Sopenharmony_ci(code:OutputLinesNV), or three (code:OutputTrianglesNV) indices and each 3659e5c31af7Sopenharmony_cigroup generates a primitive. 3660e5c31af7Sopenharmony_ci 3661e5c31af7Sopenharmony_ci.Valid Usage 3662e5c31af7Sopenharmony_ci**** 3663e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveIndicesNV-04338]] 3664e5c31af7Sopenharmony_ci The code:PrimitiveIndicesNV decoration must: be used only within the 3665e5c31af7Sopenharmony_ci code:MeshNV {ExecutionModel} 3666e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveIndicesNV-04339]] 3667e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveIndicesNV must: be declared 3668e5c31af7Sopenharmony_ci using the code:Output {StorageClass} 3669e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveIndicesNV-04340]] 3670e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveIndicesNV must: be declared as 3671e5c31af7Sopenharmony_ci an array of scalar 32-bit integer values 3672e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveIndicesNV-04341]] 3673e5c31af7Sopenharmony_ci All index values of the array decorated with code:PrimitiveIndicesNV 3674e5c31af7Sopenharmony_ci must: be in the range [eq]#[0, N-1]#, where [eq]#N# is the value 3675e5c31af7Sopenharmony_ci specified by the code:OutputVertices {ExecutionMode} 3676e5c31af7Sopenharmony_ci * [[VUID-{refpage}-OutputPoints-04342]] 3677e5c31af7Sopenharmony_ci If the {ExecutionMode} is code:OutputPoints, then the array decorated 3678e5c31af7Sopenharmony_ci with code:PrimitiveIndicesNV must: be the size of the value specified by 3679e5c31af7Sopenharmony_ci code:OutputPrimitivesNV 3680e5c31af7Sopenharmony_ci * [[VUID-{refpage}-OutputLinesNV-04343]] 3681e5c31af7Sopenharmony_ci If the {ExecutionMode} is code:OutputLinesNV, then the array decorated 3682e5c31af7Sopenharmony_ci with code:PrimitiveIndicesNV must: be the size of two times the value 3683e5c31af7Sopenharmony_ci specified by code:OutputPrimitivesNV 3684e5c31af7Sopenharmony_ci * [[VUID-{refpage}-OutputTrianglesNV-04344]] 3685e5c31af7Sopenharmony_ci If the {ExecutionMode} is code:OutputTrianglesNV, then the array 3686e5c31af7Sopenharmony_ci decorated with code:PrimitiveIndicesNV must: be the size of three times 3687e5c31af7Sopenharmony_ci the value specified by code:OutputPrimitivesNV 3688e5c31af7Sopenharmony_ci**** 3689e5c31af7Sopenharmony_ci-- 3690e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 3691e5c31af7Sopenharmony_ci 3692e5c31af7Sopenharmony_ciifdef::VK_EXT_mesh_shader[] 3693e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-primitivepointindices]] 3694e5c31af7Sopenharmony_ci[open,refpage='PrimitivePointIndicesEXT',desc='Indices of point primitives in a mesh shader',type='builtins'] 3695e5c31af7Sopenharmony_ci-- 3696e5c31af7Sopenharmony_ci:refpage: PrimitivePointIndicesEXT 3697e5c31af7Sopenharmony_ci 3698e5c31af7Sopenharmony_cicode:PrimitivePointIndicesEXT:: 3699e5c31af7Sopenharmony_ci+ 3700e5c31af7Sopenharmony_ciDecorating a variable with the code:PrimitivePointIndicesEXT decoration will 3701e5c31af7Sopenharmony_cimake that variable contain the output array of vertex index values for point 3702e5c31af7Sopenharmony_ciprimitives. 3703e5c31af7Sopenharmony_ci 3704e5c31af7Sopenharmony_ci.Valid Usage 3705e5c31af7Sopenharmony_ci**** 3706e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitivePointIndicesEXT-07041]] 3707e5c31af7Sopenharmony_ci The code:PrimitivePointIndicesEXT decoration must: be used only within 3708e5c31af7Sopenharmony_ci the code:MeshEXT {ExecutionModel} 3709e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitivePointIndicesEXT-07042]] 3710e5c31af7Sopenharmony_ci The code:PrimitivePointIndicesEXT decoration must: be used with the 3711e5c31af7Sopenharmony_ci code:OutputPoints {ExecutionMode} 3712e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitivePointIndicesEXT-07043]] 3713e5c31af7Sopenharmony_ci The variable decorated with code:PrimitivePointIndicesEXT must: be 3714e5c31af7Sopenharmony_ci declared using the code:Output {StorageClass} 3715e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitivePointIndicesEXT-07044]] 3716e5c31af7Sopenharmony_ci The variable decorated with code:PrimitivePointIndicesEXT must: be 3717e5c31af7Sopenharmony_ci declared as an array of scalar 32-bit integer values 3718e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitivePointIndicesEXT-07045]] 3719e5c31af7Sopenharmony_ci All index values of the array decorated with 3720e5c31af7Sopenharmony_ci code:PrimitivePointIndicesEXT must: be in the range [eq]#[0, N-1]#, 3721e5c31af7Sopenharmony_ci where [eq]#N# is the value specified by the code:OutputVertices 3722e5c31af7Sopenharmony_ci {ExecutionMode} 3723e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitivePointIndicesEXT-07046]] 3724e5c31af7Sopenharmony_ci The size of the array decorated with code:PrimitivePointIndicesEXT must: 3725e5c31af7Sopenharmony_ci match the value specified by code:OutputPrimitivesEXT 3726e5c31af7Sopenharmony_ci**** 3727e5c31af7Sopenharmony_ci-- 3728e5c31af7Sopenharmony_ci 3729e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-primitivelineindices]] 3730e5c31af7Sopenharmony_ci[open,refpage='PrimitiveLineIndicesEXT',desc='Indices of line primitives in a mesh shader',type='builtins'] 3731e5c31af7Sopenharmony_ci-- 3732e5c31af7Sopenharmony_ci:refpage: PrimitiveLineIndicesEXT 3733e5c31af7Sopenharmony_ci 3734e5c31af7Sopenharmony_cicode:PrimitiveLineIndicesEXT:: 3735e5c31af7Sopenharmony_ci+ 3736e5c31af7Sopenharmony_ciDecorating a variable with the code:PrimitiveLineIndicesEXT decoration will 3737e5c31af7Sopenharmony_cimake that variable contain the output array of vertex index values for line 3738e5c31af7Sopenharmony_ciprimitives. 3739e5c31af7Sopenharmony_ci 3740e5c31af7Sopenharmony_ci.Valid Usage 3741e5c31af7Sopenharmony_ci**** 3742e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveLineIndicesEXT-07047]] 3743e5c31af7Sopenharmony_ci The code:PrimitiveLineIndicesEXT decoration must: be used only within 3744e5c31af7Sopenharmony_ci the code:MeshEXT {ExecutionModel} 3745e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveLineIndicesEXT-07048]] 3746e5c31af7Sopenharmony_ci The code:PrimitiveLineIndicesEXT decoration must: be used with the 3747e5c31af7Sopenharmony_ci code:OutputLinesEXT {ExecutionMode} 3748e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveLineIndicesEXT-07049]] 3749e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveLineIndicesEXT must: be 3750e5c31af7Sopenharmony_ci declared using the code:Output {StorageClass} 3751e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveLineIndicesEXT-07050]] 3752e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveLineIndicesEXT must: be 3753e5c31af7Sopenharmony_ci declared as an array of two component vector 32-bit integer values 3754e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveLineIndicesEXT-07051]] 3755e5c31af7Sopenharmony_ci All index values of the array decorated with 3756e5c31af7Sopenharmony_ci code:PrimitiveLineIndicesEXT must: be in the range [eq]#[0, N-1]#, where 3757e5c31af7Sopenharmony_ci [eq]#N# is the value specified by the code:OutputVertices 3758e5c31af7Sopenharmony_ci {ExecutionMode} 3759e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveLineIndicesEXT-07052]] 3760e5c31af7Sopenharmony_ci The size of the array decorated with code:PrimitiveLineIndicesEXT must: 3761e5c31af7Sopenharmony_ci match the value specified by code:OutputPrimitivesEXT 3762e5c31af7Sopenharmony_ci**** 3763e5c31af7Sopenharmony_ci-- 3764e5c31af7Sopenharmony_ci 3765e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-primitivetriangleindices]] 3766e5c31af7Sopenharmony_ci[open,refpage='PrimitiveTriangleIndicesEXT',desc='Indices of triangle primitives in a mesh shader',type='builtins'] 3767e5c31af7Sopenharmony_ci-- 3768e5c31af7Sopenharmony_ci:refpage: PrimitiveTriangleIndicesEXT 3769e5c31af7Sopenharmony_ci 3770e5c31af7Sopenharmony_cicode:PrimitiveTriangleIndicesEXT:: 3771e5c31af7Sopenharmony_ci+ 3772e5c31af7Sopenharmony_ciDecorating a variable with the code:PrimitiveTriangleIndicesEXT decoration 3773e5c31af7Sopenharmony_ciwill make that variable contain the output array of vertex index values for 3774e5c31af7Sopenharmony_citriangle primitives. 3775e5c31af7Sopenharmony_ci 3776e5c31af7Sopenharmony_ci.Valid Usage 3777e5c31af7Sopenharmony_ci**** 3778e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveTriangleIndicesEXT-07053]] 3779e5c31af7Sopenharmony_ci The code:PrimitiveTriangleIndicesEXT decoration must: be used only 3780e5c31af7Sopenharmony_ci within the code:MeshEXT {ExecutionModel} 3781e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveTriangleIndicesEXT-07054]] 3782e5c31af7Sopenharmony_ci The code:PrimitiveTriangleIndicesEXT decoration must: be used with the 3783e5c31af7Sopenharmony_ci code:OutputTrianglesEXT {ExecutionMode} 3784e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveTriangleIndicesEXT-07055]] 3785e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveTriangleIndicesEXT must: be 3786e5c31af7Sopenharmony_ci declared using the code:Output {StorageClass} 3787e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveTriangleIndicesEXT-07056]] 3788e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveTriangleIndicesEXT must: be 3789e5c31af7Sopenharmony_ci declared as an array of three component vector 32-bit integer values 3790e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveTriangleIndicesEXT-07057]] 3791e5c31af7Sopenharmony_ci All index values of the array decorated with 3792e5c31af7Sopenharmony_ci code:PrimitiveTriangleIndicesEXT must: be in the range [eq]#[0, N-1]#, 3793e5c31af7Sopenharmony_ci where [eq]#N# is the value specified by the code:OutputVertices 3794e5c31af7Sopenharmony_ci {ExecutionMode} 3795e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveTriangleIndicesEXT-07058]] 3796e5c31af7Sopenharmony_ci The size of the array decorated with code:PrimitiveTriangleIndicesEXT 3797e5c31af7Sopenharmony_ci must: match the value specified by code:OutputPrimitivesEXT 3798e5c31af7Sopenharmony_ci**** 3799e5c31af7Sopenharmony_ci-- 3800e5c31af7Sopenharmony_ciendif::VK_EXT_mesh_shader[] 3801e5c31af7Sopenharmony_ci 3802e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 3803e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-primitiveshadingrate]] 3804e5c31af7Sopenharmony_ci[open,refpage='PrimitiveShadingRateKHR',desc='Primitive contribution to fragment shading rate',type='builtins'] 3805e5c31af7Sopenharmony_ci-- 3806e5c31af7Sopenharmony_ci:refpage: PrimitiveShadingRateKHR 3807e5c31af7Sopenharmony_ci 3808e5c31af7Sopenharmony_cicode:PrimitiveShadingRateKHR:: 3809e5c31af7Sopenharmony_ci 3810e5c31af7Sopenharmony_ciDecorating a variable with the code:PrimitiveShadingRateKHR built-in 3811e5c31af7Sopenharmony_cidecoration will make that variable contain the 3812e5c31af7Sopenharmony_ci<<primsrast-fragment-shading-rate-primitive, primitive fragment shading 3813e5c31af7Sopenharmony_cirate>>. 3814e5c31af7Sopenharmony_ci+ 3815e5c31af7Sopenharmony_ciThe value written to the variable decorated with 3816e5c31af7Sopenharmony_cicode:PrimitiveShadingRateKHR by the last 3817e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 3818e5c31af7Sopenharmony_cistage>> in the pipeline is used as the 3819e5c31af7Sopenharmony_ci<<primsrast-fragment-shading-rate-primitive, primitive fragment shading 3820e5c31af7Sopenharmony_cirate>>. 3821e5c31af7Sopenharmony_ciOutputs in previous shader stages are ignored. 3822e5c31af7Sopenharmony_ci+ 3823e5c31af7Sopenharmony_ciIf the last active 3824e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 3825e5c31af7Sopenharmony_cistage>> shader entry point's interface does not include a variable decorated 3826e5c31af7Sopenharmony_ciwith code:PrimitiveShadingRateKHR, then it is as if the shader specified a 3827e5c31af7Sopenharmony_cifragment shading rate value of 0, indicating a horizontal and vertical rate 3828e5c31af7Sopenharmony_ciof 1 pixel. 3829e5c31af7Sopenharmony_ci+ 3830e5c31af7Sopenharmony_ciIf a shader has code:PrimitiveShadingRateKHR in the output interface and 3831e5c31af7Sopenharmony_cithere is an execution path through the shader that does not write to it, its 3832e5c31af7Sopenharmony_civalue is undefined: for executions of the shader that take that path. 3833e5c31af7Sopenharmony_ci 3834e5c31af7Sopenharmony_ci.Valid Usage 3835e5c31af7Sopenharmony_ci**** 3836e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveShadingRateKHR-04484]] 3837e5c31af7Sopenharmony_ci The code:PrimitiveShadingRateKHR decoration must: be used only within 3838e5c31af7Sopenharmony_ci the code:MeshEXT, code:MeshNV, code:Vertex, or code:Geometry 3839e5c31af7Sopenharmony_ci {ExecutionModel} 3840e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveShadingRateKHR-04485]] 3841e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveShadingRateKHR must: be 3842e5c31af7Sopenharmony_ci declared using the code:Output {StorageClass} 3843e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveShadingRateKHR-04486]] 3844e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveShadingRateKHR must: be 3845e5c31af7Sopenharmony_ci declared as a scalar 32-bit integer value 3846e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveShadingRateKHR-04487]] 3847e5c31af7Sopenharmony_ci The value written to code:PrimitiveShadingRateKHR must: include no more 3848e5c31af7Sopenharmony_ci than one of code:Vertical2Pixels and code:Vertical4Pixels 3849e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveShadingRateKHR-04488]] 3850e5c31af7Sopenharmony_ci The value written to code:PrimitiveShadingRateKHR must: include no more 3851e5c31af7Sopenharmony_ci than one of code:Horizontal2Pixels and code:Horizontal4Pixels 3852e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveShadingRateKHR-04489]] 3853e5c31af7Sopenharmony_ci The value written to code:PrimitiveShadingRateKHR must: not have any 3854e5c31af7Sopenharmony_ci bits set other than those defined by *Fragment Shading Rate Flags* 3855e5c31af7Sopenharmony_ci enumerants in the SPIR-V specification 3856e5c31af7Sopenharmony_ci * [[VUID-{refpage}-PrimitiveShadingRateKHR-07059]] 3857e5c31af7Sopenharmony_ci The variable decorated with code:PrimitiveShadingRateKHR within the 3858e5c31af7Sopenharmony_ci code:MeshEXT {ExecutionModel} must: also be decorated with the 3859e5c31af7Sopenharmony_ci code:PerPrimitiveEXT decoration 3860e5c31af7Sopenharmony_ci**** 3861e5c31af7Sopenharmony_ci-- 3862e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 3863e5c31af7Sopenharmony_ci 3864e5c31af7Sopenharmony_ciifdef::VK_KHR_ray_tracing_pipeline[] 3865e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-raygeometryindex]] 3866e5c31af7Sopenharmony_ci[open,refpage='RayGeometryIndexKHR',desc='Geometry index in a ray shader',type='builtins'] 3867e5c31af7Sopenharmony_ci-- 3868e5c31af7Sopenharmony_ci:refpage: RayGeometryIndexKHR 3869e5c31af7Sopenharmony_ci 3870e5c31af7Sopenharmony_cicode:RayGeometryIndexKHR:: 3871e5c31af7Sopenharmony_ci 3872e5c31af7Sopenharmony_ciA variable decorated with the code:RayGeometryIndexKHR decoration will 3873e5c31af7Sopenharmony_cicontain the <<acceleration-structure-geometry-index, geometry index>> for 3874e5c31af7Sopenharmony_cithe acceleration structure geometry currently being shaded. 3875e5c31af7Sopenharmony_ci 3876e5c31af7Sopenharmony_ci.Valid Usage 3877e5c31af7Sopenharmony_ci**** 3878e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayGeometryIndexKHR-04345]] 3879e5c31af7Sopenharmony_ci The code:RayGeometryIndexKHR decoration must: be used only within the 3880e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 3881e5c31af7Sopenharmony_ci {ExecutionModel} 3882e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayGeometryIndexKHR-04346]] 3883e5c31af7Sopenharmony_ci The variable decorated with code:RayGeometryIndexKHR must: be declared 3884e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 3885e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayGeometryIndexKHR-04347]] 3886e5c31af7Sopenharmony_ci The variable decorated with code:RayGeometryIndexKHR must: be declared 3887e5c31af7Sopenharmony_ci as a scalar 32-bit integer value 3888e5c31af7Sopenharmony_ci**** 3889e5c31af7Sopenharmony_ci-- 3890e5c31af7Sopenharmony_ciendif::VK_KHR_ray_tracing_pipeline[] 3891e5c31af7Sopenharmony_ci 3892e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 3893e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-raytmax]] 3894e5c31af7Sopenharmony_ci[open,refpage='RayTmaxKHR',desc='Maximum T value of a ray',type='builtins'] 3895e5c31af7Sopenharmony_ci-- 3896e5c31af7Sopenharmony_ci:refpage: RayTmaxKHR 3897e5c31af7Sopenharmony_ci 3898e5c31af7Sopenharmony_cicode:RayTmaxKHR:: 3899e5c31af7Sopenharmony_ci 3900e5c31af7Sopenharmony_ciA variable decorated with the code:RayTmaxKHR decoration will contain the 3901e5c31af7Sopenharmony_ciparametric [eq]#t~max~# value of the ray being processed. 3902e5c31af7Sopenharmony_ciThe value is independent of the space in which the ray origin and direction 3903e5c31af7Sopenharmony_ciexist. 3904e5c31af7Sopenharmony_ciThe value is initialized to the parameter passed into the 3905e5c31af7Sopenharmony_ci<<glossary-pipeline-trace-ray, pipeline trace ray>> instruction. 3906e5c31af7Sopenharmony_ci+ 3907e5c31af7Sopenharmony_ciThe [eq]#t~max~# value changes throughout the lifetime of the ray that 3908e5c31af7Sopenharmony_ciproduced the intersection. 3909e5c31af7Sopenharmony_ciIn the closest hit shader, the value reflects the closest distance to the 3910e5c31af7Sopenharmony_ciintersected primitive. 3911e5c31af7Sopenharmony_ciIn the any-hit shader, it reflects the distance to the primitive currently 3912e5c31af7Sopenharmony_cibeing intersected. 3913e5c31af7Sopenharmony_ciIn the intersection shader, it reflects the distance to the closest 3914e5c31af7Sopenharmony_ciprimitive intersected so far or the initial value. 3915e5c31af7Sopenharmony_ciThe value can change in the intersection shader after calling 3916e5c31af7Sopenharmony_cicode:OpReportIntersectionKHR if the corresponding any-hit shader does not 3917e5c31af7Sopenharmony_ciignore the intersection. 3918e5c31af7Sopenharmony_ciIn a miss shader, the value is identical to the parameter passed into the 3919e5c31af7Sopenharmony_ci<<glossary-pipeline-trace-ray, pipeline trace ray>> instruction. 3920e5c31af7Sopenharmony_ci 3921e5c31af7Sopenharmony_ci.Valid Usage 3922e5c31af7Sopenharmony_ci**** 3923e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayTmaxKHR-04348]] 3924e5c31af7Sopenharmony_ci The code:RayTmaxKHR decoration must: be used only within the 3925e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, code:ClosestHitKHR, or 3926e5c31af7Sopenharmony_ci code:MissKHR {ExecutionModel} 3927e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayTmaxKHR-04349]] 3928e5c31af7Sopenharmony_ci The variable decorated with code:RayTmaxKHR must: be declared using the 3929e5c31af7Sopenharmony_ci code:Input {StorageClass} 3930e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayTmaxKHR-04350]] 3931e5c31af7Sopenharmony_ci The variable decorated with code:RayTmaxKHR must: be declared as a 3932e5c31af7Sopenharmony_ci scalar 32-bit floating-point value 3933e5c31af7Sopenharmony_ci**** 3934e5c31af7Sopenharmony_ci-- 3935e5c31af7Sopenharmony_ci 3936e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-raytmin]] 3937e5c31af7Sopenharmony_ci[open,refpage='RayTminKHR',desc='Minimum T value of a ray',type='builtins'] 3938e5c31af7Sopenharmony_ci-- 3939e5c31af7Sopenharmony_ci:refpage: RayTminKHR 3940e5c31af7Sopenharmony_ci 3941e5c31af7Sopenharmony_cicode:RayTminKHR:: 3942e5c31af7Sopenharmony_ci 3943e5c31af7Sopenharmony_ciA variable decorated with the code:RayTminKHR decoration will contain the 3944e5c31af7Sopenharmony_ciparametric [eq]#t~min~# value of the ray being processed. 3945e5c31af7Sopenharmony_ciThe value is independent of the space in which the ray origin and direction 3946e5c31af7Sopenharmony_ciexist. 3947e5c31af7Sopenharmony_ciThe value is the parameter passed into the <<glossary-pipeline-trace-ray, 3948e5c31af7Sopenharmony_cipipeline trace ray>> instruction. 3949e5c31af7Sopenharmony_ci+ 3950e5c31af7Sopenharmony_ciThe [eq]#t~min~# value remains constant for the duration of the ray query. 3951e5c31af7Sopenharmony_ci 3952e5c31af7Sopenharmony_ci.Valid Usage 3953e5c31af7Sopenharmony_ci**** 3954e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayTminKHR-04351]] 3955e5c31af7Sopenharmony_ci The code:RayTminKHR decoration must: be used only within the 3956e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, code:ClosestHitKHR, or 3957e5c31af7Sopenharmony_ci code:MissKHR {ExecutionModel} 3958e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayTminKHR-04352]] 3959e5c31af7Sopenharmony_ci The variable decorated with code:RayTminKHR must: be declared using the 3960e5c31af7Sopenharmony_ci code:Input {StorageClass} 3961e5c31af7Sopenharmony_ci * [[VUID-{refpage}-RayTminKHR-04353]] 3962e5c31af7Sopenharmony_ci The variable decorated with code:RayTminKHR must: be declared as a 3963e5c31af7Sopenharmony_ci scalar 32-bit floating-point value 3964e5c31af7Sopenharmony_ci**** 3965e5c31af7Sopenharmony_ci-- 3966e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 3967e5c31af7Sopenharmony_ci 3968e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sampleid]] 3969e5c31af7Sopenharmony_ci[open,refpage='SampleId',desc='Sample ID within a fragment',type='builtins'] 3970e5c31af7Sopenharmony_ci-- 3971e5c31af7Sopenharmony_ci:refpage: SampleId 3972e5c31af7Sopenharmony_ci 3973e5c31af7Sopenharmony_cicode:SampleId:: 3974e5c31af7Sopenharmony_ci 3975e5c31af7Sopenharmony_ciDecorating a variable with the code:SampleId built-in decoration will make 3976e5c31af7Sopenharmony_cithat variable contain the <<primsrast-multisampling-coverage-mask, coverage 3977e5c31af7Sopenharmony_ciindex>> for the current fragment shader invocation. 3978e5c31af7Sopenharmony_cicode:SampleId ranges from zero to the number of samples in the framebuffer 3979e5c31af7Sopenharmony_ciminus one. 3980e5c31af7Sopenharmony_ciIf a fragment shader entry point's interface includes an input variable 3981e5c31af7Sopenharmony_cidecorated with code:SampleId, <<primsrast-sampleshading,Sample Shading>> is 3982e5c31af7Sopenharmony_ciconsidered enabled with a pname:minSampleShading value of 1.0. 3983e5c31af7Sopenharmony_ci 3984e5c31af7Sopenharmony_ci.Valid Usage 3985e5c31af7Sopenharmony_ci**** 3986e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SampleId-04354]] 3987e5c31af7Sopenharmony_ci The code:SampleId decoration must: be used only within the code:Fragment 3988e5c31af7Sopenharmony_ci {ExecutionModel} 3989e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SampleId-04355]] 3990e5c31af7Sopenharmony_ci The variable decorated with code:SampleId must: be declared using the 3991e5c31af7Sopenharmony_ci code:Input {StorageClass} 3992e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SampleId-04356]] 3993e5c31af7Sopenharmony_ci The variable decorated with code:SampleId must: be declared as a scalar 3994e5c31af7Sopenharmony_ci 32-bit integer value 3995e5c31af7Sopenharmony_ci**** 3996e5c31af7Sopenharmony_ci-- 3997e5c31af7Sopenharmony_ci 3998e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-samplemask]] 3999e5c31af7Sopenharmony_ci[open,refpage='SampleMask',desc='Coverage mask for a fragment shader invocation',type='builtins'] 4000e5c31af7Sopenharmony_ci-- 4001e5c31af7Sopenharmony_ci:refpage: SampleMask 4002e5c31af7Sopenharmony_ci 4003e5c31af7Sopenharmony_cicode:SampleMask:: 4004e5c31af7Sopenharmony_ci 4005e5c31af7Sopenharmony_ciDecorating a variable with the code:SampleMask built-in decoration will make 4006e5c31af7Sopenharmony_ciany variable contain the <<fragops-shader-samplemask, sample mask>> for the 4007e5c31af7Sopenharmony_cicurrent fragment shader invocation. 4008e5c31af7Sopenharmony_ci+ 4009e5c31af7Sopenharmony_ciA variable in the code:Input storage class decorated with code:SampleMask 4010e5c31af7Sopenharmony_ciwill contain a bitmask of the set of samples covered by the primitive 4011e5c31af7Sopenharmony_cigenerating the fragment during rasterization. 4012e5c31af7Sopenharmony_ciIt has a sample bit set if and only if the sample is considered covered for 4013e5c31af7Sopenharmony_cithis fragment shader invocation. 4014e5c31af7Sopenharmony_cicode:SampleMask[] is an array of integers. 4015e5c31af7Sopenharmony_ciBits are mapped to samples in a manner where bit B of mask M 4016e5c31af7Sopenharmony_ci(`SampleMask[M]`) corresponds to sample [eq]#32 {times} M {plus} B#. 4017e5c31af7Sopenharmony_ci+ 4018e5c31af7Sopenharmony_ciA variable in the code:Output storage class decorated with code:SampleMask 4019e5c31af7Sopenharmony_ciis an array of integers forming a bit array in a manner similar to an input 4020e5c31af7Sopenharmony_civariable decorated with code:SampleMask, but where each bit represents 4021e5c31af7Sopenharmony_cicoverage as computed by the shader. 4022e5c31af7Sopenharmony_ciThis computed code:SampleMask is combined with the generated coverage mask 4023e5c31af7Sopenharmony_ciin the <<fragops-covg, multisample coverage>> operation. 4024e5c31af7Sopenharmony_ci+ 4025e5c31af7Sopenharmony_ciVariables decorated with code:SampleMask must: be either an unsized array, 4026e5c31af7Sopenharmony_cior explicitly sized to be no larger than the implementation-dependent 4027e5c31af7Sopenharmony_cimaximum sample-mask (as an array of 32-bit elements), determined by the 4028e5c31af7Sopenharmony_cimaximum number of samples. 4029e5c31af7Sopenharmony_ci+ 4030e5c31af7Sopenharmony_ciIf a fragment shader entry point's interface includes an output variable 4031e5c31af7Sopenharmony_cidecorated with code:SampleMask, the sample mask will be undefined: for any 4032e5c31af7Sopenharmony_ciarray elements of any fragment shader invocations that fail to assign a 4033e5c31af7Sopenharmony_civalue. 4034e5c31af7Sopenharmony_ciIf a fragment shader entry point's interface does not include an output 4035e5c31af7Sopenharmony_civariable decorated with code:SampleMask, the sample mask has no effect on 4036e5c31af7Sopenharmony_cithe processing of a fragment. 4037e5c31af7Sopenharmony_ci 4038e5c31af7Sopenharmony_ci.Valid Usage 4039e5c31af7Sopenharmony_ci**** 4040e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SampleMask-04357]] 4041e5c31af7Sopenharmony_ci The code:SampleMask decoration must: be used only within the 4042e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 4043e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SampleMask-04358]] 4044e5c31af7Sopenharmony_ci The variable decorated with code:SampleMask must: be declared using the 4045e5c31af7Sopenharmony_ci code:Input or code:Output {StorageClass} 4046e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SampleMask-04359]] 4047e5c31af7Sopenharmony_ci The variable decorated with code:SampleMask must: be declared as an 4048e5c31af7Sopenharmony_ci array of 32-bit integer values 4049e5c31af7Sopenharmony_ci**** 4050e5c31af7Sopenharmony_ci-- 4051e5c31af7Sopenharmony_ci 4052e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sampleposition]] 4053e5c31af7Sopenharmony_ci[open,refpage='SamplePosition',desc='Position of a shaded sample',type='builtins'] 4054e5c31af7Sopenharmony_ci-- 4055e5c31af7Sopenharmony_ci:refpage: SamplePosition 4056e5c31af7Sopenharmony_ci 4057e5c31af7Sopenharmony_cicode:SamplePosition:: 4058e5c31af7Sopenharmony_ci 4059e5c31af7Sopenharmony_ciDecorating a variable with the code:SamplePosition built-in decoration will 4060e5c31af7Sopenharmony_cimake that variable contain the sub-pixel position of the sample being 4061e5c31af7Sopenharmony_cishaded. 4062e5c31af7Sopenharmony_ciThe top left of the pixel is considered to be at coordinate [eq]#(0,0)# and 4063e5c31af7Sopenharmony_cithe bottom right of the pixel is considered to be at coordinate [eq]#(1,1)#. 4064e5c31af7Sopenharmony_ciifdef::VK_EXT_fragment_density_map[] 4065e5c31af7Sopenharmony_ci// Markup here is weird. To get all these paragraphs indented properly for 4066e5c31af7Sopenharmony_ci// the keyword, the '+' connector must be *inside* ifdefs w/o blank lines. 4067e5c31af7Sopenharmony_ci+ 4068e5c31af7Sopenharmony_ciIf the render pass has a fragment density map attachment, the variable will 4069e5c31af7Sopenharmony_ciinstead contain the sub-fragment position of the sample being shaded. 4070e5c31af7Sopenharmony_ciThe top left of the fragment is considered to be at coordinate [eq]#(0,0)# 4071e5c31af7Sopenharmony_ciand the bottom right of the fragment is considered to be at coordinate 4072e5c31af7Sopenharmony_ci[eq]#(1,1)# for any fragment area. 4073e5c31af7Sopenharmony_ciendif::VK_EXT_fragment_density_map[] 4074e5c31af7Sopenharmony_ci+ 4075e5c31af7Sopenharmony_ciIf a fragment shader entry point's interface includes an input variable 4076e5c31af7Sopenharmony_cidecorated with code:SamplePosition, <<primsrast-sampleshading,Sample 4077e5c31af7Sopenharmony_ciShading>> is considered enabled with a pname:minSampleShading value of 1.0. 4078e5c31af7Sopenharmony_ciifdef::VK_EXT_sample_locations[] 4079e5c31af7Sopenharmony_ci+ 4080e5c31af7Sopenharmony_ciIf the current pipeline uses <<primsrast-samplelocations, custom sample 4081e5c31af7Sopenharmony_cilocations>> the value of any variable decorated with the code:SamplePosition 4082e5c31af7Sopenharmony_cibuilt-in decoration is undefined:. 4083e5c31af7Sopenharmony_ciendif::VK_EXT_sample_locations[] 4084e5c31af7Sopenharmony_ci 4085e5c31af7Sopenharmony_ci.Valid Usage 4086e5c31af7Sopenharmony_ci**** 4087e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SamplePosition-04360]] 4088e5c31af7Sopenharmony_ci The code:SamplePosition decoration must: be used only within the 4089e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 4090e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SamplePosition-04361]] 4091e5c31af7Sopenharmony_ci The variable decorated with code:SamplePosition must: be declared using 4092e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4093e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SamplePosition-04362]] 4094e5c31af7Sopenharmony_ci The variable decorated with code:SamplePosition must: be declared as a 4095e5c31af7Sopenharmony_ci two-component vector of 32-bit floating-point values 4096e5c31af7Sopenharmony_ci**** 4097e5c31af7Sopenharmony_ci-- 4098e5c31af7Sopenharmony_ci 4099e5c31af7Sopenharmony_ciifdef::VK_KHR_fragment_shading_rate[] 4100e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-shadingratekhr]] 4101e5c31af7Sopenharmony_ci[open,refpage='ShadingRateKHR',desc='Shading rate of a fragment',type='builtins'] 4102e5c31af7Sopenharmony_ci-- 4103e5c31af7Sopenharmony_ci:refpage: ShadingRateKHR 4104e5c31af7Sopenharmony_ci 4105e5c31af7Sopenharmony_cicode:ShadingRateKHR:: 4106e5c31af7Sopenharmony_ci 4107e5c31af7Sopenharmony_ciDecorating a variable with the code:ShadingRateKHR built-in decoration will 4108e5c31af7Sopenharmony_cimake that variable contain the <<primsrast-fragment-shading-rate, fragment 4109e5c31af7Sopenharmony_cishading rate>> for the current fragment invocation. 4110e5c31af7Sopenharmony_ci 4111e5c31af7Sopenharmony_ci.Valid Usage 4112e5c31af7Sopenharmony_ci**** 4113e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ShadingRateKHR-04490]] 4114e5c31af7Sopenharmony_ci The code:ShadingRateKHR decoration must: be used only within the 4115e5c31af7Sopenharmony_ci code:Fragment {ExecutionModel} 4116e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ShadingRateKHR-04491]] 4117e5c31af7Sopenharmony_ci The variable decorated with code:ShadingRateKHR must: be declared using 4118e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4119e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ShadingRateKHR-04492]] 4120e5c31af7Sopenharmony_ci The variable decorated with code:ShadingRateKHR must: be declared as a 4121e5c31af7Sopenharmony_ci scalar 32-bit integer value 4122e5c31af7Sopenharmony_ci**** 4123e5c31af7Sopenharmony_ci-- 4124e5c31af7Sopenharmony_ciendif::VK_KHR_fragment_shading_rate[] 4125e5c31af7Sopenharmony_ci 4126e5c31af7Sopenharmony_ciifdef::VK_NV_shader_sm_builtins[] 4127e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-smcountnv]] 4128e5c31af7Sopenharmony_ci[open,refpage='SMCountNV',desc='Number of SMs on the device',type='builtins'] 4129e5c31af7Sopenharmony_ci-- 4130e5c31af7Sopenharmony_ci:refpage: SMCountNV 4131e5c31af7Sopenharmony_ci 4132e5c31af7Sopenharmony_cicode:SMCountNV:: 4133e5c31af7Sopenharmony_ci 4134e5c31af7Sopenharmony_ciDecorating a variable with the code:SMCountNV built-in decoration will make 4135e5c31af7Sopenharmony_cithat variable contain the number of SMs on the device. 4136e5c31af7Sopenharmony_ci 4137e5c31af7Sopenharmony_ci.Valid Usage 4138e5c31af7Sopenharmony_ci**** 4139e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SMCountNV-04363]] 4140e5c31af7Sopenharmony_ci The variable decorated with code:SMCountNV must: be declared using the 4141e5c31af7Sopenharmony_ci code:Input {StorageClass} 4142e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SMCountNV-04364]] 4143e5c31af7Sopenharmony_ci The variable decorated with code:SMCountNV must: be declared as a scalar 4144e5c31af7Sopenharmony_ci 32-bit integer value 4145e5c31af7Sopenharmony_ci**** 4146e5c31af7Sopenharmony_ci-- 4147e5c31af7Sopenharmony_ci 4148e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-smidnv]] 4149e5c31af7Sopenharmony_ci[open,refpage='SMIDNV',desc='SM ID on which a shader invocation is running',type='builtins'] 4150e5c31af7Sopenharmony_ci-- 4151e5c31af7Sopenharmony_ci:refpage: SMIDNV 4152e5c31af7Sopenharmony_ci 4153e5c31af7Sopenharmony_cicode:SMIDNV:: 4154e5c31af7Sopenharmony_ci 4155e5c31af7Sopenharmony_ciDecorating a variable with the code:SMIDNV built-in decoration will make 4156e5c31af7Sopenharmony_cithat variable contain the ID of the SM on which the current shader 4157e5c31af7Sopenharmony_ciinvocation is running. 4158e5c31af7Sopenharmony_ciThis variable is in the range [eq]#[0, code:SMCountNV-1]#. 4159e5c31af7Sopenharmony_ci 4160e5c31af7Sopenharmony_ci.Valid Usage 4161e5c31af7Sopenharmony_ci**** 4162e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SMIDNV-04365]] 4163e5c31af7Sopenharmony_ci The variable decorated with code:SMIDNV must: be declared using the 4164e5c31af7Sopenharmony_ci code:Input {StorageClass} 4165e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SMIDNV-04366]] 4166e5c31af7Sopenharmony_ci The variable decorated with code:SMIDNV must: be declared as a scalar 4167e5c31af7Sopenharmony_ci 32-bit integer value 4168e5c31af7Sopenharmony_ci**** 4169e5c31af7Sopenharmony_ci-- 4170e5c31af7Sopenharmony_ciendif::VK_NV_shader_sm_builtins[] 4171e5c31af7Sopenharmony_ci 4172e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[] 4173e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-subgroupid]] 4174e5c31af7Sopenharmony_ci[open,refpage='SubgroupId',desc='Subgroup ID ',type='builtins'] 4175e5c31af7Sopenharmony_ci-- 4176e5c31af7Sopenharmony_ci:refpage: SubgroupId 4177e5c31af7Sopenharmony_ci 4178e5c31af7Sopenharmony_cicode:SubgroupId:: 4179e5c31af7Sopenharmony_ci+ 4180e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupId built-in decoration will make 4181e5c31af7Sopenharmony_cithat variable contain the index of the subgroup within the local workgroup. 4182e5c31af7Sopenharmony_ciThis variable is in range [0, code:NumSubgroups-1]. 4183e5c31af7Sopenharmony_ci 4184e5c31af7Sopenharmony_ci.Valid Usage 4185e5c31af7Sopenharmony_ci**** 4186e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupId-04367]] 4187e5c31af7Sopenharmony_ci The code:SubgroupId decoration must: be used only within the 4188e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV 4189e5c31af7Sopenharmony_ci {ExecutionModel} 4190e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupId-04368]] 4191e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupId must: be declared using the 4192e5c31af7Sopenharmony_ci code:Input {StorageClass} 4193e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupId-04369]] 4194e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupId must: be declared as a 4195e5c31af7Sopenharmony_ci scalar 32-bit integer value 4196e5c31af7Sopenharmony_ci**** 4197e5c31af7Sopenharmony_ci-- 4198e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[] 4199e5c31af7Sopenharmony_ci 4200e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_EXT_shader_subgroup_ballot[] 4201e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sgeq]] 4202e5c31af7Sopenharmony_ci[open,refpage='SubgroupEqMask',desc='Mask of shader invocations in a subgroup with the same subgroup local invocation ID',type='builtins'] 4203e5c31af7Sopenharmony_ci-- 4204e5c31af7Sopenharmony_ci:refpage: SubgroupEqMask 4205e5c31af7Sopenharmony_ci 4206e5c31af7Sopenharmony_cicode:SubgroupEqMask:: 4207e5c31af7Sopenharmony_ci+ 4208e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupEqMask builtin decoration will 4209e5c31af7Sopenharmony_cimake that variable contain the _subgroup mask_ of the current subgroup 4210e5c31af7Sopenharmony_ciinvocation. 4211e5c31af7Sopenharmony_ciThe bit corresponding to the code:SubgroupLocalInvocationId is set in the 4212e5c31af7Sopenharmony_civariable decorated with code:SubgroupEqMask. 4213e5c31af7Sopenharmony_ciAll other bits are set to zero. 4214e5c31af7Sopenharmony_ci+ 4215e5c31af7Sopenharmony_cicode:SubgroupEqMaskKHR is an alias of code:SubgroupEqMask. 4216e5c31af7Sopenharmony_ci 4217e5c31af7Sopenharmony_ci.Valid Usage 4218e5c31af7Sopenharmony_ci**** 4219e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupEqMask-04370]] 4220e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupEqMask must: be declared using 4221e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4222e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupEqMask-04371]] 4223e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupEqMask must: be declared as a 4224e5c31af7Sopenharmony_ci four-component vector of 32-bit integer values 4225e5c31af7Sopenharmony_ci**** 4226e5c31af7Sopenharmony_ci-- 4227e5c31af7Sopenharmony_ci 4228e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sgge]] 4229e5c31af7Sopenharmony_ci[open,refpage='SubgroupGeMask',desc='Mask of shader invocations in a subgroup with the same or higher subgroup local invocation ID',type='builtins'] 4230e5c31af7Sopenharmony_ci-- 4231e5c31af7Sopenharmony_ci:refpage: SubgroupGeMask 4232e5c31af7Sopenharmony_ci 4233e5c31af7Sopenharmony_cicode:SubgroupGeMask:: 4234e5c31af7Sopenharmony_ci+ 4235e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupGeMask builtin decoration will 4236e5c31af7Sopenharmony_cimake that variable contain the _subgroup mask_ of the current subgroup 4237e5c31af7Sopenharmony_ciinvocation. 4238e5c31af7Sopenharmony_ciThe bits corresponding to the invocations greater than or equal to 4239e5c31af7Sopenharmony_cicode:SubgroupLocalInvocationId through code:SubgroupSize-1 are set in the 4240e5c31af7Sopenharmony_civariable decorated with code:SubgroupGeMask. 4241e5c31af7Sopenharmony_ciAll other bits are set to zero. 4242e5c31af7Sopenharmony_ci+ 4243e5c31af7Sopenharmony_cicode:SubgroupGeMaskKHR is an alias of code:SubgroupGeMask. 4244e5c31af7Sopenharmony_ci 4245e5c31af7Sopenharmony_ci.Valid Usage 4246e5c31af7Sopenharmony_ci**** 4247e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupGeMask-04372]] 4248e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupGeMask must: be declared using 4249e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4250e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupGeMask-04373]] 4251e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupGeMask must: be declared as a 4252e5c31af7Sopenharmony_ci four-component vector of 32-bit integer values 4253e5c31af7Sopenharmony_ci**** 4254e5c31af7Sopenharmony_ci-- 4255e5c31af7Sopenharmony_ci 4256e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sggt]] 4257e5c31af7Sopenharmony_ci[open,refpage='SubgroupGtMask',desc='Mask of shader invocations in a subgroup with a higher subgroup local invocation ID',type='builtins'] 4258e5c31af7Sopenharmony_ci-- 4259e5c31af7Sopenharmony_ci:refpage: SubgroupGtMask 4260e5c31af7Sopenharmony_ci 4261e5c31af7Sopenharmony_cicode:SubgroupGtMask:: 4262e5c31af7Sopenharmony_ci+ 4263e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupGtMask builtin decoration will 4264e5c31af7Sopenharmony_cimake that variable contain the _subgroup mask_ of the current subgroup 4265e5c31af7Sopenharmony_ciinvocation. 4266e5c31af7Sopenharmony_ciThe bits corresponding to the invocations greater than 4267e5c31af7Sopenharmony_cicode:SubgroupLocalInvocationId through code:SubgroupSize-1 are set in the 4268e5c31af7Sopenharmony_civariable decorated with code:SubgroupGtMask. 4269e5c31af7Sopenharmony_ciAll other bits are set to zero. 4270e5c31af7Sopenharmony_ci+ 4271e5c31af7Sopenharmony_cicode:SubgroupGtMaskKHR is an alias of code:SubgroupGtMask. 4272e5c31af7Sopenharmony_ci 4273e5c31af7Sopenharmony_ci.Valid Usage 4274e5c31af7Sopenharmony_ci**** 4275e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupGtMask-04374]] 4276e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupGtMask must: be declared using 4277e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4278e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupGtMask-04375]] 4279e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupGtMask must: be declared as a 4280e5c31af7Sopenharmony_ci four-component vector of 32-bit integer values 4281e5c31af7Sopenharmony_ci**** 4282e5c31af7Sopenharmony_ci-- 4283e5c31af7Sopenharmony_ci 4284e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sgle]] 4285e5c31af7Sopenharmony_ci[open,refpage='SubgroupLeMask',desc='Mask of shader invocations in a subgroup with the same or lower subgroup local invocation ID',type='builtins'] 4286e5c31af7Sopenharmony_ci-- 4287e5c31af7Sopenharmony_ci:refpage: SubgroupLeMask 4288e5c31af7Sopenharmony_ci 4289e5c31af7Sopenharmony_cicode:SubgroupLeMask:: 4290e5c31af7Sopenharmony_ci+ 4291e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupLeMask builtin decoration will 4292e5c31af7Sopenharmony_cimake that variable contain the _subgroup mask_ of the current subgroup 4293e5c31af7Sopenharmony_ciinvocation. 4294e5c31af7Sopenharmony_ciThe bits corresponding to the invocations less than or equal to 4295e5c31af7Sopenharmony_cicode:SubgroupLocalInvocationId are set in the variable decorated with 4296e5c31af7Sopenharmony_cicode:SubgroupLeMask. 4297e5c31af7Sopenharmony_ciAll other bits are set to zero. 4298e5c31af7Sopenharmony_ci+ 4299e5c31af7Sopenharmony_cicode:SubgroupLeMaskKHR is an alias of code:SubgroupLeMask. 4300e5c31af7Sopenharmony_ci 4301e5c31af7Sopenharmony_ci.Valid Usage 4302e5c31af7Sopenharmony_ci**** 4303e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupLeMask-04376]] 4304e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupLeMask must: be declared using 4305e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4306e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupLeMask-04377]] 4307e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupLeMask must: be declared as a 4308e5c31af7Sopenharmony_ci four-component vector of 32-bit integer values 4309e5c31af7Sopenharmony_ci**** 4310e5c31af7Sopenharmony_ci-- 4311e5c31af7Sopenharmony_ci 4312e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sglt]] 4313e5c31af7Sopenharmony_ci[open,refpage='SubgroupLtMask',desc='Mask of shader invocations in a subgroup with a lower subgroup local invocation ID',type='builtins'] 4314e5c31af7Sopenharmony_ci-- 4315e5c31af7Sopenharmony_ci:refpage: SubgroupLtMask 4316e5c31af7Sopenharmony_ci 4317e5c31af7Sopenharmony_cicode:SubgroupLtMask:: 4318e5c31af7Sopenharmony_ci+ 4319e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupLtMask builtin decoration will 4320e5c31af7Sopenharmony_cimake that variable contain the _subgroup mask_ of the current subgroup 4321e5c31af7Sopenharmony_ciinvocation. 4322e5c31af7Sopenharmony_ciThe bits corresponding to the invocations less than 4323e5c31af7Sopenharmony_cicode:SubgroupLocalInvocationId are set in the variable decorated with 4324e5c31af7Sopenharmony_cicode:SubgroupLtMask. 4325e5c31af7Sopenharmony_ciAll other bits are set to zero. 4326e5c31af7Sopenharmony_ci+ 4327e5c31af7Sopenharmony_cicode:SubgroupLtMaskKHR is an alias of code:SubgroupLtMask. 4328e5c31af7Sopenharmony_ci 4329e5c31af7Sopenharmony_ci.Valid Usage 4330e5c31af7Sopenharmony_ci**** 4331e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupLtMask-04378]] 4332e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupLtMask must: be declared using 4333e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4334e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupLtMask-04379]] 4335e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupLtMask must: be declared as a 4336e5c31af7Sopenharmony_ci four-component vector of 32-bit integer values 4337e5c31af7Sopenharmony_ci**** 4338e5c31af7Sopenharmony_ci-- 4339e5c31af7Sopenharmony_ci 4340e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sgli]] 4341e5c31af7Sopenharmony_ci[open,refpage='SubgroupLocalInvocationId',desc='ID of the invocation within a subgroup',type='builtins'] 4342e5c31af7Sopenharmony_ci-- 4343e5c31af7Sopenharmony_ci:refpage: SubgroupLocalInvocationId 4344e5c31af7Sopenharmony_ci 4345e5c31af7Sopenharmony_cicode:SubgroupLocalInvocationId:: 4346e5c31af7Sopenharmony_ci+ 4347e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupLocalInvocationId builtin 4348e5c31af7Sopenharmony_cidecoration will make that variable contain the index of the invocation 4349e5c31af7Sopenharmony_ciwithin the subgroup. 4350e5c31af7Sopenharmony_ciThis variable is in range [0,code:SubgroupSize-1]. 4351e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4352e5c31af7Sopenharmony_ci+ 4353e5c31af7Sopenharmony_ciIf ename:VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT is 4354e5c31af7Sopenharmony_cispecified, 4355e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 4356e5c31af7Sopenharmony_cior if pname:module declares SPIR-V version 1.6 or higher, and the local 4357e5c31af7Sopenharmony_ciworkgroup size in the X dimension of the pname:stage is a multiple of 4358e5c31af7Sopenharmony_ci<<interfaces-builtin-variables-sgs,code:SubgroupSize>>, 4359e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 4360e5c31af7Sopenharmony_cifull subgroups are enabled for that pipeline stage. 4361e5c31af7Sopenharmony_ciWhen full subgroups are enabled, subgroups must: be launched with all 4362e5c31af7Sopenharmony_ciinvocations active, i.e., there is an active invocation with 4363e5c31af7Sopenharmony_cicode:SubgroupLocalInvocationId for each value in range 4364e5c31af7Sopenharmony_ci[0,code:SubgroupSize-1]. 4365e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4366e5c31af7Sopenharmony_ci 4367e5c31af7Sopenharmony_ci[NOTE] 4368e5c31af7Sopenharmony_ci.Note 4369e5c31af7Sopenharmony_ci==== 4370e5c31af7Sopenharmony_ciThere is no direct relationship between code:SubgroupLocalInvocationId and 4371e5c31af7Sopenharmony_cicode:LocalInvocationId or code:LocalInvocationIndex. 4372e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4373e5c31af7Sopenharmony_ciIf the pipeline 4374e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 4375e5c31af7Sopenharmony_cior shader object 4376e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 4377e5c31af7Sopenharmony_ciwas created with full subgroups applications can compute their own local 4378e5c31af7Sopenharmony_ciinvocation index to serve the same purpose: 4379e5c31af7Sopenharmony_ci 4380e5c31af7Sopenharmony_ci[eq]#index = code:SubgroupLocalInvocationId + code:SubgroupId {times} 4381e5c31af7Sopenharmony_cicode:SubgroupSize# 4382e5c31af7Sopenharmony_ci 4383e5c31af7Sopenharmony_ciIf full subgroups are not enabled, some subgroups may be dispatched with 4384e5c31af7Sopenharmony_ciinactive invocations that do not correspond to a local workgroup invocation, 4385e5c31af7Sopenharmony_cimaking the value of [eq]#index# unreliable. 4386e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4387e5c31af7Sopenharmony_ci==== 4388e5c31af7Sopenharmony_ci 4389e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 4390e5c31af7Sopenharmony_ci[NOTE] 4391e5c31af7Sopenharmony_ci.Note 4392e5c31af7Sopenharmony_ci==== 4393e5c31af7Sopenharmony_ciename:VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT 4394e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[] 4395e5c31af7Sopenharmony_ciis 4396e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 4397e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 4398e5c31af7Sopenharmony_ciand ename:VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT are 4399e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 4400e5c31af7Sopenharmony_cieffectively deprecated when compiling SPIR-V 1.6 shaders, as this behavior 4401e5c31af7Sopenharmony_ciis the default for Vulkan with SPIR-V 1.6. 4402e5c31af7Sopenharmony_ciThis is more aligned with developer expectations, and avoids applications 4403e5c31af7Sopenharmony_ciunexpectedly breaking in the future. 4404e5c31af7Sopenharmony_ci==== 4405e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 4406e5c31af7Sopenharmony_ci 4407e5c31af7Sopenharmony_ci.Valid Usage 4408e5c31af7Sopenharmony_ci**** 4409e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupLocalInvocationId-04380]] 4410e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupLocalInvocationId must: be 4411e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 4412e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupLocalInvocationId-04381]] 4413e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupLocalInvocationId must: be 4414e5c31af7Sopenharmony_ci declared as a scalar 32-bit integer value 4415e5c31af7Sopenharmony_ci**** 4416e5c31af7Sopenharmony_ci-- 4417e5c31af7Sopenharmony_ci 4418e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-sgs]] 4419e5c31af7Sopenharmony_ci[open,refpage='SubgroupSize',desc='Size of a subgroup',type='builtins'] 4420e5c31af7Sopenharmony_ci-- 4421e5c31af7Sopenharmony_ci:refpage: SubgroupSize 4422e5c31af7Sopenharmony_ci 4423e5c31af7Sopenharmony_cicode:SubgroupSize:: 4424e5c31af7Sopenharmony_ci+ 4425e5c31af7Sopenharmony_ciDecorating a variable with the code:SubgroupSize builtin decoration will 4426e5c31af7Sopenharmony_cimake that variable contain the implementation-dependent 4427e5c31af7Sopenharmony_ci<<limits-subgroup-size, number of invocations in a subgroup>>. 4428e5c31af7Sopenharmony_ciThis value must: be a power-of-two integer. 4429e5c31af7Sopenharmony_ci+ 4430e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4431e5c31af7Sopenharmony_ciIf the pipeline was created with the 4432e5c31af7Sopenharmony_ciename:VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT flag 4433e5c31af7Sopenharmony_ciset, 4434e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 4435e5c31af7Sopenharmony_cior the shader object was created with the 4436e5c31af7Sopenharmony_ciename:VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT flag set, 4437e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 4438e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 4439e5c31af7Sopenharmony_cior the SPIR-V pname:module is at least version 1.6, 4440e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 4441e5c31af7Sopenharmony_cithe code:SubgroupSize decorated variable will contain the subgroup size for 4442e5c31af7Sopenharmony_cieach subgroup that gets dispatched. 4443e5c31af7Sopenharmony_ciThis value must: be between <<limits-minSubgroupSize, 4444e5c31af7Sopenharmony_cipname:minSubgroupSize>> and <<limits-maxSubgroupSize, 4445e5c31af7Sopenharmony_cipname:maxSubgroupSize>> and must: be uniform with <<shaders-scope-subgroup, 4446e5c31af7Sopenharmony_cisubgroup scope>>. 4447e5c31af7Sopenharmony_ciThe value may: vary across a single draw call, and for fragment shaders may: 4448e5c31af7Sopenharmony_civary across a single primitive. 4449e5c31af7Sopenharmony_ciIn compute dispatches, code:SubgroupSize must: be uniform with 4450e5c31af7Sopenharmony_ci<<shaders-scope-command, command scope>>. 4451e5c31af7Sopenharmony_ci+ 4452e5c31af7Sopenharmony_ciIf the pipeline was created with a chained 4453e5c31af7Sopenharmony_cislink:VkPipelineShaderStageRequiredSubgroupSizeCreateInfo structure, 4454e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 4455e5c31af7Sopenharmony_cior the shader object was created with a chained 4456e5c31af7Sopenharmony_cislink:VkShaderRequiredSubgroupSizeCreateInfoEXT structure, 4457e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 4458e5c31af7Sopenharmony_cithe code:SubgroupSize decorated variable will match 4459e5c31af7Sopenharmony_ci<<pipelines-required-subgroup-size, pname:requiredSubgroupSize>>. 4460e5c31af7Sopenharmony_ci+ 4461e5c31af7Sopenharmony_ciIf 4462e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 4463e5c31af7Sopenharmony_ciSPIR-V pname:module is less than version 1.6 and 4464e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 4465e5c31af7Sopenharmony_cithe pipeline was not created with the 4466e5c31af7Sopenharmony_ciename:VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT flag 4467e5c31af7Sopenharmony_ciset and no slink:VkPipelineShaderStageRequiredSubgroupSizeCreateInfo 4468e5c31af7Sopenharmony_cistructure was chained, 4469e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[] 4470e5c31af7Sopenharmony_ciand the shader was not created with the 4471e5c31af7Sopenharmony_ciename:VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT flag set and no 4472e5c31af7Sopenharmony_cislink:VkShaderRequiredSubgroupSizeCreateInfoEXT structure was chained, 4473e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[] 4474e5c31af7Sopenharmony_cithe 4475e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4476e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4477e5c31af7Sopenharmony_ciThe 4478e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_subgroup_size_control[] 4479e5c31af7Sopenharmony_civariable decorated with code:SubgroupSize will match <<limits-subgroup-size, 4480e5c31af7Sopenharmony_cipname:subgroupSize>>. 4481e5c31af7Sopenharmony_ci+ 4482e5c31af7Sopenharmony_ciThe maximum number of invocations that an implementation can support per 4483e5c31af7Sopenharmony_cisubgroup is 128. 4484e5c31af7Sopenharmony_ci 4485e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 4486e5c31af7Sopenharmony_ci[NOTE] 4487e5c31af7Sopenharmony_ci.Note 4488e5c31af7Sopenharmony_ci==== 4489e5c31af7Sopenharmony_ciThe old behavior for code:SubgroupSize is considered deprecated as certain 4490e5c31af7Sopenharmony_cicompute algorithms cannot be easily implemented without the guarantees of 4491e5c31af7Sopenharmony_ciename:VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT and 4492e5c31af7Sopenharmony_ciename:VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT. 4493e5c31af7Sopenharmony_ci==== 4494e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 4495e5c31af7Sopenharmony_ci 4496e5c31af7Sopenharmony_ci.Valid Usage 4497e5c31af7Sopenharmony_ci**** 4498e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupSize-04382]] 4499e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupSize must: be declared using 4500e5c31af7Sopenharmony_ci the code:Input {StorageClass} 4501e5c31af7Sopenharmony_ci * [[VUID-{refpage}-SubgroupSize-04383]] 4502e5c31af7Sopenharmony_ci The variable decorated with code:SubgroupSize must: be declared as a 4503e5c31af7Sopenharmony_ci scalar 32-bit integer value 4504e5c31af7Sopenharmony_ci**** 4505e5c31af7Sopenharmony_ci-- 4506e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_EXT_shader_subgroup_ballot[] 4507e5c31af7Sopenharmony_ci 4508e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 4509e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-taskcount]] 4510e5c31af7Sopenharmony_ci[open,refpage='TaskCountNV',desc='Number of mesh shader workgroups that will be generated',type='builtins'] 4511e5c31af7Sopenharmony_ci-- 4512e5c31af7Sopenharmony_ci:refpage: TaskCountNV 4513e5c31af7Sopenharmony_ci 4514e5c31af7Sopenharmony_cicode:TaskCountNV:: 4515e5c31af7Sopenharmony_ci+ 4516e5c31af7Sopenharmony_ciDecorating a variable with the code:TaskCountNV decoration will make that 4517e5c31af7Sopenharmony_civariable contain the task count. 4518e5c31af7Sopenharmony_ciThe task count specifies the number of subsequent mesh shader workgroups 4519e5c31af7Sopenharmony_cithat get generated upon completion of the task shader. 4520e5c31af7Sopenharmony_ci 4521e5c31af7Sopenharmony_ci.Valid Usage 4522e5c31af7Sopenharmony_ci**** 4523e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TaskCountNV-04384]] 4524e5c31af7Sopenharmony_ci The code:TaskCountNV decoration must: be used only within the 4525e5c31af7Sopenharmony_ci code:TaskNV {ExecutionModel} 4526e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TaskCountNV-04385]] 4527e5c31af7Sopenharmony_ci The variable decorated with code:TaskCountNV must: be declared using the 4528e5c31af7Sopenharmony_ci code:Output {StorageClass} 4529e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TaskCountNV-04386]] 4530e5c31af7Sopenharmony_ci The variable decorated with code:TaskCountNV must: be declared as a 4531e5c31af7Sopenharmony_ci scalar 32-bit integer value 4532e5c31af7Sopenharmony_ci**** 4533e5c31af7Sopenharmony_ci-- 4534e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 4535e5c31af7Sopenharmony_ci 4536e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-tesscoord]] 4537e5c31af7Sopenharmony_ci[open,refpage='TessCoord',desc='Barycentric coordinate of a tessellated vertex within a patch',type='builtins'] 4538e5c31af7Sopenharmony_ci-- 4539e5c31af7Sopenharmony_ci:refpage: TessCoord 4540e5c31af7Sopenharmony_ci 4541e5c31af7Sopenharmony_cicode:TessCoord:: 4542e5c31af7Sopenharmony_ci 4543e5c31af7Sopenharmony_ciDecorating a variable with the code:TessCoord built-in decoration will make 4544e5c31af7Sopenharmony_cithat variable contain the three-dimensional [eq]#(u,v,w)# barycentric 4545e5c31af7Sopenharmony_cicoordinate of the tessellated vertex within the patch. 4546e5c31af7Sopenharmony_ci[eq]#u#, [eq]#v#, and [eq]#w# are in the range [eq]#[0,1]# and vary linearly 4547e5c31af7Sopenharmony_ciacross the primitive being subdivided. 4548e5c31af7Sopenharmony_ciFor the tessellation modes of code:Quads or code:IsoLines, the third 4549e5c31af7Sopenharmony_cicomponent is always zero. 4550e5c31af7Sopenharmony_ci 4551e5c31af7Sopenharmony_ci.Valid Usage 4552e5c31af7Sopenharmony_ci**** 4553e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessCoord-04387]] 4554e5c31af7Sopenharmony_ci The code:TessCoord decoration must: be used only within the 4555e5c31af7Sopenharmony_ci code:TessellationEvaluation {ExecutionModel} 4556e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessCoord-04388]] 4557e5c31af7Sopenharmony_ci The variable decorated with code:TessCoord must: be declared using the 4558e5c31af7Sopenharmony_ci code:Input {StorageClass} 4559e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessCoord-04389]] 4560e5c31af7Sopenharmony_ci The variable decorated with code:TessCoord must: be declared as a 4561e5c31af7Sopenharmony_ci three-component vector of 32-bit floating-point values 4562e5c31af7Sopenharmony_ci**** 4563e5c31af7Sopenharmony_ci-- 4564e5c31af7Sopenharmony_ci 4565e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-tesslevelouter]] 4566e5c31af7Sopenharmony_ci[open,refpage='TessLevelOuter',desc='Outer tessellation levels',type='builtins'] 4567e5c31af7Sopenharmony_ci-- 4568e5c31af7Sopenharmony_ci:refpage: TessLevelOuter 4569e5c31af7Sopenharmony_ci 4570e5c31af7Sopenharmony_cicode:TessLevelOuter:: 4571e5c31af7Sopenharmony_ci 4572e5c31af7Sopenharmony_ciDecorating a variable with the code:TessLevelOuter built-in decoration will 4573e5c31af7Sopenharmony_cimake that variable contain the outer tessellation levels for the current 4574e5c31af7Sopenharmony_cipatch. 4575e5c31af7Sopenharmony_ci+ 4576e5c31af7Sopenharmony_ciIn tessellation control shaders, the variable decorated with 4577e5c31af7Sopenharmony_cicode:TessLevelOuter can: be written to, controlling the tessellation factors 4578e5c31af7Sopenharmony_cifor the resulting patch. 4579e5c31af7Sopenharmony_ciThese values are used by the tessellator to control primitive tessellation 4580e5c31af7Sopenharmony_ciand can: be read by tessellation evaluation shaders. 4581e5c31af7Sopenharmony_ci+ 4582e5c31af7Sopenharmony_ciIn tessellation evaluation shaders, the variable decorated with 4583e5c31af7Sopenharmony_cicode:TessLevelOuter can: read the values written by the tessellation control 4584e5c31af7Sopenharmony_cishader. 4585e5c31af7Sopenharmony_ci 4586e5c31af7Sopenharmony_ci.Valid Usage 4587e5c31af7Sopenharmony_ci**** 4588e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelOuter-04390]] 4589e5c31af7Sopenharmony_ci The code:TessLevelOuter decoration must: be used only within the 4590e5c31af7Sopenharmony_ci code:TessellationControl or code:TessellationEvaluation {ExecutionModel} 4591e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelOuter-04391]] 4592e5c31af7Sopenharmony_ci The variable decorated with code:TessLevelOuter within the 4593e5c31af7Sopenharmony_ci code:TessellationControl {ExecutionModel} must: be declared using the 4594e5c31af7Sopenharmony_ci code:Output {StorageClass} 4595e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelOuter-04392]] 4596e5c31af7Sopenharmony_ci The variable decorated with code:TessLevelOuter within the 4597e5c31af7Sopenharmony_ci code:TessellationEvaluation {ExecutionModel} must: be declared using the 4598e5c31af7Sopenharmony_ci code:Input {StorageClass} 4599e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelOuter-04393]] 4600e5c31af7Sopenharmony_ci The variable decorated with code:TessLevelOuter must: be declared as an 4601e5c31af7Sopenharmony_ci array of size four, containing 32-bit floating-point values 4602e5c31af7Sopenharmony_ci**** 4603e5c31af7Sopenharmony_ci-- 4604e5c31af7Sopenharmony_ci 4605e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-tesslevelinner]] 4606e5c31af7Sopenharmony_ci[open,refpage='TessLevelInner',desc='Inner tessellation levels',type='builtins'] 4607e5c31af7Sopenharmony_ci-- 4608e5c31af7Sopenharmony_ci:refpage: TessLevelInner 4609e5c31af7Sopenharmony_ci 4610e5c31af7Sopenharmony_cicode:TessLevelInner:: 4611e5c31af7Sopenharmony_ci 4612e5c31af7Sopenharmony_ciDecorating a variable with the code:TessLevelInner built-in decoration will 4613e5c31af7Sopenharmony_cimake that variable contain the inner tessellation levels for the current 4614e5c31af7Sopenharmony_cipatch. 4615e5c31af7Sopenharmony_ci+ 4616e5c31af7Sopenharmony_ciIn tessellation control shaders, the variable decorated with 4617e5c31af7Sopenharmony_cicode:TessLevelInner can: be written to, controlling the tessellation factors 4618e5c31af7Sopenharmony_cifor the resulting patch. 4619e5c31af7Sopenharmony_ciThese values are used by the tessellator to control primitive tessellation 4620e5c31af7Sopenharmony_ciand can: be read by tessellation evaluation shaders. 4621e5c31af7Sopenharmony_ci+ 4622e5c31af7Sopenharmony_ciIn tessellation evaluation shaders, the variable decorated with 4623e5c31af7Sopenharmony_cicode:TessLevelInner can: read the values written by the tessellation control 4624e5c31af7Sopenharmony_cishader. 4625e5c31af7Sopenharmony_ci 4626e5c31af7Sopenharmony_ci.Valid Usage 4627e5c31af7Sopenharmony_ci**** 4628e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelInner-04394]] 4629e5c31af7Sopenharmony_ci The code:TessLevelInner decoration must: be used only within the 4630e5c31af7Sopenharmony_ci code:TessellationControl or code:TessellationEvaluation {ExecutionModel} 4631e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelInner-04395]] 4632e5c31af7Sopenharmony_ci The variable decorated with code:TessLevelInner within the 4633e5c31af7Sopenharmony_ci code:TessellationControl {ExecutionModel} must: be declared using the 4634e5c31af7Sopenharmony_ci code:Output {StorageClass} 4635e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelInner-04396]] 4636e5c31af7Sopenharmony_ci The variable decorated with code:TessLevelInner within the 4637e5c31af7Sopenharmony_ci code:TessellationEvaluation {ExecutionModel} must: be declared using the 4638e5c31af7Sopenharmony_ci code:Input {StorageClass} 4639e5c31af7Sopenharmony_ci * [[VUID-{refpage}-TessLevelInner-04397]] 4640e5c31af7Sopenharmony_ci The variable decorated with code:TessLevelInner must: be declared as an 4641e5c31af7Sopenharmony_ci array of size two, containing 32-bit floating-point values 4642e5c31af7Sopenharmony_ci**** 4643e5c31af7Sopenharmony_ci-- 4644e5c31af7Sopenharmony_ci 4645e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 4646e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-vertexcounthuawei]] 4647e5c31af7Sopenharmony_ci[open,refpage='VertexCountHUAWEI',desc='cluster culling shader output variable',type='builtins'] 4648e5c31af7Sopenharmony_ci-- 4649e5c31af7Sopenharmony_ci:refpage: VertexCountHUAWEI 4650e5c31af7Sopenharmony_ci 4651e5c31af7Sopenharmony_cicode:VertexCountHUAWEI:: 4652e5c31af7Sopenharmony_ci 4653e5c31af7Sopenharmony_ciThe code:VertexCountHUAWEI decoration can be used to decorate a cluster 4654e5c31af7Sopenharmony_ciculling shader output variable,this non-indexed mode specific variable will 4655e5c31af7Sopenharmony_cicontain an integer value that specifies the number of vertices in a cluster 4656e5c31af7Sopenharmony_cito draw. 4657e5c31af7Sopenharmony_ci 4658e5c31af7Sopenharmony_ci.Valid Usage 4659e5c31af7Sopenharmony_ci**** 4660e5c31af7Sopenharmony_ci * [[VUID-{refpage}-VertexCountHUAWEI-07809]] 4661e5c31af7Sopenharmony_ci The code:VertexCountHUAWEI decoration must: be used only within the 4662e5c31af7Sopenharmony_ci code:ClusterCullingHUAWEI {ExecutionModel} 4663e5c31af7Sopenharmony_ci * [[VUID-{refpage}-VertexCountHUAWEI-07810]] 4664e5c31af7Sopenharmony_ci The variable decorated with code:VertexCountHUAWEI must: be declared as 4665e5c31af7Sopenharmony_ci a scalar 32-bit integer value 4666e5c31af7Sopenharmony_ci**** 4667e5c31af7Sopenharmony_ci-- 4668e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 4669e5c31af7Sopenharmony_ci 4670e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-vertexindex]] 4671e5c31af7Sopenharmony_ci[open,refpage='VertexIndex',desc='Vertex index of a shader invocation',type='builtins'] 4672e5c31af7Sopenharmony_ci-- 4673e5c31af7Sopenharmony_ci:refpage: VertexIndex 4674e5c31af7Sopenharmony_ci 4675e5c31af7Sopenharmony_cicode:VertexIndex:: 4676e5c31af7Sopenharmony_ci 4677e5c31af7Sopenharmony_ciDecorating a variable with the code:VertexIndex built-in decoration will 4678e5c31af7Sopenharmony_cimake that variable contain the index of the vertex that is being processed 4679e5c31af7Sopenharmony_ciby the current vertex shader invocation. 4680e5c31af7Sopenharmony_ciFor non-indexed draws, this variable begins at the pname:firstVertex 4681e5c31af7Sopenharmony_ciparameter to flink:vkCmdDraw or the pname:firstVertex member of a structure 4682e5c31af7Sopenharmony_ciconsumed by flink:vkCmdDrawIndirect and increments by one for each vertex in 4683e5c31af7Sopenharmony_cithe draw. 4684e5c31af7Sopenharmony_ciFor indexed draws, its value is the content of the index buffer for the 4685e5c31af7Sopenharmony_civertex plus the pname:vertexOffset parameter to flink:vkCmdDrawIndexed or 4686e5c31af7Sopenharmony_cithe pname:vertexOffset member of the structure consumed by 4687e5c31af7Sopenharmony_ciflink:vkCmdDrawIndexedIndirect. 4688e5c31af7Sopenharmony_ci 4689e5c31af7Sopenharmony_ci[NOTE] 4690e5c31af7Sopenharmony_ci.Note 4691e5c31af7Sopenharmony_ci==== 4692e5c31af7Sopenharmony_cicode:VertexIndex starts at the same starting value for each instance. 4693e5c31af7Sopenharmony_ci==== 4694e5c31af7Sopenharmony_ci 4695e5c31af7Sopenharmony_ci.Valid Usage 4696e5c31af7Sopenharmony_ci**** 4697e5c31af7Sopenharmony_ci * [[VUID-{refpage}-VertexIndex-04398]] 4698e5c31af7Sopenharmony_ci The code:VertexIndex decoration must: be used only within the 4699e5c31af7Sopenharmony_ci code:Vertex {ExecutionModel} 4700e5c31af7Sopenharmony_ci * [[VUID-{refpage}-VertexIndex-04399]] 4701e5c31af7Sopenharmony_ci The variable decorated with code:VertexIndex must: be declared using the 4702e5c31af7Sopenharmony_ci code:Input {StorageClass} 4703e5c31af7Sopenharmony_ci * [[VUID-{refpage}-VertexIndex-04400]] 4704e5c31af7Sopenharmony_ci The variable decorated with code:VertexIndex must: be declared as a 4705e5c31af7Sopenharmony_ci scalar 32-bit integer value 4706e5c31af7Sopenharmony_ci**** 4707e5c31af7Sopenharmony_ci-- 4708e5c31af7Sopenharmony_ci 4709e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[] 4710e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-vertexoffsethuawei]] 4711e5c31af7Sopenharmony_ci[open,refpage='VertexOffsetHUAWEI',desc='cluster culling shader output variable',type='builtins'] 4712e5c31af7Sopenharmony_ci-- 4713e5c31af7Sopenharmony_ci:refpage: VertexOffsetHUAWEI 4714e5c31af7Sopenharmony_ci 4715e5c31af7Sopenharmony_cicode:VertexOffsetHUAWEI:: 4716e5c31af7Sopenharmony_ci 4717e5c31af7Sopenharmony_ciThe code:VertexOffsetHUAWEI decoration can be used to decorate a cluster 4718e5c31af7Sopenharmony_ciculling shader output variable,this indexed mode specific variable will 4719e5c31af7Sopenharmony_cicontain an integer value that specifies a offset value added to the vertex 4720e5c31af7Sopenharmony_ciindex of a cluster before indexing into the vertex buffer. 4721e5c31af7Sopenharmony_ci 4722e5c31af7Sopenharmony_ci.Valid Usage 4723e5c31af7Sopenharmony_ci**** 4724e5c31af7Sopenharmony_ci * [[VUID-{refpage}-VertexOffsetHUAWEI-07811]] 4725e5c31af7Sopenharmony_ci The code:VertexOffsetHUAWEI decoration must: be used only within the 4726e5c31af7Sopenharmony_ci code:ClusterCullingHUAWEI {ExecutionModel} 4727e5c31af7Sopenharmony_ci * [[VUID-{refpage}-VertexOffsetHUAWEI-07812]] 4728e5c31af7Sopenharmony_ci The variable decorated with code:VertexOffsetHUAWEI must: be declared as 4729e5c31af7Sopenharmony_ci a scalar 32-bit integer value 4730e5c31af7Sopenharmony_ci**** 4731e5c31af7Sopenharmony_ci-- 4732e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[] 4733e5c31af7Sopenharmony_ci 4734e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[] 4735e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-viewindex]] 4736e5c31af7Sopenharmony_ci[open,refpage='ViewIndex',desc='View index of a shader invocation',type='builtins'] 4737e5c31af7Sopenharmony_ci-- 4738e5c31af7Sopenharmony_ci:refpage: ViewIndex 4739e5c31af7Sopenharmony_ci 4740e5c31af7Sopenharmony_cicode:ViewIndex:: 4741e5c31af7Sopenharmony_ci 4742e5c31af7Sopenharmony_ciThe code:ViewIndex decoration can: be applied to a shader input which will 4743e5c31af7Sopenharmony_cibe filled with the index of the view that is being processed by the current 4744e5c31af7Sopenharmony_cishader invocation. 4745e5c31af7Sopenharmony_ci+ 4746e5c31af7Sopenharmony_ciIf multiview is enabled in the render pass, this value will be one of the 4747e5c31af7Sopenharmony_cibits set in the view mask of the subpass the pipeline is compiled against. 4748e5c31af7Sopenharmony_ciIf multiview is not enabled in the render pass, this value will be zero. 4749e5c31af7Sopenharmony_ci 4750e5c31af7Sopenharmony_ci.Valid Usage 4751e5c31af7Sopenharmony_ci**** 4752e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewIndex-04401]] 4753e5c31af7Sopenharmony_ci The code:ViewIndex decoration must: be used only within the 4754e5c31af7Sopenharmony_ci code:MeshEXT, code:Vertex, code:Geometry, code:TessellationControl, 4755e5c31af7Sopenharmony_ci code:TessellationEvaluation or code:Fragment {ExecutionModel} 4756e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewIndex-04402]] 4757e5c31af7Sopenharmony_ci The variable decorated with code:ViewIndex must: be declared using the 4758e5c31af7Sopenharmony_ci code:Input {StorageClass} 4759e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewIndex-04403]] 4760e5c31af7Sopenharmony_ci The variable decorated with code:ViewIndex must: be declared as a scalar 4761e5c31af7Sopenharmony_ci 32-bit integer value 4762e5c31af7Sopenharmony_ci**** 4763e5c31af7Sopenharmony_ci-- 4764e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[] 4765e5c31af7Sopenharmony_ci 4766e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-viewportindex]] 4767e5c31af7Sopenharmony_ci[open,refpage='ViewportIndex',desc='Viewport index used',type='builtins'] 4768e5c31af7Sopenharmony_ci-- 4769e5c31af7Sopenharmony_ci:refpage: ViewportIndex 4770e5c31af7Sopenharmony_ci 4771e5c31af7Sopenharmony_cicode:ViewportIndex:: 4772e5c31af7Sopenharmony_ci 4773e5c31af7Sopenharmony_ciDecorating a variable with the code:ViewportIndex built-in decoration will 4774e5c31af7Sopenharmony_cimake that variable contain the index of the viewport. 4775e5c31af7Sopenharmony_ci+ 4776e5c31af7Sopenharmony_ciIn a 4777e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 4778e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[mesh,] 4779e5c31af7Sopenharmony_civertex, tessellation evaluation, or 4780e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 4781e5c31af7Sopenharmony_cigeometry shader, the variable decorated with code:ViewportIndex can be 4782e5c31af7Sopenharmony_ciwritten to with the viewport index to which the primitive produced by that 4783e5c31af7Sopenharmony_cishader will be directed. 4784e5c31af7Sopenharmony_ci+ 4785e5c31af7Sopenharmony_ciThe selected viewport index is used to select the 4786e5c31af7Sopenharmony_ciifndef::VK_NV_scissor_exclusive[] 4787e5c31af7Sopenharmony_civiewport transform and 4788e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 4789e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 4790e5c31af7Sopenharmony_civiewport transform, scissor rectangle, and exclusive 4791e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 4792e5c31af7Sopenharmony_ciscissor rectangle. 4793e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 4794e5c31af7Sopenharmony_ci+ 4795e5c31af7Sopenharmony_ciThe last active 4796e5c31af7Sopenharmony_ci_<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4797e5c31af7Sopenharmony_cistage>>_ (in pipeline order) controls the code:ViewportIndex that is used. 4798e5c31af7Sopenharmony_ciOutputs in previous shader stages are not used, even if the last stage fails 4799e5c31af7Sopenharmony_cito write the code:ViewportIndex. 4800e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[] 4801e5c31af7Sopenharmony_ci+ 4802e5c31af7Sopenharmony_ciIf the last active 4803e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4804e5c31af7Sopenharmony_cistage>> shader entry point's interface does not include a variable decorated 4805e5c31af7Sopenharmony_ciwith code:ViewportIndex 4806e5c31af7Sopenharmony_ciifdef::VK_QCOM_multiview_per_view_viewports[] 4807e5c31af7Sopenharmony_ci, and if <<features-multiview-per-view-viewports, 4808e5c31af7Sopenharmony_cimultiviewPerViewViewports>> is not enabled, 4809e5c31af7Sopenharmony_ciendif::VK_QCOM_multiview_per_view_viewports[] 4810e5c31af7Sopenharmony_cithen the first viewport is used. 4811e5c31af7Sopenharmony_ciIf a <<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4812e5c31af7Sopenharmony_cistage>> shader entry point's interface includes a variable decorated with 4813e5c31af7Sopenharmony_cicode:ViewportIndex, it must: write the same value to code:ViewportIndex for 4814e5c31af7Sopenharmony_ciall output vertices of a given primitive. 4815e5c31af7Sopenharmony_ci+ 4816e5c31af7Sopenharmony_ciIn a fragment shader, the variable decorated with code:ViewportIndex 4817e5c31af7Sopenharmony_cicontains the viewport index of the primitive that the fragment invocation 4818e5c31af7Sopenharmony_cibelongs to. 4819e5c31af7Sopenharmony_ciifdef::VK_QCOM_multiview_per_view_viewports[] 4820e5c31af7Sopenharmony_ci+ 4821e5c31af7Sopenharmony_ciIf <<features-multiview-per-view-viewports, 4822e5c31af7Sopenharmony_cipname:multiviewPerViewViewports>> is enabled, and if the last active 4823e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4824e5c31af7Sopenharmony_cistage>> shader entry point's interface does not include a variable decorated 4825e5c31af7Sopenharmony_ciwith code:ViewportIndex, then the value of code:ViewIndex is used as an 4826e5c31af7Sopenharmony_ciindex to select the viewport transform and scissor rectangle, and the value 4827e5c31af7Sopenharmony_ciof code:ViewportIndex in the fragment shader is undefined::. 4828e5c31af7Sopenharmony_ciendif::VK_QCOM_multiview_per_view_viewports[] 4829e5c31af7Sopenharmony_ci 4830e5c31af7Sopenharmony_ci.Valid Usage 4831e5c31af7Sopenharmony_ci**** 4832e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportIndex-04404]] 4833e5c31af7Sopenharmony_ci The code:ViewportIndex decoration must: be used only within the 4834e5c31af7Sopenharmony_ci code:MeshEXT, code:MeshNV, code:Vertex, code:TessellationEvaluation, 4835e5c31af7Sopenharmony_ci code:Geometry, or code:Fragment {ExecutionModel} 4836e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[] 4837e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportIndex-04405]] 4838e5c31af7Sopenharmony_ci If the <<features-shaderOutputViewportIndex, 4839e5c31af7Sopenharmony_ci pname:shaderOutputViewportIndex>> feature is not enabled then the 4840e5c31af7Sopenharmony_ci code:ViewportIndex decoration must: be used only within the 4841e5c31af7Sopenharmony_ci code:Geometry or code:Fragment {ExecutionModel} 4842e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[] 4843e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportIndex-04406]] 4844e5c31af7Sopenharmony_ci The variable decorated with code:ViewportIndex within the code:MeshEXT, 4845e5c31af7Sopenharmony_ci code:MeshNV, code:Vertex, code:TessellationEvaluation, or code:Geometry 4846e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Output {StorageClass} 4847e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportIndex-04407]] 4848e5c31af7Sopenharmony_ci The variable decorated with code:ViewportIndex within the code:Fragment 4849e5c31af7Sopenharmony_ci {ExecutionModel} must: be declared using the code:Input {StorageClass} 4850e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportIndex-04408]] 4851e5c31af7Sopenharmony_ci The variable decorated with code:ViewportIndex must: be declared as a 4852e5c31af7Sopenharmony_ci scalar 32-bit integer value 4853e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportIndex-07060]] 4854e5c31af7Sopenharmony_ci The variable decorated with code:ViewportIndex within the code:MeshEXT 4855e5c31af7Sopenharmony_ci {ExecutionModel} must: also be decorated with the code:PerPrimitiveEXT 4856e5c31af7Sopenharmony_ci decoration 4857e5c31af7Sopenharmony_ci**** 4858e5c31af7Sopenharmony_ci-- 4859e5c31af7Sopenharmony_ci 4860e5c31af7Sopenharmony_ciifdef::VK_NV_viewport_array2[] 4861e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-viewportmask]] 4862e5c31af7Sopenharmony_ci[open,refpage='ViewportMaskNV',desc='Mask of the viewports used',type='builtins'] 4863e5c31af7Sopenharmony_ci-- 4864e5c31af7Sopenharmony_ci:refpage: ViewportMaskNV 4865e5c31af7Sopenharmony_ci 4866e5c31af7Sopenharmony_cicode:ViewportMaskNV:: 4867e5c31af7Sopenharmony_ci 4868e5c31af7Sopenharmony_ciDecorating a variable with the code:ViewportMaskNV built-in decoration will 4869e5c31af7Sopenharmony_cimake that variable contain the viewport mask. 4870e5c31af7Sopenharmony_ci+ 4871e5c31af7Sopenharmony_ciIn a 4872e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader[] 4873e5c31af7Sopenharmony_cimesh, 4874e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader[] 4875e5c31af7Sopenharmony_civertex, tessellation evaluation, or geometry shader, the variable decorated 4876e5c31af7Sopenharmony_ciwith code:ViewportMaskNV can be written to with the mask of which viewports 4877e5c31af7Sopenharmony_cithe primitive produced by that shader will directed. 4878e5c31af7Sopenharmony_ci+ 4879e5c31af7Sopenharmony_ciThe code:ViewportMaskNV variable must: be an array that has 4880e5c31af7Sopenharmony_ci[eq]#{lceil}(sname:VkPhysicalDeviceLimits::pname:maxViewports / 32){rceil}# 4881e5c31af7Sopenharmony_cielements. 4882e5c31af7Sopenharmony_ciWhen a shader writes to this variable, bit B of element M controls whether a 4883e5c31af7Sopenharmony_ciprimitive is emitted to viewport [eq]#32 {times} M {plus} B#. 4884e5c31af7Sopenharmony_ciThe viewports indicated by the mask are used to select the 4885e5c31af7Sopenharmony_ciifndef::VK_NV_scissor_exclusive[] 4886e5c31af7Sopenharmony_civiewport transform and 4887e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 4888e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 4889e5c31af7Sopenharmony_civiewport transform, scissor rectangle, and exclusive 4890e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 4891e5c31af7Sopenharmony_ciscissor rectangle that a primitive will be transformed by. 4892e5c31af7Sopenharmony_ci+ 4893e5c31af7Sopenharmony_ciThe last active 4894e5c31af7Sopenharmony_ci_<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4895e5c31af7Sopenharmony_cistage>>_ (in pipeline order) controls the code:ViewportMaskNV that is used. 4896e5c31af7Sopenharmony_ciOutputs in previous shader stages are not used, even if the last stage fails 4897e5c31af7Sopenharmony_cito write the code:ViewportMaskNV. 4898e5c31af7Sopenharmony_ciWhen code:ViewportMaskNV is written by the final 4899e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4900e5c31af7Sopenharmony_cistage>>, any variable decorated with code:ViewportIndex in the fragment 4901e5c31af7Sopenharmony_cishader will have the index of the viewport that was used in generating that 4902e5c31af7Sopenharmony_cifragment. 4903e5c31af7Sopenharmony_ci+ 4904e5c31af7Sopenharmony_ciIf a <<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4905e5c31af7Sopenharmony_cistage>> shader entry point's interface includes a variable decorated with 4906e5c31af7Sopenharmony_cicode:ViewportMaskNV, it must: write the same value to code:ViewportMaskNV 4907e5c31af7Sopenharmony_cifor all output vertices of a given primitive. 4908e5c31af7Sopenharmony_ci 4909e5c31af7Sopenharmony_ci.Valid Usage 4910e5c31af7Sopenharmony_ci**** 4911e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskNV-04409]] 4912e5c31af7Sopenharmony_ci The code:ViewportMaskNV decoration must: be used only within the 4913e5c31af7Sopenharmony_ci code:Vertex, code:MeshNV, code:TessellationEvaluation, or code:Geometry 4914e5c31af7Sopenharmony_ci {ExecutionModel} 4915e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskNV-04410]] 4916e5c31af7Sopenharmony_ci The variable decorated with code:ViewportMaskNV must: be declared using 4917e5c31af7Sopenharmony_ci the code:Output {StorageClass} 4918e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskNV-04411]] 4919e5c31af7Sopenharmony_ci The variable decorated with code:ViewportMaskNV must: be declared as an 4920e5c31af7Sopenharmony_ci array of 32-bit integer values 4921e5c31af7Sopenharmony_ci**** 4922e5c31af7Sopenharmony_ci-- 4923e5c31af7Sopenharmony_ciendif::VK_NV_viewport_array2[] 4924e5c31af7Sopenharmony_ci 4925e5c31af7Sopenharmony_ciifdef::VK_NVX_multiview_per_view_attributes+VK_NV_viewport_array2[] 4926e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-viewportmaskperview]] 4927e5c31af7Sopenharmony_ci[open,refpage='ViewportMaskPerViewNV',desc='Mask of viewports broadcast to per view',type='builtins'] 4928e5c31af7Sopenharmony_ci-- 4929e5c31af7Sopenharmony_ci:refpage: ViewportMaskPerViewNV 4930e5c31af7Sopenharmony_ci 4931e5c31af7Sopenharmony_cicode:ViewportMaskPerViewNV:: 4932e5c31af7Sopenharmony_ci 4933e5c31af7Sopenharmony_ciDecorating a variable with the code:ViewportMaskPerViewNV built-in 4934e5c31af7Sopenharmony_cidecoration will make that variable contain the mask of viewports primitives 4935e5c31af7Sopenharmony_ciare broadcast to, for each view. 4936e5c31af7Sopenharmony_ci+ 4937e5c31af7Sopenharmony_ciThe value written to an element of code:ViewportMaskPerViewNV in the last 4938e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4939e5c31af7Sopenharmony_cistage>> is a bitmask indicating which viewports the primitive will be 4940e5c31af7Sopenharmony_cidirected to. 4941e5c31af7Sopenharmony_ciThe primitive will be broadcast to the viewport corresponding to each 4942e5c31af7Sopenharmony_cinon-zero bit of the bitmask, and that viewport index is used to select the 4943e5c31af7Sopenharmony_ciifndef::VK_NV_scissor_exclusive[] 4944e5c31af7Sopenharmony_civiewport transform and 4945e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 4946e5c31af7Sopenharmony_ciifdef::VK_NV_scissor_exclusive[] 4947e5c31af7Sopenharmony_civiewport transform, scissor rectangle, and exclusive 4948e5c31af7Sopenharmony_ciendif::VK_NV_scissor_exclusive[] 4949e5c31af7Sopenharmony_ciscissor rectangle, for each view. 4950e5c31af7Sopenharmony_ciThe same values must: be written to all vertices in a given primitive, or 4951e5c31af7Sopenharmony_cielse the set of viewports used for that primitive is undefined:. 4952e5c31af7Sopenharmony_ci+ 4953e5c31af7Sopenharmony_ciElements of the array correspond to views in a multiview subpass, and those 4954e5c31af7Sopenharmony_cielements corresponding to views in the view mask of the subpass the shader 4955e5c31af7Sopenharmony_ciis compiled against will be used as the viewport mask value for those views. 4956e5c31af7Sopenharmony_cicode:ViewportMaskPerViewNV output in an earlier 4957e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4958e5c31af7Sopenharmony_cistage>> is not available as an input in the subsequent 4959e5c31af7Sopenharmony_ci<<pipelines-graphics-subsets-pre-rasterization,pre-rasterization shader 4960e5c31af7Sopenharmony_cistage>>. 4961e5c31af7Sopenharmony_ci+ 4962e5c31af7Sopenharmony_ciAlthough code:ViewportMaskNV is an array, code:ViewportMaskPerViewNV is not 4963e5c31af7Sopenharmony_cia two-dimensional array. 4964e5c31af7Sopenharmony_ciInstead, code:ViewportMaskPerViewNV is limited to 32 viewports. 4965e5c31af7Sopenharmony_ci 4966e5c31af7Sopenharmony_ci.Valid Usage 4967e5c31af7Sopenharmony_ci**** 4968e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskPerViewNV-04412]] 4969e5c31af7Sopenharmony_ci The code:ViewportMaskPerViewNV decoration must: be used only within the 4970e5c31af7Sopenharmony_ci code:Vertex, code:MeshNV, code:TessellationControl, 4971e5c31af7Sopenharmony_ci code:TessellationEvaluation, or code:Geometry {ExecutionModel} 4972e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskPerViewNV-04413]] 4973e5c31af7Sopenharmony_ci The variable decorated with code:ViewportMaskPerViewNV must: be declared 4974e5c31af7Sopenharmony_ci using the code:Output {StorageClass} 4975e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskPerViewNV-04414]] 4976e5c31af7Sopenharmony_ci The variable decorated with code:ViewportMaskPerViewNV must: be declared 4977e5c31af7Sopenharmony_ci as an array of 32-bit integer values 4978e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskPerViewNV-04415]] 4979e5c31af7Sopenharmony_ci The array decorated with code:ViewportMaskPerViewNV must: be a size less 4980e5c31af7Sopenharmony_ci than or equal to 32 4981e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskPerViewNV-04416]] 4982e5c31af7Sopenharmony_ci The array decorated with code:ViewportMaskPerViewNV must: be a size 4983e5c31af7Sopenharmony_ci greater than the maximum view in the subpass's view mask 4984e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ViewportMaskPerViewNV-04417]] 4985e5c31af7Sopenharmony_ci The array variable decorated with code:ViewportMaskPerViewNV must: only 4986e5c31af7Sopenharmony_ci be indexed by a constant or specialization constant 4987e5c31af7Sopenharmony_ci**** 4988e5c31af7Sopenharmony_ci-- 4989e5c31af7Sopenharmony_ciendif::VK_NVX_multiview_per_view_attributes+VK_NV_viewport_array2[] 4990e5c31af7Sopenharmony_ci 4991e5c31af7Sopenharmony_ciifdef::VK_NV_shader_sm_builtins[] 4992e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-warpspersmnv]] 4993e5c31af7Sopenharmony_ci[open,refpage='WarpsPerSMNV',desc='Number of warps per SM',type='builtins'] 4994e5c31af7Sopenharmony_ci-- 4995e5c31af7Sopenharmony_ci:refpage: WarpsPerSMNV 4996e5c31af7Sopenharmony_ci 4997e5c31af7Sopenharmony_cicode:WarpsPerSMNV:: 4998e5c31af7Sopenharmony_ci 4999e5c31af7Sopenharmony_ciDecorating a variable with the code:WarpsPerSMNV built-in decoration will 5000e5c31af7Sopenharmony_cimake that variable contain the maximum number of warps executing on a SM. 5001e5c31af7Sopenharmony_ci 5002e5c31af7Sopenharmony_ci.Valid Usage 5003e5c31af7Sopenharmony_ci**** 5004e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpsPerSMNV-04418]] 5005e5c31af7Sopenharmony_ci The variable decorated with code:WarpsPerSMNV must: be declared using 5006e5c31af7Sopenharmony_ci the code:Input {StorageClass} 5007e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpsPerSMNV-04419]] 5008e5c31af7Sopenharmony_ci The variable decorated with code:WarpsPerSMNV must: be declared as a 5009e5c31af7Sopenharmony_ci scalar 32-bit integer value 5010e5c31af7Sopenharmony_ci**** 5011e5c31af7Sopenharmony_ci-- 5012e5c31af7Sopenharmony_ci 5013e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-warpidnv]] 5014e5c31af7Sopenharmony_ci[open,refpage='WarpIDNV',desc='Warp ID within an SM of a shader invocation',type='builtins'] 5015e5c31af7Sopenharmony_ci-- 5016e5c31af7Sopenharmony_ci:refpage: WarpIDNV 5017e5c31af7Sopenharmony_ci 5018e5c31af7Sopenharmony_cicode:WarpIDNV:: 5019e5c31af7Sopenharmony_ci 5020e5c31af7Sopenharmony_ciDecorating a variable with the code:WarpIDNV built-in decoration will make 5021e5c31af7Sopenharmony_cithat variable contain the ID of the warp on a SM on which the current shader 5022e5c31af7Sopenharmony_ciinvocation is running. 5023e5c31af7Sopenharmony_ciThis variable is in the range [eq]#[0, code:WarpsPerSMNV-1]#. 5024e5c31af7Sopenharmony_ci 5025e5c31af7Sopenharmony_ci.Valid Usage 5026e5c31af7Sopenharmony_ci**** 5027e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpIDNV-04420]] 5028e5c31af7Sopenharmony_ci The variable decorated with code:WarpIDNV must: be declared using the 5029e5c31af7Sopenharmony_ci code:Input {StorageClass} 5030e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpIDNV-04421]] 5031e5c31af7Sopenharmony_ci The variable decorated with code:WarpIDNV must: be declared as a scalar 5032e5c31af7Sopenharmony_ci 32-bit integer value 5033e5c31af7Sopenharmony_ci**** 5034e5c31af7Sopenharmony_ci-- 5035e5c31af7Sopenharmony_ciendif::VK_NV_shader_sm_builtins[] 5036e5c31af7Sopenharmony_ci 5037e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-workgroupid]] 5038e5c31af7Sopenharmony_ci[open,refpage='WorkgroupId',desc='Workgroup ID of a shader',type='builtins'] 5039e5c31af7Sopenharmony_ci-- 5040e5c31af7Sopenharmony_ci:refpage: WorkgroupId 5041e5c31af7Sopenharmony_ci 5042e5c31af7Sopenharmony_cicode:WorkgroupId:: 5043e5c31af7Sopenharmony_ci 5044e5c31af7Sopenharmony_ciDecorating a variable with the code:WorkgroupId built-in decoration will 5045e5c31af7Sopenharmony_cimake that variable contain the global workgroup that the current invocation 5046e5c31af7Sopenharmony_ciis a member of. 5047e5c31af7Sopenharmony_ciEach component ranges from a base value to a [eq]#base {plus} count# value, 5048e5c31af7Sopenharmony_cibased on the parameters passed into the dispatching commands. 5049e5c31af7Sopenharmony_ci 5050e5c31af7Sopenharmony_ci.Valid Usage 5051e5c31af7Sopenharmony_ci**** 5052e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorkgroupId-04422]] 5053e5c31af7Sopenharmony_ci The code:WorkgroupId decoration must: be used only within the 5054e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV 5055e5c31af7Sopenharmony_ci {ExecutionModel} 5056e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorkgroupId-04423]] 5057e5c31af7Sopenharmony_ci The variable decorated with code:WorkgroupId must: be declared using the 5058e5c31af7Sopenharmony_ci code:Input {StorageClass} 5059e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorkgroupId-04424]] 5060e5c31af7Sopenharmony_ci The variable decorated with code:WorkgroupId must: be declared as a 5061e5c31af7Sopenharmony_ci three-component vector of 32-bit integer values 5062e5c31af7Sopenharmony_ci**** 5063e5c31af7Sopenharmony_ci-- 5064e5c31af7Sopenharmony_ci 5065e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-workgroupsize]] 5066e5c31af7Sopenharmony_ci[open,refpage='WorkgroupSize',desc='Size of a workgroup',type='builtins'] 5067e5c31af7Sopenharmony_ci-- 5068e5c31af7Sopenharmony_ci:refpage: WorkgroupSize 5069e5c31af7Sopenharmony_ci 5070e5c31af7Sopenharmony_cicode:WorkgroupSize:: 5071e5c31af7Sopenharmony_ci 5072e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[] 5073e5c31af7Sopenharmony_ci[NOTE] 5074e5c31af7Sopenharmony_ci.Note 5075e5c31af7Sopenharmony_ci==== 5076e5c31af7Sopenharmony_ciSPIR-V 1.6 deprecated code:WorkgroupSize in favor of using the 5077e5c31af7Sopenharmony_cicode:LocalSizeId Execution Mode instead. 5078e5c31af7Sopenharmony_ciSupport for code:LocalSizeId was added with `apiext:VK_KHR_maintenance4` and 5079e5c31af7Sopenharmony_cipromoted to core in Version 1.3. 5080e5c31af7Sopenharmony_ci==== 5081e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[] 5082e5c31af7Sopenharmony_ci 5083e5c31af7Sopenharmony_ciDecorating an object with the code:WorkgroupSize built-in decoration will 5084e5c31af7Sopenharmony_cimake that object contain the dimensions of a local workgroup. 5085e5c31af7Sopenharmony_ciIf an object is decorated with the code:WorkgroupSize decoration, this takes 5086e5c31af7Sopenharmony_ciprecedence over any code:LocalSize 5087e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_KHR_maintenance4[or code:LocalSizeId] 5088e5c31af7Sopenharmony_ciexecution mode. 5089e5c31af7Sopenharmony_ci 5090e5c31af7Sopenharmony_ci.Valid Usage 5091e5c31af7Sopenharmony_ci**** 5092e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorkgroupSize-04425]] 5093e5c31af7Sopenharmony_ci The code:WorkgroupSize decoration must: be used only within the 5094e5c31af7Sopenharmony_ci code:GLCompute, code:MeshEXT, code:TaskEXT, code:MeshNV, or code:TaskNV 5095e5c31af7Sopenharmony_ci {ExecutionModel} 5096e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorkgroupSize-04426]] 5097e5c31af7Sopenharmony_ci The variable decorated with code:WorkgroupSize must: be a specialization 5098e5c31af7Sopenharmony_ci constant or a constant 5099e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorkgroupSize-04427]] 5100e5c31af7Sopenharmony_ci The variable decorated with code:WorkgroupSize must: be declared as a 5101e5c31af7Sopenharmony_ci three-component vector of 32-bit integer values 5102e5c31af7Sopenharmony_ci**** 5103e5c31af7Sopenharmony_ci-- 5104e5c31af7Sopenharmony_ci 5105e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 5106e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-worldraydirection]] 5107e5c31af7Sopenharmony_ci[open,refpage='WorldRayDirectionKHR',desc='Ray direction in world space',type='builtins'] 5108e5c31af7Sopenharmony_ci-- 5109e5c31af7Sopenharmony_ci:refpage: WorldRayDirectionKHR 5110e5c31af7Sopenharmony_ci 5111e5c31af7Sopenharmony_cicode:WorldRayDirectionKHR:: 5112e5c31af7Sopenharmony_ci 5113e5c31af7Sopenharmony_ciA variable decorated with the code:WorldRayDirectionKHR decoration will 5114e5c31af7Sopenharmony_cispecify the direction of the ray being processed, in world space. 5115e5c31af7Sopenharmony_ciThe value is the parameter passed into the <<glossary-pipeline-trace-ray, 5116e5c31af7Sopenharmony_cipipeline trace ray>> instruction. 5117e5c31af7Sopenharmony_ci 5118e5c31af7Sopenharmony_ci.Valid Usage 5119e5c31af7Sopenharmony_ci**** 5120e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldRayDirectionKHR-04428]] 5121e5c31af7Sopenharmony_ci The code:WorldRayDirectionKHR decoration must: be used only within the 5122e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, code:ClosestHitKHR, or 5123e5c31af7Sopenharmony_ci code:MissKHR {ExecutionModel} 5124e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldRayDirectionKHR-04429]] 5125e5c31af7Sopenharmony_ci The variable decorated with code:WorldRayDirectionKHR must: be declared 5126e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 5127e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldRayDirectionKHR-04430]] 5128e5c31af7Sopenharmony_ci The variable decorated with code:WorldRayDirectionKHR must: be declared 5129e5c31af7Sopenharmony_ci as a three-component vector of 32-bit floating-point values 5130e5c31af7Sopenharmony_ci**** 5131e5c31af7Sopenharmony_ci-- 5132e5c31af7Sopenharmony_ci 5133e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-worldrayorigin]] 5134e5c31af7Sopenharmony_ci[open,refpage='WorldRayOriginKHR',desc='Ray origin in world space',type='builtins'] 5135e5c31af7Sopenharmony_ci-- 5136e5c31af7Sopenharmony_ci:refpage: WorldRayOriginKHR 5137e5c31af7Sopenharmony_ci 5138e5c31af7Sopenharmony_cicode:WorldRayOriginKHR:: 5139e5c31af7Sopenharmony_ci 5140e5c31af7Sopenharmony_ciA variable decorated with the code:WorldRayOriginKHR decoration will specify 5141e5c31af7Sopenharmony_cithe origin of the ray being processed, in world space. 5142e5c31af7Sopenharmony_ciThe value is the parameter passed into the <<glossary-pipeline-trace-ray, 5143e5c31af7Sopenharmony_cipipeline trace ray>> instruction. 5144e5c31af7Sopenharmony_ci 5145e5c31af7Sopenharmony_ci.Valid Usage 5146e5c31af7Sopenharmony_ci**** 5147e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldRayOriginKHR-04431]] 5148e5c31af7Sopenharmony_ci The code:WorldRayOriginKHR decoration must: be used only within the 5149e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, code:ClosestHitKHR, or 5150e5c31af7Sopenharmony_ci code:MissKHR {ExecutionModel} 5151e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldRayOriginKHR-04432]] 5152e5c31af7Sopenharmony_ci The variable decorated with code:WorldRayOriginKHR must: be declared 5153e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 5154e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldRayOriginKHR-04433]] 5155e5c31af7Sopenharmony_ci The variable decorated with code:WorldRayOriginKHR must: be declared as 5156e5c31af7Sopenharmony_ci a three-component vector of 32-bit floating-point values 5157e5c31af7Sopenharmony_ci**** 5158e5c31af7Sopenharmony_ci-- 5159e5c31af7Sopenharmony_ci 5160e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-worldtoobject]] 5161e5c31af7Sopenharmony_ci[open,refpage='WorldToObjectKHR',desc='Transformation matrix from world to object space',type='builtins'] 5162e5c31af7Sopenharmony_ci-- 5163e5c31af7Sopenharmony_ci:refpage: WorldToObjectKHR 5164e5c31af7Sopenharmony_ci 5165e5c31af7Sopenharmony_cicode:WorldToObjectKHR:: 5166e5c31af7Sopenharmony_ci 5167e5c31af7Sopenharmony_ciA variable decorated with the code:WorldToObjectKHR decoration will contain 5168e5c31af7Sopenharmony_cithe current world-to-object transformation matrix, which is determined by 5169e5c31af7Sopenharmony_cithe instance of the current intersection. 5170e5c31af7Sopenharmony_ci 5171e5c31af7Sopenharmony_ci.Valid Usage 5172e5c31af7Sopenharmony_ci**** 5173e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldToObjectKHR-04434]] 5174e5c31af7Sopenharmony_ci The code:WorldToObjectKHR decoration must: be used only within the 5175e5c31af7Sopenharmony_ci code:IntersectionKHR, code:AnyHitKHR, or code:ClosestHitKHR 5176e5c31af7Sopenharmony_ci {ExecutionModel} 5177e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldToObjectKHR-04435]] 5178e5c31af7Sopenharmony_ci The variable decorated with code:WorldToObjectKHR must: be declared 5179e5c31af7Sopenharmony_ci using the code:Input {StorageClass} 5180e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WorldToObjectKHR-04436]] 5181e5c31af7Sopenharmony_ci The variable decorated with code:WorldToObjectKHR must: be declared as a 5182e5c31af7Sopenharmony_ci matrix with four columns of three-component vectors of 32-bit 5183e5c31af7Sopenharmony_ci floating-point values 5184e5c31af7Sopenharmony_ci**** 5185e5c31af7Sopenharmony_ci-- 5186e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_ray_tracing_pipeline[] 5187e5c31af7Sopenharmony_ci 5188e5c31af7Sopenharmony_ciifdef::VK_ARM_shader_core_builtins[] 5189e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-corecountarm]] 5190e5c31af7Sopenharmony_ci[open,refpage='CoreCountARM',desc='Number of cores on the device',type='builtins'] 5191e5c31af7Sopenharmony_ci-- 5192e5c31af7Sopenharmony_ci:refpage: CoreCountARM 5193e5c31af7Sopenharmony_ci 5194e5c31af7Sopenharmony_cicode:CoreCountARM:: 5195e5c31af7Sopenharmony_ci 5196e5c31af7Sopenharmony_ciDecorating a variable with the code:CoreCountARM built-in decoration will 5197e5c31af7Sopenharmony_cimake that variable contain the number of cores on the device. 5198e5c31af7Sopenharmony_ci 5199e5c31af7Sopenharmony_ci.Valid Usage 5200e5c31af7Sopenharmony_ci**** 5201e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoreCountARM-07595]] 5202e5c31af7Sopenharmony_ci The variable decorated with code:CoreCountARM must: be declared using 5203e5c31af7Sopenharmony_ci the code:Input {StorageClass} 5204e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoreCountARM-07596]] 5205e5c31af7Sopenharmony_ci The variable decorated with code:CoreCountARM must: be declared as a 5206e5c31af7Sopenharmony_ci scalar 32-bit integer value 5207e5c31af7Sopenharmony_ci**** 5208e5c31af7Sopenharmony_ci-- 5209e5c31af7Sopenharmony_ci 5210e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-coremaxidarm]] 5211e5c31af7Sopenharmony_ci[open,refpage='CoreMaxIDARM',desc='Max core ID that can be observed on the device running the invovation reading CoreMaxIDARM',type='builtins'] 5212e5c31af7Sopenharmony_ci-- 5213e5c31af7Sopenharmony_ci:refpage: CoreMaxIDARM 5214e5c31af7Sopenharmony_ci 5215e5c31af7Sopenharmony_cicode:CoreMaxIDARM:: 5216e5c31af7Sopenharmony_ci 5217e5c31af7Sopenharmony_ciDecorating a variable with the code:CoreMaxIDARM built-in decoration will 5218e5c31af7Sopenharmony_cimake that variable contain the max ID of any shader core on the device on 5219e5c31af7Sopenharmony_ciwhich the current shader invocation is running. 5220e5c31af7Sopenharmony_ci 5221e5c31af7Sopenharmony_ci.Valid Usage 5222e5c31af7Sopenharmony_ci**** 5223e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoreMaxIDARM-07597]] 5224e5c31af7Sopenharmony_ci The variable decorated with code:CoreMaxIDARM must: be declared using 5225e5c31af7Sopenharmony_ci the code:Input {StorageClass} 5226e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoreMaxIDARM-07598]] 5227e5c31af7Sopenharmony_ci The variable decorated with code:CoreMaxIDARM must: be declared as a 5228e5c31af7Sopenharmony_ci scalar 32-bit integer value 5229e5c31af7Sopenharmony_ci**** 5230e5c31af7Sopenharmony_ci-- 5231e5c31af7Sopenharmony_ci 5232e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-coreidarm]] 5233e5c31af7Sopenharmony_ci[open,refpage='CoreIDARM',desc='Core ID on which a shader invocation is running',type='builtins'] 5234e5c31af7Sopenharmony_ci-- 5235e5c31af7Sopenharmony_ci:refpage: CoreIDARM 5236e5c31af7Sopenharmony_ci 5237e5c31af7Sopenharmony_cicode:CoreIDARM:: 5238e5c31af7Sopenharmony_ci 5239e5c31af7Sopenharmony_ciDecorating a variable with the code:CoreIDARM built-in decoration will make 5240e5c31af7Sopenharmony_cithat variable contain the ID of the core on which the current shader 5241e5c31af7Sopenharmony_ciinvocation is running. 5242e5c31af7Sopenharmony_ciThis variable is in the range [eq]#[0, code:CoreMaxIDARM]#. 5243e5c31af7Sopenharmony_ci 5244e5c31af7Sopenharmony_ci.Valid Usage 5245e5c31af7Sopenharmony_ci**** 5246e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoreIDARM-07599]] 5247e5c31af7Sopenharmony_ci The variable decorated with code:CoreIDARM must: be declared using the 5248e5c31af7Sopenharmony_ci code:Input {StorageClass} 5249e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoreIDARM-07600]] 5250e5c31af7Sopenharmony_ci The variable decorated with code:CoreIDARM must: be declared as a scalar 5251e5c31af7Sopenharmony_ci 32-bit integer value 5252e5c31af7Sopenharmony_ci**** 5253e5c31af7Sopenharmony_ci-- 5254e5c31af7Sopenharmony_ci 5255e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-warpmaxidarm]] 5256e5c31af7Sopenharmony_ci[open,refpage='WarpMaxIDARM',desc='Max ID for a warp on the core running a shader invovation',type='builtins'] 5257e5c31af7Sopenharmony_ci-- 5258e5c31af7Sopenharmony_ci:refpage: WarpMaxIDARM 5259e5c31af7Sopenharmony_ci 5260e5c31af7Sopenharmony_cicode:WarpMaxIDARM:: 5261e5c31af7Sopenharmony_ci 5262e5c31af7Sopenharmony_ciDecorating a variable with the code:WarpMaxIDARM built-in decoration will 5263e5c31af7Sopenharmony_cimake that variable contain the maximum warp ID for the core on which the 5264e5c31af7Sopenharmony_cicurrent invocation is running. 5265e5c31af7Sopenharmony_ci 5266e5c31af7Sopenharmony_ci.Valid Usage 5267e5c31af7Sopenharmony_ci**** 5268e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpMaxIDARM-07601]] 5269e5c31af7Sopenharmony_ci The variable decorated with code:WarpMaxIDARM must: be declared using 5270e5c31af7Sopenharmony_ci the code:Input {StorageClass} 5271e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpMaxIDARM-07602]] 5272e5c31af7Sopenharmony_ci The variable decorated with code:WarpMaxIDARM must: be declared as a 5273e5c31af7Sopenharmony_ci scalar 32-bit integer value 5274e5c31af7Sopenharmony_ci**** 5275e5c31af7Sopenharmony_ci-- 5276e5c31af7Sopenharmony_ci 5277e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-warpidarm]] 5278e5c31af7Sopenharmony_ci[open,refpage='WarpIDARM',desc='Warp ID within a core of a shader invocation',type='builtins'] 5279e5c31af7Sopenharmony_ci-- 5280e5c31af7Sopenharmony_ci:refpage: WarpIDARM 5281e5c31af7Sopenharmony_ci 5282e5c31af7Sopenharmony_cicode:WarpIDARM:: 5283e5c31af7Sopenharmony_ci 5284e5c31af7Sopenharmony_ciDecorating a variable with the code:WarpIDARM built-in decoration will make 5285e5c31af7Sopenharmony_cithat variable contain the ID of the warp on a core on which the current 5286e5c31af7Sopenharmony_cishader invocation is running. 5287e5c31af7Sopenharmony_ciThis variable is in the range [eq]#[0, code:WarpMaxIDARM]#. 5288e5c31af7Sopenharmony_ci 5289e5c31af7Sopenharmony_ci.Valid Usage 5290e5c31af7Sopenharmony_ci**** 5291e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpIDARM-07603]] 5292e5c31af7Sopenharmony_ci The variable decorated with code:WarpIDARM must: be declared using the 5293e5c31af7Sopenharmony_ci code:Input {StorageClass} 5294e5c31af7Sopenharmony_ci * [[VUID-{refpage}-WarpIDARM-07604]] 5295e5c31af7Sopenharmony_ci The variable decorated with code:WarpIDARM must: be declared as a scalar 5296e5c31af7Sopenharmony_ci 32-bit integer value 5297e5c31af7Sopenharmony_ci**** 5298e5c31af7Sopenharmony_ci-- 5299e5c31af7Sopenharmony_ciendif::VK_ARM_shader_core_builtins[] 5300e5c31af7Sopenharmony_ci 5301e5c31af7Sopenharmony_ciifdef::VK_AMDX_shader_enqueue[] 5302e5c31af7Sopenharmony_ci[[interfaces-builtin-variables-coalescedinputcountamd]] 5303e5c31af7Sopenharmony_ci[open,refpage='CoalescedInputCountAMDX',desc='Number of inputs coalesced for a coalescing node in a work graph',type='builtins'] 5304e5c31af7Sopenharmony_ci-- 5305e5c31af7Sopenharmony_ci:refpage: CoalescedInputCountAMDX 5306e5c31af7Sopenharmony_ci 5307e5c31af7Sopenharmony_cicode:CoalescedInputCountAMDX:: 5308e5c31af7Sopenharmony_ci 5309e5c31af7Sopenharmony_ciDecorating a variable with the code:CoalescedInputCountAMDX built-in 5310e5c31af7Sopenharmony_cidecoration will make that variable contain the number of node dispatches 5311e5c31af7Sopenharmony_cithat the implementation coalesced into the input for the current shader. 5312e5c31af7Sopenharmony_ciThis variable will take a value in the range [eq]#[1, arraySize)#, where 5313e5c31af7Sopenharmony_ci[eq]#arraySize# is the maximum size of the input payload array for the 5314e5c31af7Sopenharmony_cishader. 5315e5c31af7Sopenharmony_ci 5316e5c31af7Sopenharmony_ci.Valid Usage 5317e5c31af7Sopenharmony_ci**** 5318e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoalescedInputCountAMDX-09172]] 5319e5c31af7Sopenharmony_ci The variable decorated with code:CoalescedInputCountAMDX must: be 5320e5c31af7Sopenharmony_ci declared using the code:Input {StorageClass} 5321e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoalescedInputCountAMDX-09173]] 5322e5c31af7Sopenharmony_ci If a variable is decorated with code:CoalescedInputCountAMDX, the 5323e5c31af7Sopenharmony_ci code:CoalescingAMDX execution mode must: be declared 5324e5c31af7Sopenharmony_ci * [[VUID-{refpage}-CoalescedInputCountAMDX-09174]] 5325e5c31af7Sopenharmony_ci The variable decorated with code:CoalescedInputCountAMDX must: be 5326e5c31af7Sopenharmony_ci declared as a scalar 32-bit integer value 5327e5c31af7Sopenharmony_ci**** 5328e5c31af7Sopenharmony_ci-- 5329e5c31af7Sopenharmony_ci 5330e5c31af7Sopenharmony_ci[open,refpage='ShaderIndexAMDX',desc='Index assigned to the shader within the workgraph',type='builtins'] 5331e5c31af7Sopenharmony_ci-- 5332e5c31af7Sopenharmony_ci:refpage: ShaderIndexAMDX 5333e5c31af7Sopenharmony_ci 5334e5c31af7Sopenharmony_cicode:ShaderIndexAMDX:: 5335e5c31af7Sopenharmony_ci 5336e5c31af7Sopenharmony_ciDecorating a variable with the code:ShaderIndexAMDX built-in decoration will 5337e5c31af7Sopenharmony_cimake that variable contain the index of the shader specified when it was 5338e5c31af7Sopenharmony_cicompiled, either via 5339e5c31af7Sopenharmony_cislink:VkPipelineShaderStageNodeCreateInfoAMDX::pname:index or by the 5340e5c31af7Sopenharmony_cicode:ShaderIndexAMDX execution mode. 5341e5c31af7Sopenharmony_ci 5342e5c31af7Sopenharmony_ci.Valid Usage 5343e5c31af7Sopenharmony_ci**** 5344e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ShaderIndexAMDX-09175]] 5345e5c31af7Sopenharmony_ci The variable decorated with code:ShaderIndexAMDX must: be declared using 5346e5c31af7Sopenharmony_ci the code:Input {StorageClass} 5347e5c31af7Sopenharmony_ci * [[VUID-{refpage}-ShaderIndexAMDX-09176]] 5348e5c31af7Sopenharmony_ci The variable decorated with code:ShaderIndexAMDX must: be declared as a 5349e5c31af7Sopenharmony_ci scalar 32-bit integer value 5350e5c31af7Sopenharmony_ci**** 5351e5c31af7Sopenharmony_ci-- 5352e5c31af7Sopenharmony_ciendif::VK_AMDX_shader_enqueue[] 5353