1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[[fxvertex]]
6e5c31af7Sopenharmony_ci= Fixed-Function Vertex Processing
7e5c31af7Sopenharmony_ci
8e5c31af7Sopenharmony_ciVertex fetching is controlled via configurable state, as a logically
9e5c31af7Sopenharmony_cidistinct graphics pipeline stage.
10e5c31af7Sopenharmony_ci
11e5c31af7Sopenharmony_ci
12e5c31af7Sopenharmony_ci[[fxvertex-attrib]]
13e5c31af7Sopenharmony_ci== Vertex Attributes
14e5c31af7Sopenharmony_ci
15e5c31af7Sopenharmony_ciVertex shaders can: define input variables, which receive _vertex attribute_
16e5c31af7Sopenharmony_cidata transferred from one or more sname:VkBuffer(s) by drawing commands.
17e5c31af7Sopenharmony_ciVertex shader input variables are bound to buffers via an indirect binding
18e5c31af7Sopenharmony_ciwhere the vertex shader associates a _vertex input attribute_ number with
19e5c31af7Sopenharmony_cieach variable, vertex input attributes are associated to _vertex input
20e5c31af7Sopenharmony_cibindings_ on a per-pipeline basis, and vertex input bindings are associated
21e5c31af7Sopenharmony_ciwith specific buffers on a per-draw basis via the
22e5c31af7Sopenharmony_cifname:vkCmdBindVertexBuffers command.
23e5c31af7Sopenharmony_ciVertex input attribute and vertex input binding descriptions also contain
24e5c31af7Sopenharmony_ciformat information controlling how data is extracted from buffer memory and
25e5c31af7Sopenharmony_ciconverted to the format expected by the vertex shader.
26e5c31af7Sopenharmony_ci
27e5c31af7Sopenharmony_ciThere are sname:VkPhysicalDeviceLimits::pname:maxVertexInputAttributes
28e5c31af7Sopenharmony_cinumber of vertex input attributes and
29e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings number of vertex
30e5c31af7Sopenharmony_ciinput bindings (each referred to by zero-based indices), where there are at
31e5c31af7Sopenharmony_cileast as many vertex input attributes as there are vertex input bindings.
32e5c31af7Sopenharmony_ciApplications can: store multiple vertex input attributes interleaved in a
33e5c31af7Sopenharmony_cisingle buffer, and use a single vertex input binding to access those
34e5c31af7Sopenharmony_ciattributes.
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ciIn GLSL, vertex shaders associate input variables with a vertex input
37e5c31af7Sopenharmony_ciattribute number using the code:location layout qualifier.
38e5c31af7Sopenharmony_ciThe code:component layout qualifier associates components of a vertex shader
39e5c31af7Sopenharmony_ciinput variable with components of a vertex input attribute.
40e5c31af7Sopenharmony_ci
41e5c31af7Sopenharmony_ci.GLSL example
42e5c31af7Sopenharmony_ci[source,glsl]
43e5c31af7Sopenharmony_ci---------------------------------------------------
44e5c31af7Sopenharmony_ci// Assign location M to variableName
45e5c31af7Sopenharmony_cilayout (location=M, component=2) in vec2 variableName;
46e5c31af7Sopenharmony_ci
47e5c31af7Sopenharmony_ci// Assign locations [N,N+L) to the array elements of variableNameArray
48e5c31af7Sopenharmony_cilayout (location=N) in vec4 variableNameArray[L];
49e5c31af7Sopenharmony_ci---------------------------------------------------
50e5c31af7Sopenharmony_ci
51e5c31af7Sopenharmony_ciIn SPIR-V, vertex shaders associate input variables with a vertex input
52e5c31af7Sopenharmony_ciattribute number using the code:Location decoration.
53e5c31af7Sopenharmony_ciThe code:Component decoration associates components of a vertex shader input
54e5c31af7Sopenharmony_civariable with components of a vertex input attribute.
55e5c31af7Sopenharmony_ciThe code:Location and code:Component decorations are specified via the
56e5c31af7Sopenharmony_cicode:OpDecorate instruction.
57e5c31af7Sopenharmony_ci
58e5c31af7Sopenharmony_ci.SPIR-V example
59e5c31af7Sopenharmony_ci[source,spirv]
60e5c31af7Sopenharmony_ci---------------------------------------------------
61e5c31af7Sopenharmony_ci               ...
62e5c31af7Sopenharmony_ci          %1 = OpExtInstImport "GLSL.std.450"
63e5c31af7Sopenharmony_ci               ...
64e5c31af7Sopenharmony_ci               OpName %9 "variableName"
65e5c31af7Sopenharmony_ci               OpName %15 "variableNameArray"
66e5c31af7Sopenharmony_ci               OpDecorate %18 BuiltIn VertexIndex
67e5c31af7Sopenharmony_ci               OpDecorate %19 BuiltIn InstanceIndex
68e5c31af7Sopenharmony_ci               OpDecorate %9 Location M
69e5c31af7Sopenharmony_ci               OpDecorate %9 Component 2
70e5c31af7Sopenharmony_ci               OpDecorate %15 Location N
71e5c31af7Sopenharmony_ci               ...
72e5c31af7Sopenharmony_ci          %2 = OpTypeVoid
73e5c31af7Sopenharmony_ci          %3 = OpTypeFunction %2
74e5c31af7Sopenharmony_ci          %6 = OpTypeFloat 32
75e5c31af7Sopenharmony_ci          %7 = OpTypeVector %6 2
76e5c31af7Sopenharmony_ci          %8 = OpTypePointer Input %7
77e5c31af7Sopenharmony_ci          %9 = OpVariable %8 Input
78e5c31af7Sopenharmony_ci         %10 = OpTypeVector %6 4
79e5c31af7Sopenharmony_ci         %11 = OpTypeInt 32 0
80e5c31af7Sopenharmony_ci         %12 = OpConstant %11 L
81e5c31af7Sopenharmony_ci         %13 = OpTypeArray %10 %12
82e5c31af7Sopenharmony_ci         %14 = OpTypePointer Input %13
83e5c31af7Sopenharmony_ci         %15 = OpVariable %14 Input
84e5c31af7Sopenharmony_ci               ...
85e5c31af7Sopenharmony_ci---------------------------------------------------
86e5c31af7Sopenharmony_ci
87e5c31af7Sopenharmony_ci
88e5c31af7Sopenharmony_ci[[fxvertex-attrib-location]]
89e5c31af7Sopenharmony_ci=== Attribute Location and Component Assignment
90e5c31af7Sopenharmony_ci
91e5c31af7Sopenharmony_ciVertex shaders allow code:Location and code:Component decorations on input
92e5c31af7Sopenharmony_civariable declarations.
93e5c31af7Sopenharmony_ciThe code:Location decoration specifies which vertex input attribute is used
94e5c31af7Sopenharmony_cito read and interpret the data that a variable will consume.
95e5c31af7Sopenharmony_ciThe code:Component decoration allows the location to be more finely
96e5c31af7Sopenharmony_cispecified for scalars and vectors, down to the individual components within
97e5c31af7Sopenharmony_cia location that are consumed.
98e5c31af7Sopenharmony_ciThe components within a location are 0, 1, 2, and 3.
99e5c31af7Sopenharmony_ciA variable starting at component N will consume components N, N+1, N+2, ...
100e5c31af7Sopenharmony_ciup through its size.
101e5c31af7Sopenharmony_ciFor single precision types, it is invalid if the sequence of components gets
102e5c31af7Sopenharmony_cilarger than 3.
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_ciWhen a vertex shader input variable declared using a 16- or 32-bit scalar or
105e5c31af7Sopenharmony_civector data type is assigned a location, its value(s) are taken from the
106e5c31af7Sopenharmony_cicomponents of the input attribute specified with the corresponding
107e5c31af7Sopenharmony_cisname:VkVertexInputAttributeDescription::pname:location.
108e5c31af7Sopenharmony_ciThe components used depend on the type of variable and the code:Component
109e5c31af7Sopenharmony_cidecoration specified in the variable declaration, as identified in
110e5c31af7Sopenharmony_ci<<fxvertex-attrib-components>>.
111e5c31af7Sopenharmony_ciAny 16-bit or 32-bit scalar or vector input will consume a single location.
112e5c31af7Sopenharmony_ciFor 16-bit and 32-bit data types, missing components are filled in with
113e5c31af7Sopenharmony_cidefault values as described <<fxvertex-input-extraction,below>>.
114e5c31af7Sopenharmony_ci
115e5c31af7Sopenharmony_ci
116e5c31af7Sopenharmony_ci[[fxvertex-attrib-components]]
117e5c31af7Sopenharmony_ci.Input attribute components accessed by 16-bit and 32-bit input variables
118e5c31af7Sopenharmony_ci[width="65%",cols="<5,<3,<3",options="header"]
119e5c31af7Sopenharmony_ci|====
120e5c31af7Sopenharmony_ci| 16-bit or 32-bit data type | code:Component decoration | Components consumed
121e5c31af7Sopenharmony_ci| scalar                     | 0 or unspecified             | (x, o, o, o)
122e5c31af7Sopenharmony_ci| scalar                     | 1                            | (o, y, o, o)
123e5c31af7Sopenharmony_ci| scalar                     | 2                            | (o, o, z, o)
124e5c31af7Sopenharmony_ci| scalar                     | 3                            | (o, o, o, w)
125e5c31af7Sopenharmony_ci| two-component vector       | 0 or unspecified             | (x, y, o, o)
126e5c31af7Sopenharmony_ci| two-component vector       | 1                            | (o, y, z, o)
127e5c31af7Sopenharmony_ci| two-component vector       | 2                            | (o, o, z, w)
128e5c31af7Sopenharmony_ci| three-component vector     | 0 or unspecified             | (x, y, z, o)
129e5c31af7Sopenharmony_ci| three-component vector     | 1                            | (o, y, z, w)
130e5c31af7Sopenharmony_ci| four-component vector      | 0 or unspecified             | (x, y, z, w)
131e5c31af7Sopenharmony_ci|====
132e5c31af7Sopenharmony_ci
133e5c31af7Sopenharmony_ciComponents indicated by "`o`" are available for use by other input variables
134e5c31af7Sopenharmony_ciwhich are sourced from the same attribute, and if used, are either filled
135e5c31af7Sopenharmony_ciwith the corresponding component from the input format (if present), or the
136e5c31af7Sopenharmony_cidefault value.
137e5c31af7Sopenharmony_ci
138e5c31af7Sopenharmony_ciWhen a vertex shader input variable declared using a 32-bit floating point
139e5c31af7Sopenharmony_cimatrix type is assigned a location _i_, its values are taken from
140e5c31af7Sopenharmony_ciconsecutive input attributes starting with the corresponding
141e5c31af7Sopenharmony_cisname:VkVertexInputAttributeDescription::pname:location.
142e5c31af7Sopenharmony_ciSuch matrices are treated as an array of column vectors with values taken
143e5c31af7Sopenharmony_cifrom the input attributes identified in <<fxvertex-attrib-matrix>>.
144e5c31af7Sopenharmony_ciThe sname:VkVertexInputAttributeDescription::pname:format must: be specified
145e5c31af7Sopenharmony_ciwith a elink:VkFormat that corresponds to the appropriate type of column
146e5c31af7Sopenharmony_civector.
147e5c31af7Sopenharmony_ciThe code:Component decoration must: not be used with matrix types.
148e5c31af7Sopenharmony_ci
149e5c31af7Sopenharmony_ci[[fxvertex-attrib-matrix]]
150e5c31af7Sopenharmony_ci.Input attributes accessed by 32-bit input matrix variables
151e5c31af7Sopenharmony_ci[width="100%",cols="<10%,<24%,<21%,<45%",options="header"]
152e5c31af7Sopenharmony_ci|====
153e5c31af7Sopenharmony_ci| Data type     | Column vector type        | Locations consumed    | Components consumed
154e5c31af7Sopenharmony_ci| mat2          | two-component vector      | i, i+1                | (x, y, o, o), (x, y, o, o)
155e5c31af7Sopenharmony_ci| mat2x3        | three-component vector    | i, i+1                | (x, y, z, o), (x, y, z, o)
156e5c31af7Sopenharmony_ci| mat2x4        | four-component vector     | i, i+1                | (x, y, z, w), (x, y, z, w)
157e5c31af7Sopenharmony_ci| mat3x2        | two-component vector      | i, i+1, i+2           | (x, y, o, o), (x, y, o, o), (x, y, o, o)
158e5c31af7Sopenharmony_ci| mat3          | three-component vector    | i, i+1, i+2           | (x, y, z, o), (x, y, z, o), (x, y, z, o)
159e5c31af7Sopenharmony_ci| mat3x4        | four-component vector     | i, i+1, i+2           | (x, y, z, w), (x, y, z, w), (x, y, z, w)
160e5c31af7Sopenharmony_ci| mat4x2        | two-component vector      | i, i+1, i+2, i+3      | (x, y, o, o), (x, y, o, o), (x, y, o, o), (x, y, o, o)
161e5c31af7Sopenharmony_ci| mat4x3        | three-component vector    | i, i+1, i+2, i+3      | (x, y, z, o), (x, y, z, o), (x, y, z, o), (x, y, z, o)
162e5c31af7Sopenharmony_ci| mat4          | four-component vector     | i, i+1, i+2, i+3      | (x, y, z, w), (x, y, z, w), (x, y, z, w), (x, y, z, w)
163e5c31af7Sopenharmony_ci|====
164e5c31af7Sopenharmony_ci
165e5c31af7Sopenharmony_ciComponents indicated by "`o`" are available for use by other input variables
166e5c31af7Sopenharmony_ciwhich are sourced from the same attribute, and if used, are either filled
167e5c31af7Sopenharmony_ciwith the corresponding component from the input (if present), or the default
168e5c31af7Sopenharmony_civalue.
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_ciWhen a vertex shader input variable declared using a scalar or vector 64-bit
171e5c31af7Sopenharmony_cidata type is assigned a location _i_, its values are taken from consecutive
172e5c31af7Sopenharmony_ciinput attributes starting with the corresponding
173e5c31af7Sopenharmony_cisname:VkVertexInputAttributeDescription::pname:location.
174e5c31af7Sopenharmony_ciThe locations and components used depend on the type of variable and the
175e5c31af7Sopenharmony_cicode:Component decoration specified in the variable declaration, as
176e5c31af7Sopenharmony_ciidentified in <<fxvertex-attrib-double>>.
177e5c31af7Sopenharmony_ciFor 64-bit data types, no default attribute values are provided.
178e5c31af7Sopenharmony_ciInput variables must: not use more components than provided by the
179e5c31af7Sopenharmony_ciattribute.
180e5c31af7Sopenharmony_ciInput attributes which have one- or two-component 64-bit formats will
181e5c31af7Sopenharmony_ciconsume a single location.
182e5c31af7Sopenharmony_ciInput attributes which have three- or four-component 64-bit formats will
183e5c31af7Sopenharmony_ciconsume two consecutive locations.
184e5c31af7Sopenharmony_ciA 64-bit scalar data type will consume two components, and a 64-bit
185e5c31af7Sopenharmony_citwo-component vector data type will consume all four components available
186e5c31af7Sopenharmony_ciwithin a location.
187e5c31af7Sopenharmony_ciA three- or four-component 64-bit data type must: not specify a component.
188e5c31af7Sopenharmony_ciA three-component 64-bit data type will consume all four components of the
189e5c31af7Sopenharmony_cifirst location and components 0 and 1 of the second location.
190e5c31af7Sopenharmony_ciThis leaves components 2 and 3 available for other component-qualified
191e5c31af7Sopenharmony_cideclarations.
192e5c31af7Sopenharmony_ciA four-component 64-bit data type will consume all four components of the
193e5c31af7Sopenharmony_cifirst location and all four components of the second location.
194e5c31af7Sopenharmony_ciIt is invalid for a scalar or two-component 64-bit data type to specify a
195e5c31af7Sopenharmony_cicomponent of 1 or 3.
196e5c31af7Sopenharmony_ci
197e5c31af7Sopenharmony_ci[[fxvertex-attrib-double]]
198e5c31af7Sopenharmony_ci.Input attribute locations and components accessed by 64-bit input variables
199e5c31af7Sopenharmony_ci[width="100%",cols="<18%,^12%,<25%,^14%,^18%,<13%",options="header"]
200e5c31af7Sopenharmony_ci|====
201e5c31af7Sopenharmony_ci^.^| Input format | Locations consumed
202e5c31af7Sopenharmony_ci        ^.^| 64-bit data type   |code:Location decoration |code:Component decoration ^| 32-bit components consumed
203e5c31af7Sopenharmony_ci| R64          | i
204e5c31af7Sopenharmony_ci        | scalar                  | i                         | 0 or unspecified           | (x, y, -, -)
205e5c31af7Sopenharmony_ci.3+<.^| R64G64 .3+^.^| i
206e5c31af7Sopenharmony_ci        | scalar                  | i                         | 0 or unspecified           | (x, y, o, o)
207e5c31af7Sopenharmony_ci        | scalar                  | i                         | 2                          | (o, o, z, w)
208e5c31af7Sopenharmony_ci        | two-component vector    | i                         | 0 or unspecified           | (x, y, z, w)
209e5c31af7Sopenharmony_ci.5+<.^| R64G64B64 .5+^.^| i, i+1
210e5c31af7Sopenharmony_ci        | scalar                  | i                         | 0 or unspecified           | (x, y, o, o), (o, o, -, -)
211e5c31af7Sopenharmony_ci        | scalar                  | i                         | 2                          | (o, o, z, w), (o, o, -, -)
212e5c31af7Sopenharmony_ci        | scalar                  | i+1                       | 0 or unspecified           | (o, o, o, o), (x, y, -, -)
213e5c31af7Sopenharmony_ci        | two-component vector    | i                         | 0 or unspecified           | (x, y, z, w), (o, o, -, -)
214e5c31af7Sopenharmony_ci        | three-component vector  | i                         | unspecified                | (x, y, z, w), (x, y, -, -)
215e5c31af7Sopenharmony_ci.8+<.^| R64G64B64A64 .8+^.^| i, i+1
216e5c31af7Sopenharmony_ci        | scalar                  | i                         | 0 or unspecified           | (x, y, o, o), (o, o, o, o)
217e5c31af7Sopenharmony_ci        | scalar                  | i                         | 2                          | (o, o, z, w), (o, o, o, o)
218e5c31af7Sopenharmony_ci        | scalar                  | i+1                       | 0 or unspecified           | (o, o, o, o), (x, y, o, o)
219e5c31af7Sopenharmony_ci        | scalar                  | i+1                       | 2                          | (o, o, o, o), (o, o, z, w)
220e5c31af7Sopenharmony_ci        | two-component vector    | i                         | 0 or unspecified           | (x, y, z, w), (o, o, o, o)
221e5c31af7Sopenharmony_ci        | two-component vector    | i+1                       | 0 or unspecified           | (o, o, o, o), (x, y, z, w)
222e5c31af7Sopenharmony_ci        | three-component vector  | i                         | unspecified                | (x, y, z, w), (x, y, o, o)
223e5c31af7Sopenharmony_ci        | four-component vector   | i                         | unspecified                | (x, y, z, w), (x, y, z, w)
224e5c31af7Sopenharmony_ci|====
225e5c31af7Sopenharmony_ci
226e5c31af7Sopenharmony_ciComponents indicated by "`o`" are available for use by other input variables
227e5c31af7Sopenharmony_ciwhich are sourced from the same attribute.
228e5c31af7Sopenharmony_ciComponents indicated by "`-`" are not available for input variables as there
229e5c31af7Sopenharmony_ciare no default values provided for 64-bit data types, and there is no data
230e5c31af7Sopenharmony_ciprovided by the input format.
231e5c31af7Sopenharmony_ci
232e5c31af7Sopenharmony_ciWhen a vertex shader input variable declared using a 64-bit floating-point
233e5c31af7Sopenharmony_cimatrix type is assigned a location _i_, its values are taken from
234e5c31af7Sopenharmony_ciconsecutive input attribute locations.
235e5c31af7Sopenharmony_ciSuch matrices are treated as an array of column vectors with values taken
236e5c31af7Sopenharmony_cifrom the input attributes as shown in <<fxvertex-attrib-double>>.
237e5c31af7Sopenharmony_ciEach column vector starts at the location immediately following the last
238e5c31af7Sopenharmony_cilocation of the previous column vector.
239e5c31af7Sopenharmony_ciThe number of attributes and components assigned to each matrix is
240e5c31af7Sopenharmony_cidetermined by the matrix dimensions and ranges from two to eight locations.
241e5c31af7Sopenharmony_ci
242e5c31af7Sopenharmony_ciWhen a vertex shader input variable declared using an array type is assigned
243e5c31af7Sopenharmony_cia location, its values are taken from consecutive input attributes starting
244e5c31af7Sopenharmony_ciwith the corresponding
245e5c31af7Sopenharmony_cisname:VkVertexInputAttributeDescription::pname:location.
246e5c31af7Sopenharmony_ciThe number of attributes and components assigned to each element are
247e5c31af7Sopenharmony_cidetermined according to the data type of the array elements and
248e5c31af7Sopenharmony_cicode:Component decoration (if any) specified in the declaration of the
249e5c31af7Sopenharmony_ciarray, as described above.
250e5c31af7Sopenharmony_ciEach element of the array, in order, is assigned to consecutive locations,
251e5c31af7Sopenharmony_cibut all at the same specified component within each location.
252e5c31af7Sopenharmony_ci
253e5c31af7Sopenharmony_ciOnly input variables declared with the data types and component decorations
254e5c31af7Sopenharmony_cias specified above are supported.
255e5c31af7Sopenharmony_ci_Location aliasing_ is causing two variables to have the same location
256e5c31af7Sopenharmony_cinumber.
257e5c31af7Sopenharmony_ci_Component aliasing_ is assigning the same (or overlapping) component number
258e5c31af7Sopenharmony_cifor two location aliases.
259e5c31af7Sopenharmony_ciLocation aliasing is allowed only if it does not cause component aliasing.
260e5c31af7Sopenharmony_ciFurther, when location aliasing, the aliases sharing the location must: all
261e5c31af7Sopenharmony_cihave the same SPIR-V floating-point component type or all have the same
262e5c31af7Sopenharmony_ciwidth integer-type components.
263e5c31af7Sopenharmony_ci
264e5c31af7Sopenharmony_ci
265e5c31af7Sopenharmony_ci[[fxvertex-input]]
266e5c31af7Sopenharmony_ci== Vertex Input Description
267e5c31af7Sopenharmony_ci
268e5c31af7Sopenharmony_ciApplications specify vertex input attribute and vertex input binding
269e5c31af7Sopenharmony_cidescriptions as part of graphics pipeline creation by setting the
270e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo::pname:pVertexInputState pointer to a
271e5c31af7Sopenharmony_cislink:VkPipelineVertexInputStateCreateInfo structure.
272e5c31af7Sopenharmony_ciifdef::VK_EXT_vertex_input_dynamic_state[]
273e5c31af7Sopenharmony_ciAlternatively, if the graphics pipeline is created with the
274e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_VERTEX_INPUT_EXT dynamic state enabled, then the
275e5c31af7Sopenharmony_civertex input attribute and vertex input binding descriptions are specified
276e5c31af7Sopenharmony_cidynamically with flink:vkCmdSetVertexInputEXT, and the
277e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo::pname:pVertexInputState pointer is
278e5c31af7Sopenharmony_ciignored.
279e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_input_dynamic_state[]
280e5c31af7Sopenharmony_ci
281e5c31af7Sopenharmony_ci[open,refpage='VkPipelineVertexInputStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline vertex input state',type='structs']
282e5c31af7Sopenharmony_ci--
283e5c31af7Sopenharmony_ciThe sname:VkPipelineVertexInputStateCreateInfo structure is defined as:
284e5c31af7Sopenharmony_ci
285e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineVertexInputStateCreateInfo.txt[]
286e5c31af7Sopenharmony_ci
287e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
288e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
289e5c31af7Sopenharmony_ci    structure.
290e5c31af7Sopenharmony_ci  * pname:flags is reserved for future use.
291e5c31af7Sopenharmony_ci  * pname:vertexBindingDescriptionCount is the number of vertex binding
292e5c31af7Sopenharmony_ci    descriptions provided in pname:pVertexBindingDescriptions.
293e5c31af7Sopenharmony_ci  * pname:pVertexBindingDescriptions is a pointer to an array of
294e5c31af7Sopenharmony_ci    sname:VkVertexInputBindingDescription structures.
295e5c31af7Sopenharmony_ci  * pname:vertexAttributeDescriptionCount is the number of vertex attribute
296e5c31af7Sopenharmony_ci    descriptions provided in pname:pVertexAttributeDescriptions.
297e5c31af7Sopenharmony_ci  * pname:pVertexAttributeDescriptions is a pointer to an array of
298e5c31af7Sopenharmony_ci    sname:VkVertexInputAttributeDescription structures.
299e5c31af7Sopenharmony_ci
300e5c31af7Sopenharmony_ci.Valid Usage
301e5c31af7Sopenharmony_ci****
302e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineVertexInputStateCreateInfo-vertexBindingDescriptionCount-00613]]
303e5c31af7Sopenharmony_ci    pname:vertexBindingDescriptionCount must: be less than or equal to
304e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
305e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineVertexInputStateCreateInfo-vertexAttributeDescriptionCount-00614]]
306e5c31af7Sopenharmony_ci    pname:vertexAttributeDescriptionCount must: be less than or equal to
307e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputAttributes
308e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineVertexInputStateCreateInfo-binding-00615]]
309e5c31af7Sopenharmony_ci    For every pname:binding specified by each element of
310e5c31af7Sopenharmony_ci    pname:pVertexAttributeDescriptions, a
311e5c31af7Sopenharmony_ci    sname:VkVertexInputBindingDescription must: exist in
312e5c31af7Sopenharmony_ci    pname:pVertexBindingDescriptions with the same value of pname:binding
313e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineVertexInputStateCreateInfo-pVertexBindingDescriptions-00616]]
314e5c31af7Sopenharmony_ci    All elements of pname:pVertexBindingDescriptions must: describe distinct
315e5c31af7Sopenharmony_ci    binding numbers
316e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineVertexInputStateCreateInfo-pVertexAttributeDescriptions-00617]]
317e5c31af7Sopenharmony_ci    All elements of pname:pVertexAttributeDescriptions must: describe
318e5c31af7Sopenharmony_ci    distinct attribute locations
319e5c31af7Sopenharmony_ci****
320e5c31af7Sopenharmony_ci
321e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineVertexInputStateCreateInfo.txt[]
322e5c31af7Sopenharmony_ci--
323e5c31af7Sopenharmony_ci
324e5c31af7Sopenharmony_ci[open,refpage='VkPipelineVertexInputStateCreateFlags',desc='Reserved for future use',type='flags']
325e5c31af7Sopenharmony_ci--
326e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineVertexInputStateCreateFlags.txt[]
327e5c31af7Sopenharmony_ci
328e5c31af7Sopenharmony_citname:VkPipelineVertexInputStateCreateFlags is a bitmask type for setting a
329e5c31af7Sopenharmony_cimask, but is currently reserved for future use.
330e5c31af7Sopenharmony_ci--
331e5c31af7Sopenharmony_ci
332e5c31af7Sopenharmony_ci[open,refpage='VkVertexInputBindingDescription',desc='Structure specifying vertex input binding description',type='structs']
333e5c31af7Sopenharmony_ci--
334e5c31af7Sopenharmony_ciEach vertex input binding is specified by the
335e5c31af7Sopenharmony_cisname:VkVertexInputBindingDescription structure, defined as:
336e5c31af7Sopenharmony_ci
337e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkVertexInputBindingDescription.txt[]
338e5c31af7Sopenharmony_ci
339e5c31af7Sopenharmony_ci  * pname:binding is the binding number that this structure describes.
340e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between consecutive elements within the
341e5c31af7Sopenharmony_ci    buffer.
342e5c31af7Sopenharmony_ci  * pname:inputRate is a elink:VkVertexInputRate value specifying whether
343e5c31af7Sopenharmony_ci    vertex attribute addressing is a function of the vertex index or of the
344e5c31af7Sopenharmony_ci    instance index.
345e5c31af7Sopenharmony_ci
346e5c31af7Sopenharmony_ci.Valid Usage
347e5c31af7Sopenharmony_ci****
348e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription-binding-00618]]
349e5c31af7Sopenharmony_ci    pname:binding must: be less than
350e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
351e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription-stride-00619]]
352e5c31af7Sopenharmony_ci    pname:stride must: be less than or equal to
353e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindingStride
354e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
355e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription-stride-04456]]
356e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled,
357e5c31af7Sopenharmony_ci    pname:stride must: be a multiple of, and at least as large as,
358e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetPropertiesKHR::pname:minVertexInputBindingStrideAlignment
359e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
360e5c31af7Sopenharmony_ci****
361e5c31af7Sopenharmony_ci
362e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkVertexInputBindingDescription.txt[]
363e5c31af7Sopenharmony_ci--
364e5c31af7Sopenharmony_ci
365e5c31af7Sopenharmony_ci[open,refpage='VkVertexInputRate',desc='Specify rate at which vertex attributes are pulled from buffers',type='enums']
366e5c31af7Sopenharmony_ci--
367e5c31af7Sopenharmony_ciPossible values of slink:VkVertexInputBindingDescription::pname:inputRate,
368e5c31af7Sopenharmony_cispecifying the rate at which vertex attributes are pulled from buffers, are:
369e5c31af7Sopenharmony_ci
370e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkVertexInputRate.txt[]
371e5c31af7Sopenharmony_ci
372e5c31af7Sopenharmony_ci  * ename:VK_VERTEX_INPUT_RATE_VERTEX specifies that vertex attribute
373e5c31af7Sopenharmony_ci    addressing is a function of the vertex index.
374e5c31af7Sopenharmony_ci  * ename:VK_VERTEX_INPUT_RATE_INSTANCE specifies that vertex attribute
375e5c31af7Sopenharmony_ci    addressing is a function of the instance index.
376e5c31af7Sopenharmony_ci--
377e5c31af7Sopenharmony_ci
378e5c31af7Sopenharmony_ci[open,refpage='VkVertexInputAttributeDescription',desc='Structure specifying vertex input attribute description',type='structs']
379e5c31af7Sopenharmony_ci--
380e5c31af7Sopenharmony_ciEach vertex input attribute is specified by the
381e5c31af7Sopenharmony_cisname:VkVertexInputAttributeDescription structure, defined as:
382e5c31af7Sopenharmony_ci
383e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkVertexInputAttributeDescription.txt[]
384e5c31af7Sopenharmony_ci
385e5c31af7Sopenharmony_ci  * pname:location is the shader input location number for this attribute.
386e5c31af7Sopenharmony_ci  * pname:binding is the binding number which this attribute takes its data
387e5c31af7Sopenharmony_ci    from.
388e5c31af7Sopenharmony_ci  * pname:format is the size and type of the vertex attribute data.
389e5c31af7Sopenharmony_ci  * pname:offset is a byte offset of this attribute relative to the start of
390e5c31af7Sopenharmony_ci    an element in the vertex input binding.
391e5c31af7Sopenharmony_ci
392e5c31af7Sopenharmony_ci.Valid Usage
393e5c31af7Sopenharmony_ci****
394e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription-location-00620]]
395e5c31af7Sopenharmony_ci    pname:location must: be less than
396e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputAttributes
397e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription-binding-00621]]
398e5c31af7Sopenharmony_ci    pname:binding must: be less than
399e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
400e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription-offset-00622]]
401e5c31af7Sopenharmony_ci    pname:offset must: be less than or equal to
402e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputAttributeOffset
403e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription-format-00623]]
404e5c31af7Sopenharmony_ci    pname:format must: be allowed as a vertex buffer format, as specified by
405e5c31af7Sopenharmony_ci    the ename:VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT flag in
406e5c31af7Sopenharmony_ci    sname:VkFormatProperties::pname:bufferFeatures returned by
407e5c31af7Sopenharmony_ci    fname:vkGetPhysicalDeviceFormatProperties
408e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
409e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription-vertexAttributeAccessBeyondStride-04457]]
410e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
411e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:vertexAttributeAccessBeyondStride
412e5c31af7Sopenharmony_ci    is ename:VK_FALSE, the sum of pname:offset plus the size of the vertex
413e5c31af7Sopenharmony_ci    attribute data described by pname:format must: not be greater than
414e5c31af7Sopenharmony_ci    pname:stride in the slink:VkVertexInputBindingDescription referenced in
415e5c31af7Sopenharmony_ci    pname:binding
416e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
417e5c31af7Sopenharmony_ci****
418e5c31af7Sopenharmony_ci
419e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkVertexInputAttributeDescription.txt[]
420e5c31af7Sopenharmony_ci--
421e5c31af7Sopenharmony_ci
422e5c31af7Sopenharmony_ciifdef::VK_EXT_vertex_input_dynamic_state[]
423e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetVertexInputEXT',desc='Set the vertex input state dynamically for a command buffer',type='protos']
424e5c31af7Sopenharmony_ci--
425e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the vertex input attribute
426e5c31af7Sopenharmony_ciand vertex input binding descriptions, call:
427e5c31af7Sopenharmony_ci
428e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetVertexInputEXT.txt[]
429e5c31af7Sopenharmony_ci
430e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
431e5c31af7Sopenharmony_ci    recorded.
432e5c31af7Sopenharmony_ci  * pname:vertexBindingDescriptionCount is the number of vertex binding
433e5c31af7Sopenharmony_ci    descriptions provided in pname:pVertexBindingDescriptions.
434e5c31af7Sopenharmony_ci  * pname:pVertexBindingDescriptions is a pointer to an array of
435e5c31af7Sopenharmony_ci    sname:VkVertexInputBindingDescription2EXT structures.
436e5c31af7Sopenharmony_ci  * pname:vertexAttributeDescriptionCount is the number of vertex attribute
437e5c31af7Sopenharmony_ci    descriptions provided in pname:pVertexAttributeDescriptions.
438e5c31af7Sopenharmony_ci  * pname:pVertexAttributeDescriptions is a pointer to an array of
439e5c31af7Sopenharmony_ci    sname:VkVertexInputAttributeDescription2EXT structures.
440e5c31af7Sopenharmony_ci
441e5c31af7Sopenharmony_ciThis command sets the vertex input attribute and vertex input binding
442e5c31af7Sopenharmony_cidescriptions state for subsequent drawing commands when the graphics
443e5c31af7Sopenharmony_cipipeline is created with ename:VK_DYNAMIC_STATE_VERTEX_INPUT_EXT set in
444e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
445e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
446e5c31af7Sopenharmony_cislink:VkGraphicsPipelineCreateInfo::pname:pVertexInputState values used to
447e5c31af7Sopenharmony_cicreate the currently active pipeline.
448e5c31af7Sopenharmony_ci
449e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[]
450e5c31af7Sopenharmony_ciIf the bound pipeline state object was also created with the
451e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT dynamic state
452e5c31af7Sopenharmony_cienabled, then flink:vkCmdBindVertexBuffers2EXT can be used instead of
453e5c31af7Sopenharmony_cifname:vkCmdSetVertexInputEXT to dynamically set the stride.
454e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[]
455e5c31af7Sopenharmony_ci
456e5c31af7Sopenharmony_ci.Valid Usage
457e5c31af7Sopenharmony_ci****
458e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetVertexInputEXT-None-04790]]
459e5c31af7Sopenharmony_ci    The <<features-vertexInputDynamicState, vertexInputDynamicState>>
460e5c31af7Sopenharmony_ci    feature must: be enabled
461e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetVertexInputEXT-vertexBindingDescriptionCount-04791]]
462e5c31af7Sopenharmony_ci    pname:vertexBindingDescriptionCount must: be less than or equal to
463e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
464e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetVertexInputEXT-vertexAttributeDescriptionCount-04792]]
465e5c31af7Sopenharmony_ci    pname:vertexAttributeDescriptionCount must: be less than or equal to
466e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputAttributes
467e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetVertexInputEXT-binding-04793]]
468e5c31af7Sopenharmony_ci    For every pname:binding specified by each element of
469e5c31af7Sopenharmony_ci    pname:pVertexAttributeDescriptions, a
470e5c31af7Sopenharmony_ci    sname:VkVertexInputBindingDescription2EXT must: exist in
471e5c31af7Sopenharmony_ci    pname:pVertexBindingDescriptions with the same value of pname:binding
472e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetVertexInputEXT-pVertexBindingDescriptions-04794]]
473e5c31af7Sopenharmony_ci    All elements of pname:pVertexBindingDescriptions must: describe distinct
474e5c31af7Sopenharmony_ci    binding numbers
475e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetVertexInputEXT-pVertexAttributeDescriptions-04795]]
476e5c31af7Sopenharmony_ci    All elements of pname:pVertexAttributeDescriptions must: describe
477e5c31af7Sopenharmony_ci    distinct attribute locations
478e5c31af7Sopenharmony_ci****
479e5c31af7Sopenharmony_ci
480e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetVertexInputEXT.txt[]
481e5c31af7Sopenharmony_ci--
482e5c31af7Sopenharmony_ci
483e5c31af7Sopenharmony_ci[open,refpage='VkVertexInputBindingDescription2EXT',desc='Structure specifying the extended vertex input binding description',type='structs']
484e5c31af7Sopenharmony_ci--
485e5c31af7Sopenharmony_ciThe sname:VkVertexInputBindingDescription2EXT structure is defined as:
486e5c31af7Sopenharmony_ci
487e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkVertexInputBindingDescription2EXT.txt[]
488e5c31af7Sopenharmony_ci
489e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
490e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
491e5c31af7Sopenharmony_ci    structure.
492e5c31af7Sopenharmony_ci  * pname:binding is the binding number that this structure describes.
493e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between consecutive elements within the
494e5c31af7Sopenharmony_ci    buffer.
495e5c31af7Sopenharmony_ci  * pname:inputRate is a elink:VkVertexInputRate value specifying whether
496e5c31af7Sopenharmony_ci    vertex attribute addressing is a function of the vertex index or of the
497e5c31af7Sopenharmony_ci    instance index.
498e5c31af7Sopenharmony_ciifdef::VK_EXT_vertex_attribute_divisor[]
499e5c31af7Sopenharmony_ci  * pname:divisor is the number of successive instances that will use the
500e5c31af7Sopenharmony_ci    same value of the vertex attribute when instanced rendering is enabled.
501e5c31af7Sopenharmony_ci    This member can: be set to a value other than `1` if the
502e5c31af7Sopenharmony_ci    <<features-vertexAttributeInstanceRateDivisor,
503e5c31af7Sopenharmony_ci    vertexAttributeInstanceRateDivisor>> feature is enabled.
504e5c31af7Sopenharmony_ci    For example, if the divisor is N, the same vertex attribute will be
505e5c31af7Sopenharmony_ci    applied to N successive instances before moving on to the next vertex
506e5c31af7Sopenharmony_ci    attribute.
507e5c31af7Sopenharmony_ci    The maximum value of pname:divisor is implementation-dependent and can
508e5c31af7Sopenharmony_ci    be queried using
509e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT::pname:maxVertexAttribDivisor.
510e5c31af7Sopenharmony_ci    A value of `0` can: be used for the divisor if the
511e5c31af7Sopenharmony_ci    <<features-vertexAttributeInstanceRateZeroDivisor,pname:vertexAttributeInstanceRateZeroDivisor>>
512e5c31af7Sopenharmony_ci    feature is enabled.
513e5c31af7Sopenharmony_ci    In this case, the same vertex attribute will be applied to all
514e5c31af7Sopenharmony_ci    instances.
515e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_attribute_divisor[]
516e5c31af7Sopenharmony_ciifndef::VK_EXT_vertex_attribute_divisor[]
517e5c31af7Sopenharmony_ci  * pname:divisor must: be set to `1`
518e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_attribute_divisor[]
519e5c31af7Sopenharmony_ci
520e5c31af7Sopenharmony_ci.Valid Usage
521e5c31af7Sopenharmony_ci****
522e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription2EXT-binding-04796]]
523e5c31af7Sopenharmony_ci    pname:binding must: be less than
524e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
525e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription2EXT-stride-04797]]
526e5c31af7Sopenharmony_ci    pname:stride must: be less than or equal to
527e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindingStride
528e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription2EXT-divisor-04798]]
529e5c31af7Sopenharmony_ci    If the <<features-vertexAttributeInstanceRateZeroDivisor,
530e5c31af7Sopenharmony_ci    vertexAttributeInstanceRateZeroDivisor>> feature is not enabled,
531e5c31af7Sopenharmony_ci    pname:divisor must: not be `0`
532e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription2EXT-divisor-04799]]
533e5c31af7Sopenharmony_ci    If the <<features-vertexAttributeInstanceRateDivisor,
534e5c31af7Sopenharmony_ci    vertexAttributeInstanceRateDivisor>> feature is not enabled,
535e5c31af7Sopenharmony_ci    pname:divisor must: be `1`
536e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription2EXT-divisor-06226]]
537e5c31af7Sopenharmony_ci    pname:divisor must: be a value between `0` and
538e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT::pname:maxVertexAttribDivisor,
539e5c31af7Sopenharmony_ci    inclusive
540e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDescription2EXT-divisor-06227]]
541e5c31af7Sopenharmony_ci    If pname:divisor is not `1` then pname:inputRate must: be of type
542e5c31af7Sopenharmony_ci    ename:VK_VERTEX_INPUT_RATE_INSTANCE
543e5c31af7Sopenharmony_ci****
544e5c31af7Sopenharmony_ci
545e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkVertexInputBindingDescription2EXT.txt[]
546e5c31af7Sopenharmony_ci--
547e5c31af7Sopenharmony_ci
548e5c31af7Sopenharmony_ci[open,refpage='VkVertexInputAttributeDescription2EXT',desc='Structure specifying the extended vertex input attribute description',type='structs']
549e5c31af7Sopenharmony_ci--
550e5c31af7Sopenharmony_ciThe sname:VkVertexInputAttributeDescription2EXT structure is defined as:
551e5c31af7Sopenharmony_ci
552e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkVertexInputAttributeDescription2EXT.txt[]
553e5c31af7Sopenharmony_ci
554e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
555e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
556e5c31af7Sopenharmony_ci    structure.
557e5c31af7Sopenharmony_ci  * pname:location is the shader input location number for this attribute.
558e5c31af7Sopenharmony_ci  * pname:binding is the binding number which this attribute takes its data
559e5c31af7Sopenharmony_ci    from.
560e5c31af7Sopenharmony_ci  * pname:format is the size and type of the vertex attribute data.
561e5c31af7Sopenharmony_ci  * pname:offset is a byte offset of this attribute relative to the start of
562e5c31af7Sopenharmony_ci    an element in the vertex input binding.
563e5c31af7Sopenharmony_ci
564e5c31af7Sopenharmony_ci.Valid Usage
565e5c31af7Sopenharmony_ci****
566e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription2EXT-location-06228]]
567e5c31af7Sopenharmony_ci    pname:location must: be less than
568e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputAttributes
569e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription2EXT-binding-06229]]
570e5c31af7Sopenharmony_ci    pname:binding must: be less than
571e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
572e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription2EXT-offset-06230]]
573e5c31af7Sopenharmony_ci    pname:offset must: be less than or equal to
574e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputAttributeOffset
575e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription2EXT-format-04805]]
576e5c31af7Sopenharmony_ci    pname:format must: be allowed as a vertex buffer format, as specified by
577e5c31af7Sopenharmony_ci    the ename:VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT flag in
578e5c31af7Sopenharmony_ci    sname:VkFormatProperties::pname:bufferFeatures returned by
579e5c31af7Sopenharmony_ci    fname:vkGetPhysicalDeviceFormatProperties
580e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
581e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputAttributeDescription2EXT-vertexAttributeAccessBeyondStride-04806]]
582e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
583e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:vertexAttributeAccessBeyondStride
584e5c31af7Sopenharmony_ci    is ename:VK_FALSE, the sum of pname:offset plus the size of the vertex
585e5c31af7Sopenharmony_ci    attribute data described by pname:format must: not be greater than
586e5c31af7Sopenharmony_ci    pname:stride in the slink:VkVertexInputBindingDescription2EXT referenced
587e5c31af7Sopenharmony_ci    in pname:binding
588e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
589e5c31af7Sopenharmony_ci****
590e5c31af7Sopenharmony_ci
591e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkVertexInputAttributeDescription2EXT.txt[]
592e5c31af7Sopenharmony_ci--
593e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_input_dynamic_state[]
594e5c31af7Sopenharmony_ci
595e5c31af7Sopenharmony_ci[open,refpage='vkCmdBindVertexBuffers',desc='Bind vertex buffers to a command buffer',type='protos']
596e5c31af7Sopenharmony_ci--
597e5c31af7Sopenharmony_ciTo bind vertex buffers to a command buffer for use in subsequent drawing
598e5c31af7Sopenharmony_cicommands, call:
599e5c31af7Sopenharmony_ci
600e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBindVertexBuffers.txt[]
601e5c31af7Sopenharmony_ci
602e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
603e5c31af7Sopenharmony_ci    recorded.
604e5c31af7Sopenharmony_ci  * pname:firstBinding is the index of the first vertex input binding whose
605e5c31af7Sopenharmony_ci    state is updated by the command.
606e5c31af7Sopenharmony_ci  * pname:bindingCount is the number of vertex input bindings whose state is
607e5c31af7Sopenharmony_ci    updated by the command.
608e5c31af7Sopenharmony_ci  * pname:pBuffers is a pointer to an array of buffer handles.
609e5c31af7Sopenharmony_ci  * pname:pOffsets is a pointer to an array of buffer offsets.
610e5c31af7Sopenharmony_ci
611e5c31af7Sopenharmony_ciThe values taken from elements [eq]#i# of pname:pBuffers and pname:pOffsets
612e5c31af7Sopenharmony_cireplace the current state for the vertex input binding
613e5c31af7Sopenharmony_ci[eq]#pname:firstBinding {plus} i#, for [eq]#i# in [eq]#[0,
614e5c31af7Sopenharmony_cipname:bindingCount)#.
615e5c31af7Sopenharmony_ciThe vertex input binding is updated to start at the offset indicated by
616e5c31af7Sopenharmony_cipname:pOffsets[i] from the start of the buffer pname:pBuffers[i].
617e5c31af7Sopenharmony_ciAll vertex input attributes that use each of these bindings will use these
618e5c31af7Sopenharmony_ciupdated addresses in their address calculations for subsequent drawing
619e5c31af7Sopenharmony_cicommands.
620e5c31af7Sopenharmony_ciifdef::VK_EXT_robustness2[]
621e5c31af7Sopenharmony_ciIf the <<features-nullDescriptor,nullDescriptor>> feature is enabled,
622e5c31af7Sopenharmony_cielements of pname:pBuffers can: be dlink:VK_NULL_HANDLE, and can: be used by
623e5c31af7Sopenharmony_cithe vertex shader.
624e5c31af7Sopenharmony_ciIf a vertex input attribute is bound to a vertex input binding that is
625e5c31af7Sopenharmony_cidlink:VK_NULL_HANDLE, the values taken from memory are considered to be
626e5c31af7Sopenharmony_cizero, and missing G, B, or A components are
627e5c31af7Sopenharmony_ci<<fxvertex-input-extraction,filled with [eq]#(0,0,1)#>>.
628e5c31af7Sopenharmony_ciendif::VK_EXT_robustness2[]
629e5c31af7Sopenharmony_ci
630e5c31af7Sopenharmony_ci.Valid Usage
631e5c31af7Sopenharmony_ci****
632e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers-firstBinding-00624]]
633e5c31af7Sopenharmony_ci    pname:firstBinding must: be less than
634e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
635e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers-firstBinding-00625]]
636e5c31af7Sopenharmony_ci    The sum of pname:firstBinding and pname:bindingCount must: be less than
637e5c31af7Sopenharmony_ci    or equal to sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
638e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers-pOffsets-00626]]
639e5c31af7Sopenharmony_ci    All elements of pname:pOffsets must: be less than the size of the
640e5c31af7Sopenharmony_ci    corresponding element in pname:pBuffers
641e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers-pBuffers-00627]]
642e5c31af7Sopenharmony_ci    All elements of pname:pBuffers must: have been created with the
643e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_VERTEX_BUFFER_BIT flag
644e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers-pBuffers-00628]]
645e5c31af7Sopenharmony_ci    Each element of pname:pBuffers that is non-sparse must: be bound
646e5c31af7Sopenharmony_ci    completely and contiguously to a single sname:VkDeviceMemory object
647e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers-pBuffers-04001]]
648e5c31af7Sopenharmony_ci    If the <<features-nullDescriptor,nullDescriptor>> feature is not
649e5c31af7Sopenharmony_ci    enabled, all elements of pname:pBuffers must: not be
650e5c31af7Sopenharmony_ci    dlink:VK_NULL_HANDLE
651e5c31af7Sopenharmony_ciifdef::VK_EXT_robustness2[]
652e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers-pBuffers-04002]]
653e5c31af7Sopenharmony_ci    If an element of pname:pBuffers is dlink:VK_NULL_HANDLE, then the
654e5c31af7Sopenharmony_ci    corresponding element of pname:pOffsets must: be zero
655e5c31af7Sopenharmony_ciendif::VK_EXT_robustness2[]
656e5c31af7Sopenharmony_ci****
657e5c31af7Sopenharmony_ci
658e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBindVertexBuffers.txt[]
659e5c31af7Sopenharmony_ci--
660e5c31af7Sopenharmony_ci
661e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[]
662e5c31af7Sopenharmony_ci[open,refpage='vkCmdBindVertexBuffers2EXT',desc='Bind vertex buffers to a command buffer and dynamically set strides',type='protos']
663e5c31af7Sopenharmony_ci--
664e5c31af7Sopenharmony_ciAlternatively, to bind vertex buffers, along with their sizes and strides,
665e5c31af7Sopenharmony_cito a command buffer for use in subsequent drawing commands, call:
666e5c31af7Sopenharmony_ci
667e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBindVertexBuffers2EXT.txt[]
668e5c31af7Sopenharmony_ci
669e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
670e5c31af7Sopenharmony_ci    recorded.
671e5c31af7Sopenharmony_ci  * pname:firstBinding is the index of the first vertex input binding whose
672e5c31af7Sopenharmony_ci    state is updated by the command.
673e5c31af7Sopenharmony_ci  * pname:bindingCount is the number of vertex input bindings whose state is
674e5c31af7Sopenharmony_ci    updated by the command.
675e5c31af7Sopenharmony_ci  * pname:pBuffers is a pointer to an array of buffer handles.
676e5c31af7Sopenharmony_ci  * pname:pOffsets is a pointer to an array of buffer offsets.
677e5c31af7Sopenharmony_ci  * pname:pSizes is `NULL` or a pointer to an array of the size in bytes of
678e5c31af7Sopenharmony_ci    vertex data bound from pname:pBuffers.
679e5c31af7Sopenharmony_ci  * pname:pStrides is `NULL` or a pointer to an array of buffer strides.
680e5c31af7Sopenharmony_ci
681e5c31af7Sopenharmony_ciThe values taken from elements [eq]#i# of pname:pBuffers and pname:pOffsets
682e5c31af7Sopenharmony_cireplace the current state for the vertex input binding
683e5c31af7Sopenharmony_ci[eq]#pname:firstBinding {plus} i#, for [eq]#i# in [eq]#[0,
684e5c31af7Sopenharmony_cipname:bindingCount)#.
685e5c31af7Sopenharmony_ciThe vertex input binding is updated to start at the offset indicated by
686e5c31af7Sopenharmony_cipname:pOffsets[i] from the start of the buffer pname:pBuffers[i].
687e5c31af7Sopenharmony_ciIf pname:pSizes is not `NULL` then pname:pSizes[i] specifies the bound size
688e5c31af7Sopenharmony_ciof the vertex buffer starting from the corresponding elements of
689e5c31af7Sopenharmony_cipname:pBuffers[i] plus pname:pOffsets[i].
690e5c31af7Sopenharmony_ciAll vertex input attributes that use each of these bindings will use these
691e5c31af7Sopenharmony_ciupdated addresses in their address calculations for subsequent drawing
692e5c31af7Sopenharmony_cicommands.
693e5c31af7Sopenharmony_ciifdef::VK_EXT_robustness2[]
694e5c31af7Sopenharmony_ciIf the <<features-nullDescriptor,nullDescriptor>> feature is enabled,
695e5c31af7Sopenharmony_cielements of pname:pBuffers can: be dlink:VK_NULL_HANDLE, and can: be used by
696e5c31af7Sopenharmony_cithe vertex shader.
697e5c31af7Sopenharmony_ciIf a vertex input attribute is bound to a vertex input binding that is
698e5c31af7Sopenharmony_cidlink:VK_NULL_HANDLE, the values taken from memory are considered to be
699e5c31af7Sopenharmony_cizero, and missing G, B, or A components are
700e5c31af7Sopenharmony_ci<<fxvertex-input-extraction,filled with [eq]#(0,0,1)#>>.
701e5c31af7Sopenharmony_ciendif::VK_EXT_robustness2[]
702e5c31af7Sopenharmony_ci
703e5c31af7Sopenharmony_ciThis command also <pipelines-dynamic-state, dynamically sets>> the byte
704e5c31af7Sopenharmony_cistrides between consecutive elements within buffer pname:pBuffers[i] to the
705e5c31af7Sopenharmony_cicorresponding pname:pStrides[i] value when the graphics pipeline is created
706e5c31af7Sopenharmony_ciwith ename:VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT set in
707e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
708e5c31af7Sopenharmony_ciOtherwise, strides are specified by the
709e5c31af7Sopenharmony_cisname:VkVertexInputBindingDescription::pname:stride values used to create
710e5c31af7Sopenharmony_cithe currently active pipeline.
711e5c31af7Sopenharmony_ci
712e5c31af7Sopenharmony_ciifdef::VK_EXT_vertex_input_dynamic_state[]
713e5c31af7Sopenharmony_ciIf the bound pipeline state object was also created with the
714e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_VERTEX_INPUT_EXT dynamic state enabled then
715e5c31af7Sopenharmony_ciflink:vkCmdSetVertexInputEXT can: be used instead of
716e5c31af7Sopenharmony_cifname:vkCmdBindVertexBuffers2EXT to set the stride.
717e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_input_dynamic_state[]
718e5c31af7Sopenharmony_ci
719e5c31af7Sopenharmony_ci.Valid Usage
720e5c31af7Sopenharmony_ci****
721e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-firstBinding-03355]]
722e5c31af7Sopenharmony_ci    pname:firstBinding must: be less than
723e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
724e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-firstBinding-03356]]
725e5c31af7Sopenharmony_ci    The sum of pname:firstBinding and pname:bindingCount must: be less than
726e5c31af7Sopenharmony_ci    or equal to sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
727e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pOffsets-03357]]
728e5c31af7Sopenharmony_ci    All elements of pname:pOffsets must: be less than the size of the
729e5c31af7Sopenharmony_ci    corresponding element in pname:pBuffers
730e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pSizes-03358]]
731e5c31af7Sopenharmony_ci    If pname:pSizes is not `NULL`, all elements of pname:pOffsets plus
732e5c31af7Sopenharmony_ci    pname:pSizes must: be less than or equal to the size of the
733e5c31af7Sopenharmony_ci    corresponding element in pname:pBuffers
734e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pBuffers-03359]]
735e5c31af7Sopenharmony_ci    All elements of pname:pBuffers must: have been created with the
736e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_VERTEX_BUFFER_BIT flag
737e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pBuffers-03360]]
738e5c31af7Sopenharmony_ci    Each element of pname:pBuffers that is non-sparse must: be bound
739e5c31af7Sopenharmony_ci    completely and contiguously to a single sname:VkDeviceMemory object
740e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pBuffers-04111]]
741e5c31af7Sopenharmony_ci    If the <<features-nullDescriptor,nullDescriptor>> feature is not
742e5c31af7Sopenharmony_ci    enabled, all elements of pname:pBuffers must: not be
743e5c31af7Sopenharmony_ci    dlink:VK_NULL_HANDLE
744e5c31af7Sopenharmony_ciifdef::VK_EXT_robustness2[]
745e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pBuffers-04112]]
746e5c31af7Sopenharmony_ci    If an element of pname:pBuffers is dlink:VK_NULL_HANDLE, then the
747e5c31af7Sopenharmony_ci    corresponding element of pname:pOffsets must: be zero
748e5c31af7Sopenharmony_ciendif::VK_EXT_robustness2[]
749e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pStrides-03362]]
750e5c31af7Sopenharmony_ci    If pname:pStrides is not `NULL` each element of pname:pStrides must: be
751e5c31af7Sopenharmony_ci    less than or equal to
752e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindingStride
753e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindVertexBuffers2EXT-pStrides-06209]]
754e5c31af7Sopenharmony_ci    If pname:pStrides is not `NULL` each element of pname:pStrides must: be
755e5c31af7Sopenharmony_ci    either 0 or greater than or equal to the maximum extent of all vertex
756e5c31af7Sopenharmony_ci    input attributes fetched from the corresponding binding, where the
757e5c31af7Sopenharmony_ci    extent is calculated as the
758e5c31af7Sopenharmony_ci    slink:VkVertexInputAttributeDescription::pname:offset plus
759e5c31af7Sopenharmony_ci    slink:VkVertexInputAttributeDescription::pname:format size
760e5c31af7Sopenharmony_ci****
761e5c31af7Sopenharmony_ci
762e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBindVertexBuffers2EXT.txt[]
763e5c31af7Sopenharmony_ci--
764e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[]
765e5c31af7Sopenharmony_ci
766e5c31af7Sopenharmony_ci
767e5c31af7Sopenharmony_ciifdef::VK_EXT_vertex_attribute_divisor[]
768e5c31af7Sopenharmony_ci
769e5c31af7Sopenharmony_ci[[fxvertex-attribute_divisor]]
770e5c31af7Sopenharmony_ci== Vertex Attribute Divisor in Instanced Rendering
771e5c31af7Sopenharmony_ci
772e5c31af7Sopenharmony_ci[open,refpage='VkPipelineVertexInputDivisorStateCreateInfoEXT',desc='Structure specifying vertex attributes assignment during instanced rendering',type='structs']
773e5c31af7Sopenharmony_ci--
774e5c31af7Sopenharmony_ciIf
775e5c31af7Sopenharmony_ci<<features-vertexAttributeInstanceRateDivisor,pname:vertexAttributeInstanceRateDivisor>>
776e5c31af7Sopenharmony_cifeature is enabled and the pname:pNext chain of
777e5c31af7Sopenharmony_cislink:VkPipelineVertexInputStateCreateInfo includes a
778e5c31af7Sopenharmony_cisname:VkPipelineVertexInputDivisorStateCreateInfoEXT structure, then that
779e5c31af7Sopenharmony_cistructure controls how vertex attributes are assigned to an instance when
780e5c31af7Sopenharmony_ciinstanced rendering is enabled.
781e5c31af7Sopenharmony_ci
782e5c31af7Sopenharmony_ciThe sname:VkPipelineVertexInputDivisorStateCreateInfoEXT structure is
783e5c31af7Sopenharmony_cidefined as:
784e5c31af7Sopenharmony_ci
785e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineVertexInputDivisorStateCreateInfoEXT.txt[]
786e5c31af7Sopenharmony_ci
787e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
788e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
789e5c31af7Sopenharmony_ci    structure.
790e5c31af7Sopenharmony_ci  * pname:vertexBindingDivisorCount is the number of elements in the
791e5c31af7Sopenharmony_ci    pname:pVertexBindingDivisors array.
792e5c31af7Sopenharmony_ci  * pname:pVertexBindingDivisors is a pointer to an array of
793e5c31af7Sopenharmony_ci    sname:VkVertexInputBindingDivisorDescriptionEXT structures specifying
794e5c31af7Sopenharmony_ci    the divisor value for each binding.
795e5c31af7Sopenharmony_ci
796e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineVertexInputDivisorStateCreateInfoEXT.txt[]
797e5c31af7Sopenharmony_ci--
798e5c31af7Sopenharmony_ci
799e5c31af7Sopenharmony_ci[open,refpage='VkVertexInputBindingDivisorDescriptionEXT',desc='Structure specifying a divisor used in instanced rendering',type='structs']
800e5c31af7Sopenharmony_ci--
801e5c31af7Sopenharmony_ciThe individual divisor values per binding are specified using the
802e5c31af7Sopenharmony_cisname:VkVertexInputBindingDivisorDescriptionEXT structure which is defined
803e5c31af7Sopenharmony_cias:
804e5c31af7Sopenharmony_ci
805e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkVertexInputBindingDivisorDescriptionEXT.txt[]
806e5c31af7Sopenharmony_ci
807e5c31af7Sopenharmony_ci  * pname:binding is the binding number for which the divisor is specified.
808e5c31af7Sopenharmony_ci  * pname:divisor is the number of successive instances that will use the
809e5c31af7Sopenharmony_ci    same value of the vertex attribute when instanced rendering is enabled.
810e5c31af7Sopenharmony_ci    For example, if the divisor is N, the same vertex attribute will be
811e5c31af7Sopenharmony_ci    applied to N successive instances before moving on to the next vertex
812e5c31af7Sopenharmony_ci    attribute.
813e5c31af7Sopenharmony_ci    The maximum value of pname:divisor is implementation-dependent and can
814e5c31af7Sopenharmony_ci    be queried using
815e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT::pname:maxVertexAttribDivisor.
816e5c31af7Sopenharmony_ci    A value of `0` can: be used for the divisor if the
817e5c31af7Sopenharmony_ci    <<features-vertexAttributeInstanceRateZeroDivisor,pname:vertexAttributeInstanceRateZeroDivisor>>
818e5c31af7Sopenharmony_ci    feature is enabled.
819e5c31af7Sopenharmony_ci    In this case, the same vertex attribute will be applied to all
820e5c31af7Sopenharmony_ci    instances.
821e5c31af7Sopenharmony_ci
822e5c31af7Sopenharmony_ciIf this structure is not used to define a divisor value for an attribute,
823e5c31af7Sopenharmony_cithen the divisor has a logical default value of 1.
824e5c31af7Sopenharmony_ci
825e5c31af7Sopenharmony_ci.Valid Usage
826e5c31af7Sopenharmony_ci****
827e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDivisorDescriptionEXT-binding-01869]]
828e5c31af7Sopenharmony_ci    pname:binding must: be less than
829e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxVertexInputBindings
830e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDivisorDescriptionEXT-vertexAttributeInstanceRateZeroDivisor-02228]]
831e5c31af7Sopenharmony_ci    If the pname:vertexAttributeInstanceRateZeroDivisor feature is not
832e5c31af7Sopenharmony_ci    enabled, pname:divisor must: not be `0`
833e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDivisorDescriptionEXT-vertexAttributeInstanceRateDivisor-02229]]
834e5c31af7Sopenharmony_ci    If the pname:vertexAttributeInstanceRateDivisor feature is not enabled,
835e5c31af7Sopenharmony_ci    pname:divisor must: be `1`
836e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDivisorDescriptionEXT-divisor-01870]]
837e5c31af7Sopenharmony_ci    pname:divisor must: be a value between `0` and
838e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT::pname:maxVertexAttribDivisor,
839e5c31af7Sopenharmony_ci    inclusive
840e5c31af7Sopenharmony_ci  * [[VUID-VkVertexInputBindingDivisorDescriptionEXT-inputRate-01871]]
841e5c31af7Sopenharmony_ci    slink:VkVertexInputBindingDescription::pname:inputRate must: be of type
842e5c31af7Sopenharmony_ci    ename:VK_VERTEX_INPUT_RATE_INSTANCE for this pname:binding
843e5c31af7Sopenharmony_ci****
844e5c31af7Sopenharmony_ci
845e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkVertexInputBindingDivisorDescriptionEXT.txt[]
846e5c31af7Sopenharmony_ci--
847e5c31af7Sopenharmony_ci
848e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_attribute_divisor[]
849e5c31af7Sopenharmony_ci
850e5c31af7Sopenharmony_ci[[fxvertex-input-address-calculation]]
851e5c31af7Sopenharmony_ci== Vertex Input Address Calculation
852e5c31af7Sopenharmony_ciThe address of each attribute for each code:vertexIndex and
853e5c31af7Sopenharmony_cicode:instanceIndex is calculated as follows:
854e5c31af7Sopenharmony_ci
855e5c31af7Sopenharmony_ci  * Let code:attribDesc be the member of
856e5c31af7Sopenharmony_ci    slink:VkPipelineVertexInputStateCreateInfo::pname:pVertexAttributeDescriptions
857e5c31af7Sopenharmony_ci    with sname:VkVertexInputAttributeDescription::pname:location equal to
858e5c31af7Sopenharmony_ci    the vertex input attribute number.
859e5c31af7Sopenharmony_ci  * Let code:bindingDesc be the member of
860e5c31af7Sopenharmony_ci    slink:VkPipelineVertexInputStateCreateInfo::pname:pVertexBindingDescriptions
861e5c31af7Sopenharmony_ci    with sname:VkVertexInputAttributeDescription::pname:binding equal to
862e5c31af7Sopenharmony_ci    code:attribDesc.binding.
863e5c31af7Sopenharmony_ci  * Let code:vertexIndex be the index of the vertex within the draw (a value
864e5c31af7Sopenharmony_ci    between pname:firstVertex and pname:firstVertex+pname:vertexCount for
865e5c31af7Sopenharmony_ci    fname:vkCmdDraw, or a value taken from the index buffer for
866e5c31af7Sopenharmony_ci    fname:vkCmdDrawIndexed), and let code:instanceIndex be the instance
867e5c31af7Sopenharmony_ci    number of the draw (a value between pname:firstInstance and
868e5c31af7Sopenharmony_ci    pname:firstInstance+pname:instanceCount).
869e5c31af7Sopenharmony_ciifdef::VK_EXT_vertex_attribute_divisor[]
870e5c31af7Sopenharmony_ci  * Let code:divisor be the member of
871e5c31af7Sopenharmony_ci    slink:VkPipelineVertexInputDivisorStateCreateInfoEXT::pname:pVertexBindingDivisors
872e5c31af7Sopenharmony_ci    with sname:VkVertexInputBindingDivisorDescriptionEXT::pname:binding
873e5c31af7Sopenharmony_ci    equal to code:attribDesc.binding.
874e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_attribute_divisor[]
875e5c31af7Sopenharmony_ci
876e5c31af7Sopenharmony_ci[source,c]
877e5c31af7Sopenharmony_ci---------------------------------------------------
878e5c31af7Sopenharmony_cibufferBindingAddress = buffer[binding].baseAddress + offset[binding];
879e5c31af7Sopenharmony_ci
880e5c31af7Sopenharmony_ciif (bindingDesc.inputRate == VK_VERTEX_INPUT_RATE_VERTEX)
881e5c31af7Sopenharmony_ci    vertexOffset = vertexIndex * bindingDesc.stride;
882e5c31af7Sopenharmony_cielse
883e5c31af7Sopenharmony_ciifndef::VK_EXT_vertex_attribute_divisor[]
884e5c31af7Sopenharmony_ci    vertexOffset = instanceIndex * bindingDesc.stride;
885e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_attribute_divisor[]
886e5c31af7Sopenharmony_ciifdef::VK_EXT_vertex_attribute_divisor[]
887e5c31af7Sopenharmony_ci    if (divisor == 0)
888e5c31af7Sopenharmony_ci        vertexOffset = firstInstance * bindingDesc.stride;
889e5c31af7Sopenharmony_ci    else
890e5c31af7Sopenharmony_ci        vertexOffset = (firstInstance + ((instanceIndex - firstInstance) / divisor)) * bindingDesc.stride;
891e5c31af7Sopenharmony_ciendif::VK_EXT_vertex_attribute_divisor[]
892e5c31af7Sopenharmony_ci
893e5c31af7Sopenharmony_ciattribAddress = bufferBindingAddress + vertexOffset + attribDesc.offset;
894e5c31af7Sopenharmony_ci---------------------------------------------------
895e5c31af7Sopenharmony_ci
896e5c31af7Sopenharmony_ci[[fxvertex-input-extraction]]
897e5c31af7Sopenharmony_ci=== Vertex Input Extraction
898e5c31af7Sopenharmony_ciFor each attribute, raw data is extracted starting at `attribAddress` and is
899e5c31af7Sopenharmony_ciconverted from the sname:VkVertexInputAttributeDescription's pname:format to
900e5c31af7Sopenharmony_cieither floating-point, unsigned integer, or signed integer based on the base
901e5c31af7Sopenharmony_citype of the format; the base type of the format must: match the base type of
902e5c31af7Sopenharmony_cithe input variable in the shader.
903e5c31af7Sopenharmony_ciThe input variable in the shader must: be declared as a 64-bit data type if
904e5c31af7Sopenharmony_ciand only if pname:format is a 64-bit data type.
905e5c31af7Sopenharmony_ciIf pname:format is a packed format, `attribAddress` must: be a multiple of
906e5c31af7Sopenharmony_cithe size in bytes of the whole attribute data type as described in
907e5c31af7Sopenharmony_ci<<formats-packed,Packed Formats>>.
908e5c31af7Sopenharmony_ciOtherwise, `attribAddress` must: be a multiple of the size in bytes of the
909e5c31af7Sopenharmony_cicomponent type indicated by pname:format (see <<formats,Formats>>).
910e5c31af7Sopenharmony_ciFor attributes that are not 64-bit data types, each component is converted
911e5c31af7Sopenharmony_cito the format of the input variable based on its type and size (as defined
912e5c31af7Sopenharmony_ciin the <<formats-definition,Format Definition>> section for each
913e5c31af7Sopenharmony_cielink:VkFormat), using the appropriate equations in <<fundamentals-fp16,
914e5c31af7Sopenharmony_ci16-Bit Floating-Point Numbers>>, <<fundamentals-fp11,Unsigned 11-Bit
915e5c31af7Sopenharmony_ciFloating-Point Numbers>>, <<fundamentals-fp10,Unsigned 10-Bit Floating-Point
916e5c31af7Sopenharmony_ciNumbers>>, <<fundamentals-fixedconv,Fixed-Point Data Conversion>>, and
917e5c31af7Sopenharmony_ci<<textures-sexp-RGB,Shared Exponent to RGB>>.
918e5c31af7Sopenharmony_ciSigned integer components smaller than 32 bits are sign-extended.
919e5c31af7Sopenharmony_ciAttributes that are not 64-bit data types are expanded to four components in
920e5c31af7Sopenharmony_cithe same way as described in <<textures-conversion-to-rgba,conversion to
921e5c31af7Sopenharmony_ciRGBA>>.
922e5c31af7Sopenharmony_ciThe number of components in the vertex shader input variable need not
923e5c31af7Sopenharmony_ciexactly match the number of components in the format.
924e5c31af7Sopenharmony_ciIf the vertex shader has fewer components, the extra components are
925e5c31af7Sopenharmony_cidiscarded.
926