VKCMDDISPATCHINDIREC(3)

NAME
vkCmdDispatchIndirect - Dispatch compute work items using indirect parameters.

C SPECIFICATION

    void vkCmdDispatchIndirect(
        VkCommandBuffer                             commandBuffer,
        VkBuffer                                    buffer,
        VkDeviceSize                                offset);

PARAMETERS

commandBuffer
    Command buffer upon which to execute the command.

buffer
    The buffer object containing the parameters to dispatch.

offset
    The offset within buffer at which the parameters are located.

DESCRIPTION

vkCmdDispatchIndirect dispatches a group of x by y by z compute workgroups where the values of x, y, and z are taken from offset bytes into the buffer object specified by buffer. At this location in the buffer, there is assumed to be an instance of the VkDispatchIndirectCommand structure, whose definition is:

    typedef struct VkDispatchIndirectCommand {
        uint32_t    x;
        uint32_t    y;
        uint32_t    z;
    } VkDispatchIndirectCommand;

offset must be a multiple of four. If any of the x, y or z members of VkDispatchIndirectCommand are zero, then no work is initiated. Two- and one-dimensional work may be initiated by setting z or y and z to 1, respectively.

VALID USAGE

    • commandBuffer must be a valid VkCommandBuffer handle

    • buffer must be a valid VkBuffer handle

    • commandBuffer must be in the recording state

    • The VkCommandPool that commandBuffer was allocated from must support compute operations

    • This command must only be called outside of a render pass instance

    • Each of commandBuffer and buffer must have been created, allocated or retrieved from the same VkDevice

    • For each set n that is statically used by the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_COMPUTE, a descriptor set must have been bound to n at VK_PIPELINE_BIND_POINT_COMPUTE, with a VkPipelineLayout that is compatible for set n, with the VkPipelineLayout used to create the current VkPipeline, as described in ???

    • Descriptors in each bound descriptor set, specified via vkCmdBindDescriptorSets, must be valid if they are statically used by the currently bound VkPipeline object, specified via vkCmdBindPipeline

    • A valid compute pipeline must be bound to the current command buffer with VK_PIPELINE_BIND_POINT_COMPUTE

    • buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT bit set

    • offset must be a multiple of 4

    • The sum of offset and the size of VkDispatchIndirectCommand must be less than or equal to the size of buffer

    • For each push constant that is statically used by the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_COMPUTE, a push constant value must have been set for VK_PIPELINE_BIND_POINT_COMPUTE, with a VkPipelineLayout that is compatible for push constants with the one used to create the current VkPipeline, as described in ???

    • If any VkSampler object that is accessed from a shader by the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_COMPUTE uses unnormalized coordinates, it 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

    • If any VkSampler object that is accessed from a shader by the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_COMPUTE uses unnormalized coordinates, it 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

    • If any VkSampler object that is accessed from a shader by the VkPipeline currently bound to VK_PIPELINE_BIND_POINT_COMPUTE uses unnormalized coordinates, it 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

    • If the robust buffer access feature is not enabled, and any shader stage in the VkPipeline object currently bound to VK_PIPELINE_BIND_POINT_COMPUTE accesses a uniform buffer, it must not access values outside of the range of that buffer specified in the currently bound descriptor set

    • If the robust buffer access feature is not enabled, and any shader stage in the VkPipeline object currently bound to VK_PIPELINE_BIND_POINT_COMPUTE accesses a storage buffer, it must not access values outside of the range of that buffer specified in the currently bound descriptor set

    • Any VkImageView being sampled with VK_FILTER_LINEAR as a result of this command must be of a format which supports linear filtering, as specified by the VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT flag in VkFormatProperties::linearTilingFeatures (for a linear image) or VkFormatProperties::optimalTilingFeatures(for an optimally tiled image) returned by vkGetPhysicalDeviceFormatProperties

HOST SYNCHRONIZATION

    • Host access to commandBuffer must be externally synchronized

COMMAND PROPERTIES
Command Buffer Levels | Render Pass Scope | Supported Queue Types
Primary Secondary | Outside | COMPUTE

NOTES

Although vkCmdDispatchIndirect does not generate errors or return a value, enabled validation layers may detect possible error conditions or potentially undefined behavior and report this via some other means.

SEE ALSO

vkCmdDispatch, vkCmdDrawIndirect, vkCmdDrawIndexedIndirect

COPYRIGHT

Copyright © 2014-2016 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

AUTHOR

Khronos Group
    Author.