// Copyright (c) 2019-2020 NVIDIA Corporation
//
// SPDX-License-Identifier: CC-BY-4.0

[[device-generated-commands]]
= Device-Generated Commands

This chapter discusses the generation of command buffer content on the
device, for which these principle steps are to be taken:

  * Define via sname:VkIndirectCommandsLayoutNV the sequence of commands
    which should be generated.
  * Optionally make use of <<graphics-shadergroups, device-bindable Shader
    Groups>>.
  * Retrieve device addresses by flink:vkGetBufferDeviceAddressEXT for
    setting buffers on the device.
  * Fill one or more sname:VkBuffer with the appropriate content that gets
    interpreted by sname:VkIndirectCommandsLayoutNV.
  * Create a `preprocess` sname:VkBuffer using the allocation information
    from flink:vkGetGeneratedCommandsMemoryRequirementsNV.
  * Optionally preprocess the input data using
    flink:vkCmdPreprocessGeneratedCommandsNV in a separate action.
  * Generate and execute the actual commands via
    flink:vkCmdExecuteGeneratedCommandsNV passing all required data.

flink:vkCmdPreprocessGeneratedCommandsNV executes in a separate logical
pipeline from either graphics or compute.
When preprocessing commands in a separate step they must: be explicitly
synchronized against the command execution.
When not preprocessing, the preprocessing is automatically synchronized
against the command execution.

include::indirectcommands.txt[]

include::generation.txt[]
