<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderCommandEncoder/drawMeshThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLRenderCommandEncoder(im)drawMeshThreadgroupsWithIndirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:"
  },
  "title" : "drawMeshThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)"
}
-->

# drawMeshThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)

Encodes a draw command that invokes a mesh shader and, optionally, an object shader with indirect arguments.

```
func drawMeshThreadgroups(indirectBuffer: any MTLBuffer, indirectBufferOffset: Int, threadsPerObjectThreadgroup: MTLSize, threadsPerMeshThreadgroup: MTLSize)
```

## Parameters

`indirectBuffer`

An [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance with data that matches the layout of the [`MTLDispatchThreadgroupsIndirectArguments`](/documentation/Metal/MTLDispatchThreadgroupsIndirectArguments) structure.

`indirectBufferOffset`

An integer that represents the location, in bytes, from the start of `indirectBuffer` where the indirect arguments structure begins.

    See the     [Metal feature set tables (PDF)](https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf)     to check for offset alignment requirements for buffers in     `device`     and     `constant`     address space.

`threadsPerObjectThreadgroup`

An [`MTLSize`](/documentation/Metal/MTLSize) instance that represents the number of threads in an object shader threadgroup, if applicable.

`threadsPerMeshThreadgroup`

An [`MTLSize`](/documentation/Metal/MTLSize) instance that represents the number of threads in a mesh shader threadgroup.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)