C Specification

To record an indirect mesh tasks drawing command with the draw count sourced from a buffer, call:

// Provided by VK_EXT_mesh_shader with (VK_VERSION_1_2 or VK_KHR_draw_indirect_count) or VK_AMD_draw_indirect_count
void vkCmdDrawMeshTasksIndirectCountEXT(
    VkCommandBuffer                             commandBuffer,
    VkBuffer                                    buffer,
    VkDeviceSize                                offset,
    VkBuffer                                    countBuffer,
    VkDeviceSize                                countBufferOffset,
    uint32_t                                    maxDrawCount,
    uint32_t                                    stride);

Parameters

  • commandBuffer is the command buffer into which the command is recorded.

  • buffer is the buffer containing draw parameters.

  • offset is the byte offset into buffer where parameters begin.

  • countBuffer is the buffer containing the draw count.

  • countBufferOffset is the byte offset into countBuffer where the draw count begins.

  • maxDrawCount specifies the maximum number of draws that will be executed. The actual number of executed draw calls is the minimum of the count specified in countBuffer and maxDrawCount.

  • stride is the byte stride between successive sets of draw parameters.

Description

vkCmdDrawMeshTasksIndirectCountEXT behaves similarly to vkCmdDrawMeshTasksIndirectEXT except that the draw count is read by the device from a buffer during execution. The command will read an unsigned 32-bit integer from countBuffer located at countBufferOffset and use this as the draw count.

Valid Usage
  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-buffer-02708
    If buffer is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-buffer-02709
    buffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT usage flag set

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-offset-02710
    offset must be a multiple of 4

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-commandBuffer-02711
    commandBuffer must not be a protected command buffer

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBuffer-02714
    If countBuffer is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBuffer-02715
    countBuffer must have been created with the VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT usage flag set

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBufferOffset-02716
    countBufferOffset must be a multiple of 4

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBuffer-02717
    The count stored in countBuffer must be less than or equal to VkPhysicalDeviceLimits::maxDrawIndirectCount

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBufferOffset-04129
    (countBufferOffset + sizeof(uint32_t)) must be less than or equal to the size of countBuffer

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-None-04445
    If the drawIndirectCount feature is not enabled this function must not be used

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-stride-07096
    stride must be a multiple of 4 and must be greater than or equal to sizeof(VkDrawMeshTasksIndirectCommandEXT)

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-maxDrawCount-07097
    If maxDrawCount is greater than or equal to 1, (stride × (maxDrawCount - 1) + offset + sizeof(VkDrawMeshTasksIndirectCommandEXT)) must be less than or equal to the size of buffer

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-MeshEXT-07100
    The current pipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS must contain a shader stage using the MeshEXT Execution Model

Valid Usage (Implicit)
  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-commandBuffer-parameter
    commandBuffer must be a valid VkCommandBuffer handle

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-buffer-parameter
    buffer must be a valid VkBuffer handle

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-countBuffer-parameter
    countBuffer must be a valid VkBuffer handle

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-commandBuffer-recording
    commandBuffer must be in the recording state

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-commandBuffer-cmdpool
    The VkCommandPool that commandBuffer was allocated from must support VK_QUEUE_GRAPHICS_BIT operations

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

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-suspended
    This command must not be called between suspended render pass instances

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-videocoding
    This command must only be called outside of a video coding scope

  • VUID-vkCmdDrawMeshTasksIndirectCountEXT-commonparent
    Each of buffer, commandBuffer, and countBuffer must have been created, allocated, or retrieved from the same VkDevice

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 Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Inside

Outside

VK_QUEUE_GRAPHICS_BIT

Action

Conditional Rendering

vkCmdDrawMeshTasksIndirectCountEXT is affected by conditional rendering

See Also

Document Notes

For more information, see the Vulkan Specification.

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0