---
title: "drawMeshThreadgroups(indirectBuffer:indirectBufferOffset:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/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.

## Declaration

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

## Parameters

- `indirectBuffer`: An doc://com.apple.metal/documentation/Metal/MTLBuffer instance with data that matches the layout of the doc://com.apple.metal/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 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 doc://com.apple.metal/documentation/Metal/MTLSize instance that represents the number of threads in an object shader threadgroup, if applicable.
- `threadsPerMeshThreadgroup`: An doc://com.apple.metal/documentation/Metal/MTLSize instance that represents the number of threads in a mesh shader threadgroup.

## See Also

### Drawing with meshes

- [drawMeshThreads(_:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)](metal/mtlrendercommandencoder/drawmeshthreads(_:threadsperobjectthreadgroup:threadspermeshthreadgroup:).md)
- [drawMeshThreadgroups(_:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)](metal/mtlrendercommandencoder/drawmeshthreadgroups(_:threadsperobjectthreadgroup:threadspermeshthreadgroup:).md)
