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