summaryrefslogtreecommitdiff
path: root/chapters/VK_NV_device_generated_commands/generation.adoc
blob: ac5519e92152ed29c3e8ca9c7a17cb9a086f681b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
// Copyright (c) 2019-2020 NVIDIA Corporation
//
// SPDX-License-Identifier: CC-BY-4.0

== Indirect Commands Generation and Execution

[open,refpage='vkGetGeneratedCommandsMemoryRequirementsNV',desc='Retrieve the buffer allocation requirements for generated commands',type='protos']
--
The generation of commands on the device requires a `preprocess` buffer.
To retrieve the memory size and alignment requirements of a particular
execution state call:

include::{generated}/api/protos/vkGetGeneratedCommandsMemoryRequirementsNV.adoc[]

  * pname:device is the logical device that owns the buffer.
  * pname:pInfo is a pointer to a
    sname:VkGeneratedCommandsMemoryRequirementsInfoNV structure containing
    parameters required for the memory requirements query.
  * pname:pMemoryRequirements is a pointer to a slink:VkMemoryRequirements2
    structure in which the memory requirements of the buffer object are
    returned.

.Valid Usage
****
  * [[VUID-vkGetGeneratedCommandsMemoryRequirementsNV-deviceGeneratedCommands-02906]]
    The <<features-deviceGeneratedCommands,
    sname:VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV::pname:deviceGeneratedCommands>>
    feature must: be enabled
ifdef::VK_NV_device_generated_commands_compute[]
  * [[VUID-vkGetGeneratedCommandsMemoryRequirementsNV-pInfo-09074]]
    If pname:pInfo->pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE, then the
    <<features-deviceGeneratedCompute,
    sname:VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV::pname:deviceGeneratedCompute>>
    feature must: be enabled
endif::VK_NV_device_generated_commands_compute[]
****

include::{generated}/validity/protos/vkGetGeneratedCommandsMemoryRequirementsNV.adoc[]
--

[open,refpage='VkGeneratedCommandsMemoryRequirementsInfoNV',desc='Structure specifying parameters for the reservation of preprocess buffer space',type='structs']
--
include::{generated}/api/structs/VkGeneratedCommandsMemoryRequirementsInfoNV.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:pipelineBindPoint is the elink:VkPipelineBindPoint of the
    pname:pipeline that this buffer memory is intended to be used with
    during the execution.
  * pname:pipeline is the slink:VkPipeline that this buffer memory is
    intended to be used with during the execution.
  * pname:indirectCommandsLayout is the slink:VkIndirectCommandsLayoutNV
    that this buffer memory is intended to be used with.
  * pname:maxSequencesCount is the maximum number of sequences that this
    buffer memory in combination with the other state provided can: be used
    with.

.Valid Usage
****
  * [[VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-maxSequencesCount-02907]]
    pname:maxSequencesCount must: be less or equal to
    slink:VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::pname:maxIndirectSequenceCount
  * [[VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-pipelineBindPoint-09075]]
    If pname:pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_GRAPHICS, then pname:pipeline must: be a
    valid slink:VkPipeline handle
ifdef::VK_NV_device_generated_commands_compute[]
  * [[VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-pipelineBindPoint-09076]]
    If pname:pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE, and the
    pname:indirectCommandsLayout was not created with a
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NV token, then the
    pname:pipeline must: be a valid slink:VkPipeline handle
  * [[VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-pipelineBindPoint-09077]]
    If pname:pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE, and the
    pname:indirectCommandsLayout contains a
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NV token, then the
    pname:pipeline must: be dlink:VK_NULL_HANDLE
endif::VK_NV_device_generated_commands_compute[]
****

include::{generated}/validity/structs/VkGeneratedCommandsMemoryRequirementsInfoNV.adoc[]
--

ifdef::VK_NV_device_generated_commands_compute[]

To bind a compute pipeline in <<device-generated-commands,Device-Generated
Commands>>, an application must: query the pipeline's device address.

[open,refpage='vkGetPipelineIndirectDeviceAddressNV',desc='Get pipeline\'s 64-bit device address',type='protos']
--
:refpage: vkGetPipelineIndirectDeviceAddressNV

To query a compute pipeline's 64-bit device address, call:

include::{generated}/api/protos/vkGetPipelineIndirectDeviceAddressNV.adoc[]

  * pname:device is the logical device on which the pipeline was created.
  * pname:pInfo is a pointer to a
    slink:VkPipelineIndirectDeviceAddressInfoNV structure specifying the
    pipeline to retrieve the address for.

.Valid Usage
****
  * [[VUID-vkGetPipelineIndirectDeviceAddressNV-deviceGeneratedComputePipelines-09078]]
    The <<features-deviceGeneratedComputePipelines,
    sname:VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV::pname:deviceGeneratedComputePipelines>>
    feature must: be enabled
****

include::{generated}/validity/protos/vkGetPipelineIndirectDeviceAddressNV.adoc[]
--

[open,refpage='VkPipelineIndirectDeviceAddressInfoNV',desc='Structure specifying the pipeline to query an address for',type='structs']
--
:refpage: VkPipelineIndirectDeviceAddressInfoNV

The sname:VkPipelineIndirectDeviceAddressInfoNV structure is defined as:

include::{generated}/api/structs/VkPipelineIndirectDeviceAddressInfoNV.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:pipelineBindPoint is a elink:VkPipelineBindPoint value specifying
    the type of pipeline whose device address is being queried.
  * pname:pipeline specifies the pipeline whose device address is being
    queried.

.Valid Usage
****
  * [[VUID-VkPipelineIndirectDeviceAddressInfoNV-pipelineBindPoint-09079]]
    The provided pname:pipelineBindPoint must: be of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE
  * [[VUID-VkPipelineIndirectDeviceAddressInfoNV-pipeline-09080]]
    pname:pipeline must: have been created with flag
    ename:VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV set
  * [[VUID-VkPipelineIndirectDeviceAddressInfoNV-pipeline-09081]]
    pname:pipeline must: have been created with a
    slink:VkComputePipelineIndirectBufferInfoNV structure specifying a valid
    address where its metadata will be saved
****
include::{generated}/validity/structs/VkPipelineIndirectDeviceAddressInfoNV.adoc[]
--

[open,refpage='vkGetPipelineIndirectMemoryRequirementsNV',desc='Get the memory requirements for the compute indirect pipeline',type='protos']
--
:refpage: vkGetPipelineIndirectMemoryRequirementsNV

To determine the memory requirements for a compute pipeline's metadata,
call:

include::{generated}/api/protos/vkGetPipelineIndirectMemoryRequirementsNV.adoc[]

  * pname:device is the logical device that owns the buffer.
  * pname:pCreateInfo is a slink:VkComputePipelineCreateInfo structure
    specifying the creation parameters of the compute pipeline whose memory
    requirements are being queried.
  * pname:pMemoryRequirements is a pointer to a slink:VkMemoryRequirements2
    structure in which the requested pipeline's memory requirements are
    returned.

If pname:pCreateInfo->pNext chain includes a pointer to a
slink:VkComputePipelineIndirectBufferInfoNV structure, then the contents of
that structure are ignored.

.Valid Usage
****
  * [[VUID-vkGetPipelineIndirectMemoryRequirementsNV-deviceGeneratedComputePipelines-09082]]
    The <<features-deviceGeneratedComputePipelines,
    sname:VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV::pname:deviceGeneratedComputePipelines>>
    feature must: be enabled
  * [[VUID-vkGetPipelineIndirectMemoryRequirementsNV-pCreateInfo-09083]]
    pname:pCreateInfo->flags must: include
    ename:VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV
****

include::{generated}/validity/protos/vkGetPipelineIndirectMemoryRequirementsNV.adoc[]
--
endif::VK_NV_device_generated_commands_compute[]

[open,refpage='vkCmdExecuteGeneratedCommandsNV',desc='Generate and execute commands on the device',type='protos']
--
:refpage: vkCmdExecuteGeneratedCommandsNV

The actual generation of commands as well as their execution on the device
is handled as single action with:

include::{generated}/api/protos/vkCmdExecuteGeneratedCommandsNV.adoc[]

  * pname:commandBuffer is the command buffer into which the command is
    recorded.
  * pname:isPreprocessed represents whether the input data has already been
    preprocessed on the device.
    If it is ename:VK_FALSE this command will implicitly trigger the
    preprocessing step, otherwise not.
  * pname:pGeneratedCommandsInfo is a pointer to a
    slink:VkGeneratedCommandsInfoNV structure containing parameters
    affecting the generation of commands.

If the ename:VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV
flag was used to create the
slink:VkGeneratedCommandsInfoNV::pname:indirectCommandsLayout then the order
of execution of individual draws through this command may: execute in any
order, and may: not necessarily be in the same order as specified in
slink:VkGeneratedCommandsInfoNV::pname:pStreams.

ifdef::VK_NV_device_generated_commands_compute[]
The order of execution of individual dispatches through this command may:
execute in any order and may: not necessarily be in the same order as
specified in slink:VkGeneratedCommandsInfoNV::pname:pStreams.
endif::VK_NV_device_generated_commands_compute[]

.Valid Usage
****
include::{chapters}/commonvalidity/draw_common.adoc[]
include::{chapters}/commonvalidity/draw_vertex_binding.adoc[]
ifdef::VK_VERSION_1_1[]
  * [[VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-02970]]
    pname:commandBuffer must: not be a protected command buffer
endif::VK_VERSION_1_1[]
  * [[VUID-vkCmdExecuteGeneratedCommandsNV-isPreprocessed-02908]]
    If pname:isPreprocessed is ename:VK_TRUE then
    flink:vkCmdPreprocessGeneratedCommandsNV must: have already been
    executed on the device, using the same pname:pGeneratedCommandsInfo
    content as well as the content of the input buffers it references (all
    except slink:VkGeneratedCommandsInfoNV::pname:preprocessBuffer).
    Furthermore pname:pGeneratedCommandsInfo`s pname:indirectCommandsLayout
    must: have been created with the
    ename:VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV bit
    set
  * [[VUID-vkCmdExecuteGeneratedCommandsNV-pipeline-02909]]
    slink:VkGeneratedCommandsInfoNV::pname:pipeline must: match the current
    bound pipeline at
    slink:VkGeneratedCommandsInfoNV::pname:pipelineBindPoint
ifdef::VK_EXT_transform_feedback[]
  * [[VUID-vkCmdExecuteGeneratedCommandsNV-None-02910]]
    Transform feedback must: not be active
endif::VK_EXT_transform_feedback[]
  * [[VUID-vkCmdExecuteGeneratedCommandsNV-deviceGeneratedCommands-02911]]
    The <<features-deviceGeneratedCommands,
    sname:VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV::pname:deviceGeneratedCommands>>
    feature must: be enabled
****

include::{generated}/validity/protos/vkCmdExecuteGeneratedCommandsNV.adoc[]
--

[open,refpage='VkGeneratedCommandsInfoNV',desc='Structure specifying parameters for the generation of commands',type='structs']
--
:refpage:

The sname:VkGeneratedCommandsInfoNV is defined as:

include::{generated}/api/structs/VkGeneratedCommandsInfoNV.adoc[]

  * pname:sType is a elink:VkStructureType value identifying this structure.
  * pname:pNext is `NULL` or a pointer to a structure extending this
    structure.
  * pname:pipelineBindPoint is the elink:VkPipelineBindPoint used for the
    pname:pipeline.
  * pname:pipeline is the slink:VkPipeline used in the generation and
    execution process.
  * pname:indirectCommandsLayout is the slink:VkIndirectCommandsLayoutNV
    that provides the command sequence to generate.
  * pname:streamCount defines the number of input streams
  * pname:pStreams is a pointer to an array of pname:streamCount
    slink:VkIndirectCommandsStreamNV structures providing the input data for
    the tokens used in pname:indirectCommandsLayout.
  * pname:sequencesCount is the maximum number of sequences to reserve.
    If pname:sequencesCountBuffer is dlink:VK_NULL_HANDLE, this is also the
    actual number of sequences generated.
  * pname:preprocessBuffer is the slink:VkBuffer that is used for
    preprocessing the input data for execution.
    If this structure is used with flink:vkCmdExecuteGeneratedCommandsNV
    with its pname:isPreprocessed set to ename:VK_TRUE, then the
    preprocessing step is skipped and data is only read from this buffer.
    The contents and the layout of this buffer is opaque to applications and
    must: not be modified or copied to another buffer for reuse.
  * pname:preprocessOffset is the byte offset into pname:preprocessBuffer
    where the preprocessed data is stored.
  * pname:preprocessSize is the maximum byte size within the
    pname:preprocessBuffer after the pname:preprocessOffset that is
    available for preprocessing.
  * pname:sequencesCountBuffer is a sname:VkBuffer in which the actual
    number of sequences is provided as single code:uint32_t value.
  * pname:sequencesCountOffset is the byte offset into
    pname:sequencesCountBuffer where the count value is stored.
  * pname:sequencesIndexBuffer is a sname:VkBuffer that encodes the used
    sequence indices as code:uint32_t array.
  * pname:sequencesIndexOffset is the byte offset into
    pname:sequencesIndexBuffer where the index values start.

.Valid Usage
****
  * [[VUID-VkGeneratedCommandsInfoNV-pipeline-02912]]
    The provided pname:pipeline must: match the pipeline bound at execution
    time
  * [[VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-02913]]
    If the pname:indirectCommandsLayout uses a token of
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV, then the
    pname:pipeline must: have been created with multiple shader groups
  * [[VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-02914]]
    If the pname:indirectCommandsLayout uses a token of
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV, then the
    pname:pipeline must: have been created with
    ename:VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV set in
    sname:VkGraphicsPipelineCreateInfo::pname:flags
  * [[VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-02915]]
    If the pname:indirectCommandsLayout uses a token of
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV, then the
    pname:pipeline`s sname:VkPipelineLayout must: match the
    slink:VkIndirectCommandsLayoutTokenNV::pname:pushconstantPipelineLayout
  * [[VUID-VkGeneratedCommandsInfoNV-streamCount-02916]]
    pname:streamCount must: match the pname:indirectCommandsLayout's
    pname:streamCount
ifdef::VK_NV_device_generated_commands_compute[]
  * [[VUID-VkGeneratedCommandsInfoNV-pipelineBindPoint-09084]]
    If pname:pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE, then the pname:pipeline must: have
    been created with the flag
    ename:VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV
  * [[VUID-VkGeneratedCommandsInfoNV-pipelineBindPoint-09085]]
    If pname:pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE, then the pname:pipeline must: have
    been created with a slink:VkComputePipelineIndirectBufferInfoNV
    structure specifying a valid address where its metadata will be saved
  * [[VUID-VkGeneratedCommandsInfoNV-pipelineBindPoint-09086]]
    If pname:pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE, then
    flink:vkCmdUpdatePipelineIndirectBufferNV must: have been called on that
    pipeline to save its metadata to a device address
  * [[VUID-VkGeneratedCommandsInfoNV-pipelineBindPoint-09087]]
    If pname:pipelineBindPoint is of type
    ename:VK_PIPELINE_BIND_POINT_COMPUTE, and if
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NV is used, then
    pname:pipeline must: be dlink:VK_NULL_HANDLE
endif::VK_NV_device_generated_commands_compute[]
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesCount-02917]]
    pname:sequencesCount must: be less or equal to
    slink:VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::pname:maxIndirectSequenceCount
    and
    slink:VkGeneratedCommandsMemoryRequirementsInfoNV::pname:maxSequencesCount
    that was used to determine the pname:preprocessSize
  * [[VUID-VkGeneratedCommandsInfoNV-preprocessBuffer-02918]]
    pname:preprocessBuffer must: have the
    ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set in its usage flag
  * [[VUID-VkGeneratedCommandsInfoNV-preprocessOffset-02919]]
    pname:preprocessOffset must: be aligned to
    slink:VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::pname:minIndirectCommandsBufferOffsetAlignment
  * [[VUID-VkGeneratedCommandsInfoNV-preprocessBuffer-02971]]
    If pname:preprocessBuffer is non-sparse then it must: be bound
    completely and contiguously to a single sname:VkDeviceMemory object
  * [[VUID-VkGeneratedCommandsInfoNV-preprocessSize-02920]]
    pname:preprocessSize must: be at least equal to the memory requirement`s
    size returned by flink:vkGetGeneratedCommandsMemoryRequirementsNV using
    the matching inputs (pname:indirectCommandsLayout, ...) as within this
    structure
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02921]]
    pname:sequencesCountBuffer can: be set if the actual used count of
    sequences is sourced from the provided buffer.
    In that case the pname:sequencesCount serves as upper bound
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02922]]
    If pname:sequencesCountBuffer is not dlink:VK_NULL_HANDLE, its usage
    flag must: have the ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02923]]
    If pname:sequencesCountBuffer is not dlink:VK_NULL_HANDLE,
    pname:sequencesCountOffset must: be aligned to
    sname:VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::pname:minSequencesCountBufferOffsetAlignment
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02972]]
    If pname:sequencesCountBuffer is not dlink:VK_NULL_HANDLE and is
    non-sparse then it must: be bound completely and contiguously to a
    single sname:VkDeviceMemory object
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02924]]
    If pname:indirectCommandsLayout's
    ename:VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV is set,
    pname:sequencesIndexBuffer must: be set otherwise it must: be
    dlink:VK_NULL_HANDLE
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02925]]
    If pname:sequencesIndexBuffer is not dlink:VK_NULL_HANDLE, its usage
    flag must: have the ename:VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02926]]
    If pname:sequencesIndexBuffer is not dlink:VK_NULL_HANDLE,
    pname:sequencesIndexOffset must: be aligned to
    sname:VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::pname:minSequencesIndexBufferOffsetAlignment
  * [[VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02973]]
    If pname:sequencesIndexBuffer is not dlink:VK_NULL_HANDLE and is
    non-sparse then it must: be bound completely and contiguously to a
    single sname:VkDeviceMemory object
ifdef::VK_NV_mesh_shader[]
  * [[VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-07078]]
    If the pname:indirectCommandsLayout uses a token of
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV, then the
    pname:pipeline must: contain a shader stage using the code:MeshNV
    {ExecutionModel}
endif::VK_NV_mesh_shader[]
ifdef::VK_EXT_mesh_shader[]
  * [[VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-07079]]
    If the pname:indirectCommandsLayout uses a token of
    ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV, then the
    pname:pipeline must: contain a shader stage using the code:MeshEXT
    {ExecutionModel}
endif::VK_EXT_mesh_shader[]
****

include::{generated}/validity/structs/VkGeneratedCommandsInfoNV.adoc[]
--

Referencing the functions defined in <<indirectmdslayout>>,
fname:vkCmdExecuteGeneratedCommandsNV behaves as:

[source,c]
----
uint32_t sequencesCount = sequencesCountBuffer ?
      min(maxSequencesCount, sequencesCountBuffer.load_uint32(sequencesCountOffset) :
      maxSequencesCount;


cmdProcessAllSequences(commandBuffer, pipeline,
                       indirectCommandsLayout, pIndirectCommandsStreams,
                       sequencesCount,
                       sequencesIndexBuffer, sequencesIndexOffset);

// The stateful commands within indirectCommandsLayout will not
// affect the state of subsequent commands in the target
// command buffer (cmd)
----

[NOTE]
.Note
====
It is important to note that the values of all state related to the
pname:pipelineBindPoint used are undefined: after this command.
====

[open,refpage='vkCmdPreprocessGeneratedCommandsNV',desc='Performs preprocessing for generated commands',type='protos']
--
Commands can: be preprocessed prior execution using the following command:

include::{generated}/api/protos/vkCmdPreprocessGeneratedCommandsNV.adoc[]

  * pname:commandBuffer is the command buffer which does the preprocessing.
  * pname:pGeneratedCommandsInfo is a pointer to a
    slink:VkGeneratedCommandsInfoNV structure containing parameters
    affecting the preprocessing step.

.Valid Usage
****
ifdef::VK_VERSION_1_1[]
  * [[VUID-vkCmdPreprocessGeneratedCommandsNV-commandBuffer-02974]]
    pname:commandBuffer must: not be a protected command buffer
endif::VK_VERSION_1_1[]
  * [[VUID-vkCmdPreprocessGeneratedCommandsNV-pGeneratedCommandsInfo-02927]]
    pname:pGeneratedCommandsInfo`s pname:indirectCommandsLayout must: have
    been created with the
    ename:VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV bit
    set
  * [[VUID-vkCmdPreprocessGeneratedCommandsNV-deviceGeneratedCommands-02928]]
    The <<features-deviceGeneratedCommands,
    sname:VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV::pname:deviceGeneratedCommands>>
    feature must: be enabled
****

include::{generated}/validity/protos/vkCmdPreprocessGeneratedCommandsNV.adoc[]
--

ifdef::VK_NV_device_generated_commands_compute[]
The bound descriptor sets and push constants that will be used with indirect
command generation for the compute pipelines must: already be specified at
the time of preprocessing commands with
flink:vkCmdPreprocessGeneratedCommandsNV.
They must: not change until the execution of indirect commands is submitted
with flink:vkCmdExecuteGeneratedCommandsNV.

If push constants for the compute pipeline are also specified in the
slink:VkGeneratedCommandsInfoNV::pname:indirectCommandsLayout with
ename:VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV token, then those
values override the push constants that were previously pushed for the
compute pipeline.

endif::VK_NV_device_generated_commands_compute[]