Author: The Khronos® Vulkan Working Group

# Vulkan® 1.3.217 - A Specification (with all registered extensions)

The Khronos® Vulkan Working Group
version 1.3.217, 2022-06-14 16:15:01Z
from git branch: Git branch not available commit: Git commit not available

Loading… please wait.

Search:

## 31. 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 `VkIndirectCommandsLayoutNV` the sequence of commands which should be generated.

- Optionally make use of device-bindable Shader Groups.

- Retrieve device addresses by vkGetBufferDeviceAddressEXT for setting buffers on the device.

- Fill one or more `VkBuffer` with the appropriate content that gets interpreted by `VkIndirectCommandsLayoutNV`.

- Create a `preprocess` `VkBuffer` using the allocation information from vkGetGeneratedCommandsMemoryRequirementsNV.

- Optionally preprocess the input data using vkCmdPreprocessGeneratedCommandsNV in a separate action.

- Generate and execute the actual commands via vkCmdExecuteGeneratedCommandsNV passing all required data.

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.

### 31.1. Indirect Commands Layout

The device-side command generation happens through an iterative processing of an atomic sequence comprised of command tokens, which are represented by:

    // Provided by VK_NV_device_generated_commands
    VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNV)

#### 31.1.1. Creation and Deletion

Indirect command layouts are created by:

    // Provided by VK_NV_device_generated_commands
    VkResult vkCreateIndirectCommandsLayoutNV(
        VkDevice                                    device,
        const VkIndirectCommandsLayoutCreateInfoNV* pCreateInfo,
        const VkAllocationCallbacks*                pAllocator,
        VkIndirectCommandsLayoutNV*                 pIndirectCommandsLayout);

- `device` is the logical device that creates the indirect command layout.

- `pCreateInfo` is a pointer to a `VkIndirectCommandsLayoutCreateInfoNV` structure containing parameters affecting creation of the indirect command layout.

- `pAllocator` controls host memory allocation as described in the Memory Allocation chapter.

- `pIndirectCommandsLayout` is a pointer to a `VkIndirectCommandsLayoutNV` handle in which the resulting indirect command layout is returned.

Valid Usage

- VUID-vkCreateIndirectCommandsLayoutNV-deviceGeneratedCommands-02929
  The `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV`::`deviceGeneratedCommands` feature must be enabled

Valid Usage (Implicit)

- VUID-vkCreateIndirectCommandsLayoutNV-device-parameter
  `device` must be a valid VkDevice handle

- VUID-vkCreateIndirectCommandsLayoutNV-pCreateInfo-parameter
  `pCreateInfo` must be a valid pointer to a valid VkIndirectCommandsLayoutCreateInfoNV structure

- VUID-vkCreateIndirectCommandsLayoutNV-pAllocator-parameter
  If `pAllocator` is not `NULL`, `pAllocator` must be a valid pointer to a valid VkAllocationCallbacks structure

- VUID-vkCreateIndirectCommandsLayoutNV-pIndirectCommandsLayout-parameter
  `pIndirectCommandsLayout` must be a valid pointer to a VkIndirectCommandsLayoutNV handle

Return Codes

Success

  - `VK_SUCCESS`

Failure

  - `VK_ERROR_OUT_OF_HOST_MEMORY`

  - `VK_ERROR_OUT_OF_DEVICE_MEMORY`

The `VkIndirectCommandsLayoutCreateInfoNV` structure is defined as:

    // Provided by VK_NV_device_generated_commands
    typedef struct VkIndirectCommandsLayoutCreateInfoNV {
        VkStructureType                           sType;
        const void*                               pNext;
        VkIndirectCommandsLayoutUsageFlagsNV      flags;
        VkPipelineBindPoint                       pipelineBindPoint;
        uint32_t                                  tokenCount;
        const VkIndirectCommandsLayoutTokenNV*    pTokens;
        uint32_t                                  streamCount;
        const uint32_t*                           pStreamStrides;
    } VkIndirectCommandsLayoutCreateInfoNV;

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to a structure extending this structure.

- `pipelineBindPoint` is the VkPipelineBindPoint that this layout targets.

- `flags` is a bitmask of VkIndirectCommandsLayoutUsageFlagBitsNV specifying usage hints of this layout.

- `tokenCount` is the length of the individual command sequence.

- `pTokens` is an array describing each command token in detail. See VkIndirectCommandsTokenTypeNV and VkIndirectCommandsLayoutTokenNV below for details.

- `streamCount` is the number of streams used to provide the token inputs.

- `pStreamStrides` is an array defining the byte stride for each input stream.

The following code illustrates some of the flags:

    void cmdProcessAllSequences(cmd, pipeline, indirectCommandsLayout, pIndirectCommandsTokens, sequencesCount, indexbuffer, indexbufferOffset)
    {
      for (s = 0; s < sequencesCount; s++)
      {
        sUsed = s;

        if (indirectCommandsLayout.flags & VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV) {
          sUsed = indexbuffer.load_uint32( sUsed * sizeof(uint32_t) + indexbufferOffset);
        }

        if (indirectCommandsLayout.flags & VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV) {
          sUsed = incoherent_implementation_dependent_permutation[ sUsed ];
        }

        cmdProcessSequence( cmd, pipeline, indirectCommandsLayout, pIndirectCommandsTokens, sUsed );
      }
    }

Valid Usage

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pipelineBindPoint-02930
  The `pipelineBindPoint` must be `VK_PIPELINE_BIND_POINT_GRAPHICS`

- VUID-VkIndirectCommandsLayoutCreateInfoNV-tokenCount-02931
  `tokenCount` must be greater than `0` and less than or equal to `VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV`::`maxIndirectCommandsTokenCount`

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pTokens-02932
  If `pTokens` contains an entry of `VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV` it must be the first element of the array and there must be only a single element of such token type

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pTokens-02933
  If `pTokens` contains an entry of `VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV` there must be only a single element of such token type

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pTokens-02934
  All state tokens in `pTokens` must occur prior work provoking tokens (`VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV`, `VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV`, `VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV`)

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pTokens-02935
  The content of `pTokens` must include one single work provoking token that is compatible with the `pipelineBindPoint`

- VUID-VkIndirectCommandsLayoutCreateInfoNV-streamCount-02936
  `streamCount` must be greater than `0` and less or equal to `VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV`::`maxIndirectCommandsStreamCount`

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pStreamStrides-02937
  each element of `pStreamStrides` must be greater than `0`and less than or equal to `VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV`::`maxIndirectCommandsStreamStride`. Furthermore the alignment of each token input must be ensured

Valid Usage (Implicit)

- VUID-VkIndirectCommandsLayoutCreateInfoNV-sType-sType
  `sType` must be `VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NV`

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pNext-pNext
  `pNext` must be `NULL`

- VUID-VkIndirectCommandsLayoutCreateInfoNV-flags-parameter
  `flags` must be a valid combination of VkIndirectCommandsLayoutUsageFlagBitsNV values

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pipelineBindPoint-parameter
  `pipelineBindPoint` must be a valid VkPipelineBindPoint value

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pTokens-parameter
  `pTokens` must be a valid pointer to an array of `tokenCount` valid VkIndirectCommandsLayoutTokenNV structures

- VUID-VkIndirectCommandsLayoutCreateInfoNV-pStreamStrides-parameter
  `pStreamStrides` must be a valid pointer to an array of `streamCount` `uint32_t` values

- VUID-VkIndirectCommandsLayoutCreateInfoNV-tokenCount-arraylength
  `tokenCount` must be greater than `0`

- VUID-VkIndirectCommandsLayoutCreateInfoNV-streamCount-arraylength
  `streamCount` must be greater than `0`

Bits which can be set in VkIndirectCommandsLayoutCreateInfoNV::`flags`, specifying usage hints of an indirect command layout, are:

    // Provided by VK_NV_device_generated_commands
    typedef enum VkIndirectCommandsLayoutUsageFlagBitsNV {
        VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV = 0x00000001,
        VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV = 0x00000002,
        VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV = 0x00000004,
    } VkIndirectCommandsLayoutUsageFlagBitsNV;

- `VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV` specifies that the layout is always used with the manual preprocessing step through calling vkCmdPreprocessGeneratedCommandsNV and executed by vkCmdExecuteGeneratedCommandsNV with `isPreprocessed` set to `VK_TRUE`.

- `VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV` specifies that the input data for the sequences is not implicitly indexed from 0..sequencesUsed but a user provided `VkBuffer` encoding the index is provided.

- `VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV` specifies that the processing of sequences can happen at an implementation-dependent order, which is not: guaranteed to be coherent using the same input data.

    // Provided by VK_NV_device_generated_commands
    typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNV;

`VkIndirectCommandsLayoutUsageFlagsNV` is a bitmask type for setting a mask of zero or more VkIndirectCommandsLayoutUsageFlagBitsNV.

Indirect command layouts are destroyed by:

    // Provided by VK_NV_device_generated_commands
    void vkDestroyIndirectCommandsLayoutNV(
        VkDevice                                    device,
        VkIndirectCommandsLayoutNV                  indirectCommandsLayout,
        const VkAllocationCallbacks*                pAllocator);

- `device` is the logical device that destroys the layout.

- `indirectCommandsLayout` is the layout to destroy.

- `pAllocator` controls host memory allocation as described in the Memory Allocation chapter.

Valid Usage

- VUID-vkDestroyIndirectCommandsLayoutNV-indirectCommandsLayout-02938
  All submitted commands that refer to `indirectCommandsLayout` must have completed execution

- VUID-vkDestroyIndirectCommandsLayoutNV-indirectCommandsLayout-02939
  If `VkAllocationCallbacks` were provided when `indirectCommandsLayout` was created, a compatible set of callbacks must be provided here

- VUID-vkDestroyIndirectCommandsLayoutNV-indirectCommandsLayout-02940
  If no `VkAllocationCallbacks` were provided when `indirectCommandsLayout` was created, `pAllocator` must be `NULL`

- VUID-vkDestroyIndirectCommandsLayoutNV-deviceGeneratedCommands-02941
  The `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV`::`deviceGeneratedCommands` feature must be enabled

Valid Usage (Implicit)

- VUID-vkDestroyIndirectCommandsLayoutNV-device-parameter
  `device` must be a valid VkDevice handle

- VUID-vkDestroyIndirectCommandsLayoutNV-indirectCommandsLayout-parameter
  If `indirectCommandsLayout` is not VK_NULL_HANDLE, `indirectCommandsLayout` must be a valid VkIndirectCommandsLayoutNV handle

- VUID-vkDestroyIndirectCommandsLayoutNV-pAllocator-parameter
  If `pAllocator` is not `NULL`, `pAllocator` must be a valid pointer to a valid VkAllocationCallbacks structure

- VUID-vkDestroyIndirectCommandsLayoutNV-indirectCommandsLayout-parent
  If `indirectCommandsLayout` is a valid handle, it must have been created, allocated, or retrieved from `device`

Host Synchronization

- Host access to `indirectCommandsLayout` must be externally synchronized

#### 31.1.2. Token Input Streams

The `VkIndirectCommandsStreamNV` structure specifies the input data for one or more tokens at processing time.

    // Provided by VK_NV_device_generated_commands
    typedef struct VkIndirectCommandsStreamNV {
        VkBuffer        buffer;
        VkDeviceSize    offset;
    } VkIndirectCommandsStreamNV;

- `buffer` specifies the VkBuffer storing the functional arguments for each sequence. These arguments can be written by the device.

- `offset` specified an offset into `buffer` where the arguments start.

Valid Usage

- VUID-VkIndirectCommandsStreamNV-buffer-02942
  The `buffer`’s usage flag must have the `VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT` bit set

- VUID-VkIndirectCommandsStreamNV-offset-02943
  The `offset` must be aligned to `VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV`::`minIndirectCommandsBufferOffsetAlignment`

- VUID-VkIndirectCommandsStreamNV-buffer-02975
  If `buffer` is non-sparse then it must be bound completely and contiguously to a single `VkDeviceMemory` object

Valid Usage (Implicit)

- VUID-VkIndirectCommandsStreamNV-buffer-parameter
  `buffer` must be a valid VkBuffer handle

The input streams can contain raw `uint32_t` values, existing indirect commands such as:

- VkDrawIndirectCommand

- VkDrawIndexedIndirectCommand

- VkDrawMeshTasksIndirectCommandNV

or additional commands as listed below. How the data is used is described in the next section.

The `VkBindShaderGroupIndirectCommandNV` structure specifies the input data for the `VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV` token.

    // Provided by VK_NV_device_generated_commands
    typedef struct VkBindShaderGroupIndirectCommandNV {
        uint32_t    groupIndex;
    } VkBindShaderGroupIndirectCommandNV;

- `index` specifies which shader group of the current bound graphics pipeline is used.

Valid Usage

- VUID-VkBindShaderGroupIndirectCommandNV-None-02944
  The current bound graphics pipeline, as well as the pipelines it may reference, must have been created with `VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV`

- VUID-VkBindShaderGroupIndirectCommandNV-index-02945
  The `index` must be within range of the accessible shader groups of the current bound graphics pipeline. See vkCmdBindPipelineShaderGroupNV for further details

The `VkBindIndexBufferIndirectCommandNV` structure specifies the input data for the `VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV` token.

    // Provided by VK_NV_device_generated_commands
    typedef struct VkBindIndexBufferIndirectCommandNV {
        VkDeviceAddress    bufferAddress;
        uint32_t           size;
        VkIndexType        indexType;
    } VkBindIndexBufferIndirectCommandNV;

- `bufferAddress` specifies a physical address of the VkBuffer used as index buffer.

- `size` is the byte size range which is available for this operation from the provided address.

- `indexType` is a VkIndexType value specifying how indices are treated. Instead of the Vulkan enum values, a custom `uint32_t` value can be mapped to an VkIndexType by specifying the `VkIndirectCommandsLayoutTokenNV`::`pIndexTypes` and `VkIndirectCommandsLayoutTokenNV`::`pIndexTypeValues` arrays.

Valid Usage

- VUID-VkBindIndexBufferIndirectCommandNV-None-02946
  The buffer’s usage flag from which the address was acquired must have the `VK_BUFFER_USAGE_INDEX_BUFFER_BIT` bit set

- VUID-VkBindIndexBufferIndirectCommandNV-bufferAddress-02947
  The `bufferAddress` must be aligned to the `indexType` used

- VUID-VkBindIndexBufferIndirectCommandNV-None-02948
  Each element of the buffer from which the address was acquired and that is non-sparse must be bound completely and contiguously to a single `VkDeviceMemory` object

Valid Usage (Implicit)

- VUID-VkBindIndexBufferIndirectCommandNV-indexType-parameter
  `indexType` must be a valid VkIndexType value

The `VkBindVertexBufferIndirectCommandNV` structure specifies the input data for the `VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV` token.

    // Provided by VK_NV_device_generated_commands
    typedef struct VkBindVertexBufferIndirectCommandNV {
        VkDeviceAddress    bufferAddress;
        uint32_t           size;
        uint32_t           stride;
    } VkBindVertexBufferIndirectCommandNV;

- `bufferAddress` specifies a physical address of the VkBuffer used as vertex input binding.

- `size` is the byte size range which is available for this operation from the provided address.

- `stride` is the byte size stride for this vertex input binding as in `VkVertexInputBindingDescription`::`stride`. It is only used if `VkIndirectCommandsLayoutTokenNV`::`vertexDynamicStride` was set, otherwise the stride is inherited from the current bound graphics pipeline.

Valid Usage

- VUID-VkBindVertexBufferIndirectCommandNV-None-02949
  The buffer’s usage flag from which the address was acquired must have the `VK_BUFFER_USAGE_VERTEX_BUFFER_BIT` bit set

- VUID-VkBindVertexBufferIndirectCommandNV-None-02950
  Each element of the buffer from which the address was acquired and that is non-sparse must be bound completely and contiguously to a single `VkDeviceMemory` object

The `VkSetStateFlagsIndirectCommandNV` structure specifies the input data for the `VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV` token. Which state is changed depends on the VkIndirectStateFlagBitsNV specified at `VkIndirectCommandsLayoutNV` creation time.

    // Provided by VK_NV_device_generated_commands
    typedef struct VkSetStateFlagsIndirectCommandNV {
        uint32_t    data;
    } VkSetStateFlagsIndirectCommandNV;

- `data` encodes packed state that this command alters.

  - Bit `0`: If set represents `VK_FRONT_FACE_CLOCKWISE`, otherwise `VK_FRONT_FACE_COUNTER_CLOCKWISE`

A subset of the graphics pipeline state can be altered using indirect state flags:

    // Provided by VK_NV_device_generated_commands
    typedef enum VkIndirectStateFlagBitsNV {
        VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV = 0x00000001,
    } VkIndirectStateFlagBitsNV;

- `VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV` allows to toggle the VkFrontFace rasterization state for subsequent draw operations.

    // Provided by VK_NV_device_generated_commands
    typedef VkFlags VkIndirectStateFlagsNV;

`VkIndirectStateFlagsNV` is a bitmask type for setting a mask of zero or more VkIndirectStateFlagBitsNV.

#### 31.1.3. Tokenized Command Processing

The processing is in principle illustrated below:

    void cmdProcessSequence(cmd, pipeline, indirectCommandsLayout, pIndirectCommandsStreams, s)
    {
      for (t = 0; t < indirectCommandsLayout.tokenCount; t++)
      {
        uint32_t stream  = indirectCommandsLayout.pTokens[t].stream;
        uint32_t offset  = indirectCommandsLayout.pTokens[t].offset;
        uint32_t stride  = indirectCommandsLayout.pStreamStrides[stream];
        stream            = pIndirectCommandsStreams[stream];
        const void* input = stream.buffer.pointer( stream.offset + stride * s + offset )

        // further details later
        indirectCommandsLayout.pTokens[t].command (cmd, pipeline, input, s);
      }
    }

    void cmdProcessAllSequences(cmd, pipeline, indirectCommandsLayout, pIndirectCommandsStreams, sequencesCount)
    {
      for (s = 0; s < sequencesCount; s++)
      {
        cmdProcessSequence(cmd, pipeline, indirectCommandsLayout, pIndirectCommandsStreams, s);
      }
    }

The processing of each sequence is considered stateless, therefore all state changes must occur prior work provoking commands within the sequence. A single sequence is strictly targeting the VkPipelineBindPoint it was created with.

The primary input data for each token is provided through `VkBuffer` content at preprocessing using vkCmdPreprocessGeneratedCommandsNV or execution time using vkCmdExecuteGeneratedCommandsNV, however some functional arguments, for example binding sets, are specified at layout creation time. The input size is different for each token.

Possible values of those elements of the VkIndirectCommandsLayoutCreateInfoNV::`pTokens` array specifying command tokens (other elements of the array specify command parameters) are:

    // Provided by VK_NV_device_generated_commands
    typedef enum VkIndirectCommandsTokenTypeNV {
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV = 0,
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV = 1,
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV = 2,
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV = 3,
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV = 4,
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV = 5,
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV = 6,
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV = 7,
    } VkIndirectCommandsTokenTypeNV;

Table 44. Supported indirect command tokens
Token type | Equivalent command
--- | ---
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV` | vkCmdBindPipelineShaderGroupNV
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV` | -
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV` | vkCmdBindIndexBuffer
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV` | vkCmdBindVertexBuffers
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV` | vkCmdPushConstants
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV` | vkCmdDrawIndexedIndirect
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV` | vkCmdDrawIndirect
`VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV` | vkCmdDrawMeshTasksIndirectNV

The `VkIndirectCommandsLayoutTokenNV` structure specifies details to the function arguments that need to be known at layout creation time:

    // Provided by VK_NV_device_generated_commands
    typedef struct VkIndirectCommandsLayoutTokenNV {
        VkStructureType                  sType;
        const void*                      pNext;
        VkIndirectCommandsTokenTypeNV    tokenType;
        uint32_t                         stream;
        uint32_t                         offset;
        uint32_t                         vertexBindingUnit;
        VkBool32                         vertexDynamicStride;
        VkPipelineLayout                 pushconstantPipelineLayout;
        VkShaderStageFlags               pushconstantShaderStageFlags;
        uint32_t                         pushconstantOffset;
        uint32_t                         pushconstantSize;
        VkIndirectStateFlagsNV           indirectStateFlags;
        uint32_t                         indexTypeCount;
        const VkIndexType*               pIndexTypes;
        const uint32_t*                  pIndexTypeValues;
    } VkIndirectCommandsLayoutTokenNV;

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to a structure extending this structure.

- `tokenType` specifies the token command type.

- `stream` is the index of the input stream containing the token argument data.

- `offset` is a relative starting offset within the input stream memory for the token argument data.

- `vertexBindingUnit` is used for the vertex buffer binding command.

- `vertexDynamicStride` sets if the vertex buffer stride is provided by the binding command rather than the current bound graphics pipeline state.

- `pushconstantPipelineLayout` is the `VkPipelineLayout` used for the push constant command.

- `pushconstantShaderStageFlags` are the shader stage flags used for the push constant command.

- `pushconstantOffset` is the offset used for the push constant command.

- `pushconstantSize` is the size used for the push constant command.

- `indirectStateFlags` are the active states for the state flag command.

- `indexTypeCount` is the optional size of the `pIndexTypes` and `pIndexTypeValues` array pairings. If not zero, it allows to register a custom `uint32_t` value to be treated as specific `VkIndexType`.

- `pIndexTypes` is the used `VkIndexType` for the corresponding `uint32_t` value entry in `pIndexTypeValues`.

Valid Usage

- VUID-VkIndirectCommandsLayoutTokenNV-stream-02951
  `stream` must be smaller than `VkIndirectCommandsLayoutCreateInfoNV`::`streamCount`

- VUID-VkIndirectCommandsLayoutTokenNV-offset-02952
  `offset` must be less than or equal to `VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV`::`maxIndirectCommandsTokenOffset`

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02976
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV`, `vertexBindingUnit` must stay within device supported limits for the appropriate commands

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02977
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, `pushconstantPipelineLayout` must be valid

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02978
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, `pushconstantOffset` must be a multiple of `4`

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02979
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, `pushconstantSize` must be a multiple of `4`

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02980
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, `pushconstantOffset` must be less than `VkPhysicalDeviceLimits`::`maxPushConstantsSize`

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02981
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, `pushconstantSize` must be less than or equal to `VkPhysicalDeviceLimits`::`maxPushConstantsSize` minus `pushconstantOffset`

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02982
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, for each byte in the range specified by `pushconstantOffset` and `pushconstantSize` and for each shader stage in `pushconstantShaderStageFlags`, there must be a push constant range in `pushconstantPipelineLayout` that includes that byte and that stage

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02983
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, for each byte in the range specified by `pushconstantOffset` and `pushconstantSize` and for each push constant range that overlaps that byte, `pushconstantShaderStageFlags` must include all stages in that push constant range’s VkPushConstantRange::`stageFlags`

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-02984
  If `tokenType` is `VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV`, `indirectStateFlags` must not be `0`

Valid Usage (Implicit)

- VUID-VkIndirectCommandsLayoutTokenNV-sType-sType
  `sType` must be `VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_TOKEN_NV`

- VUID-VkIndirectCommandsLayoutTokenNV-pNext-pNext
  `pNext` must be `NULL`

- VUID-VkIndirectCommandsLayoutTokenNV-tokenType-parameter
  `tokenType` must be a valid VkIndirectCommandsTokenTypeNV value

- VUID-VkIndirectCommandsLayoutTokenNV-pushconstantPipelineLayout-parameter
  If `pushconstantPipelineLayout` is not VK_NULL_HANDLE, `pushconstantPipelineLayout` must be a valid VkPipelineLayout handle

- VUID-VkIndirectCommandsLayoutTokenNV-pushconstantShaderStageFlags-parameter
  `pushconstantShaderStageFlags` must be a valid combination of VkShaderStageFlagBits values

- VUID-VkIndirectCommandsLayoutTokenNV-indirectStateFlags-parameter
  `indirectStateFlags` must be a valid combination of VkIndirectStateFlagBitsNV values

- VUID-VkIndirectCommandsLayoutTokenNV-pIndexTypes-parameter
  If `indexTypeCount` is not `0`, `pIndexTypes` must be a valid pointer to an array of `indexTypeCount` valid VkIndexType values

- VUID-VkIndirectCommandsLayoutTokenNV-pIndexTypeValues-parameter
  If `indexTypeCount` is not `0`, `pIndexTypeValues` must be a valid pointer to an array of `indexTypeCount` `uint32_t` values

The following code provides detailed information on how an individual sequence is processed. For valid usage, all restrictions from the regular commands apply.

    void cmdProcessSequence(cmd, pipeline, indirectCommandsLayout, pIndirectCommandsStreams, s)
    {
      for (uint32_t t = 0; t < indirectCommandsLayout.tokenCount; t++){
        token = indirectCommandsLayout.pTokens[t];

        uint32_t stride   = indirectCommandsLayout.pStreamStrides[token.stream];
        stream            = pIndirectCommandsStreams[token.stream];
        uint32_t offset   = stream.offset + stride * s + token.offset;
        const void* input = stream.buffer.pointer( offset )

        switch(input.type){
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV:
          VkBindShaderGroupIndirectCommandNV* bind = input;

          vkCmdBindPipelineShaderGroupNV(cmd, indirectCommandsLayout.pipelineBindPoint,
            pipeline, bind->groupIndex);
        break;

        VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV:
          VkSetStateFlagsIndirectCommandNV* state = input;

          if (token.indirectStateFlags & VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV){
            if (state.data & (1 << 0)){
              set VK_FRONT_FACE_CLOCKWISE;
            } else {
              set VK_FRONT_FACE_COUNTER_CLOCKWISE;
            }
          }
        break;

        VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV:
          uint32_t* data = input;

          vkCmdPushConstants(cmd,
            token.pushconstantPipelineLayout
            token.pushconstantStageFlags,
            token.pushconstantOffset,
            token.pushconstantSize, data);
        break;

        VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV:
          VkBindIndexBufferIndirectCommandNV* data = input;

          // the indexType may optionally be remapped
          // from a custom uint32_t value, via
          // VkIndirectCommandsLayoutTokenNV::pIndexTypeValues

          vkCmdBindIndexBuffer(cmd,
            deriveBuffer(data->bufferAddress),
            deriveOffset(data->bufferAddress),
            data->indexType);
        break;

        VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV:
          VkBindVertexBufferIndirectCommandNV* data = input;

          // if token.vertexDynamicStride is VK_TRUE
          // then the stride for this binding is set
          // using data->stride as well

          vkCmdBindVertexBuffers(cmd,
            token.vertexBindingUnit, 1,
            &deriveBuffer(data->bufferAddress),
            &deriveOffset(data->bufferAddress));
        break;

        VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV:
          vkCmdDrawIndexedIndirect(cmd,
            stream.buffer, offset, 1, 0);
        break;

        VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV:
          vkCmdDrawIndirect(cmd,
            stream.buffer,
            offset, 1, 0);
        break;

        // only available if VK_NV_mesh_shader is supported
        VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NV:
          vkCmdDrawMeshTasksIndirectNV(cmd,
            stream.buffer, offset, 1, 0);
        break;
        }
      }
    }

### 31.2. Indirect Commands Generation And Execution

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:

    // Provided by VK_NV_device_generated_commands
    void vkGetGeneratedCommandsMemoryRequirementsNV(
        VkDevice                                    device,
        const VkGeneratedCommandsMemoryRequirementsInfoNV* pInfo,
        VkMemoryRequirements2*                      pMemoryRequirements);

- `device` is the logical device that owns the buffer.

- `pInfo` is a pointer to a `VkGeneratedCommandsMemoryRequirementsInfoNV` structure containing parameters required for the memory requirements query.

- `pMemoryRequirements` is a pointer to a VkMemoryRequirements2 structure in which the memory requirements of the buffer object are returned.

Valid Usage

- VUID-vkGetGeneratedCommandsMemoryRequirementsNV-deviceGeneratedCommands-02906
  The `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV`::`deviceGeneratedCommands` feature must be enabled

Valid Usage (Implicit)

- VUID-vkGetGeneratedCommandsMemoryRequirementsNV-device-parameter
  `device` must be a valid VkDevice handle

- VUID-vkGetGeneratedCommandsMemoryRequirementsNV-pInfo-parameter
  `pInfo` must be a valid pointer to a valid VkGeneratedCommandsMemoryRequirementsInfoNV structure

- VUID-vkGetGeneratedCommandsMemoryRequirementsNV-pMemoryRequirements-parameter
  `pMemoryRequirements` must be a valid pointer to a VkMemoryRequirements2 structure

    // Provided by VK_NV_device_generated_commands
    typedef struct VkGeneratedCommandsMemoryRequirementsInfoNV {
        VkStructureType               sType;
        const void*                   pNext;
        VkPipelineBindPoint           pipelineBindPoint;
        VkPipeline                    pipeline;
        VkIndirectCommandsLayoutNV    indirectCommandsLayout;
        uint32_t                      maxSequencesCount;
    } VkGeneratedCommandsMemoryRequirementsInfoNV;

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to a structure extending this structure.

- `pipelineBindPoint` is the VkPipelineBindPoint of the `pipeline` that this buffer memory is intended to be used with during the execution.

- `pipeline` is the VkPipeline that this buffer memory is intended to be used with during the execution.

- `indirectCommandsLayout` is the VkIndirectCommandsLayoutNV that this buffer memory is intended to be used with.

- `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
  `maxSequencesCount` must be less or equal to VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::`maxIndirectSequenceCount`

Valid Usage (Implicit)

- VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-sType-sType
  `sType` must be `VK_STRUCTURE_TYPE_GENERATED_COMMANDS_MEMORY_REQUIREMENTS_INFO_NV`

- VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-pNext-pNext
  `pNext` must be `NULL`

- VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-pipelineBindPoint-parameter
  `pipelineBindPoint` must be a valid VkPipelineBindPoint value

- VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-pipeline-parameter
  `pipeline` must be a valid VkPipeline handle

- VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-indirectCommandsLayout-parameter
  `indirectCommandsLayout` must be a valid VkIndirectCommandsLayoutNV handle

- VUID-VkGeneratedCommandsMemoryRequirementsInfoNV-commonparent
  Both of `indirectCommandsLayout`, and `pipeline` must have been created, allocated, or retrieved from the same VkDevice

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

    // Provided by VK_NV_device_generated_commands
    void vkCmdExecuteGeneratedCommandsNV(
        VkCommandBuffer                             commandBuffer,
        VkBool32                                    isPreprocessed,
        const VkGeneratedCommandsInfoNV*            pGeneratedCommandsInfo);

- `commandBuffer` is the command buffer into which the command is recorded.

- `isPreprocessed` represents whether the input data has already been preprocessed on the device. If it is `VK_FALSE` this command will implicitly trigger the preprocessing step, otherwise not.

- `pGeneratedCommandsInfo` is a pointer to a VkGeneratedCommandsInfoNV structure containing parameters affecting the generation of commands.

Valid Usage

- VUID-vkCmdExecuteGeneratedCommandsNV-magFilter-04553
  If a VkSampler created with `magFilter` or `minFilter` equal to `VK_FILTER_LINEAR` and `compareEnable` equal to `VK_FALSE` is used to sample a VkImageView as a result of this command, then the image view’s format features must contain `VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT`

- VUID-vkCmdExecuteGeneratedCommandsNV-mipmapMode-04770
  If a VkSampler created with `mipmapMode` equal to `VK_SAMPLER_MIPMAP_MODE_LINEAR` and `compareEnable` equal to `VK_FALSE` is used to sample a VkImageView as a result of this command, then the image view’s format features must contain `VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT`

- VUID-vkCmdExecuteGeneratedCommandsNV-None-06479
  If a VkImageView is sampled with depth comparison, the image view’s format features must contain `VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT`

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02691
  If a `VkImageView` is accessed using atomic operations as a result of this command, then the image view’s format features must contain `VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT`

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02692
  If a `VkImageView` is sampled with `VK_FILTER_CUBIC_EXT` as a result of this command, then the image view’s format features must contain `VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT`

- VUID-vkCmdExecuteGeneratedCommandsNV-filterCubic-02694
  Any VkImageView being sampled with `VK_FILTER_CUBIC_EXT` as a result of this command must have a VkImageViewType and format that supports cubic filtering, as specified by `VkFilterCubicImageViewImageFormatPropertiesEXT`::`filterCubic` returned by `vkGetPhysicalDeviceImageFormatProperties2`

- VUID-vkCmdExecuteGeneratedCommandsNV-filterCubicMinmax-02695
  Any VkImageView being sampled with `VK_FILTER_CUBIC_EXT` with a reduction mode of either `VK_SAMPLER_REDUCTION_MODE_MIN` or `VK_SAMPLER_REDUCTION_MODE_MAX` as a result of this command must have a VkImageViewType and format that supports cubic filtering together with minmax filtering, as specified by `VkFilterCubicImageViewImageFormatPropertiesEXT`::`filterCubicMinmax` returned by `vkGetPhysicalDeviceImageFormatProperties2`

- VUID-vkCmdExecuteGeneratedCommandsNV-flags-02696
  Any VkImage created with a VkImageCreateInfo::`flags` containing `VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV` sampled as a result of this command must only be sampled using a VkSamplerAddressMode of `VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE`

- VUID-vkCmdExecuteGeneratedCommandsNV-OpTypeImage-06423
  Any VkImageView or VkBufferView being written as a storage image or storage texel buffer where the image format field of the `OpTypeImage` is `Unknown` then the view’s format feature must contain `VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT`

- VUID-vkCmdExecuteGeneratedCommandsNV-OpTypeImage-06424
  Any VkImageView or VkBufferView being read as a storage image or storage texel buffer where the image format field of the `OpTypeImage` is `Unknown` then the view’s format feature must contain `VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT`

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02697
  For each set n that is statically used by the `VkPipeline` bound to the pipeline bind point used by this command, a descriptor set must have been bound to n at the same pipeline bind point, with a `VkPipelineLayout` that is compatible for set n, with the `VkPipelineLayout` used to create the current `VkPipeline`, as described in Pipeline Layout Compatibility

- VUID-vkCmdExecuteGeneratedCommandsNV-maintenance4-06425
  If the `maintenance4` feature is not enabled, then for each push constant that is statically used by the `VkPipeline` bound to the pipeline bind point used by this command, a push constant value must have been set for the same pipeline bind point, with a `VkPipelineLayout` that is compatible for push constants, with the `VkPipelineLayout` used to create the current `VkPipeline`, as described in Pipeline Layout Compatibility

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02699
  Descriptors in each bound descriptor set, specified via `vkCmdBindDescriptorSets`, must be valid if they are statically used by the `VkPipeline` bound to the pipeline bind point used by this command

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02700
  A valid pipeline must be bound to the pipeline bind point used by this command

- VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-02701
  If the `VkPipeline` object bound to the pipeline bind point used by this command requires any dynamic state, that state must have been set or inherited (if the `VK_NV_inherited_viewport_scissor` extension is enabled) for `commandBuffer`, and done so after any previously bound pipeline with the corresponding state not specified as dynamic

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02859
  There must not have been any calls to dynamic state setting commands for any state not specified as dynamic in the `VkPipeline` object bound to the pipeline bind point used by this command, since that pipeline was bound

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02702
  If the `VkPipeline` object bound to the pipeline bind point used by this command accesses a `VkSampler` object that uses unnormalized coordinates, that sampler must not be used to sample from any `VkImage` with a `VkImageView` of the type `VK_IMAGE_VIEW_TYPE_3D`, `VK_IMAGE_VIEW_TYPE_CUBE`, `VK_IMAGE_VIEW_TYPE_1D_ARRAY`, `VK_IMAGE_VIEW_TYPE_2D_ARRAY` or `VK_IMAGE_VIEW_TYPE_CUBE_ARRAY`, in any shader stage

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02703
  If the `VkPipeline` object bound to the pipeline bind point used by this command accesses a `VkSampler` object that uses unnormalized coordinates, that sampler must not be used with any of the SPIR-V `OpImageSample*` or `OpImageSparseSample*` instructions with `ImplicitLod`, `Dref` or `Proj` in their name, in any shader stage

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02704
  If the `VkPipeline` object bound to the pipeline bind point used by this command accesses a `VkSampler` object that uses unnormalized coordinates, that sampler must not be used with any of the SPIR-V `OpImageSample*` or `OpImageSparseSample*` instructions that includes a LOD bias or any offset values, in any shader stage

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02705
  If the robust buffer access feature is not enabled, and if the `VkPipeline` object bound to the pipeline bind point used by this command accesses a uniform buffer, it must not access values outside of the range of the buffer as specified in the descriptor set bound to the same pipeline bind point

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02706
  If the robust buffer access feature is not enabled, and if the `VkPipeline` object bound to the pipeline bind point used by this command accesses a storage buffer, it must not access values outside of the range of the buffer as specified in the descriptor set bound to the same pipeline bind point

- VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-02707
  If `commandBuffer` is an unprotected command buffer and `protectedNoFault` is not supported, any resource accessed by the VkPipeline object bound to the pipeline bind point used by this command must not be a protected resource

- VUID-vkCmdExecuteGeneratedCommandsNV-None-06550
  If the `VkPipeline` object bound to the pipeline bind point used by this command accesses a `VkSampler` or `VkImageView` object that enables sampler Y′CBCR conversion, that object must only be used with `OpImageSample*` or `OpImageSparseSample*` instructions

- VUID-vkCmdExecuteGeneratedCommandsNV-ConstOffset-06551
  If the `VkPipeline` object bound to the pipeline bind point used by this command accesses a `VkSampler` or `VkImageView` object that enables sampler Y′CBCR conversion, that object must not use the `ConstOffset` and `Offset` operands

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04115
  If a VkImageView is accessed using `OpImageWrite` as a result of this command, then the `Type` of the `Texel` operand of that instruction must have at least as many components as the image view’s format

- VUID-vkCmdExecuteGeneratedCommandsNV-OpImageWrite-04469
  If a VkBufferView is accessed using `OpImageWrite` as a result of this command, then the `Type` of the `Texel` operand of that instruction must have at least as many components as the buffer view’s format

- VUID-vkCmdExecuteGeneratedCommandsNV-SampledType-04470
  If a VkImageView with a VkFormat that has a 64-bit component width is accessed as a result of this command, the `SampledType` of the `OpTypeImage` operand of that instruction must have a `Width` of 64

- VUID-vkCmdExecuteGeneratedCommandsNV-SampledType-04471
  If a VkImageView with a VkFormat that has a component width less than 64-bit is accessed as a result of this command, the `SampledType` of the `OpTypeImage` operand of that instruction must have a `Width` of 32

- VUID-vkCmdExecuteGeneratedCommandsNV-SampledType-04472
  If a VkBufferView with a VkFormat that has a 64-bit component width is accessed as a result of this command, the `SampledType` of the `OpTypeImage` operand of that instruction must have a `Width` of 64

- VUID-vkCmdExecuteGeneratedCommandsNV-SampledType-04473
  If a VkBufferView with a VkFormat that has a component width less than 64-bit is accessed as a result of this command, the `SampledType` of the `OpTypeImage` operand of that instruction must have a `Width` of 32

- VUID-vkCmdExecuteGeneratedCommandsNV-sparseImageInt64Atomics-04474
  If the `sparseImageInt64Atomics` feature is not enabled, VkImage objects created with the `VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT` flag must not be accessed by atomic instructions through an `OpTypeImage` with a `SampledType` with a `Width` of 64 by this command

- VUID-vkCmdExecuteGeneratedCommandsNV-sparseImageInt64Atomics-04475
  If the `sparseImageInt64Atomics` feature is not enabled, VkBuffer objects created with the `VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT` flag must not be accessed by atomic instructions through an `OpTypeImage` with a `SampledType` with a `Width` of 64 by this command

- VUID-vkCmdExecuteGeneratedCommandsNV-renderPass-02684
  The current render pass must be compatible with the `renderPass` member of the `VkGraphicsPipelineCreateInfo` structure specified when creating the `VkPipeline` bound to `VK_PIPELINE_BIND_POINT_GRAPHICS`

- VUID-vkCmdExecuteGeneratedCommandsNV-subpass-02685
  The subpass index of the current render pass must be equal to the `subpass` member of the `VkGraphicsPipelineCreateInfo` structure specified when creating the `VkPipeline` bound to `VK_PIPELINE_BIND_POINT_GRAPHICS`

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02686
  Every input attachment used by the current subpass must be bound to the pipeline via a descriptor set

- VUID-vkCmdExecuteGeneratedCommandsNV-None-06537
  Memory backing image subresources used as attachments in the current render pass must not be written in any way other than as an attachment by this command

- VUID-vkCmdExecuteGeneratedCommandsNV-None-06538
  If any recorded command in the current subpass will write to an image subresource as an attachment, this command must not read from the memory backing that image subresource in any other way than as an attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-None-06539
  If any recorded command in the current subpass will read from an image subresource used as an attachment in any way other than as an attachment, this command must not write to that image subresource as an attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-maxMultiviewInstanceIndex-02688
  If the draw is recorded in a render pass instance with multiview enabled, the maximum instance index must be less than or equal to VkPhysicalDeviceMultiviewProperties::`maxMultiviewInstanceIndex`

- VUID-vkCmdExecuteGeneratedCommandsNV-sampleLocationsEnable-02689
  If the bound graphics pipeline was created with VkPipelineSampleLocationsStateCreateInfoEXT::`sampleLocationsEnable` set to `VK_TRUE` and the current subpass has a depth/stencil attachment, then that attachment must have been created with the `VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT` bit set

- VUID-vkCmdExecuteGeneratedCommandsNV-None-06666
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT` dynamic state enabled then vkCmdSetSampleLocationsEXT must have been called in the current command buffer prior to this drawing command

- VUID-vkCmdExecuteGeneratedCommandsNV-viewportCount-03417
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic state enabled, but not the `VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT` dynamic state enabled, then vkCmdSetViewportWithCount must have been called in the current command buffer prior to this drawing command, and the `viewportCount` parameter of `vkCmdSetViewportWithCount` must match the `VkPipelineViewportStateCreateInfo`::`scissorCount` of the pipeline

- VUID-vkCmdExecuteGeneratedCommandsNV-scissorCount-03418
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT` dynamic state enabled, but not the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic state enabled, then vkCmdSetScissorWithCount must have been called in the current command buffer prior to this drawing command, and the `scissorCount` parameter of `vkCmdSetScissorWithCount` must match the `VkPipelineViewportStateCreateInfo`::`viewportCount` of the pipeline

- VUID-vkCmdExecuteGeneratedCommandsNV-viewportCount-03419
  If the bound graphics pipeline state was created with both the `VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT` and `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic states enabled then both vkCmdSetViewportWithCount and vkCmdSetScissorWithCount must have been called in the current command buffer prior to this drawing command, and the `viewportCount` parameter of `vkCmdSetViewportWithCount` must match the `scissorCount` parameter of `vkCmdSetScissorWithCount`

- VUID-vkCmdExecuteGeneratedCommandsNV-viewportCount-04137
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic state enabled, but not the `VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV` dynamic state enabled, then the bound graphics pipeline must have been created with VkPipelineViewportWScalingStateCreateInfoNV::`viewportCount` greater or equal to the `viewportCount` parameter in the last call to vkCmdSetViewportWithCount

- VUID-vkCmdExecuteGeneratedCommandsNV-viewportCount-04138
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` and `VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV` dynamic states enabled then the `viewportCount` parameter in the last call to vkCmdSetViewportWScalingNV must be greater than or equal to the `viewportCount` parameter in the last call to vkCmdSetViewportWithCount

- VUID-vkCmdExecuteGeneratedCommandsNV-viewportCount-04139
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic state enabled, but not the `VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV` dynamic state enabled, then the bound graphics pipeline must have been created with VkPipelineViewportShadingRateImageStateCreateInfoNV::`viewportCount` greater or equal to the `viewportCount` parameter in the last call to vkCmdSetViewportWithCount

- VUID-vkCmdExecuteGeneratedCommandsNV-viewportCount-04140
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` and `VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV` dynamic states enabled then the `viewportCount` parameter in the last call to vkCmdSetViewportShadingRatePaletteNV must be greater than or equal to the `viewportCount` parameter in the last call to vkCmdSetViewportWithCount

- VUID-vkCmdExecuteGeneratedCommandsNV-VkPipelineVieportCreateInfo-04141
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic state enabled and a VkPipelineViewportSwizzleStateCreateInfoNV structure chained from `VkPipelineVieportCreateInfo`, then the bound graphics pipeline must have been created with VkPipelineViewportSwizzleStateCreateInfoNV::`viewportCount` greater or equal to the `viewportCount` parameter in the last call to vkCmdSetViewportWithCount

- VUID-vkCmdExecuteGeneratedCommandsNV-VkPipelineVieportCreateInfo-04142
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic state enabled and a VkPipelineViewportExclusiveScissorStateCreateInfoNV structure chained from `VkPipelineVieportCreateInfo`, then the bound graphics pipeline must have been created with VkPipelineViewportExclusiveScissorStateCreateInfoNV::`exclusiveScissorCount` greater or equal to the `viewportCount` parameter in the last call to vkCmdSetViewportWithCount

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04876
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE` dynamic state enabled then vkCmdSetRasterizerDiscardEnable must have been called in the current command buffer prior to this drawing command

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04877
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE` dynamic state enabled then vkCmdSetDepthBiasEnable must have been called in the current command buffer prior to this drawing command

- VUID-vkCmdExecuteGeneratedCommandsNV-logicOp-04878
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_LOGIC_OP_EXT` dynamic state enabled then vkCmdSetLogicOpEXT must have been called in the current command buffer prior to this drawing command and the `logicOp` must be a valid VkLogicOp value

- VUID-vkCmdExecuteGeneratedCommandsNV-primitiveFragmentShadingRateWithMultipleViewports-04552
  If the `primitiveFragmentShadingRateWithMultipleViewports` limit is not supported, the bound graphics pipeline was created with the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT` dynamic state enabled, and any of the shader stages of the bound graphics pipeline write to the `PrimitiveShadingRateKHR` built-in, then vkCmdSetViewportWithCount must have been called in the current command buffer prior to this drawing command, and the `viewportCount` parameter of `vkCmdSetViewportWithCount` must be `1`

- VUID-vkCmdExecuteGeneratedCommandsNV-blendEnable-04727
  If rasterization is not disabled in the bound graphics pipeline, then for each color attachment in the subpass, if the corresponding image view’s format features do not contain `VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT`, then the `blendEnable` member of the corresponding element of the `pAttachments` member of `pColorBlendState` must be `VK_FALSE`

- VUID-vkCmdExecuteGeneratedCommandsNV-rasterizationSamples-04740
  If rasterization is not disabled in the bound graphics pipeline, and neither the `VK_AMD_mixed_attachment_samples` nor the `VK_NV_framebuffer_mixed_samples` extensions are enabled, then VkPipelineMultisampleStateCreateInfo::`rasterizationSamples` must be the same as the current subpass color and/or depth/stencil attachments

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06172
  If the current render pass instance was begun with vkCmdBeginRendering, the `imageView` member of `pDepthAttachment` is not VK_NULL_HANDLE, and the `layout` member of `pDepthAttachment` is `VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL`, this command must not write any values to the depth attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06173
  If the current render pass instance was begun with vkCmdBeginRendering, the `imageView` member of `pStencilAttachment` is not VK_NULL_HANDLE, and the `layout` member of `pStencilAttachment` is `VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL`, this command must not write any values to the stencil attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06174
  If the current render pass instance was begun with vkCmdBeginRendering, the `imageView` member of `pDepthAttachment` is not VK_NULL_HANDLE, and the `layout` member of `pDepthAttachment` is `VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL`, this command must not write any values to the depth attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06175
  If the current render pass instance was begun with vkCmdBeginRendering, the `imageView` member of `pStencilAttachment` is not VK_NULL_HANDLE, and the `layout` member of `pStencilAttachment` is `VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL`, this command must not write any values to the stencil attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06176
  If the current render pass instance was begun with vkCmdBeginRendering, the `imageView` member of `pDepthAttachment` is not VK_NULL_HANDLE, and the `layout` member of `pDepthAttachment` is `VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL`, this command must not write any values to the depth attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06177
  If the current render pass instance was begun with vkCmdBeginRendering, the `imageView` member of `pStencilAttachment` is not VK_NULL_HANDLE, and the `layout` member of `pStencilAttachment` is `VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL`, this command must not write any values to the stencil attachment

- VUID-vkCmdExecuteGeneratedCommandsNV-viewMask-06178
  If the current render pass instance was begun with vkCmdBeginRendering, the currently bound graphics pipeline must have been created with a VkPipelineRenderingCreateInfo::`viewMask` equal to VkRenderingInfo::`viewMask`

- VUID-vkCmdExecuteGeneratedCommandsNV-colorAttachmentCount-06179
  If the current render pass instance was begun with vkCmdBeginRendering, the currently bound graphics pipeline must have been created with a VkPipelineRenderingCreateInfo::`colorAttachmentCount` equal to VkRenderingInfo::`colorAttachmentCount`

- VUID-vkCmdExecuteGeneratedCommandsNV-colorAttachmentCount-06180
  If the current render pass instance was begun with vkCmdBeginRendering and VkRenderingInfo::`colorAttachmentCount` greater than `0`, then each element of the VkRenderingInfo::`pColorAttachments` array with a `imageView` not equal to VK_NULL_HANDLE must have been created with a VkFormat equal to the corresponding element of VkPipelineRenderingCreateInfo::`pColorAttachmentFormats` used to create the currently bound graphics pipeline

- VUID-vkCmdExecuteGeneratedCommandsNV-attachmentCount-06667
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT` dynamic state enabled then vkCmdSetColorWriteEnableEXT must have been called in the current command buffer prior to this drawing command, and the `attachmentCount` parameter of `vkCmdSetColorWriteEnableEXT` must be equal to the `VkPipelineColorBlendStateCreateInfo`::`attachmentCount` of the currently bound graphics pipeline

- VUID-vkCmdExecuteGeneratedCommandsNV-pDepthAttachment-06181
  If the current render pass instance was begun with vkCmdBeginRendering and VkRenderingInfo::`pDepthAttachment->pname`:imageView was not VK_NULL_HANDLE, the value of VkPipelineRenderingCreateInfo::`depthAttachmentFormat` used to create the currently bound graphics pipeline must be equal to the VkFormat used to create VkRenderingInfo::`pDepthAttachment->pname`:imageView

- VUID-vkCmdExecuteGeneratedCommandsNV-pStencilAttachment-06182
  If the current render pass instance was begun with vkCmdBeginRendering and VkRenderingInfo::`pStencilAttachment->pname`:imageView was not VK_NULL_HANDLE, the value of VkPipelineRenderingCreateInfo::`stencilAttachmentFormat` used to create the currently bound graphics pipeline must be equal to the VkFormat used to create VkRenderingInfo::`pStencilAttachment->pname`:imageView

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06183
  If the current render pass instance was begun with vkCmdBeginRendering and VkRenderingFragmentShadingRateAttachmentInfoKHR::`imageView` was not VK_NULL_HANDLE, the currently bound graphics pipeline must have been created with `VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR`

- VUID-vkCmdExecuteGeneratedCommandsNV-imageView-06184
  If the current render pass instance was begun with vkCmdBeginRendering and VkRenderingFragmentDensityMapAttachmentInfoEXT::`imageView` was not VK_NULL_HANDLE, the currently bound graphics pipeline must have been created with `VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT`

- VUID-vkCmdExecuteGeneratedCommandsNV-colorAttachmentCount-06185
  If the currently bound pipeline was created with a VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV structure, and the current render pass instance was begun with vkCmdBeginRendering with a VkRenderingInfo::`colorAttachmentCount` parameter greater than `0`, then each element of the VkRenderingInfo::`pColorAttachments` array with a `imageView` not equal to VK_NULL_HANDLE must have been created with a sample count equal to the corresponding element of the `pColorAttachmentSamples` member of VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV used to create the currently bound graphics pipeline

- VUID-vkCmdExecuteGeneratedCommandsNV-pDepthAttachment-06186
  If the current render pass instance was begun with vkCmdBeginRendering, the currently bound pipeline was created with a VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV structure, and VkRenderingInfo::`pDepthAttachment->pname`:imageView was not VK_NULL_HANDLE, the value of the `depthStencilAttachmentSamples` member of VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV used to create the currently bound graphics pipeline must be equal to the sample count used to create VkRenderingInfo::`pDepthAttachment->pname`:imageView

- VUID-vkCmdExecuteGeneratedCommandsNV-pStencilAttachment-06187
  If the current render pass instance was begun with vkCmdBeginRendering, the currently bound pipeline was created with a VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV structure, and VkRenderingInfo::`pStencilAttachment->pname`:imageView was not VK_NULL_HANDLE, the value of the `depthStencilAttachmentSamples` member of VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV used to create the currently bound graphics pipeline must be equal to the sample count used to create VkRenderingInfo::`pStencilAttachment->pname`:imageView

- VUID-vkCmdExecuteGeneratedCommandsNV-colorAttachmentCount-06188
  If the currently bound pipeline was created without a VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV structure, and the current render pass instance was begun with vkCmdBeginRendering with a VkRenderingInfo::`colorAttachmentCount` parameter greater than `0`, then each element of the VkRenderingInfo::`pColorAttachments` array with a `imageView` not equal to VK_NULL_HANDLE must have been created with a sample count equal to the value of VkPipelineMultisampleStateCreateInfo::`rasterizationSamples` used to create the currently bound graphics pipeline

- VUID-vkCmdExecuteGeneratedCommandsNV-pDepthAttachment-06189
  If the current render pass instance was begun with vkCmdBeginRendering, the currently bound pipeline was created without a VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV structure, and VkRenderingInfo::`pDepthAttachment->pname`:imageView was not VK_NULL_HANDLE, the value of VkPipelineMultisampleStateCreateInfo::`rasterizationSamples` used to create the currently bound graphics pipeline must be equal to the sample count used to create VkRenderingInfo::`pDepthAttachment->pname`:imageView

- VUID-vkCmdExecuteGeneratedCommandsNV-pStencilAttachment-06190
  If the current render pass instance was begun with vkCmdBeginRendering, the currently bound pipeline was created without a VkAttachmentSampleCountInfoAMD or VkAttachmentSampleCountInfoNV structure, and VkRenderingInfo::`pStencilAttachment->pname`:imageView was not VK_NULL_HANDLE, the value of VkPipelineMultisampleStateCreateInfo::`rasterizationSamples` used to create the currently bound graphics pipeline must be equal to the sample count used to create VkRenderingInfo::`pStencilAttachment->pname`:imageView

- VUID-vkCmdExecuteGeneratedCommandsNV-renderPass-06198
  If the current render pass instance was begun with vkCmdBeginRendering, the currently bound pipeline must have been created with a VkGraphicsPipelineCreateInfo::`renderPass` equal to VK_NULL_HANDLE

- VUID-vkCmdExecuteGeneratedCommandsNV-primitivesGeneratedQueryWithRasterizerDiscard-06708
  If the `primitivesGeneratedQueryWithRasterizerDiscard` feature is not enabled and the `VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT` query is active, rasterization discard must not be enabled.

- VUID-vkCmdExecuteGeneratedCommandsNV-primitivesGeneratedQueryWithNonZeroStreams-06709
  If the `primitivesGeneratedQueryWithNonZeroStreams` feature is not enabled and the `VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT` query is active, the bound graphics pipeline must not have been created with a non-zero value in `VkPipelineRasterizationStateStreamCreateInfoEXT`::`rasterizationStream`.

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04007
  All vertex input bindings accessed via vertex input variables declared in the vertex shader entry point’s interface must have either valid or VK_NULL_HANDLE buffers bound

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04008
  If the nullDescriptor feature is not enabled, all vertex input bindings accessed via vertex input variables declared in the vertex shader entry point’s interface must not be VK_NULL_HANDLE

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02721
  For a given vertex buffer binding, any attribute data fetched must be entirely contained within the corresponding vertex buffer binding, as described in Vertex Input Description

- VUID-vkCmdExecuteGeneratedCommandsNV-primitiveTopology-03420
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT` dynamic state enabled then vkCmdSetPrimitiveTopologyEXT must have been called in the current command buffer prior to this drawing command, and the `primitiveTopology` parameter of `vkCmdSetPrimitiveTopologyEXT` must be of the same topology class as the pipeline VkPipelineInputAssemblyStateCreateInfo::`topology` state

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04912
  If the bound graphics pipeline was created with both the `VK_DYNAMIC_STATE_VERTEX_INPUT_EXT` and `VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT` dynamic states enabled, then vkCmdSetVertexInputEXT must have been called in the current command buffer prior to this draw command

- VUID-vkCmdExecuteGeneratedCommandsNV-pStrides-04913
  If the bound graphics pipeline was created with the `VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT` dynamic state enabled, but not the `VK_DYNAMIC_STATE_VERTEX_INPUT_EXT` dynamic state enabled, then vkCmdBindVertexBuffers2EXT must have been called in the current command buffer prior to this draw command, and the `pStrides` parameter of vkCmdBindVertexBuffers2EXT must not be `NULL`

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04914
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_VERTEX_INPUT_EXT` dynamic state enabled, then vkCmdSetVertexInputEXT must have been called in the current command buffer prior to this draw command

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04875
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT` dynamic state enabled then vkCmdSetPatchControlPointsEXT must have been called in the current command buffer prior to this drawing command

- VUID-vkCmdExecuteGeneratedCommandsNV-None-04879
  If the bound graphics pipeline state was created with the `VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT` dynamic state enabled then vkCmdSetPrimitiveRestartEnableEXT must have been called in the current command buffer prior to this drawing command

- VUID-vkCmdExecuteGeneratedCommandsNV-stage-06481
  The bound graphics pipeline must not have been created with the VkPipelineShaderStageCreateInfo::`stage` member of an element of VkGraphicsPipelineCreateInfo::`pStages` set to `VK_SHADER_STAGE_TASK_BIT_NV` or `VK_SHADER_STAGE_MESH_BIT_NV`

- VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-02970
  `commandBuffer` must not be a protected command buffer

- VUID-vkCmdExecuteGeneratedCommandsNV-isPreprocessed-02908
  If `isPreprocessed` is `VK_TRUE` then vkCmdPreprocessGeneratedCommandsNV must have already been executed on the device, using the same `pGeneratedCommandsInfo` content as well as the content of the input buffers it references (all except VkGeneratedCommandsInfoNV::`preprocessBuffer`). Furthermore `pGeneratedCommandsInfo``s `indirectCommandsLayout` must have been created with the `VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV` bit set

- VUID-vkCmdExecuteGeneratedCommandsNV-pipeline-02909
  `VkGeneratedCommandsInfoNV`::`pipeline` must match the current bound pipeline at `VkGeneratedCommandsInfoNV`::`pipelineBindPoint`

- VUID-vkCmdExecuteGeneratedCommandsNV-None-02910
  Transform feedback must not be active

- VUID-vkCmdExecuteGeneratedCommandsNV-deviceGeneratedCommands-02911
  The `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV`::`deviceGeneratedCommands` feature must be enabled

Valid Usage (Implicit)

- VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-parameter
  `commandBuffer` must be a valid VkCommandBuffer handle

- VUID-vkCmdExecuteGeneratedCommandsNV-pGeneratedCommandsInfo-parameter
  `pGeneratedCommandsInfo` must be a valid pointer to a valid VkGeneratedCommandsInfoNV structure

- VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-recording
  `commandBuffer` must be in the recording state

- VUID-vkCmdExecuteGeneratedCommandsNV-commandBuffer-cmdpool
  The `VkCommandPool` that `commandBuffer` was allocated from must support graphics, or compute operations

- VUID-vkCmdExecuteGeneratedCommandsNV-renderpass
  This command must only be called inside of a render pass instance

Host Synchronization

- Host access to `commandBuffer` must be externally synchronized

- Host access to the `VkCommandPool` that `commandBuffer` was allocated from must be externally synchronized

Command Properties

Command Buffer Levels | Render Pass Scope | Supported Queue Types
--- | --- | ---
Primary Secondary | Inside | Graphics Compute

    // Provided by VK_NV_device_generated_commands
    typedef struct VkGeneratedCommandsInfoNV {
        VkStructureType                      sType;
        const void*                          pNext;
        VkPipelineBindPoint                  pipelineBindPoint;
        VkPipeline                           pipeline;
        VkIndirectCommandsLayoutNV           indirectCommandsLayout;
        uint32_t                             streamCount;
        const VkIndirectCommandsStreamNV*    pStreams;
        uint32_t                             sequencesCount;
        VkBuffer                             preprocessBuffer;
        VkDeviceSize                         preprocessOffset;
        VkDeviceSize                         preprocessSize;
        VkBuffer                             sequencesCountBuffer;
        VkDeviceSize                         sequencesCountOffset;
        VkBuffer                             sequencesIndexBuffer;
        VkDeviceSize                         sequencesIndexOffset;
    } VkGeneratedCommandsInfoNV;

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to a structure extending this structure.

- `pipelineBindPoint` is the VkPipelineBindPoint used for the `pipeline`.

- `pipeline` is the VkPipeline used in the generation and execution process.

- `indirectCommandsLayout` is the VkIndirectCommandsLayoutNV that provides the command sequence to generate.

- `streamCount` defines the number of input streams

- `pStreams` is a pointer to an array of `streamCount` VkIndirectCommandsStreamNV structures providing the input data for the tokens used in `indirectCommandsLayout`.

- `sequencesCount` is the maximum number of sequences to reserve. If `sequencesCountBuffer` is VK_NULL_HANDLE, this is also the actual number of sequences generated.

- `preprocessBuffer` is the VkBuffer that is used for preprocessing the input data for execution. If this structure is used with vkCmdExecuteGeneratedCommandsNV with its `isPreprocessed` set to `VK_TRUE`, then the preprocessing step is skipped and data is only read from this buffer.

- `preprocessOffset` is the byte offset into `preprocessBuffer` where the preprocessed data is stored.

- `preprocessSize` is the maximum byte size within the `preprocessBuffer` after the `preprocessOffset` that is available for preprocessing.

- `sequencesCountBuffer` is a `VkBuffer` in which the actual number of sequences is provided as single `uint32_t` value.

- `sequencesCountOffset` is the byte offset into `sequencesCountBuffer` where the count value is stored.

- `sequencesIndexBuffer` is a `VkBuffer` that encodes the used sequence indices as `uint32_t` array.

- `sequencesIndexOffset` is the byte offset into `sequencesIndexBuffer` where the index values start.

Valid Usage

- VUID-VkGeneratedCommandsInfoNV-pipeline-02912
  The provided `pipeline` must match the pipeline bound at execution time

- VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-02913
  If the `indirectCommandsLayout` uses a token of `VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV`, then the `pipeline` must have been created with multiple shader groups

- VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-02914
  If the `indirectCommandsLayout` uses a token of `VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV`, then the `pipeline` must have been created with `VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV` set in `VkGraphicsPipelineCreateInfo`::`flags`

- VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-02915
  If the `indirectCommandsLayout` uses a token of `VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV`, then the `pipeline``s `VkPipelineLayout` must match the VkIndirectCommandsLayoutTokenNV::`pushconstantPipelineLayout`

- VUID-VkGeneratedCommandsInfoNV-streamCount-02916
  `streamCount` must match the `indirectCommandsLayout`’s `streamCount`

- VUID-VkGeneratedCommandsInfoNV-sequencesCount-02917
  `sequencesCount` must be less or equal to VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::`maxIndirectSequenceCount` and VkGeneratedCommandsMemoryRequirementsInfoNV::`maxSequencesCount` that was used to determine the `preprocessSize`

- VUID-VkGeneratedCommandsInfoNV-preprocessBuffer-02918
  `preprocessBuffer` must have the `VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT` bit set in its usage flag

- VUID-VkGeneratedCommandsInfoNV-preprocessOffset-02919
  `preprocessOffset` must be aligned to VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV::`minIndirectCommandsBufferOffsetAlignment`

- VUID-VkGeneratedCommandsInfoNV-preprocessBuffer-02971
  If `preprocessBuffer` is non-sparse then it must be bound completely and contiguously to a single `VkDeviceMemory` object

- VUID-VkGeneratedCommandsInfoNV-preprocessSize-02920
  `preprocessSize` must be at least equal to the memory requirement`s size returned by vkGetGeneratedCommandsMemoryRequirementsNV using the matching inputs (`indirectCommandsLayout`, …​) as within this structure

- VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02921
  `sequencesCountBuffer` can be set if the actual used count of sequences is sourced from the provided buffer. In that case the `sequencesCount` serves as upper bound

- VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02922
  If `sequencesCountBuffer` is not VK_NULL_HANDLE, its usage flag must have the `VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT` bit set

- VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02923
  If `sequencesCountBuffer` is not VK_NULL_HANDLE, `sequencesCountOffset` must be aligned to `VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV`::`minSequencesCountBufferOffsetAlignment`

- VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-02972
  If `sequencesCountBuffer` is not VK_NULL_HANDLE and is non-sparse then it must be bound completely and contiguously to a single `VkDeviceMemory` object

- VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02924
  If `indirectCommandsLayout`’s `VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV` is set, `sequencesIndexBuffer` must be set otherwise it must be VK_NULL_HANDLE

- VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02925
  If `sequencesIndexBuffer` is not VK_NULL_HANDLE, its usage flag must have the `VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT` bit set

- VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02926
  If `sequencesIndexBuffer` is not VK_NULL_HANDLE, `sequencesIndexOffset` must be aligned to `VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV`::`minSequencesIndexBufferOffsetAlignment`

- VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-02973
  If `sequencesIndexBuffer` is not VK_NULL_HANDLE and is non-sparse then it must be bound completely and contiguously to a single `VkDeviceMemory` object

Valid Usage (Implicit)

- VUID-VkGeneratedCommandsInfoNV-sType-sType
  `sType` must be `VK_STRUCTURE_TYPE_GENERATED_COMMANDS_INFO_NV`

- VUID-VkGeneratedCommandsInfoNV-pNext-pNext
  `pNext` must be `NULL`

- VUID-VkGeneratedCommandsInfoNV-pipelineBindPoint-parameter
  `pipelineBindPoint` must be a valid VkPipelineBindPoint value

- VUID-VkGeneratedCommandsInfoNV-pipeline-parameter
  `pipeline` must be a valid VkPipeline handle

- VUID-VkGeneratedCommandsInfoNV-indirectCommandsLayout-parameter
  `indirectCommandsLayout` must be a valid VkIndirectCommandsLayoutNV handle

- VUID-VkGeneratedCommandsInfoNV-pStreams-parameter
  `pStreams` must be a valid pointer to an array of `streamCount` valid VkIndirectCommandsStreamNV structures

- VUID-VkGeneratedCommandsInfoNV-preprocessBuffer-parameter
  `preprocessBuffer` must be a valid VkBuffer handle

- VUID-VkGeneratedCommandsInfoNV-sequencesCountBuffer-parameter
  If `sequencesCountBuffer` is not VK_NULL_HANDLE, `sequencesCountBuffer` must be a valid VkBuffer handle

- VUID-VkGeneratedCommandsInfoNV-sequencesIndexBuffer-parameter
  If `sequencesIndexBuffer` is not VK_NULL_HANDLE, `sequencesIndexBuffer` must be a valid VkBuffer handle

- VUID-VkGeneratedCommandsInfoNV-streamCount-arraylength
  `streamCount` must be greater than `0`

- VUID-VkGeneratedCommandsInfoNV-commonparent
  Each of `indirectCommandsLayout`, `pipeline`, `preprocessBuffer`, `sequencesCountBuffer`, and `sequencesIndexBuffer` that are valid handles of non-ignored parameters must have been created, allocated, or retrieved from the same VkDevice

Referencing the functions defined in Indirect Commands Layout, `vkCmdExecuteGeneratedCommandsNV` behaves as:

    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 It is important to note that the values of all state related to the `pipelineBindPoint` used are undefined after this command.

Commands can be preprocessed prior execution using the following command:

    // Provided by VK_NV_device_generated_commands
    void vkCmdPreprocessGeneratedCommandsNV(
        VkCommandBuffer                             commandBuffer,
        const VkGeneratedCommandsInfoNV*            pGeneratedCommandsInfo);

- `commandBuffer` is the command buffer which does the preprocessing.

- `pGeneratedCommandsInfo` is a pointer to a VkGeneratedCommandsInfoNV structure containing parameters affecting the preprocessing step.

Valid Usage

- VUID-vkCmdPreprocessGeneratedCommandsNV-commandBuffer-02974
  `commandBuffer` must not be a protected command buffer

- VUID-vkCmdPreprocessGeneratedCommandsNV-pGeneratedCommandsInfo-02927
  `pGeneratedCommandsInfo``s `indirectCommandsLayout` must have been created with the `VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV` bit set

- VUID-vkCmdPreprocessGeneratedCommandsNV-deviceGeneratedCommands-02928
  The `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV`::`deviceGeneratedCommands` feature must be enabled

Valid Usage (Implicit)

- VUID-vkCmdPreprocessGeneratedCommandsNV-commandBuffer-parameter
  `commandBuffer` must be a valid VkCommandBuffer handle

- VUID-vkCmdPreprocessGeneratedCommandsNV-pGeneratedCommandsInfo-parameter
  `pGeneratedCommandsInfo` must be a valid pointer to a valid VkGeneratedCommandsInfoNV structure

- VUID-vkCmdPreprocessGeneratedCommandsNV-commandBuffer-recording
  `commandBuffer` must be in the recording state

- VUID-vkCmdPreprocessGeneratedCommandsNV-commandBuffer-cmdpool
  The `VkCommandPool` that `commandBuffer` was allocated from must support graphics, or compute operations

- VUID-vkCmdPreprocessGeneratedCommandsNV-renderpass
  This command must only be called outside of a render pass instance

Host Synchronization

- Host access to `commandBuffer` must be externally synchronized

- Host access to the `VkCommandPool` that `commandBuffer` was allocated from must be externally synchronized

Command Properties

Command Buffer Levels | Render Pass Scope | Supported Queue Types
--- | --- | ---
Primary Secondary | Outside | Graphics Compute