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