1e5c31af7Sopenharmony_ci// Copyright 2015-2024 The Khronos Group Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[[drawing]]
6e5c31af7Sopenharmony_ci= Drawing Commands
7e5c31af7Sopenharmony_ci
8e5c31af7Sopenharmony_ci_Drawing commands_ (commands with ftext:Draw in the name) provoke work in a
9e5c31af7Sopenharmony_cigraphics pipeline.
10e5c31af7Sopenharmony_ciDrawing commands are recorded into a command buffer and when executed by a
11e5c31af7Sopenharmony_ciqueue, will produce work which executes according to the bound graphics
12e5c31af7Sopenharmony_ciifndef::VK_EXT_shader_object[pipeline.]
13e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
14e5c31af7Sopenharmony_cipipeline, or if the <<features-shaderObject, pname:shaderObject>> feature is
15e5c31af7Sopenharmony_cienabled, any <<shaders-objects, shader objects>> bound to graphics stages.
16e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
17e5c31af7Sopenharmony_ciA graphics pipeline
18e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
19e5c31af7Sopenharmony_cior a combination of one or more graphics shader objects
20e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
21e5c31af7Sopenharmony_cimust: be bound to a command buffer before any drawing commands are recorded
22e5c31af7Sopenharmony_ciin that command buffer.
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci[open,refpage='VkPipelineInputAssemblyStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline input assembly state',type='structs']
25e5c31af7Sopenharmony_ci--
26e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
27e5c31af7Sopenharmony_ciDrawing can be achieved in two modes:
28e5c31af7Sopenharmony_ci
29e5c31af7Sopenharmony_ci  * <<drawing-mesh-shading,Programmable Mesh Shading>>, the mesh shader
30e5c31af7Sopenharmony_ci    assembles primitives, or
31e5c31af7Sopenharmony_ci  * <<drawing-primitive-shading,Programmable Primitive Shading>>, the input
32e5c31af7Sopenharmony_ci    primitives are assembled as follows.
33e5c31af7Sopenharmony_ci
34e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ciEach draw is made up of zero or more vertices and zero or more instances,
37e5c31af7Sopenharmony_ciwhich are processed by the device and result in the assembly of primitives.
38e5c31af7Sopenharmony_ciPrimitives are assembled according to the pname:pInputAssemblyState member
39e5c31af7Sopenharmony_ciof the slink:VkGraphicsPipelineCreateInfo structure, which is of type
40e5c31af7Sopenharmony_cisname:VkPipelineInputAssemblyStateCreateInfo:
41e5c31af7Sopenharmony_ci
42e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineInputAssemblyStateCreateInfo.adoc[]
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ci  * pname:sType is a elink:VkStructureType value identifying this structure.
45e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
46e5c31af7Sopenharmony_ci    structure.
47e5c31af7Sopenharmony_ci  * pname:flags is reserved for future use.
48e5c31af7Sopenharmony_ci  * pname:topology is a elink:VkPrimitiveTopology defining the primitive
49e5c31af7Sopenharmony_ci    topology, as described below.
50e5c31af7Sopenharmony_ci  * pname:primitiveRestartEnable controls whether a special vertex index
51e5c31af7Sopenharmony_ci    value is treated as restarting the assembly of primitives.
52e5c31af7Sopenharmony_ci    This enable only applies to indexed draws (flink:vkCmdDrawIndexed,
53e5c31af7Sopenharmony_ciifdef::VK_EXT_multi_draw[]
54e5c31af7Sopenharmony_ci    flink:vkCmdDrawMultiIndexedEXT,
55e5c31af7Sopenharmony_ciendif::VK_EXT_multi_draw[]
56e5c31af7Sopenharmony_ci    and flink:vkCmdDrawIndexedIndirect), and the special index value is
57e5c31af7Sopenharmony_ci    either 0xFFFFFFFF when the pname:indexType parameter of
58e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[fname:vkCmdBindIndexBuffer2KHR or]
59e5c31af7Sopenharmony_ci    fname:vkCmdBindIndexBuffer is equal to ename:VK_INDEX_TYPE_UINT32,
60e5c31af7Sopenharmony_ciifdef::VK_EXT_index_type_uint8[]
61e5c31af7Sopenharmony_ci    0xFF when pname:indexType is equal to ename:VK_INDEX_TYPE_UINT8_EXT,
62e5c31af7Sopenharmony_ciendif::VK_EXT_index_type_uint8[]
63e5c31af7Sopenharmony_ci    or 0xFFFF when pname:indexType is equal to ename:VK_INDEX_TYPE_UINT16.
64e5c31af7Sopenharmony_ciifndef::VK_EXT_primitive_topology_list_restart[]
65e5c31af7Sopenharmony_ci    Primitive restart is not allowed for "`list`" topologies.
66e5c31af7Sopenharmony_ciendif::VK_EXT_primitive_topology_list_restart[]
67e5c31af7Sopenharmony_ciifdef::VK_EXT_primitive_topology_list_restart[]
68e5c31af7Sopenharmony_ci    Primitive restart is not allowed for "`list`" topologies, unless one of
69e5c31af7Sopenharmony_ci    the features <<features-primitiveTopologyPatchListRestart,
70e5c31af7Sopenharmony_ci    pname:primitiveTopologyPatchListRestart>> (for
71e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_PATCH_LIST) or
72e5c31af7Sopenharmony_ci    <<features-primitiveTopologyListRestart,
73e5c31af7Sopenharmony_ci    pname:primitiveTopologyListRestart>> (for all other list topologies) is
74e5c31af7Sopenharmony_ci    enabled.
75e5c31af7Sopenharmony_ciendif::VK_EXT_primitive_topology_list_restart[]
76e5c31af7Sopenharmony_ci
77e5c31af7Sopenharmony_ciRestarting the assembly of primitives discards the most recent index values
78e5c31af7Sopenharmony_ciif those elements formed an incomplete primitive, and restarts the primitive
79e5c31af7Sopenharmony_ciassembly using the subsequent indices, but only assembling the immediately
80e5c31af7Sopenharmony_cifollowing element through the end of the originally specified elements.
81e5c31af7Sopenharmony_ciThe primitive restart index value comparison is performed before adding the
82e5c31af7Sopenharmony_cipname:vertexOffset value to the index value.
83e5c31af7Sopenharmony_ci
84e5c31af7Sopenharmony_ci.Valid Usage
85e5c31af7Sopenharmony_ci****
86e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineInputAssemblyStateCreateInfo-topology-06252]]
87e5c31af7Sopenharmony_ci    If
88e5c31af7Sopenharmony_ciifdef::VK_EXT_primitive_topology_list_restart[]
89e5c31af7Sopenharmony_ci    the <<features-primitiveTopologyListRestart,
90e5c31af7Sopenharmony_ci    pname:primitiveTopologyListRestart>> feature is not enabled, and
91e5c31af7Sopenharmony_ciendif::VK_EXT_primitive_topology_list_restart[]
92e5c31af7Sopenharmony_ci    pname:topology is ename:VK_PRIMITIVE_TOPOLOGY_POINT_LIST,
93e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
94e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
95e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, or
96e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY,
97e5c31af7Sopenharmony_ci    pname:primitiveRestartEnable must: be ename:VK_FALSE
98e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineInputAssemblyStateCreateInfo-topology-06253]]
99e5c31af7Sopenharmony_ci    If
100e5c31af7Sopenharmony_ciifdef::VK_EXT_primitive_topology_list_restart[]
101e5c31af7Sopenharmony_ci    the <<features-primitiveTopologyPatchListRestart,
102e5c31af7Sopenharmony_ci    pname:primitiveTopologyPatchListRestart>> feature is not enabled, and
103e5c31af7Sopenharmony_ciendif::VK_EXT_primitive_topology_list_restart[]
104e5c31af7Sopenharmony_ci    pname:topology is ename:VK_PRIMITIVE_TOPOLOGY_PATCH_LIST,
105e5c31af7Sopenharmony_ci    pname:primitiveRestartEnable must: be ename:VK_FALSE
106e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00429]]
107e5c31af7Sopenharmony_ci    If the <<features-geometryShader, pname:geometryShader>> feature is not
108e5c31af7Sopenharmony_ci    enabled, pname:topology must: not be any of
109e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY,
110e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY,
111e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY or
112e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY
113e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineInputAssemblyStateCreateInfo-topology-00430]]
114e5c31af7Sopenharmony_ci    If the <<features-tessellationShader, pname:tessellationShader>> feature
115e5c31af7Sopenharmony_ci    is not enabled, pname:topology must: not be
116e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
117e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
118e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineInputAssemblyStateCreateInfo-triangleFans-04452]]
119e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
120e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:triangleFans
121e5c31af7Sopenharmony_ci    is ename:VK_FALSE, pname:topology must: not be
122e5c31af7Sopenharmony_ci    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN
123e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
124e5c31af7Sopenharmony_ci****
125e5c31af7Sopenharmony_ci
126e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineInputAssemblyStateCreateInfo.adoc[]
127e5c31af7Sopenharmony_ci--
128e5c31af7Sopenharmony_ci
129e5c31af7Sopenharmony_ci[open,refpage='VkPipelineInputAssemblyStateCreateFlags',desc='Reserved for future use',type='flags']
130e5c31af7Sopenharmony_ci--
131e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineInputAssemblyStateCreateFlags.adoc[]
132e5c31af7Sopenharmony_ci
133e5c31af7Sopenharmony_citname:VkPipelineInputAssemblyStateCreateFlags is a bitmask type for setting
134e5c31af7Sopenharmony_cia mask, but is currently reserved for future use.
135e5c31af7Sopenharmony_ci--
136e5c31af7Sopenharmony_ci
137e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2,VK_EXT_shader_object[]
138e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetPrimitiveRestartEnable',desc='Set primitive assembly restart state dynamically for a command buffer',type='protos',alias='vkCmdSetPrimitiveRestartEnableEXT']
139e5c31af7Sopenharmony_ci--
140e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically control>> whether a special vertex
141e5c31af7Sopenharmony_ciindex value is treated as restarting the assembly of primitives, call:
142e5c31af7Sopenharmony_ci
143e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[]
144e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetPrimitiveRestartEnable.adoc[]
145e5c31af7Sopenharmony_ci
146e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state2,VK_EXT_shader_object[or the equivalent command]
147e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[]
148e5c31af7Sopenharmony_ci
149e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state2,VK_EXT_shader_object[]
150e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetPrimitiveRestartEnableEXT.adoc[]
151e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state2,VK_EXT_shader_object[]
152e5c31af7Sopenharmony_ci
153e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
154e5c31af7Sopenharmony_ci    recorded.
155e5c31af7Sopenharmony_ci  * pname:primitiveRestartEnable controls whether a special vertex index
156e5c31af7Sopenharmony_ci    value is treated as restarting the assembly of primitives.
157e5c31af7Sopenharmony_ci    It behaves in the same way as
158e5c31af7Sopenharmony_ci    sname:VkPipelineInputAssemblyStateCreateInfo::pname:primitiveRestartEnable
159e5c31af7Sopenharmony_ci
160e5c31af7Sopenharmony_ciThis command sets the primitive restart enable for subsequent drawing
161e5c31af7Sopenharmony_cicommands
162e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
163e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2[when drawing using <<shaders-objects, shader objects>>, or]
164e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2[when drawing using <<shaders-objects, shader objects>>.]
165e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
166e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2[]
167e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
168e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE set in
169e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
170e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2[]
171e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
172e5c31af7Sopenharmony_cislink:VkPipelineInputAssemblyStateCreateInfo::pname:primitiveRestartEnable
173e5c31af7Sopenharmony_civalue used to create the currently active pipeline.
174e5c31af7Sopenharmony_ci
175e5c31af7Sopenharmony_ci:refpage: vkCmdSetPrimitiveRestartEnable
176e5c31af7Sopenharmony_ci
177e5c31af7Sopenharmony_ci.Valid Usage
178e5c31af7Sopenharmony_ci****
179e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state2_feature_common.adoc[]
180e5c31af7Sopenharmony_ci****
181e5c31af7Sopenharmony_ci
182e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetPrimitiveRestartEnable.adoc[]
183e5c31af7Sopenharmony_ci--
184e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state2,VK_EXT_shader_object[]
185e5c31af7Sopenharmony_ci
186e5c31af7Sopenharmony_ci
187e5c31af7Sopenharmony_ci[[drawing-primitive-topologies]]
188e5c31af7Sopenharmony_ci== Primitive Topologies
189e5c31af7Sopenharmony_ci
190e5c31af7Sopenharmony_ci_Primitive topology_ determines how consecutive vertices are organized into
191e5c31af7Sopenharmony_ciprimitives, and determines the type of primitive that is used at the
192e5c31af7Sopenharmony_cibeginning of the graphics pipeline.
193e5c31af7Sopenharmony_ciThe effective topology for later stages of the pipeline is altered by
194e5c31af7Sopenharmony_citessellation or geometry shading (if either is in use) and depends on the
195e5c31af7Sopenharmony_ciexecution modes of those shaders.
196e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
197e5c31af7Sopenharmony_ciIn the case of mesh shading the only effective topology is defined by the
198e5c31af7Sopenharmony_ciexecution mode of the mesh shader.
199e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
200e5c31af7Sopenharmony_ci
201e5c31af7Sopenharmony_ci[open,refpage='VkPrimitiveTopology',desc='Supported primitive topologies',type='enums']
202e5c31af7Sopenharmony_ci--
203e5c31af7Sopenharmony_ciThe primitive topologies defined by elink:VkPrimitiveTopology are:
204e5c31af7Sopenharmony_ci
205e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPrimitiveTopology.adoc[]
206e5c31af7Sopenharmony_ci
207e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_POINT_LIST specifies a series of
208e5c31af7Sopenharmony_ci    <<drawing-point-lists,separate point primitives>>.
209e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST specifies a series of
210e5c31af7Sopenharmony_ci    <<drawing-line-lists,separate line primitives>>.
211e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_LINE_STRIP specifies a series of
212e5c31af7Sopenharmony_ci    <<drawing-line-strips,connected line primitives>> with consecutive lines
213e5c31af7Sopenharmony_ci    sharing a vertex.
214e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST specifies a series of
215e5c31af7Sopenharmony_ci    <<drawing-triangle-lists,separate triangle primitives>>.
216e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP specifies a series of
217e5c31af7Sopenharmony_ci    <<drawing-triangle-strips,connected triangle primitives>> with
218e5c31af7Sopenharmony_ci    consecutive triangles sharing an edge.
219e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN specifies a series of
220e5c31af7Sopenharmony_ci    <<drawing-triangle-fans,connected triangle primitives>> with all
221e5c31af7Sopenharmony_ci    triangles sharing a common vertex.
222e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
223e5c31af7Sopenharmony_ci    If the `apiext:VK_KHR_portability_subset` extension is enabled, and
224e5c31af7Sopenharmony_ci    slink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:triangleFans
225e5c31af7Sopenharmony_ci    is ename:VK_FALSE, then triangle fans are not supported by the
226e5c31af7Sopenharmony_ci    implementation, and ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN must: not
227e5c31af7Sopenharmony_ci    be used.
228e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
229e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY specifies a series
230e5c31af7Sopenharmony_ci    of <<drawing-line-lists-with-adjacency,separate line primitives with
231e5c31af7Sopenharmony_ci    adjacency>>.
232e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY specifies a series
233e5c31af7Sopenharmony_ci    of <<drawing-line-strips-with-adjacency,connected line primitives with
234e5c31af7Sopenharmony_ci    adjacency>>, with consecutive primitives sharing three vertices.
235e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY specifies a
236e5c31af7Sopenharmony_ci    series of <<drawing-triangle-lists-with-adjacency,separate triangle
237e5c31af7Sopenharmony_ci    primitives with adjacency>>.
238e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY specifies
239e5c31af7Sopenharmony_ci    <<drawing-triangle-strips-with-adjacency,connected triangle primitives
240e5c31af7Sopenharmony_ci    with adjacency>>, with consecutive triangles sharing an edge.
241e5c31af7Sopenharmony_ci  * ename:VK_PRIMITIVE_TOPOLOGY_PATCH_LIST specifies
242e5c31af7Sopenharmony_ci    <<drawing-patch-lists,separate patch primitives>>.
243e5c31af7Sopenharmony_ci
244e5c31af7Sopenharmony_ciEach primitive topology, and its construction from a list of vertices, is
245e5c31af7Sopenharmony_cidescribed in detail below with a supporting diagram, according to the
246e5c31af7Sopenharmony_cifollowing key:
247e5c31af7Sopenharmony_ci
248e5c31af7Sopenharmony_ci[cols="1,2,9"]
249e5c31af7Sopenharmony_ci|====
250e5c31af7Sopenharmony_ci^.^| image:{images}/primitive_topology_key_vertex.svg[pdfwidth=6pt,align="center",opts="{imageopts}"]
251e5c31af7Sopenharmony_ci.^| Vertex
252e5c31af7Sopenharmony_ci| A point in 3-dimensional space.
253e5c31af7Sopenharmony_ci  Positions chosen within the diagrams are arbitrary and for
254e5c31af7Sopenharmony_ci  illustration only.
255e5c31af7Sopenharmony_ci
256e5c31af7Sopenharmony_ci^.^| image:{images}/primitive_topology_key_vertex_number.svg[pdfwidth=6pt,align="center",opts="{imageopts}"]
257e5c31af7Sopenharmony_ci.^| Vertex Number
258e5c31af7Sopenharmony_ci| Sequence position of a vertex within the provided vertex data.
259e5c31af7Sopenharmony_ci
260e5c31af7Sopenharmony_ci^.^| image:{images}/primitive_topology_key_provoking_vertex.svg[pdfwidth=30pt,align="center",opts="{imageopts}"]
261e5c31af7Sopenharmony_ci.^| Provoking Vertex
262e5c31af7Sopenharmony_ci| Provoking vertex within the main primitive.
263e5c31af7Sopenharmony_ci  The tail is angled towards the relevant primitive.
264e5c31af7Sopenharmony_ci  Used in <<vertexpostproc-flatshading, flat shading>>.
265e5c31af7Sopenharmony_ci
266e5c31af7Sopenharmony_ci^.^| image:{images}/primitive_topology_key_edge.svg[pdfwidth=30pt,align="center",opts="{imageopts}"]
267e5c31af7Sopenharmony_ci.^| Primitive Edge
268e5c31af7Sopenharmony_ci| An edge connecting the points of a main primitive.
269e5c31af7Sopenharmony_ci
270e5c31af7Sopenharmony_ci^.^| image:{images}/primitive_topology_key_adjacency_edge.svg[pdfwidth=30pt,align="center",opts="{imageopts}"]
271e5c31af7Sopenharmony_ci.^| Adjacency Edge
272e5c31af7Sopenharmony_ci| Points connected by these lines do not contribute to a main primitive,
273e5c31af7Sopenharmony_ci  and are only accessible in a <<geometry,geometry shader>>.
274e5c31af7Sopenharmony_ci
275e5c31af7Sopenharmony_ci^.^| image:{images}/primitive_topology_key_winding_order.svg[pdfwidth=30pt,align="center",opts="{imageopts}"]
276e5c31af7Sopenharmony_ci.^| Winding Order
277e5c31af7Sopenharmony_ci| The relative order in which vertices are defined within a primitive,
278e5c31af7Sopenharmony_ci  used in the <<primsrast-polygons-basic,facing determination>>.
279e5c31af7Sopenharmony_ci  This ordering has no specific start or end point.
280e5c31af7Sopenharmony_ci|====
281e5c31af7Sopenharmony_ci
282e5c31af7Sopenharmony_ciThe diagrams are supported with mathematical definitions where the vertices
283e5c31af7Sopenharmony_ci([eq]#v#) and primitives ([eq]#p#) are numbered starting from [eq]#0#;
284e5c31af7Sopenharmony_ci[eq]#v~0~# is the first vertex in the provided data and [eq]#p~0~# is the
285e5c31af7Sopenharmony_cifirst primitive in the set of primitives defined by the vertices and
286e5c31af7Sopenharmony_citopology.
287e5c31af7Sopenharmony_ci--
288e5c31af7Sopenharmony_ci
289e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[]
290e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetPrimitiveTopology',desc='Set primitive topology state dynamically for a command buffer',type='protos',alias='vkCmdSetPrimitiveTopologyEXT']
291e5c31af7Sopenharmony_ci--
292e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> primitive topology, call:
293e5c31af7Sopenharmony_ci
294e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3[]
295e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetPrimitiveTopology.adoc[]
296e5c31af7Sopenharmony_ci
297e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[or the equivalent command]
298e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3[]
299e5c31af7Sopenharmony_ci
300e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[]
301e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetPrimitiveTopologyEXT.adoc[]
302e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state,VK_EXT_shader_object[]
303e5c31af7Sopenharmony_ci
304e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
305e5c31af7Sopenharmony_ci    recorded.
306e5c31af7Sopenharmony_ci  * pname:primitiveTopology specifies the primitive topology to use for
307e5c31af7Sopenharmony_ci    drawing.
308e5c31af7Sopenharmony_ci
309e5c31af7Sopenharmony_ciThis command sets the primitive topology for subsequent drawing commands
310e5c31af7Sopenharmony_ciifdef::VK_EXT_shader_object[]
311e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>, or]
312e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[when drawing using <<shaders-objects, shader objects>>.]
313e5c31af7Sopenharmony_ciendif::VK_EXT_shader_object[]
314e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[]
315e5c31af7Sopenharmony_ciwhen the graphics pipeline is created with
316e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY set in
317e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
318e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state[]
319e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
320e5c31af7Sopenharmony_cislink:VkPipelineInputAssemblyStateCreateInfo::pname:topology value used to
321e5c31af7Sopenharmony_cicreate the currently active pipeline.
322e5c31af7Sopenharmony_ci
323e5c31af7Sopenharmony_ci:refpage: vkCmdSetPrimitiveTopology
324e5c31af7Sopenharmony_ci
325e5c31af7Sopenharmony_ci.Valid Usage
326e5c31af7Sopenharmony_ci****
327e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/dynamic_state_feature_common.adoc[]
328e5c31af7Sopenharmony_ci****
329e5c31af7Sopenharmony_ci
330e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetPrimitiveTopology.adoc[]
331e5c31af7Sopenharmony_ci--
332e5c31af7Sopenharmony_ci
333e5c31af7Sopenharmony_ci
334e5c31af7Sopenharmony_ci[[drawing-primitive-topology-class]]
335e5c31af7Sopenharmony_ci=== Topology Class
336e5c31af7Sopenharmony_ci
337e5c31af7Sopenharmony_ciThe primitive topologies are grouped into the following topology classes:
338e5c31af7Sopenharmony_ci
339e5c31af7Sopenharmony_ci[[topology-classes]]
340e5c31af7Sopenharmony_ci.Topology classes
341e5c31af7Sopenharmony_ci[options="header"]
342e5c31af7Sopenharmony_ci|===
343e5c31af7Sopenharmony_ci| Topology Class  | Primitive Topology
344e5c31af7Sopenharmony_ci| Point           | ename:VK_PRIMITIVE_TOPOLOGY_POINT_LIST
345e5c31af7Sopenharmony_ci| Line            | ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST,
346e5c31af7Sopenharmony_ci                    ename:VK_PRIMITIVE_TOPOLOGY_LINE_STRIP,
347e5c31af7Sopenharmony_ci                    ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY,
348e5c31af7Sopenharmony_ci                    ename:VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY
349e5c31af7Sopenharmony_ci| Triangle        | ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
350e5c31af7Sopenharmony_ci                    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
351e5c31af7Sopenharmony_ci                    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN,
352e5c31af7Sopenharmony_ci                    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY,
353e5c31af7Sopenharmony_ci                    ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY
354e5c31af7Sopenharmony_ci| Patch           | ename:VK_PRIMITIVE_TOPOLOGY_PATCH_LIST
355e5c31af7Sopenharmony_ci|===
356e5c31af7Sopenharmony_ciendif::VK_VERSION_1_3,VK_EXT_extended_dynamic_state,VK_EXT_shader_object[]
357e5c31af7Sopenharmony_ci
358e5c31af7Sopenharmony_ci
359e5c31af7Sopenharmony_ci[[drawing-point-lists]]
360e5c31af7Sopenharmony_ci=== Point Lists
361e5c31af7Sopenharmony_ci
362e5c31af7Sopenharmony_ciWhen the topology is ename:VK_PRIMITIVE_TOPOLOGY_POINT_LIST, each
363e5c31af7Sopenharmony_ciconsecutive vertex defines a single point primitive, according to the
364e5c31af7Sopenharmony_ciequation:
365e5c31af7Sopenharmony_ci
366e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~i~}#
367e5c31af7Sopenharmony_ci
368e5c31af7Sopenharmony_ciAs there is only one vertex, that vertex is the provoking vertex.
369e5c31af7Sopenharmony_ciThe number of primitives generated is equal to [eq]#pname:vertexCount#.
370e5c31af7Sopenharmony_ci
371e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_point_list.svg[align="center",opts="{imageopts}"]
372e5c31af7Sopenharmony_ci
373e5c31af7Sopenharmony_ci
374e5c31af7Sopenharmony_ci[[drawing-line-lists]]
375e5c31af7Sopenharmony_ci=== Line Lists
376e5c31af7Sopenharmony_ci
377e5c31af7Sopenharmony_ciWhen the primitive topology is ename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST, each
378e5c31af7Sopenharmony_ciconsecutive pair of vertices defines a single line primitive, according to
379e5c31af7Sopenharmony_cithe equation:
380e5c31af7Sopenharmony_ci
381e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~2i~, v~2i+1~}#
382e5c31af7Sopenharmony_ci
383e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
384e5c31af7Sopenharmony_ci[eq]#{lfloor}pname:vertexCount/2{rfloor}#.
385e5c31af7Sopenharmony_ci
386e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
387e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
388e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
389e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
390e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
391e5c31af7Sopenharmony_ciThe
392e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
393e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~2i~#.
394e5c31af7Sopenharmony_ci
395e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_list.svg[align="center",opts="{imageopts}"]
396e5c31af7Sopenharmony_ci
397e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
398e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
399e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
400e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~2i+1~#.
401e5c31af7Sopenharmony_ci
402e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_list_last.svg[align="center",opts="{imageopts}"]
403e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
404e5c31af7Sopenharmony_ci
405e5c31af7Sopenharmony_ci
406e5c31af7Sopenharmony_ci[[drawing-line-strips]]
407e5c31af7Sopenharmony_ci=== Line Strips
408e5c31af7Sopenharmony_ci
409e5c31af7Sopenharmony_ciWhen the primitive topology is ename:VK_PRIMITIVE_TOPOLOGY_LINE_STRIP, one
410e5c31af7Sopenharmony_ciline primitive is defined by each vertex and the following vertex, according
411e5c31af7Sopenharmony_cito the equation:
412e5c31af7Sopenharmony_ci
413e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~i~, v~i+1~}#
414e5c31af7Sopenharmony_ci
415e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
416e5c31af7Sopenharmony_ci[eq]#max(0,pname:vertexCount-1)#.
417e5c31af7Sopenharmony_ci
418e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
419e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
420e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
421e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
422e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
423e5c31af7Sopenharmony_ciThe
424e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
425e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~i~#.
426e5c31af7Sopenharmony_ci
427e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_strip.svg[align="center",opts="{imageopts}"]
428e5c31af7Sopenharmony_ci
429e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
430e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
431e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
432e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~i+1~#.
433e5c31af7Sopenharmony_ci
434e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_strip_last.svg[align="center",opts="{imageopts}"]
435e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
436e5c31af7Sopenharmony_ci
437e5c31af7Sopenharmony_ci
438e5c31af7Sopenharmony_ci[[drawing-triangle-lists]]
439e5c31af7Sopenharmony_ci=== Triangle Lists
440e5c31af7Sopenharmony_ci
441e5c31af7Sopenharmony_ciWhen the primitive topology is ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
442e5c31af7Sopenharmony_cieach consecutive set of three vertices defines a single triangle primitive,
443e5c31af7Sopenharmony_ciaccording to the equation:
444e5c31af7Sopenharmony_ci
445e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~3i~, v~3i+1~, v~3i+2~}#
446e5c31af7Sopenharmony_ci
447e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
448e5c31af7Sopenharmony_ci[eq]#{lfloor}pname:vertexCount/3{rfloor}#.
449e5c31af7Sopenharmony_ci
450e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
451e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
452e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
453e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
454e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
455e5c31af7Sopenharmony_ciThe
456e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
457e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~3i~#.
458e5c31af7Sopenharmony_ci
459e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_list.svg[align="center",opts="{imageopts}"]
460e5c31af7Sopenharmony_ci
461e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
462e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
463e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
464e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~3i+2~#.
465e5c31af7Sopenharmony_ci
466e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_list_last.svg[align="center",opts="{imageopts}"]
467e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
468e5c31af7Sopenharmony_ci
469e5c31af7Sopenharmony_ci
470e5c31af7Sopenharmony_ci[[drawing-triangle-strips]]
471e5c31af7Sopenharmony_ci=== Triangle Strips
472e5c31af7Sopenharmony_ci
473e5c31af7Sopenharmony_ciWhen the primitive topology is ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP,
474e5c31af7Sopenharmony_cione triangle primitive is defined by each vertex and the two vertices that
475e5c31af7Sopenharmony_cifollow it, according to the equation:
476e5c31af7Sopenharmony_ci
477e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~i~, v~i+(1+i%2)~, v~i+(2-i%2)~}#
478e5c31af7Sopenharmony_ci
479e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
480e5c31af7Sopenharmony_ci[eq]#max(0,pname:vertexCount-2)#.
481e5c31af7Sopenharmony_ci
482e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
483e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
484e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
485e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
486e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
487e5c31af7Sopenharmony_ciThe
488e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
489e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~i~#.
490e5c31af7Sopenharmony_ci
491e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_strip.svg[align="center",opts="{imageopts}"]
492e5c31af7Sopenharmony_ci
493e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
494e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
495e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
496e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~i+2~#.
497e5c31af7Sopenharmony_ci
498e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_strip_last.svg[align="center",opts="{imageopts}"]
499e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
500e5c31af7Sopenharmony_ci
501e5c31af7Sopenharmony_ci[NOTE]
502e5c31af7Sopenharmony_ci.Note
503e5c31af7Sopenharmony_ci====
504e5c31af7Sopenharmony_ciThe ordering of the vertices in each successive triangle is reversed, so
505e5c31af7Sopenharmony_cithat the winding order is consistent throughout the strip.
506e5c31af7Sopenharmony_ci====
507e5c31af7Sopenharmony_ci
508e5c31af7Sopenharmony_ci
509e5c31af7Sopenharmony_ci[[drawing-triangle-fans]]
510e5c31af7Sopenharmony_ci=== Triangle Fans
511e5c31af7Sopenharmony_ci
512e5c31af7Sopenharmony_ciWhen the primitive topology is ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN,
513e5c31af7Sopenharmony_citriangle primitives are defined around a shared common vertex, according to
514e5c31af7Sopenharmony_cithe equation:
515e5c31af7Sopenharmony_ci
516e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~i+1~, v~i+2~, v~0~}#
517e5c31af7Sopenharmony_ci
518e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
519e5c31af7Sopenharmony_ci[eq]#max(0,pname:vertexCount-2)#.
520e5c31af7Sopenharmony_ci
521e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
522e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
523e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
524e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
525e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
526e5c31af7Sopenharmony_ciThe
527e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
528e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~i+1~#.
529e5c31af7Sopenharmony_ci
530e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_fan.svg[align="center",opts="{imageopts}"]
531e5c31af7Sopenharmony_ci
532e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
533e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
534e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
535e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~i+2~#.
536e5c31af7Sopenharmony_ci
537e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_fan_last.svg[align="center",opts="{imageopts}"]
538e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
539e5c31af7Sopenharmony_ci
540e5c31af7Sopenharmony_ciifdef::VK_KHR_portability_subset[]
541e5c31af7Sopenharmony_ci[NOTE]
542e5c31af7Sopenharmony_ci.Note
543e5c31af7Sopenharmony_ci====
544e5c31af7Sopenharmony_ciIf the `apiext:VK_KHR_portability_subset` extension is enabled, and
545e5c31af7Sopenharmony_cislink:VkPhysicalDevicePortabilitySubsetFeaturesKHR::pname:triangleFans is
546e5c31af7Sopenharmony_ciename:VK_FALSE, then triangle fans are not supported by the implementation,
547e5c31af7Sopenharmony_ciand ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN must: not be used.
548e5c31af7Sopenharmony_ci====
549e5c31af7Sopenharmony_ciendif::VK_KHR_portability_subset[]
550e5c31af7Sopenharmony_ci
551e5c31af7Sopenharmony_ci
552e5c31af7Sopenharmony_ci[[drawing-line-lists-with-adjacency]]
553e5c31af7Sopenharmony_ci=== Line Lists With Adjacency
554e5c31af7Sopenharmony_ci
555e5c31af7Sopenharmony_ciWhen the primitive topology is
556e5c31af7Sopenharmony_ciename:VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY, each consecutive set
557e5c31af7Sopenharmony_ciof four vertices defines a single line primitive with adjacency, according
558e5c31af7Sopenharmony_cito the equation:
559e5c31af7Sopenharmony_ci
560e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~4i~, v~4i+1~, v~4i+2~,v~4i+3~}#
561e5c31af7Sopenharmony_ci
562e5c31af7Sopenharmony_ciA line primitive is described by the second and third vertices of the total
563e5c31af7Sopenharmony_ciprimitive, with the remaining two vertices only accessible in a
564e5c31af7Sopenharmony_ci<<geometry,geometry shader>>.
565e5c31af7Sopenharmony_ci
566e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
567e5c31af7Sopenharmony_ci[eq]#{lfloor}pname:vertexCount/4{rfloor}#.
568e5c31af7Sopenharmony_ci
569e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
570e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
571e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
572e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
573e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
574e5c31af7Sopenharmony_ciThe
575e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
576e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~4i+1~#.
577e5c31af7Sopenharmony_ci
578e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_list_with_adjacency.svg[align="center",opts="{imageopts}"]
579e5c31af7Sopenharmony_ci
580e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
581e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
582e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
583e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~4i+2~#.
584e5c31af7Sopenharmony_ci
585e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_list_with_adjacency_last.svg[align="center",opts="{imageopts}"]
586e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
587e5c31af7Sopenharmony_ci
588e5c31af7Sopenharmony_ci
589e5c31af7Sopenharmony_ci[[drawing-line-strips-with-adjacency]]
590e5c31af7Sopenharmony_ci=== Line Strips With Adjacency
591e5c31af7Sopenharmony_ci
592e5c31af7Sopenharmony_ciWhen the primitive topology is
593e5c31af7Sopenharmony_ciename:VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY, one line primitive
594e5c31af7Sopenharmony_ciwith adjacency is defined by each vertex and the following vertex, according
595e5c31af7Sopenharmony_cito the equation:
596e5c31af7Sopenharmony_ci
597e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~i~, v~i+1~, v~i+2~, v~i+3~}#
598e5c31af7Sopenharmony_ci
599e5c31af7Sopenharmony_ciA line primitive is described by the second and third vertices of the total
600e5c31af7Sopenharmony_ciprimitive, with the remaining two vertices only accessible in a
601e5c31af7Sopenharmony_ci<<geometry,geometry shader>>.
602e5c31af7Sopenharmony_ci
603e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
604e5c31af7Sopenharmony_ci[eq]#max(0,pname:vertexCount-3)#.
605e5c31af7Sopenharmony_ci
606e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
607e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
608e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
609e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
610e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
611e5c31af7Sopenharmony_ciThe
612e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
613e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~i+1~#.
614e5c31af7Sopenharmony_ci
615e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_strip_with_adjacency.svg[align="center",opts="{imageopts}"]
616e5c31af7Sopenharmony_ci
617e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
618e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
619e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
620e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~i+2~#.
621e5c31af7Sopenharmony_ci
622e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_line_strip_with_adjacency_last.svg[align="center",opts="{imageopts}"]
623e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
624e5c31af7Sopenharmony_ci
625e5c31af7Sopenharmony_ci
626e5c31af7Sopenharmony_ci[[drawing-triangle-lists-with-adjacency]]
627e5c31af7Sopenharmony_ci=== Triangle Lists With Adjacency
628e5c31af7Sopenharmony_ci
629e5c31af7Sopenharmony_ciWhen the primitive topology is
630e5c31af7Sopenharmony_ciename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY, each consecutive
631e5c31af7Sopenharmony_ciset of six vertices defines a single triangle primitive with adjacency,
632e5c31af7Sopenharmony_ciaccording to the equations:
633e5c31af7Sopenharmony_ci
634e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~6i~, v~6i+1~, v~6i+2~, v~6i+3~, v~6i+4~,
635e5c31af7Sopenharmony_ci            v~6i+5~}#
636e5c31af7Sopenharmony_ci
637e5c31af7Sopenharmony_ciA triangle primitive is described by the first, third, and fifth vertices of
638e5c31af7Sopenharmony_cithe total primitive, with the remaining three vertices only accessible in a
639e5c31af7Sopenharmony_ci<<geometry,geometry shader>>.
640e5c31af7Sopenharmony_ci
641e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
642e5c31af7Sopenharmony_ci[eq]#{lfloor}pname:vertexCount/6{rfloor}#.
643e5c31af7Sopenharmony_ci
644e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
645e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
646e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
647e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
648e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
649e5c31af7Sopenharmony_ciThe
650e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
651e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is [eq]#v~6i~#.
652e5c31af7Sopenharmony_ci
653e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_list_with_adjacency.svg[align="center",opts="{imageopts}"]
654e5c31af7Sopenharmony_ci
655e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
656e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
657e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
658e5c31af7Sopenharmony_ci[eq]#p~i~# is [eq]#v~6i+4~#.
659e5c31af7Sopenharmony_ci
660e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_list_with_adjacency_last.svg[align="center",opts="{imageopts}"]
661e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
662e5c31af7Sopenharmony_ci
663e5c31af7Sopenharmony_ci
664e5c31af7Sopenharmony_ci[[drawing-triangle-strips-with-adjacency]]
665e5c31af7Sopenharmony_ci=== Triangle Strips With Adjacency
666e5c31af7Sopenharmony_ci
667e5c31af7Sopenharmony_ciWhen the primitive topology is
668e5c31af7Sopenharmony_ciename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY, one triangle
669e5c31af7Sopenharmony_ciprimitive with adjacency is defined by each vertex and the following 5
670e5c31af7Sopenharmony_civertices.
671e5c31af7Sopenharmony_ci
672e5c31af7Sopenharmony_ciThe number of primitives generated, [eq]#n#, is equal to [eq]#{lfloor}max(0,
673e5c31af7Sopenharmony_cipname:vertexCount - 4)/2{rfloor}#.
674e5c31af7Sopenharmony_ci
675e5c31af7Sopenharmony_ciIf [eq]#n=1#, the primitive is defined as:
676e5c31af7Sopenharmony_ci
677e5c31af7Sopenharmony_ci  {empty}:: [eq]#p = {v~0~, v~1~, v~2~, v~5~, v~4~, v~3~}#
678e5c31af7Sopenharmony_ci
679e5c31af7Sopenharmony_ciIf [eq]#n>1#, the total primitive consists of different vertices according
680e5c31af7Sopenharmony_cito where it is in the strip:
681e5c31af7Sopenharmony_ci
682e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~2i~, v~2i+1~, v~2i+2~, v~2i+6~, v~2i+4~,
683e5c31af7Sopenharmony_ci            v~2i+3~}# when [eq]#i=0#
684e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~2i~, v~2i+3~, v~2i+4~, v~2i+6~, v~2i+2~,
685e5c31af7Sopenharmony_ci            v~2i-2~}# when [eq]#i>0#, [eq]#i<n-1#, and [eq]#i%2=1#
686e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~2i~, v~2i-2~, v~2i+2~, v~2i+6~, v~2i+4~,
687e5c31af7Sopenharmony_ci            v~2i+3~}# when [eq]#i>0#, [eq]#i<n-1#, and [eq]#i%2=0#
688e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~2i~, v~2i+3~, v~2i+4~, v~2i+5~, v~2i+2~,
689e5c31af7Sopenharmony_ci            v~2i-2~}# when [eq]#i=n-1# and [eq]#i%2=1#
690e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~2i~, v~2i-2~, v~2i+2~, v~2i+5~, v~2i+4~,
691e5c31af7Sopenharmony_ci            v~2i+3~}# when [eq]#i=n-1# and [eq]#i%2=0#
692e5c31af7Sopenharmony_ci
693e5c31af7Sopenharmony_ciA triangle primitive is described by the first, third, and fifth vertices of
694e5c31af7Sopenharmony_cithe total primitive in all cases, with the remaining three vertices only
695e5c31af7Sopenharmony_ciaccessible in a <<geometry,geometry shader>>.
696e5c31af7Sopenharmony_ci
697e5c31af7Sopenharmony_ci[NOTE]
698e5c31af7Sopenharmony_ci.Note
699e5c31af7Sopenharmony_ci====
700e5c31af7Sopenharmony_ciThe ordering of the vertices in each successive triangle is altered so that
701e5c31af7Sopenharmony_cithe winding order is consistent throughout the strip.
702e5c31af7Sopenharmony_ci====
703e5c31af7Sopenharmony_ci
704e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
705e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
706e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the
707e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
708e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
709e5c31af7Sopenharmony_ciThe
710e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
711e5c31af7Sopenharmony_ciprovoking vertex for [eq]#p~i~# is always [eq]#v~2i~#.
712e5c31af7Sopenharmony_ci
713e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_strip_with_adjacency.svg[align="center",opts="{imageopts}"]
714e5c31af7Sopenharmony_ci
715e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
716e5c31af7Sopenharmony_ciWhen the pname:provokingVertexMode is
717e5c31af7Sopenharmony_ciename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the provoking vertex for
718e5c31af7Sopenharmony_ci[eq]#p~i~# is always [eq]#v~2i+4~#.
719e5c31af7Sopenharmony_ci
720e5c31af7Sopenharmony_ciimage::{images}/primitive_topology_triangle_strip_with_adjacency_last.svg[align="center",opts="{imageopts}"]
721e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
722e5c31af7Sopenharmony_ci
723e5c31af7Sopenharmony_ci
724e5c31af7Sopenharmony_ci[[drawing-patch-lists]]
725e5c31af7Sopenharmony_ci=== Patch Lists
726e5c31af7Sopenharmony_ci
727e5c31af7Sopenharmony_ciWhen the primitive topology is ename:VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, each
728e5c31af7Sopenharmony_ciconsecutive set of [eq]#m# vertices defines a single patch primitive,
729e5c31af7Sopenharmony_ciaccording to the equation:
730e5c31af7Sopenharmony_ci
731e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~i~ = {v~mi~, v~mi+1~, ..., v~mi+(m-2)~, v~mi+(m-1)~}#
732e5c31af7Sopenharmony_ci
733e5c31af7Sopenharmony_ciwhere [eq]#m# is equal to
734e5c31af7Sopenharmony_cislink:VkPipelineTessellationStateCreateInfo::pname:patchControlPoints.
735e5c31af7Sopenharmony_ci
736e5c31af7Sopenharmony_ciPatch lists are never passed to <<vertexpostproc, vertex post-processing>>,
737e5c31af7Sopenharmony_ciand as such no provoking vertex is defined for patch primitives.
738e5c31af7Sopenharmony_ciThe number of primitives generated is equal to
739e5c31af7Sopenharmony_ci[eq]#{lfloor}pname:vertexCount/m{rfloor}#.
740e5c31af7Sopenharmony_ci
741e5c31af7Sopenharmony_ciThe vertices comprising a patch have no implied geometry, and are used as
742e5c31af7Sopenharmony_ciinputs to tessellation shaders and the fixed-function tessellator to
743e5c31af7Sopenharmony_cigenerate new point, line, or triangle primitives.
744e5c31af7Sopenharmony_ci
745e5c31af7Sopenharmony_ci
746e5c31af7Sopenharmony_ci[[drawing-primitive-order]]
747e5c31af7Sopenharmony_ci== Primitive Order
748e5c31af7Sopenharmony_ci
749e5c31af7Sopenharmony_ciPrimitives generated by <<drawing, drawing commands>> progress through the
750e5c31af7Sopenharmony_cistages of the <<synchronization-pipeline-graphics, graphics pipeline>> in
751e5c31af7Sopenharmony_ci_primitive order_.
752e5c31af7Sopenharmony_ciPrimitive order is initially determined in the following way:
753e5c31af7Sopenharmony_ci
754e5c31af7Sopenharmony_ci  . Submission order determines the initial ordering
755e5c31af7Sopenharmony_ci  . For indirect drawing commands, the order in which accessed instances of
756e5c31af7Sopenharmony_ci    the slink:VkDrawIndirectCommand are stored in pname:buffer, from lower
757e5c31af7Sopenharmony_ci    indirect buffer addresses to higher addresses.
758e5c31af7Sopenharmony_ci  . If a drawing command includes multiple instances, the order in which
759e5c31af7Sopenharmony_ci    instances are executed, from lower numbered instances to higher.
760e5c31af7Sopenharmony_ci  . The order in which primitives are specified by a drawing command:
761e5c31af7Sopenharmony_ci  ** For non-indexed draws, from vertices with a lower numbered
762e5c31af7Sopenharmony_ci     code:vertexIndex to a higher numbered code:vertexIndex.
763e5c31af7Sopenharmony_ci  ** For indexed draws, vertices sourced from a lower index buffer addresses
764e5c31af7Sopenharmony_ci     to higher addresses.
765e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
766e5c31af7Sopenharmony_ci  ** For draws using mesh shaders, the order is provided by <<mesh-ordering,
767e5c31af7Sopenharmony_ci     mesh shading>>.
768e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
769e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[]
770e5c31af7Sopenharmony_ci  ** For draws using cluster culling shaders, the order is provided by
771e5c31af7Sopenharmony_ci     <<cluster-culling-cluster-ordering, cluster culling shading>>.
772e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[]
773e5c31af7Sopenharmony_ci
774e5c31af7Sopenharmony_ciWithin this order implementations further sort primitives:
775e5c31af7Sopenharmony_ci
776e5c31af7Sopenharmony_ci[start=5]
777e5c31af7Sopenharmony_ci  . If tessellation shading is active, by an implementation-dependent order
778e5c31af7Sopenharmony_ci    of new primitives generated by <<tessellation-primitive-order,
779e5c31af7Sopenharmony_ci    tessellation>>.
780e5c31af7Sopenharmony_ci  . If geometry shading is active, by the order new primitives are generated
781e5c31af7Sopenharmony_ci    by <<geometry-ordering, geometry shading>>.
782e5c31af7Sopenharmony_ci  . If the <<primsrast-polygonmode,polygon mode>> is not
783e5c31af7Sopenharmony_ci    ename:VK_POLYGON_MODE_FILL,
784e5c31af7Sopenharmony_ciifdef::VK_NV_fill_rectangle[]
785e5c31af7Sopenharmony_ci    or ename:VK_POLYGON_MODE_FILL_RECTANGLE_NV,
786e5c31af7Sopenharmony_ciendif::VK_NV_fill_rectangle[]
787e5c31af7Sopenharmony_ci    by an implementation-dependent ordering of the new primitives generated
788e5c31af7Sopenharmony_ci    within the original primitive.
789e5c31af7Sopenharmony_ci
790e5c31af7Sopenharmony_ciPrimitive order is later used to define <<primsrast-order, rasterization
791e5c31af7Sopenharmony_ciorder>>, which determines the order in which fragments output results to a
792e5c31af7Sopenharmony_ciframebuffer.
793e5c31af7Sopenharmony_ci
794e5c31af7Sopenharmony_ci
795e5c31af7Sopenharmony_ci[[drawing-primitive-shading]]
796e5c31af7Sopenharmony_ci== Programmable Primitive Shading
797e5c31af7Sopenharmony_ci
798e5c31af7Sopenharmony_ciOnce primitives are assembled, they proceed to the vertex shading stage of
799e5c31af7Sopenharmony_cithe pipeline.
800e5c31af7Sopenharmony_ciIf the draw includes multiple instances, then the set of primitives is sent
801e5c31af7Sopenharmony_cito the vertex shading stage multiple times, once for each instance.
802e5c31af7Sopenharmony_ci
803e5c31af7Sopenharmony_ciIt is implementation-dependent whether vertex shading occurs on vertices
804e5c31af7Sopenharmony_cithat are discarded as part of incomplete primitives, but if it does occur
805e5c31af7Sopenharmony_cithen it operates as if they were vertices in complete primitives and such
806e5c31af7Sopenharmony_ciinvocations can: have side effects.
807e5c31af7Sopenharmony_ci
808e5c31af7Sopenharmony_ciVertex shading receives two per-vertex inputs from the primitive assembly
809e5c31af7Sopenharmony_cistage - the code:vertexIndex and the code:instanceIndex.
810e5c31af7Sopenharmony_ciHow these values are generated is defined below, with each command.
811e5c31af7Sopenharmony_ci
812e5c31af7Sopenharmony_ciDrawing commands fall roughly into two categories:
813e5c31af7Sopenharmony_ci
814e5c31af7Sopenharmony_ci  * Non-indexed drawing commands present a sequential code:vertexIndex to
815e5c31af7Sopenharmony_ci    the vertex shader.
816e5c31af7Sopenharmony_ci    The sequential index is generated automatically by the device (see
817e5c31af7Sopenharmony_ci    <<fxvertex,Fixed-Function Vertex Processing>> for details on both
818e5c31af7Sopenharmony_ci    specifying the vertex attributes indexed by code:vertexIndex, as well as
819e5c31af7Sopenharmony_ci    binding vertex buffers containing those attributes to a command buffer).
820e5c31af7Sopenharmony_ci    These commands are:
821e5c31af7Sopenharmony_ci  ** flink:vkCmdDraw
822e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndirect
823e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[]
824e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndirectCount
825e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[]
826e5c31af7Sopenharmony_ciifdef::VK_KHR_draw_indirect_count[]
827e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndirectCountKHR
828e5c31af7Sopenharmony_ciendif::VK_KHR_draw_indirect_count[]
829e5c31af7Sopenharmony_ciifdef::VK_AMD_draw_indirect_count[]
830e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndirectCountAMD
831e5c31af7Sopenharmony_ciendif::VK_AMD_draw_indirect_count[]
832e5c31af7Sopenharmony_ciifdef::VK_EXT_multi_draw[]
833e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawMultiEXT
834e5c31af7Sopenharmony_ciendif::VK_EXT_multi_draw[]
835e5c31af7Sopenharmony_ci  * Indexed drawing commands read index values from an _index buffer_ and
836e5c31af7Sopenharmony_ci    use this to compute the code:vertexIndex value for the vertex shader.
837e5c31af7Sopenharmony_ci    These commands are:
838e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndexed
839e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndexedIndirect
840e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[]
841e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndexedIndirectCount
842e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[]
843e5c31af7Sopenharmony_ciifdef::VK_KHR_draw_indirect_count[]
844e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndexedIndirectCountKHR
845e5c31af7Sopenharmony_ciendif::VK_KHR_draw_indirect_count[]
846e5c31af7Sopenharmony_ciifdef::VK_AMD_draw_indirect_count[]
847e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawIndexedIndirectCountAMD
848e5c31af7Sopenharmony_ciendif::VK_AMD_draw_indirect_count[]
849e5c31af7Sopenharmony_ciifdef::VK_EXT_multi_draw[]
850e5c31af7Sopenharmony_ci  ** flink:vkCmdDrawMultiIndexedEXT
851e5c31af7Sopenharmony_ciendif::VK_EXT_multi_draw[]
852e5c31af7Sopenharmony_ci
853e5c31af7Sopenharmony_ci
854e5c31af7Sopenharmony_ci[open,refpage='vkCmdBindIndexBuffer',desc='Bind an index buffer to a command buffer',type='protos']
855e5c31af7Sopenharmony_ci--
856e5c31af7Sopenharmony_ci:refpage: vkCmdBindIndexBuffer
857e5c31af7Sopenharmony_ci
858e5c31af7Sopenharmony_ciTo bind an index buffer to a command buffer, call:
859e5c31af7Sopenharmony_ci
860e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBindIndexBuffer.adoc[]
861e5c31af7Sopenharmony_ci
862e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
863e5c31af7Sopenharmony_ci    recorded.
864e5c31af7Sopenharmony_ci  * pname:buffer is the buffer being bound.
865e5c31af7Sopenharmony_ci  * pname:offset is the starting offset in bytes within pname:buffer used in
866e5c31af7Sopenharmony_ci    index buffer address calculations.
867e5c31af7Sopenharmony_ci  * pname:indexType is a elink:VkIndexType value specifying the size of the
868e5c31af7Sopenharmony_ci    indices.
869e5c31af7Sopenharmony_ci
870e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance6[]
871e5c31af7Sopenharmony_ciIf the <<features-maintenance6,pname:maintenance6>> feature is enabled,
872e5c31af7Sopenharmony_cipname:buffer can: be dlink:VK_NULL_HANDLE.
873e5c31af7Sopenharmony_ciifdef::VK_EXT_robustness2[]
874e5c31af7Sopenharmony_ciIf pname:buffer is dlink:VK_NULL_HANDLE and the <<features-nullDescriptor,
875e5c31af7Sopenharmony_cipname:nullDescriptor>> feature is enabled, every index fetched results in a
876e5c31af7Sopenharmony_civalue of zero.
877e5c31af7Sopenharmony_ciendif::VK_EXT_robustness2[]
878e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance6[]
879e5c31af7Sopenharmony_ci
880e5c31af7Sopenharmony_ci.Valid Usage
881e5c31af7Sopenharmony_ci****
882e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/bind_index_buffer_common.adoc[]
883e5c31af7Sopenharmony_ci****
884e5c31af7Sopenharmony_ci
885e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBindIndexBuffer.adoc[]
886e5c31af7Sopenharmony_ci--
887e5c31af7Sopenharmony_ci
888e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[]
889e5c31af7Sopenharmony_ci[open,refpage='vkCmdBindIndexBuffer2KHR',desc='Bind an index buffer to a command buffer',type='protos']
890e5c31af7Sopenharmony_ci--
891e5c31af7Sopenharmony_ci:refpage: vkCmdBindIndexBuffer2KHR
892e5c31af7Sopenharmony_ci
893e5c31af7Sopenharmony_ciTo bind an index buffer, along with its size, to a command buffer, call:
894e5c31af7Sopenharmony_ci
895e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBindIndexBuffer2KHR.adoc[]
896e5c31af7Sopenharmony_ci
897e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
898e5c31af7Sopenharmony_ci    recorded.
899e5c31af7Sopenharmony_ci  * pname:buffer is the buffer being bound.
900e5c31af7Sopenharmony_ci  * pname:offset is the starting offset in bytes within pname:buffer used in
901e5c31af7Sopenharmony_ci    index buffer address calculations.
902e5c31af7Sopenharmony_ci  * pname:size is the size in bytes of index data bound from pname:buffer.
903e5c31af7Sopenharmony_ci  * pname:indexType is a elink:VkIndexType value specifying the size of the
904e5c31af7Sopenharmony_ci    indices.
905e5c31af7Sopenharmony_ci
906e5c31af7Sopenharmony_cipname:size specifies the bound size of the index buffer starting from
907e5c31af7Sopenharmony_cipname:offset.
908e5c31af7Sopenharmony_ciIf pname:size is ename:VK_WHOLE_SIZE then the bound size is from
909e5c31af7Sopenharmony_cipname:offset to the end of the pname:buffer.
910e5c31af7Sopenharmony_ci
911e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance6[]
912e5c31af7Sopenharmony_ciIf the <<features-maintenance6,pname:maintenance6>> feature is enabled,
913e5c31af7Sopenharmony_cipname:buffer can: be dlink:VK_NULL_HANDLE.
914e5c31af7Sopenharmony_ciifdef::VK_EXT_robustness2[]
915e5c31af7Sopenharmony_ciIf pname:buffer is dlink:VK_NULL_HANDLE and the <<features-nullDescriptor,
916e5c31af7Sopenharmony_cipname:nullDescriptor>> feature is enabled, every index fetched results in a
917e5c31af7Sopenharmony_civalue of zero.
918e5c31af7Sopenharmony_ciendif::VK_EXT_robustness2[]
919e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance6[]
920e5c31af7Sopenharmony_ci
921e5c31af7Sopenharmony_ci.Valid Usage
922e5c31af7Sopenharmony_ci****
923e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/bind_index_buffer_common.adoc[]
924e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindIndexBuffer2KHR-size-08767]]
925e5c31af7Sopenharmony_ci    If pname:size is not ename:VK_WHOLE_SIZE, pname:size must: be a multiple
926e5c31af7Sopenharmony_ci    of the size of the type indicated by pname:indexType
927e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindIndexBuffer2KHR-size-08768]]
928e5c31af7Sopenharmony_ci    If pname:size is not ename:VK_WHOLE_SIZE, the sum of pname:offset and
929e5c31af7Sopenharmony_ci    pname:size must: be less than or equal to the size of pname:buffer
930e5c31af7Sopenharmony_ci****
931e5c31af7Sopenharmony_ci
932e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBindIndexBuffer2KHR.adoc[]
933e5c31af7Sopenharmony_ci--
934e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance5[]
935e5c31af7Sopenharmony_ci
936e5c31af7Sopenharmony_ci[open,refpage='VkIndexType',desc='Type of index buffer indices',type='enums']
937e5c31af7Sopenharmony_ci--
938e5c31af7Sopenharmony_ciPossible values of
939e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[flink:vkCmdBindIndexBuffer2KHR::pname:indexType and]
940e5c31af7Sopenharmony_ciflink:vkCmdBindIndexBuffer::pname:indexType, specifying the size of indices,
941e5c31af7Sopenharmony_ciare:
942e5c31af7Sopenharmony_ci
943e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkIndexType.adoc[]
944e5c31af7Sopenharmony_ci
945e5c31af7Sopenharmony_ci  * ename:VK_INDEX_TYPE_UINT16 specifies that indices are 16-bit unsigned
946e5c31af7Sopenharmony_ci    integer values.
947e5c31af7Sopenharmony_ci  * ename:VK_INDEX_TYPE_UINT32 specifies that indices are 32-bit unsigned
948e5c31af7Sopenharmony_ci    integer values.
949e5c31af7Sopenharmony_ciifdef::VK_NV_ray_tracing,VK_KHR_acceleration_structure[]
950e5c31af7Sopenharmony_ci  * ename:VK_INDEX_TYPE_NONE_KHR specifies that no indices are provided.
951e5c31af7Sopenharmony_ciendif::VK_NV_ray_tracing,VK_KHR_acceleration_structure[]
952e5c31af7Sopenharmony_ciifdef::VK_EXT_index_type_uint8[]
953e5c31af7Sopenharmony_ci  * ename:VK_INDEX_TYPE_UINT8_EXT specifies that indices are 8-bit unsigned
954e5c31af7Sopenharmony_ci    integer values.
955e5c31af7Sopenharmony_ciendif::VK_EXT_index_type_uint8[]
956e5c31af7Sopenharmony_ci--
957e5c31af7Sopenharmony_ci
958e5c31af7Sopenharmony_ciThe parameters for each drawing command are specified directly in the
959e5c31af7Sopenharmony_cicommand or read from buffer memory, depending on the command.
960e5c31af7Sopenharmony_ciDrawing commands that source their parameters from buffer memory are known
961e5c31af7Sopenharmony_cias _indirect_ drawing commands.
962e5c31af7Sopenharmony_ci
963e5c31af7Sopenharmony_ciAll drawing commands interact with the <<features-robustBufferAccess,
964e5c31af7Sopenharmony_cipname:robustBufferAccess>> feature.
965e5c31af7Sopenharmony_ci
966e5c31af7Sopenharmony_ci[open,refpage='vkCmdDraw',desc='Draw primitives',type='protos']
967e5c31af7Sopenharmony_ci--
968e5c31af7Sopenharmony_ci:refpage: vkCmdDraw
969e5c31af7Sopenharmony_ci
970e5c31af7Sopenharmony_ciTo record a non-indexed draw, call:
971e5c31af7Sopenharmony_ci
972e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDraw.adoc[]
973e5c31af7Sopenharmony_ci
974e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
975e5c31af7Sopenharmony_ci    recorded.
976e5c31af7Sopenharmony_ci  * pname:vertexCount is the number of vertices to draw.
977e5c31af7Sopenharmony_ci  * pname:instanceCount is the number of instances to draw.
978e5c31af7Sopenharmony_ci  * pname:firstVertex is the index of the first vertex to draw.
979e5c31af7Sopenharmony_ci  * pname:firstInstance is the instance ID of the first instance to draw.
980e5c31af7Sopenharmony_ci
981e5c31af7Sopenharmony_ciWhen the command is executed, primitives are assembled using the current
982e5c31af7Sopenharmony_ciprimitive topology and pname:vertexCount consecutive vertex indices with the
983e5c31af7Sopenharmony_cifirst code:vertexIndex value equal to pname:firstVertex.
984e5c31af7Sopenharmony_ciThe primitives are drawn pname:instanceCount times with code:instanceIndex
985e5c31af7Sopenharmony_cistarting with pname:firstInstance and increasing sequentially for each
986e5c31af7Sopenharmony_ciinstance.
987e5c31af7Sopenharmony_ciThe assembled primitives execute the bound graphics pipeline.
988e5c31af7Sopenharmony_ci
989e5c31af7Sopenharmony_ci.Valid Usage
990e5c31af7Sopenharmony_ci****
991e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
992e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_nonindirect_common.adoc[]
993e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
994e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_instance_common.adoc[]
995e5c31af7Sopenharmony_ci****
996e5c31af7Sopenharmony_ci
997e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDraw.adoc[]
998e5c31af7Sopenharmony_ci--
999e5c31af7Sopenharmony_ci
1000e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawIndexed',desc='Draw primitives with indexed vertices',type='protos']
1001e5c31af7Sopenharmony_ci--
1002e5c31af7Sopenharmony_ci:refpage: vkCmdDrawIndexed
1003e5c31af7Sopenharmony_ci
1004e5c31af7Sopenharmony_ciTo record an indexed draw, call:
1005e5c31af7Sopenharmony_ci
1006e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndexed.adoc[]
1007e5c31af7Sopenharmony_ci
1008e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1009e5c31af7Sopenharmony_ci    recorded.
1010e5c31af7Sopenharmony_ci  * pname:indexCount is the number of vertices to draw.
1011e5c31af7Sopenharmony_ci  * pname:instanceCount is the number of instances to draw.
1012e5c31af7Sopenharmony_ci  * pname:firstIndex is the base index within the index buffer.
1013e5c31af7Sopenharmony_ci  * pname:vertexOffset is the value added to the vertex index before
1014e5c31af7Sopenharmony_ci    indexing into the vertex buffer.
1015e5c31af7Sopenharmony_ci  * pname:firstInstance is the instance ID of the first instance to draw.
1016e5c31af7Sopenharmony_ci
1017e5c31af7Sopenharmony_ciWhen the command is executed, primitives are assembled using the current
1018e5c31af7Sopenharmony_ciprimitive topology and pname:indexCount vertices whose indices are retrieved
1019e5c31af7Sopenharmony_cifrom the index buffer.
1020e5c31af7Sopenharmony_ciThe index buffer is treated as an array of tightly packed unsigned integers
1021e5c31af7Sopenharmony_ciof size defined by the
1022e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[flink:vkCmdBindIndexBuffer2KHR::pname:indexType or the]
1023e5c31af7Sopenharmony_ciflink:vkCmdBindIndexBuffer::pname:indexType parameter with which the buffer
1024e5c31af7Sopenharmony_ciwas bound.
1025e5c31af7Sopenharmony_ci
1026e5c31af7Sopenharmony_ciThe first vertex index is at an offset of [eq]#pname:firstIndex {times}
1027e5c31af7Sopenharmony_cicode:indexSize {plus} pname:offset# within the bound index buffer, where
1028e5c31af7Sopenharmony_cipname:offset is the offset specified by fname:vkCmdBindIndexBuffer
1029e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance5[or fname:vkCmdBindIndexBuffer2KHR,]
1030e5c31af7Sopenharmony_ciand code:indexSize is the byte size of the type specified by
1031e5c31af7Sopenharmony_cipname:indexType.
1032e5c31af7Sopenharmony_ciSubsequent index values are retrieved from consecutive locations in the
1033e5c31af7Sopenharmony_ciindex buffer.
1034e5c31af7Sopenharmony_ciIndices are first compared to the primitive restart value, then zero
1035e5c31af7Sopenharmony_ciextended to 32 bits (if the code:indexType is
1036e5c31af7Sopenharmony_ciifdef::VK_EXT_index_type_uint8[]
1037e5c31af7Sopenharmony_ciename:VK_INDEX_TYPE_UINT8_EXT or
1038e5c31af7Sopenharmony_ciendif::VK_EXT_index_type_uint8[]
1039e5c31af7Sopenharmony_ciename:VK_INDEX_TYPE_UINT16) and have pname:vertexOffset added to them,
1040e5c31af7Sopenharmony_cibefore being supplied as the code:vertexIndex value.
1041e5c31af7Sopenharmony_ci
1042e5c31af7Sopenharmony_ciThe primitives are drawn pname:instanceCount times with code:instanceIndex
1043e5c31af7Sopenharmony_cistarting with pname:firstInstance and increasing sequentially for each
1044e5c31af7Sopenharmony_ciinstance.
1045e5c31af7Sopenharmony_ciThe assembled primitives execute the bound graphics pipeline.
1046e5c31af7Sopenharmony_ci
1047e5c31af7Sopenharmony_ci.Valid Usage
1048e5c31af7Sopenharmony_ci****
1049e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1050e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_nonindirect_common.adoc[]
1051e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1052e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indexed_common.adoc[]
1053e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_instance_common.adoc[]
1054e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_index_binding.adoc[]
1055e5c31af7Sopenharmony_ci****
1056e5c31af7Sopenharmony_ci
1057e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawIndexed.adoc[]
1058e5c31af7Sopenharmony_ci--
1059e5c31af7Sopenharmony_ci
1060e5c31af7Sopenharmony_ciifdef::VK_EXT_multi_draw[]
1061e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawMultiEXT',desc='Draw primitives',type='protos']
1062e5c31af7Sopenharmony_ci--
1063e5c31af7Sopenharmony_ci:refpage: vkCmdDrawMultiEXT
1064e5c31af7Sopenharmony_ci
1065e5c31af7Sopenharmony_ciTo record an ordered sequence of draws which have no state changes between
1066e5c31af7Sopenharmony_cithem, call:
1067e5c31af7Sopenharmony_ci
1068e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawMultiEXT.adoc[]
1069e5c31af7Sopenharmony_ci
1070e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1071e5c31af7Sopenharmony_ci    recorded.
1072e5c31af7Sopenharmony_ci  * pname:drawCount is the number of draws to execute, and can: be zero.
1073e5c31af7Sopenharmony_ci  * pname:pVertexInfo is a pointer to an array of slink:VkMultiDrawInfoEXT
1074e5c31af7Sopenharmony_ci    with vertex information to be drawn.
1075e5c31af7Sopenharmony_ci  * pname:instanceCount is the number of instances per draw.
1076e5c31af7Sopenharmony_ci  * pname:firstInstance is the instance ID of the first instance in each
1077e5c31af7Sopenharmony_ci    draw.
1078e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between consecutive elements of
1079e5c31af7Sopenharmony_ci    pname:pVertexInfo.
1080e5c31af7Sopenharmony_ci
1081e5c31af7Sopenharmony_ciThe number of draws recorded is pname:drawCount, with each draw reading,
1082e5c31af7Sopenharmony_cisequentially, a pname:firstVertex and a pname:vertexCount from
1083e5c31af7Sopenharmony_cipname:pVertexInfo.
1084e5c31af7Sopenharmony_ciFor each recorded draw, primitives are assembled as for flink:vkCmdDraw, and
1085e5c31af7Sopenharmony_cidrawn pname:instanceCount times with code:instanceIndex starting with
1086e5c31af7Sopenharmony_cipname:firstInstance and sequentially for each instance.
1087e5c31af7Sopenharmony_ci
1088e5c31af7Sopenharmony_ci.Valid Usage
1089e5c31af7Sopenharmony_ci****
1090e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1091e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_nonindirect_common.adoc[]
1092e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1093e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_instance_common.adoc[]
1094e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiEXT-None-04933]]
1095e5c31af7Sopenharmony_ci    The <<features-multiDraw, pname:multiDraw>> feature must: be enabled
1096e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiEXT-drawCount-04934]]
1097e5c31af7Sopenharmony_ci    pname:drawCount must: be less than
1098e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceMultiDrawPropertiesEXT::pname:maxMultiDrawCount
1099e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiEXT-drawCount-04935]]
1100e5c31af7Sopenharmony_ci    If pname:drawCount is greater than zero, pname:pVertexInfo must: be a
1101e5c31af7Sopenharmony_ci    valid pointer to memory containing one or more valid instances of
1102e5c31af7Sopenharmony_ci    slink:VkMultiDrawInfoEXT structures
1103e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiEXT-stride-04936]]
1104e5c31af7Sopenharmony_ci    pname:stride must: be a multiple of 4
1105e5c31af7Sopenharmony_ci****
1106e5c31af7Sopenharmony_ci
1107e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawMultiEXT.adoc[]
1108e5c31af7Sopenharmony_ci--
1109e5c31af7Sopenharmony_ci
1110e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawMultiIndexedEXT',desc='Draw primitives',type='protos']
1111e5c31af7Sopenharmony_ci--
1112e5c31af7Sopenharmony_ci:refpage: vkCmdDrawMultiIndexedEXT
1113e5c31af7Sopenharmony_ci
1114e5c31af7Sopenharmony_ciTo record an ordered sequence of indexed draws which have no state changes
1115e5c31af7Sopenharmony_cibetween them, call:
1116e5c31af7Sopenharmony_ci
1117e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawMultiIndexedEXT.adoc[]
1118e5c31af7Sopenharmony_ci
1119e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1120e5c31af7Sopenharmony_ci    recorded.
1121e5c31af7Sopenharmony_ci  * pname:drawCount is the number of draws to execute, and can: be zero.
1122e5c31af7Sopenharmony_ci  * pname:pIndexInfo is a pointer to an array of
1123e5c31af7Sopenharmony_ci    slink:VkMultiDrawIndexedInfoEXT with index information to be drawn.
1124e5c31af7Sopenharmony_ci  * pname:instanceCount is the number of instances per draw.
1125e5c31af7Sopenharmony_ci  * pname:firstInstance is the instance ID of the first instance in each
1126e5c31af7Sopenharmony_ci    draw.
1127e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between consecutive elements of
1128e5c31af7Sopenharmony_ci    pname:pIndexInfo.
1129e5c31af7Sopenharmony_ci  * pname:pVertexOffset is `NULL` or a pointer to the value added to the
1130e5c31af7Sopenharmony_ci    vertex index before indexing into the vertex buffer.
1131e5c31af7Sopenharmony_ci    When specified, sname:VkMultiDrawIndexedInfoEXT::pname:offset is
1132e5c31af7Sopenharmony_ci    ignored.
1133e5c31af7Sopenharmony_ci
1134e5c31af7Sopenharmony_ciThe number of draws recorded is pname:drawCount, with each draw reading,
1135e5c31af7Sopenharmony_cisequentially, a pname:firstIndex and an pname:indexCount from
1136e5c31af7Sopenharmony_cipname:pIndexInfo.
1137e5c31af7Sopenharmony_ciFor each recorded draw, primitives are assembled as for
1138e5c31af7Sopenharmony_ciflink:vkCmdDrawIndexed, and drawn pname:instanceCount times with
1139e5c31af7Sopenharmony_cicode:instanceIndex starting with pname:firstInstance and sequentially for
1140e5c31af7Sopenharmony_cieach instance.
1141e5c31af7Sopenharmony_ciIf pname:pVertexOffset is `NULL`, a pname:vertexOffset is also read from
1142e5c31af7Sopenharmony_cipname:pIndexInfo, otherwise the value from dereferencing pname:pVertexOffset
1143e5c31af7Sopenharmony_ciis used.
1144e5c31af7Sopenharmony_ci
1145e5c31af7Sopenharmony_ci.Valid Usage
1146e5c31af7Sopenharmony_ci****
1147e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1148e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_nonindirect_common.adoc[]
1149e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1150e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indexed_common.adoc[]
1151e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_instance_common.adoc[]
1152e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_index_binding.adoc[]
1153e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiIndexedEXT-None-04937]]
1154e5c31af7Sopenharmony_ci    The <<features-multiDraw, pname:multiDraw>> feature must: be enabled
1155e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiIndexedEXT-drawCount-04939]]
1156e5c31af7Sopenharmony_ci    pname:drawCount must: be less than
1157e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceMultiDrawPropertiesEXT::pname:maxMultiDrawCount
1158e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiIndexedEXT-drawCount-04940]]
1159e5c31af7Sopenharmony_ci    If pname:drawCount is greater than zero, pname:pIndexInfo must: be a
1160e5c31af7Sopenharmony_ci    valid pointer to memory containing one or more valid instances of
1161e5c31af7Sopenharmony_ci    slink:VkMultiDrawIndexedInfoEXT structures
1162e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawMultiIndexedEXT-stride-04941]]
1163e5c31af7Sopenharmony_ci    pname:stride must: be a multiple of 4
1164e5c31af7Sopenharmony_ci****
1165e5c31af7Sopenharmony_ci
1166e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawMultiIndexedEXT.adoc[]
1167e5c31af7Sopenharmony_ci--
1168e5c31af7Sopenharmony_ci
1169e5c31af7Sopenharmony_ci[open,refpage='VkMultiDrawInfoEXT',desc='Structure specifying a multi-draw command',type='structs',xrefs='vkCmdDrawMultiEXT']
1170e5c31af7Sopenharmony_ci--
1171e5c31af7Sopenharmony_ciThe sname:VkMultiDrawInfoEXT structure is defined as:
1172e5c31af7Sopenharmony_ci
1173e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkMultiDrawInfoEXT.adoc[]
1174e5c31af7Sopenharmony_ci
1175e5c31af7Sopenharmony_ci  * pname:firstVertex is the first vertex to draw.
1176e5c31af7Sopenharmony_ci  * pname:vertexCount is the number of vertices to draw.
1177e5c31af7Sopenharmony_ci
1178e5c31af7Sopenharmony_ciThe members of sname:VkMultiDrawInfoEXT have the same meaning as the
1179e5c31af7Sopenharmony_cipname:firstVertex and pname:vertexCount parameters in flink:vkCmdDraw.
1180e5c31af7Sopenharmony_ci
1181e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkMultiDrawInfoEXT.adoc[]
1182e5c31af7Sopenharmony_ci--
1183e5c31af7Sopenharmony_ci
1184e5c31af7Sopenharmony_ci[open,refpage='VkMultiDrawIndexedInfoEXT',desc='Structure specifying a multi-draw command',type='structs',xrefs='vkCmdDrawMultiIndexedEXT']
1185e5c31af7Sopenharmony_ci--
1186e5c31af7Sopenharmony_ciThe sname:VkMultiDrawIndexedInfoEXT structure is defined as:
1187e5c31af7Sopenharmony_ci
1188e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkMultiDrawIndexedInfoEXT.adoc[]
1189e5c31af7Sopenharmony_ci
1190e5c31af7Sopenharmony_ci  * pname:firstIndex is the first index to draw.
1191e5c31af7Sopenharmony_ci  * pname:indexCount is the number of vertices to draw.
1192e5c31af7Sopenharmony_ci  * pname:vertexOffset is the value added to the vertex index before
1193e5c31af7Sopenharmony_ci    indexing into the vertex buffer for indexed multidraws.
1194e5c31af7Sopenharmony_ci
1195e5c31af7Sopenharmony_ciThe pname:firstIndex, pname:indexCount, and pname:vertexOffset members of
1196e5c31af7Sopenharmony_cisname:VkMultiDrawIndexedInfoEXT have the same meaning as the
1197e5c31af7Sopenharmony_cipname:firstIndex, pname:indexCount, and pname:vertexOffset parameters,
1198e5c31af7Sopenharmony_cirespectively, of flink:vkCmdDrawIndexed.
1199e5c31af7Sopenharmony_ci
1200e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkMultiDrawIndexedInfoEXT.adoc[]
1201e5c31af7Sopenharmony_ci
1202e5c31af7Sopenharmony_ci--
1203e5c31af7Sopenharmony_ciendif::VK_EXT_multi_draw[]
1204e5c31af7Sopenharmony_ci
1205e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawIndirect',desc='Draw primitives with indirect parameters',type='protos']
1206e5c31af7Sopenharmony_ci--
1207e5c31af7Sopenharmony_ci:refpage: vkCmdDrawIndirect
1208e5c31af7Sopenharmony_ci
1209e5c31af7Sopenharmony_ciTo record a non-indexed indirect drawing command, call:
1210e5c31af7Sopenharmony_ci
1211e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndirect.adoc[]
1212e5c31af7Sopenharmony_ci
1213e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1214e5c31af7Sopenharmony_ci    recorded.
1215e5c31af7Sopenharmony_ci  * pname:buffer is the buffer containing draw parameters.
1216e5c31af7Sopenharmony_ci  * pname:offset is the byte offset into pname:buffer where parameters
1217e5c31af7Sopenharmony_ci    begin.
1218e5c31af7Sopenharmony_ci  * pname:drawCount is the number of draws to execute, and can: be zero.
1219e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between successive sets of draw
1220e5c31af7Sopenharmony_ci    parameters.
1221e5c31af7Sopenharmony_ci
1222e5c31af7Sopenharmony_cifname:vkCmdDrawIndirect behaves similarly to flink:vkCmdDraw except that the
1223e5c31af7Sopenharmony_ciparameters are read by the device from a buffer during execution.
1224e5c31af7Sopenharmony_cipname:drawCount draws are executed by the command, with parameters taken
1225e5c31af7Sopenharmony_cifrom pname:buffer starting at pname:offset and increasing by pname:stride
1226e5c31af7Sopenharmony_cibytes for each successive draw.
1227e5c31af7Sopenharmony_ciThe parameters of each draw are encoded in an array of
1228e5c31af7Sopenharmony_cislink:VkDrawIndirectCommand structures.
1229e5c31af7Sopenharmony_ciIf pname:drawCount is less than or equal to one, pname:stride is ignored.
1230e5c31af7Sopenharmony_ci
1231e5c31af7Sopenharmony_ci.Valid Usage
1232e5c31af7Sopenharmony_ci****
1233e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1234e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1235e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_indirect_common.adoc[]
1236e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indirect_drawcount.adoc[]
1237e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirect-drawCount-00476]]
1238e5c31af7Sopenharmony_ci    If pname:drawCount is greater than `1`, pname:stride must: be a multiple
1239e5c31af7Sopenharmony_ci    of `4` and must: be greater than or equal to
1240e5c31af7Sopenharmony_ci    code:sizeof(sname:VkDrawIndirectCommand)
1241e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirect-drawCount-00487]]
1242e5c31af7Sopenharmony_ci    If pname:drawCount is equal to `1`, [eq]#(pname:offset {plus}
1243e5c31af7Sopenharmony_ci    code:sizeof(slink:VkDrawIndirectCommand))# must: be less than or equal
1244e5c31af7Sopenharmony_ci    to the size of pname:buffer
1245e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirect-drawCount-00488]]
1246e5c31af7Sopenharmony_ci    If pname:drawCount is greater than `1`, [eq]#(pname:stride {times}
1247e5c31af7Sopenharmony_ci    (pname:drawCount - 1) {plus} pname:offset {plus}
1248e5c31af7Sopenharmony_ci    code:sizeof(slink:VkDrawIndirectCommand))# must: be less than or equal
1249e5c31af7Sopenharmony_ci    to the size of pname:buffer
1250e5c31af7Sopenharmony_ci****
1251e5c31af7Sopenharmony_ci
1252e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawIndirect.adoc[]
1253e5c31af7Sopenharmony_ci--
1254e5c31af7Sopenharmony_ci
1255e5c31af7Sopenharmony_ci[open,refpage='VkDrawIndirectCommand',desc='Structure specifying a indirect drawing command',type='structs',xrefs='vkCmdDrawIndirect']
1256e5c31af7Sopenharmony_ci--
1257e5c31af7Sopenharmony_ci:refpage: VkDrawIndirectCommand
1258e5c31af7Sopenharmony_ci
1259e5c31af7Sopenharmony_ciThe sname:VkDrawIndirectCommand structure is defined as:
1260e5c31af7Sopenharmony_ci
1261e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDrawIndirectCommand.adoc[]
1262e5c31af7Sopenharmony_ci
1263e5c31af7Sopenharmony_ci  * pname:vertexCount is the number of vertices to draw.
1264e5c31af7Sopenharmony_ci  * pname:instanceCount is the number of instances to draw.
1265e5c31af7Sopenharmony_ci  * pname:firstVertex is the index of the first vertex to draw.
1266e5c31af7Sopenharmony_ci  * pname:firstInstance is the instance ID of the first instance to draw.
1267e5c31af7Sopenharmony_ci
1268e5c31af7Sopenharmony_ciThe members of sname:VkDrawIndirectCommand have the same meaning as the
1269e5c31af7Sopenharmony_cisimilarly named parameters of flink:vkCmdDraw.
1270e5c31af7Sopenharmony_ci
1271e5c31af7Sopenharmony_ci.Valid Usage
1272e5c31af7Sopenharmony_ci****
1273e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_instance_common.adoc[]
1274e5c31af7Sopenharmony_ci  * [[VUID-VkDrawIndirectCommand-None-00500]]
1275e5c31af7Sopenharmony_ci    For a given vertex buffer binding, any attribute data fetched must: be
1276e5c31af7Sopenharmony_ci    entirely contained within the corresponding vertex buffer binding, as
1277e5c31af7Sopenharmony_ci    described in <<fxvertex-input>>
1278e5c31af7Sopenharmony_ci  * [[VUID-VkDrawIndirectCommand-firstInstance-00501]]
1279e5c31af7Sopenharmony_ci    If the <<features-drawIndirectFirstInstance,
1280e5c31af7Sopenharmony_ci    pname:drawIndirectFirstInstance>> feature is not enabled,
1281e5c31af7Sopenharmony_ci    pname:firstInstance must: be code:0
1282e5c31af7Sopenharmony_ci****
1283e5c31af7Sopenharmony_ci
1284e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDrawIndirectCommand.adoc[]
1285e5c31af7Sopenharmony_ci--
1286e5c31af7Sopenharmony_ci
1287e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_draw_indirect_count[]
1288e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawIndirectCount',desc='Draw primitives with indirect parameters and draw count',type='protos',alias='vkCmdDrawIndirectCountKHR vkCmdDrawIndirectCountAMD']
1289e5c31af7Sopenharmony_ci--
1290e5c31af7Sopenharmony_ci:refpage: vkCmdDrawIndirectCount
1291e5c31af7Sopenharmony_ci
1292e5c31af7Sopenharmony_ciTo record a non-indexed draw call with a draw call count sourced from a
1293e5c31af7Sopenharmony_cibuffer, call:
1294e5c31af7Sopenharmony_ci
1295e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[]
1296e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndirectCount.adoc[]
1297e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[]
1298e5c31af7Sopenharmony_ci
1299e5c31af7Sopenharmony_ci// Jon: conditional logic on connective clauses with 3 forms of the command including VK_VERSION_1_2 needs work.
1300e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2+VK_KHR_draw_indirect_count[or the equivalent command]
1301e5c31af7Sopenharmony_ci
1302e5c31af7Sopenharmony_ciifdef::VK_KHR_draw_indirect_count[]
1303e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndirectCountKHR.adoc[]
1304e5c31af7Sopenharmony_ciendif::VK_KHR_draw_indirect_count[]
1305e5c31af7Sopenharmony_ci
1306e5c31af7Sopenharmony_ciifdef::VK_KHR_draw_indirect_count+VK_AMD_draw_indirect_count[or the equivalent command]
1307e5c31af7Sopenharmony_ci
1308e5c31af7Sopenharmony_ciifdef::VK_AMD_draw_indirect_count[]
1309e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndirectCountAMD.adoc[]
1310e5c31af7Sopenharmony_ciendif::VK_AMD_draw_indirect_count[]
1311e5c31af7Sopenharmony_ci
1312e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1313e5c31af7Sopenharmony_ci    recorded.
1314e5c31af7Sopenharmony_ci  * pname:buffer is the buffer containing draw parameters.
1315e5c31af7Sopenharmony_ci  * pname:offset is the byte offset into pname:buffer where parameters
1316e5c31af7Sopenharmony_ci    begin.
1317e5c31af7Sopenharmony_ci  * pname:countBuffer is the buffer containing the draw count.
1318e5c31af7Sopenharmony_ci  * pname:countBufferOffset is the byte offset into pname:countBuffer where
1319e5c31af7Sopenharmony_ci    the draw count begins.
1320e5c31af7Sopenharmony_ci  * pname:maxDrawCount specifies the maximum number of draws that will be
1321e5c31af7Sopenharmony_ci    executed.
1322e5c31af7Sopenharmony_ci    The actual number of executed draw calls is the minimum of the count
1323e5c31af7Sopenharmony_ci    specified in pname:countBuffer and pname:maxDrawCount.
1324e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between successive sets of draw
1325e5c31af7Sopenharmony_ci    parameters.
1326e5c31af7Sopenharmony_ci
1327e5c31af7Sopenharmony_cifname:vkCmdDrawIndirectCount behaves similarly to flink:vkCmdDrawIndirect
1328e5c31af7Sopenharmony_ciexcept that the draw count is read by the device from a buffer during
1329e5c31af7Sopenharmony_ciexecution.
1330e5c31af7Sopenharmony_ciThe command will read an unsigned 32-bit integer from pname:countBuffer
1331e5c31af7Sopenharmony_cilocated at pname:countBufferOffset and use this as the draw count.
1332e5c31af7Sopenharmony_ci
1333e5c31af7Sopenharmony_ci.Valid Usage
1334e5c31af7Sopenharmony_ci****
1335e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1336e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1337e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_indirect_common.adoc[]
1338e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indirect_count_common.adoc[]
1339e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectCount-stride-03110]]
1340e5c31af7Sopenharmony_ci    pname:stride must: be a multiple of `4` and must: be greater than or
1341e5c31af7Sopenharmony_ci    equal to sizeof(sname:VkDrawIndirectCommand)
1342e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectCount-maxDrawCount-03111]]
1343e5c31af7Sopenharmony_ci    If pname:maxDrawCount is greater than or equal to `1`,
1344e5c31af7Sopenharmony_ci    [eq]#(pname:stride {times} (pname:maxDrawCount - 1) {plus} pname:offset
1345e5c31af7Sopenharmony_ci    {plus} sizeof(sname:VkDrawIndirectCommand))# must: be less than or equal
1346e5c31af7Sopenharmony_ci    to the size of pname:buffer
1347e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectCount-countBuffer-03121]]
1348e5c31af7Sopenharmony_ci    If the count stored in pname:countBuffer is equal to `1`,
1349e5c31af7Sopenharmony_ci    [eq]#(pname:offset {plus} sizeof(sname:VkDrawIndirectCommand))# must: be
1350e5c31af7Sopenharmony_ci    less than or equal to the size of pname:buffer
1351e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectCount-countBuffer-03122]]
1352e5c31af7Sopenharmony_ci    If the count stored in pname:countBuffer is greater than `1`,
1353e5c31af7Sopenharmony_ci    [eq]#(pname:stride {times} (pname:drawCount - 1) {plus} pname:offset
1354e5c31af7Sopenharmony_ci    {plus} sizeof(sname:VkDrawIndirectCommand))# must: be less than or equal
1355e5c31af7Sopenharmony_ci    to the size of pname:buffer
1356e5c31af7Sopenharmony_ci****
1357e5c31af7Sopenharmony_ci
1358e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawIndirectCount.adoc[]
1359e5c31af7Sopenharmony_ci
1360e5c31af7Sopenharmony_ci--
1361e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_draw_indirect_count[]
1362e5c31af7Sopenharmony_ci
1363e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawIndexedIndirect',desc='Draw primitives with indirect parameters and indexed vertices',type='protos']
1364e5c31af7Sopenharmony_ci--
1365e5c31af7Sopenharmony_ci:refpage: vkCmdDrawIndexedIndirect
1366e5c31af7Sopenharmony_ci
1367e5c31af7Sopenharmony_ciTo record an indexed indirect drawing command, call:
1368e5c31af7Sopenharmony_ci
1369e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndexedIndirect.adoc[]
1370e5c31af7Sopenharmony_ci
1371e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1372e5c31af7Sopenharmony_ci    recorded.
1373e5c31af7Sopenharmony_ci  * pname:buffer is the buffer containing draw parameters.
1374e5c31af7Sopenharmony_ci  * pname:offset is the byte offset into pname:buffer where parameters
1375e5c31af7Sopenharmony_ci    begin.
1376e5c31af7Sopenharmony_ci  * pname:drawCount is the number of draws to execute, and can: be zero.
1377e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between successive sets of draw
1378e5c31af7Sopenharmony_ci    parameters.
1379e5c31af7Sopenharmony_ci
1380e5c31af7Sopenharmony_cifname:vkCmdDrawIndexedIndirect behaves similarly to flink:vkCmdDrawIndexed
1381e5c31af7Sopenharmony_ciexcept that the parameters are read by the device from a buffer during
1382e5c31af7Sopenharmony_ciexecution.
1383e5c31af7Sopenharmony_cipname:drawCount draws are executed by the command, with parameters taken
1384e5c31af7Sopenharmony_cifrom pname:buffer starting at pname:offset and increasing by pname:stride
1385e5c31af7Sopenharmony_cibytes for each successive draw.
1386e5c31af7Sopenharmony_ciThe parameters of each draw are encoded in an array of
1387e5c31af7Sopenharmony_cislink:VkDrawIndexedIndirectCommand structures.
1388e5c31af7Sopenharmony_ciIf pname:drawCount is less than or equal to one, pname:stride is ignored.
1389e5c31af7Sopenharmony_ci
1390e5c31af7Sopenharmony_ci.Valid Usage
1391e5c31af7Sopenharmony_ci****
1392e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1393e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1394e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_indirect_common.adoc[]
1395e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indirect_drawcount.adoc[]
1396e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indexed_common.adoc[]
1397e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndexedIndirect-drawCount-00528]]
1398e5c31af7Sopenharmony_ci    If pname:drawCount is greater than `1`, pname:stride must: be a multiple
1399e5c31af7Sopenharmony_ci    of `4` and must: be greater than or equal to
1400e5c31af7Sopenharmony_ci    code:sizeof(sname:VkDrawIndexedIndirectCommand)
1401e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndexedIndirect-drawCount-00539]]
1402e5c31af7Sopenharmony_ci    If pname:drawCount is equal to `1`, [eq]#(pname:offset {plus}
1403e5c31af7Sopenharmony_ci    code:sizeof(sname:VkDrawIndexedIndirectCommand))# must: be less than or
1404e5c31af7Sopenharmony_ci    equal to the size of pname:buffer
1405e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndexedIndirect-drawCount-00540]]
1406e5c31af7Sopenharmony_ci    If pname:drawCount is greater than `1`, [eq]#(pname:stride {times}
1407e5c31af7Sopenharmony_ci    (pname:drawCount - 1) {plus} pname:offset {plus}
1408e5c31af7Sopenharmony_ci    code:sizeof(sname:VkDrawIndexedIndirectCommand))# must: be less than or
1409e5c31af7Sopenharmony_ci    equal to the size of pname:buffer
1410e5c31af7Sopenharmony_ci****
1411e5c31af7Sopenharmony_ci
1412e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawIndexedIndirect.adoc[]
1413e5c31af7Sopenharmony_ci--
1414e5c31af7Sopenharmony_ci
1415e5c31af7Sopenharmony_ci[open,refpage='VkDrawIndexedIndirectCommand',desc='Structure specifying a indexed indirect drawing command',type='structs',xrefs='vkCmdDrawIndexedIndirect']
1416e5c31af7Sopenharmony_ci--
1417e5c31af7Sopenharmony_ci:refpage: VkDrawIndexedIndirectCommand
1418e5c31af7Sopenharmony_ci
1419e5c31af7Sopenharmony_ciThe sname:VkDrawIndexedIndirectCommand structure is defined as:
1420e5c31af7Sopenharmony_ci
1421e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkDrawIndexedIndirectCommand.adoc[]
1422e5c31af7Sopenharmony_ci
1423e5c31af7Sopenharmony_ci  * pname:indexCount is the number of vertices to draw.
1424e5c31af7Sopenharmony_ci  * pname:instanceCount is the number of instances to draw.
1425e5c31af7Sopenharmony_ci  * pname:firstIndex is the base index within the index buffer.
1426e5c31af7Sopenharmony_ci  * pname:vertexOffset is the value added to the vertex index before
1427e5c31af7Sopenharmony_ci    indexing into the vertex buffer.
1428e5c31af7Sopenharmony_ci  * pname:firstInstance is the instance ID of the first instance to draw.
1429e5c31af7Sopenharmony_ci
1430e5c31af7Sopenharmony_ciThe members of sname:VkDrawIndexedIndirectCommand have the same meaning as
1431e5c31af7Sopenharmony_cithe similarly named parameters of flink:vkCmdDrawIndexed.
1432e5c31af7Sopenharmony_ci
1433e5c31af7Sopenharmony_ci.Valid Usage
1434e5c31af7Sopenharmony_ci****
1435e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_instance_common.adoc[]
1436e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_index_binding.adoc[]
1437e5c31af7Sopenharmony_ci  * [[VUID-VkDrawIndexedIndirectCommand-None-00552]]
1438e5c31af7Sopenharmony_ci    For a given vertex buffer binding, any attribute data fetched must: be
1439e5c31af7Sopenharmony_ci    entirely contained within the corresponding vertex buffer binding, as
1440e5c31af7Sopenharmony_ci    described in <<fxvertex-input>>
1441e5c31af7Sopenharmony_ci  * [[VUID-VkDrawIndexedIndirectCommand-firstInstance-00554]]
1442e5c31af7Sopenharmony_ci    If the <<features-drawIndirectFirstInstance,
1443e5c31af7Sopenharmony_ci    pname:drawIndirectFirstInstance>> feature is not enabled,
1444e5c31af7Sopenharmony_ci    pname:firstInstance must: be code:0
1445e5c31af7Sopenharmony_ci****
1446e5c31af7Sopenharmony_ci
1447e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkDrawIndexedIndirectCommand.adoc[]
1448e5c31af7Sopenharmony_ci--
1449e5c31af7Sopenharmony_ci
1450e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_KHR_draw_indirect_count[]
1451e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawIndexedIndirectCount',desc='Draw parameters with indirect parameters, indexed vertices, and draw count',type='protos',alias='vkCmdDrawIndexedIndirectCountKHR vkCmdDrawIndexedIndirectCountAMD']
1452e5c31af7Sopenharmony_ci--
1453e5c31af7Sopenharmony_ci:refpage: vkCmdDrawIndexedIndirectCount
1454e5c31af7Sopenharmony_ci
1455e5c31af7Sopenharmony_ciTo record an indexed draw call with a draw call count sourced from a buffer,
1456e5c31af7Sopenharmony_cicall:
1457e5c31af7Sopenharmony_ci
1458e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2[]
1459e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndexedIndirectCount.adoc[]
1460e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2[]
1461e5c31af7Sopenharmony_ci
1462e5c31af7Sopenharmony_ci// Jon: conditional logic on connective clauses with 3 forms of the command including VK_VERSION_1_2 needs work.
1463e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2+VK_KHR_draw_indirect_count[or the equivalent command]
1464e5c31af7Sopenharmony_ci
1465e5c31af7Sopenharmony_ciifdef::VK_KHR_draw_indirect_count[]
1466e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndexedIndirectCountKHR.adoc[]
1467e5c31af7Sopenharmony_ciendif::VK_KHR_draw_indirect_count[]
1468e5c31af7Sopenharmony_ci
1469e5c31af7Sopenharmony_ciifdef::VK_KHR_draw_indirect_count+VK_AMD_draw_indirect_count[or the equivalent command]
1470e5c31af7Sopenharmony_ci
1471e5c31af7Sopenharmony_ciifdef::VK_AMD_draw_indirect_count[]
1472e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndexedIndirectCountAMD.adoc[]
1473e5c31af7Sopenharmony_ciendif::VK_AMD_draw_indirect_count[]
1474e5c31af7Sopenharmony_ci
1475e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1476e5c31af7Sopenharmony_ci    recorded.
1477e5c31af7Sopenharmony_ci  * pname:buffer is the buffer containing draw parameters.
1478e5c31af7Sopenharmony_ci  * pname:offset is the byte offset into pname:buffer where parameters
1479e5c31af7Sopenharmony_ci    begin.
1480e5c31af7Sopenharmony_ci  * pname:countBuffer is the buffer containing the draw count.
1481e5c31af7Sopenharmony_ci  * pname:countBufferOffset is the byte offset into pname:countBuffer where
1482e5c31af7Sopenharmony_ci    the draw count begins.
1483e5c31af7Sopenharmony_ci  * pname:maxDrawCount specifies the maximum number of draws that will be
1484e5c31af7Sopenharmony_ci    executed.
1485e5c31af7Sopenharmony_ci    The actual number of executed draw calls is the minimum of the count
1486e5c31af7Sopenharmony_ci    specified in pname:countBuffer and pname:maxDrawCount.
1487e5c31af7Sopenharmony_ci  * pname:stride is the byte stride between successive sets of draw
1488e5c31af7Sopenharmony_ci    parameters.
1489e5c31af7Sopenharmony_ci
1490e5c31af7Sopenharmony_cifname:vkCmdDrawIndexedIndirectCount behaves similarly to
1491e5c31af7Sopenharmony_ciflink:vkCmdDrawIndexedIndirect except that the draw count is read by the
1492e5c31af7Sopenharmony_cidevice from a buffer during execution.
1493e5c31af7Sopenharmony_ciThe command will read an unsigned 32-bit integer from pname:countBuffer
1494e5c31af7Sopenharmony_cilocated at pname:countBufferOffset and use this as the draw count.
1495e5c31af7Sopenharmony_ci
1496e5c31af7Sopenharmony_ci.Valid Usage
1497e5c31af7Sopenharmony_ci****
1498e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1499e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1500e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_dispatch_indirect_common.adoc[]
1501e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indirect_count_common.adoc[]
1502e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_indexed_common.adoc[]
1503e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndexedIndirectCount-stride-03142]]
1504e5c31af7Sopenharmony_ci    pname:stride must: be a multiple of `4` and must: be greater than or
1505e5c31af7Sopenharmony_ci    equal to sizeof(sname:VkDrawIndexedIndirectCommand)
1506e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndexedIndirectCount-maxDrawCount-03143]]
1507e5c31af7Sopenharmony_ci    If pname:maxDrawCount is greater than or equal to `1`,
1508e5c31af7Sopenharmony_ci    [eq]#(pname:stride {times} (pname:maxDrawCount - 1) {plus} pname:offset
1509e5c31af7Sopenharmony_ci    {plus} sizeof(sname:VkDrawIndexedIndirectCommand))# must: be less than
1510e5c31af7Sopenharmony_ci    or equal to the size of pname:buffer
1511e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndexedIndirectCount-countBuffer-03153]]
1512e5c31af7Sopenharmony_ci    If count stored in pname:countBuffer is equal to `1`, [eq]#(pname:offset
1513e5c31af7Sopenharmony_ci    {plus} sizeof(sname:VkDrawIndexedIndirectCommand))# must: be less than
1514e5c31af7Sopenharmony_ci    or equal to the size of pname:buffer
1515e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndexedIndirectCount-countBuffer-03154]]
1516e5c31af7Sopenharmony_ci    If count stored in pname:countBuffer is greater than `1`,
1517e5c31af7Sopenharmony_ci    [eq]#(pname:stride {times} (pname:drawCount - 1) {plus} pname:offset
1518e5c31af7Sopenharmony_ci    {plus} sizeof(sname:VkDrawIndexedIndirectCommand))# must: be less than
1519e5c31af7Sopenharmony_ci    or equal to the size of pname:buffer
1520e5c31af7Sopenharmony_ci****
1521e5c31af7Sopenharmony_ci
1522e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawIndexedIndirectCount.adoc[]
1523e5c31af7Sopenharmony_ci--
1524e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_KHR_draw_indirect_count[]
1525e5c31af7Sopenharmony_ci
1526e5c31af7Sopenharmony_ci
1527e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[]
1528e5c31af7Sopenharmony_ci[[drawing-transform-feedback]]
1529e5c31af7Sopenharmony_ci=== Drawing Transform Feedback
1530e5c31af7Sopenharmony_ci
1531e5c31af7Sopenharmony_ciIt is possible to draw vertex data that was previously captured during
1532e5c31af7Sopenharmony_ciactive <<vertexpostproc-transform-feedback,transform feedback>> by binding
1533e5c31af7Sopenharmony_cione or more of the transform feedback buffers as vertex buffers.
1534e5c31af7Sopenharmony_ciA pipeline barrier is required between using the buffers as transform
1535e5c31af7Sopenharmony_cifeedback buffers and vertex buffers to ensure all writes to the transform
1536e5c31af7Sopenharmony_cifeedback buffers are visible when the data is read as vertex attributes.
1537e5c31af7Sopenharmony_ciThe source access is ename:VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT and
1538e5c31af7Sopenharmony_cithe destination access is ename:VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT for the
1539e5c31af7Sopenharmony_cipipeline stages ename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT and
1540e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_VERTEX_INPUT_BIT respectively.
1541e5c31af7Sopenharmony_ciThe value written to the counter buffer by
1542e5c31af7Sopenharmony_ciflink:vkCmdEndTransformFeedbackEXT can: be used to determine the vertex
1543e5c31af7Sopenharmony_cicount for the draw.
1544e5c31af7Sopenharmony_ciA pipeline barrier is required between using the counter buffer for
1545e5c31af7Sopenharmony_cifname:vkCmdEndTransformFeedbackEXT and fname:vkCmdDrawIndirectByteCountEXT
1546e5c31af7Sopenharmony_ciwhere the source access is
1547e5c31af7Sopenharmony_ciename:VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT and the destination
1548e5c31af7Sopenharmony_ciaccess is ename:VK_ACCESS_INDIRECT_COMMAND_READ_BIT for the pipeline stages
1549e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT and
1550e5c31af7Sopenharmony_ciename:VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT respectively.
1551e5c31af7Sopenharmony_ci
1552e5c31af7Sopenharmony_ci[open,refpage='vkCmdDrawIndirectByteCountEXT',desc='Draw primitives with indirect parameters where the vertex count is derived from the counter byte value in the counter buffer',type='protos']
1553e5c31af7Sopenharmony_ci--
1554e5c31af7Sopenharmony_ci:refpage: vkCmdDrawIndirectByteCountEXT
1555e5c31af7Sopenharmony_ci
1556e5c31af7Sopenharmony_ciTo record a non-indexed draw call, where the vertex count is based on a byte
1557e5c31af7Sopenharmony_cicount read from a buffer and the passed in vertex stride parameter, call:
1558e5c31af7Sopenharmony_ci
1559e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdDrawIndirectByteCountEXT.adoc[]
1560e5c31af7Sopenharmony_ci
1561e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
1562e5c31af7Sopenharmony_ci    recorded.
1563e5c31af7Sopenharmony_ci  * pname:instanceCount is the number of instances to draw.
1564e5c31af7Sopenharmony_ci  * pname:firstInstance is the instance ID of the first instance to draw.
1565e5c31af7Sopenharmony_ci  * pname:counterBuffer is the buffer handle from where the byte count is
1566e5c31af7Sopenharmony_ci    read.
1567e5c31af7Sopenharmony_ci  * pname:counterBufferOffset is the offset into the buffer used to read the
1568e5c31af7Sopenharmony_ci    byte count, which is used to calculate the vertex count for this draw
1569e5c31af7Sopenharmony_ci    call.
1570e5c31af7Sopenharmony_ci  * pname:counterOffset is subtracted from the byte count read from the
1571e5c31af7Sopenharmony_ci    pname:counterBuffer at the pname:counterBufferOffset
1572e5c31af7Sopenharmony_ci  * pname:vertexStride is the stride in bytes between each element of the
1573e5c31af7Sopenharmony_ci    vertex data that is used to calculate the vertex count from the counter
1574e5c31af7Sopenharmony_ci    value.
1575e5c31af7Sopenharmony_ci    This value is typically the same value that was used in the graphics
1576e5c31af7Sopenharmony_ci    pipeline state when the transform feedback was captured as the
1577e5c31af7Sopenharmony_ci    code:XfbStride.
1578e5c31af7Sopenharmony_ci
1579e5c31af7Sopenharmony_ciWhen the command is executed, primitives are assembled in the same way as
1580e5c31af7Sopenharmony_cidone with flink:vkCmdDraw except the pname:vertexCount is calculated based
1581e5c31af7Sopenharmony_cion the byte count read from pname:counterBuffer at offset
1582e5c31af7Sopenharmony_cipname:counterBufferOffset.
1583e5c31af7Sopenharmony_ciThe assembled primitives execute the bound graphics pipeline.
1584e5c31af7Sopenharmony_ci
1585e5c31af7Sopenharmony_ciThe effective pname:vertexCount is calculated as follows:
1586e5c31af7Sopenharmony_ci
1587e5c31af7Sopenharmony_ci[source,c]
1588e5c31af7Sopenharmony_ci----
1589e5c31af7Sopenharmony_ciconst uint32_t * counterBufferPtr = (const uint8_t *)counterBuffer.address + counterBufferOffset;
1590e5c31af7Sopenharmony_civertexCount = floor(max(0, (*counterBufferPtr - counterOffset)) / vertexStride);
1591e5c31af7Sopenharmony_ci----
1592e5c31af7Sopenharmony_ci
1593e5c31af7Sopenharmony_ciThe effective pname:firstVertex is zero.
1594e5c31af7Sopenharmony_ci
1595e5c31af7Sopenharmony_ci.Valid Usage
1596e5c31af7Sopenharmony_ci****
1597e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_common.adoc[]
1598e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
1599e5c31af7Sopenharmony_ciinclude::{chapters}/commonvalidity/draw_instance_common.adoc[]
1600e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-transformFeedback-02287]]
1601e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackFeaturesEXT::pname:transformFeedback
1602e5c31af7Sopenharmony_ci    must: be enabled
1603e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-transformFeedbackDraw-02288]]
1604e5c31af7Sopenharmony_ci    The implementation must: support
1605e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:transformFeedbackDraw
1606e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-vertexStride-02289]]
1607e5c31af7Sopenharmony_ci    pname:vertexStride must: be greater than 0 and less than or equal to
1608e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBufferDataStride
1609e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-counterBuffer-04567]]
1610e5c31af7Sopenharmony_ci    If pname:counterBuffer is non-sparse then it must: be bound completely
1611e5c31af7Sopenharmony_ci    and contiguously to a single sname:VkDeviceMemory object
1612e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-counterBuffer-02290]]
1613e5c31af7Sopenharmony_ci    pname:counterBuffer must: have been created with the
1614e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set
1615e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-counterBufferOffset-04568]]
1616e5c31af7Sopenharmony_ci    pname:counterBufferOffset must: be a multiple of `4`
1617e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-counterOffset-09474]]
1618e5c31af7Sopenharmony_ci    pname:counterOffset must: be a multiple of `4`
1619e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-vertexStride-09475]]
1620e5c31af7Sopenharmony_ci    pname:vertexStride must: be a multiple of `4`
1621e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1[]
1622e5c31af7Sopenharmony_ci  * [[VUID-vkCmdDrawIndirectByteCountEXT-commandBuffer-02646]]
1623e5c31af7Sopenharmony_ci    pname:commandBuffer must: not be a protected command buffer
1624e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1[]
1625e5c31af7Sopenharmony_ci****
1626e5c31af7Sopenharmony_ci
1627e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdDrawIndirectByteCountEXT.adoc[]
1628e5c31af7Sopenharmony_ci--
1629e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[]
1630e5c31af7Sopenharmony_ci
1631e5c31af7Sopenharmony_ci
1632e5c31af7Sopenharmony_ciifdef::VK_EXT_conditional_rendering[]
1633e5c31af7Sopenharmony_ci[[drawing-conditional-rendering]]
1634e5c31af7Sopenharmony_ci== Conditional Rendering
1635e5c31af7Sopenharmony_ci
1636e5c31af7Sopenharmony_ciCertain rendering commands can: be executed conditionally based on a value
1637e5c31af7Sopenharmony_ciin buffer memory.
1638e5c31af7Sopenharmony_ciThese rendering commands are limited to <<drawing,drawing commands>>,
1639e5c31af7Sopenharmony_ci<<dispatch,dispatching commands>>, and clearing attachments with
1640e5c31af7Sopenharmony_ciflink:vkCmdClearAttachments within a conditional rendering block which is
1641e5c31af7Sopenharmony_cidefined by commands flink:vkCmdBeginConditionalRenderingEXT and
1642e5c31af7Sopenharmony_ciflink:vkCmdEndConditionalRenderingEXT.
1643e5c31af7Sopenharmony_ciOther rendering commands remain unaffected by conditional rendering.
1644e5c31af7Sopenharmony_ci
1645e5c31af7Sopenharmony_ci[[active-conditional-rendering]]
1646e5c31af7Sopenharmony_ciAfter beginning conditional rendering, it is considered _active_ within the
1647e5c31af7Sopenharmony_cicommand buffer it was called until it is ended with
1648e5c31af7Sopenharmony_ciflink:vkCmdEndConditionalRenderingEXT.
1649e5c31af7Sopenharmony_ci
1650e5c31af7Sopenharmony_ciConditional rendering must: begin and end in the same command buffer.
1651e5c31af7Sopenharmony_ciWhen conditional rendering is active, a primary command buffer can: execute
1652e5c31af7Sopenharmony_cisecondary command buffers if the <<features-inheritedConditionalRendering,
1653e5c31af7Sopenharmony_cipname:inheritedConditionalRendering>> feature is enabled.
1654e5c31af7Sopenharmony_ciFor a secondary command buffer to be executed while conditional rendering is
1655e5c31af7Sopenharmony_ciactive in the primary command buffer, it must: set the
1656e5c31af7Sopenharmony_cipname:conditionalRenderingEnable flag of
1657e5c31af7Sopenharmony_cislink:VkCommandBufferInheritanceConditionalRenderingInfoEXT, as described in
1658e5c31af7Sopenharmony_cithe <<commandbuffers-recording, Command Buffer Recording>> section.
1659e5c31af7Sopenharmony_ci
1660e5c31af7Sopenharmony_ciConditional rendering must: also either begin and end inside the same
1661e5c31af7Sopenharmony_cisubpass of a render pass instance, or must: both begin and end outside of a
1662e5c31af7Sopenharmony_cirender pass instance (i.e. contain entire render pass instances).
1663e5c31af7Sopenharmony_ci
1664e5c31af7Sopenharmony_ci[open,refpage='vkCmdBeginConditionalRenderingEXT',desc='Define the beginning of a conditional rendering block',type='protos']
1665e5c31af7Sopenharmony_ci--
1666e5c31af7Sopenharmony_ciTo begin conditional rendering, call:
1667e5c31af7Sopenharmony_ci
1668e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBeginConditionalRenderingEXT.adoc[]
1669e5c31af7Sopenharmony_ci
1670e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which this command will
1671e5c31af7Sopenharmony_ci    be recorded.
1672e5c31af7Sopenharmony_ci  * pname:pConditionalRenderingBegin is a pointer to a
1673e5c31af7Sopenharmony_ci    slink:VkConditionalRenderingBeginInfoEXT structure specifying parameters
1674e5c31af7Sopenharmony_ci    of conditional rendering.
1675e5c31af7Sopenharmony_ci
1676e5c31af7Sopenharmony_ci.Valid Usage
1677e5c31af7Sopenharmony_ci****
1678e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginConditionalRenderingEXT-None-01980]]
1679e5c31af7Sopenharmony_ci    Conditional rendering must: not already be
1680e5c31af7Sopenharmony_ci    <<active-conditional-rendering,active>>
1681e5c31af7Sopenharmony_ci****
1682e5c31af7Sopenharmony_ci
1683e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBeginConditionalRenderingEXT.adoc[]
1684e5c31af7Sopenharmony_ci--
1685e5c31af7Sopenharmony_ci
1686e5c31af7Sopenharmony_ci[open,refpage='VkConditionalRenderingBeginInfoEXT',desc='Structure specifying conditional rendering begin information',type='structs']
1687e5c31af7Sopenharmony_ci--
1688e5c31af7Sopenharmony_ciThe sname:VkConditionalRenderingBeginInfoEXT structure is defined as:
1689e5c31af7Sopenharmony_ci
1690e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkConditionalRenderingBeginInfoEXT.adoc[]
1691e5c31af7Sopenharmony_ci
1692e5c31af7Sopenharmony_ci  * pname:sType is a elink:VkStructureType value identifying this structure.
1693e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1694e5c31af7Sopenharmony_ci    structure.
1695e5c31af7Sopenharmony_ci  * pname:buffer is a buffer containing the predicate for conditional
1696e5c31af7Sopenharmony_ci    rendering.
1697e5c31af7Sopenharmony_ci  * pname:offset is the byte offset into pname:buffer where the predicate is
1698e5c31af7Sopenharmony_ci    located.
1699e5c31af7Sopenharmony_ci  * pname:flags is a bitmask of tlink:VkConditionalRenderingFlagsEXT
1700e5c31af7Sopenharmony_ci    specifying the behavior of conditional rendering.
1701e5c31af7Sopenharmony_ci
1702e5c31af7Sopenharmony_ciIf the 32-bit value at pname:offset in pname:buffer memory is zero, then the
1703e5c31af7Sopenharmony_cirendering commands are discarded, otherwise they are executed as normal.
1704e5c31af7Sopenharmony_ciIf the value of the predicate in buffer memory changes while conditional
1705e5c31af7Sopenharmony_cirendering is active, the rendering commands may: be discarded in an
1706e5c31af7Sopenharmony_ciimplementation-dependent way.
1707e5c31af7Sopenharmony_ciSome implementations may latch the value of the predicate upon beginning
1708e5c31af7Sopenharmony_ciconditional rendering while others may read it before every rendering
1709e5c31af7Sopenharmony_cicommand.
1710e5c31af7Sopenharmony_ci
1711e5c31af7Sopenharmony_ci.Valid Usage
1712e5c31af7Sopenharmony_ci****
1713e5c31af7Sopenharmony_ci  * [[VUID-VkConditionalRenderingBeginInfoEXT-buffer-01981]]
1714e5c31af7Sopenharmony_ci    If pname:buffer is non-sparse then it must: be bound completely and
1715e5c31af7Sopenharmony_ci    contiguously to a single sname:VkDeviceMemory object
1716e5c31af7Sopenharmony_ci  * [[VUID-VkConditionalRenderingBeginInfoEXT-buffer-01982]]
1717e5c31af7Sopenharmony_ci    pname:buffer must: have been created with the
1718e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT bit set
1719e5c31af7Sopenharmony_ci  * [[VUID-VkConditionalRenderingBeginInfoEXT-offset-01983]]
1720e5c31af7Sopenharmony_ci    pname:offset must: be less than the size of pname:buffer by at least 32
1721e5c31af7Sopenharmony_ci    bits
1722e5c31af7Sopenharmony_ci  * [[VUID-VkConditionalRenderingBeginInfoEXT-offset-01984]]
1723e5c31af7Sopenharmony_ci    pname:offset must: be a multiple of 4
1724e5c31af7Sopenharmony_ci****
1725e5c31af7Sopenharmony_ci
1726e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkConditionalRenderingBeginInfoEXT.adoc[]
1727e5c31af7Sopenharmony_ci--
1728e5c31af7Sopenharmony_ci
1729e5c31af7Sopenharmony_ci[open,refpage='VkConditionalRenderingFlagBitsEXT',desc='Specify the behavior of conditional rendering',type='enums']
1730e5c31af7Sopenharmony_ci--
1731e5c31af7Sopenharmony_ciBits which can: be set in
1732e5c31af7Sopenharmony_ciflink:vkCmdBeginConditionalRenderingEXT::pname:flags, specifying the
1733e5c31af7Sopenharmony_cibehavior of conditional rendering, are:
1734e5c31af7Sopenharmony_ci
1735e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkConditionalRenderingFlagBitsEXT.adoc[]
1736e5c31af7Sopenharmony_ci
1737e5c31af7Sopenharmony_ci  * ename:VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT specifies the condition
1738e5c31af7Sopenharmony_ci    used to determine whether to discard rendering commands or not.
1739e5c31af7Sopenharmony_ci    That is, if the 32-bit predicate read from pname:buffer memory at
1740e5c31af7Sopenharmony_ci    pname:offset is zero, the rendering commands are not discarded, and if
1741e5c31af7Sopenharmony_ci    non zero, then they are discarded.
1742e5c31af7Sopenharmony_ci--
1743e5c31af7Sopenharmony_ci
1744e5c31af7Sopenharmony_ci[open,refpage='VkConditionalRenderingFlagsEXT',desc='Bitmask of VkConditionalRenderingFlagBitsEXT',type='flags']
1745e5c31af7Sopenharmony_ci--
1746e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkConditionalRenderingFlagsEXT.adoc[]
1747e5c31af7Sopenharmony_ci
1748e5c31af7Sopenharmony_citname:VkConditionalRenderingFlagsEXT is a bitmask type for setting a mask of
1749e5c31af7Sopenharmony_cizero or more elink:VkConditionalRenderingFlagBitsEXT.
1750e5c31af7Sopenharmony_ci--
1751e5c31af7Sopenharmony_ci
1752e5c31af7Sopenharmony_ci[open,refpage='vkCmdEndConditionalRenderingEXT',desc='Define the end of a conditional rendering block',type='protos']
1753e5c31af7Sopenharmony_ci--
1754e5c31af7Sopenharmony_ciTo end conditional rendering, call:
1755e5c31af7Sopenharmony_ci
1756e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdEndConditionalRenderingEXT.adoc[]
1757e5c31af7Sopenharmony_ci
1758e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which this command will
1759e5c31af7Sopenharmony_ci    be recorded.
1760e5c31af7Sopenharmony_ci
1761e5c31af7Sopenharmony_ciOnce ended, conditional rendering becomes inactive.
1762e5c31af7Sopenharmony_ci
1763e5c31af7Sopenharmony_ci.Valid Usage
1764e5c31af7Sopenharmony_ci****
1765e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndConditionalRenderingEXT-None-01985]]
1766e5c31af7Sopenharmony_ci    Conditional rendering must: be <<active-conditional-rendering,active>>
1767e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndConditionalRenderingEXT-None-01986]]
1768e5c31af7Sopenharmony_ci    If conditional rendering was made
1769e5c31af7Sopenharmony_ci    <<active-conditional-rendering,active>> outside of a render pass
1770e5c31af7Sopenharmony_ci    instance, it must: not be ended inside a render pass instance
1771e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndConditionalRenderingEXT-None-01987]]
1772e5c31af7Sopenharmony_ci    If conditional rendering was made
1773e5c31af7Sopenharmony_ci    <<active-conditional-rendering,active>> within a subpass it must: be
1774e5c31af7Sopenharmony_ci    ended in the same subpass
1775e5c31af7Sopenharmony_ci****
1776e5c31af7Sopenharmony_ci
1777e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdEndConditionalRenderingEXT.adoc[]
1778e5c31af7Sopenharmony_ci--
1779e5c31af7Sopenharmony_ciendif::VK_EXT_conditional_rendering[]
1780e5c31af7Sopenharmony_ci
1781e5c31af7Sopenharmony_ciifdef::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
1782e5c31af7Sopenharmony_ciinclude::{chapters}/VK_NV_mesh_shader/drawing.adoc[]
1783e5c31af7Sopenharmony_ciendif::VK_NV_mesh_shader,VK_EXT_mesh_shader[]
1784e5c31af7Sopenharmony_ci
1785e5c31af7Sopenharmony_ciifdef::VK_HUAWEI_cluster_culling_shader[]
1786e5c31af7Sopenharmony_ciinclude::{chapters}/VK_HUAWEI_cluster_culling_shader/drawing.adoc[]
1787e5c31af7Sopenharmony_ciendif::VK_HUAWEI_cluster_culling_shader[]
1788