<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4RenderCommandEncoder/drawMeshThreads(threadsPerGrid:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTL4RenderCommandEncoder(im)drawMeshThreads:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:"
  },
  "title" : "drawMeshThreads(threadsPerGrid:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)"
}
-->

# drawMeshThreads(threadsPerGrid:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)

Encodes a draw command that invokes a mesh shader and, optionally, an object shader with a grid of threads.

```
func drawMeshThreads(threadsPerGrid: MTLSize, threadsPerObjectThreadgroup: MTLSize, threadsPerMeshThreadgroup: MTLSize)
```

## Parameters

`threadsPerGrid`

A [`MTLSize`](/documentation/Metal/MTLSize) instance that represents the number of threads for each grid dimension.
For mesh shaders, the command rounds the value down to the nearest multiple of
`threadsPerMeshThreadgroup` for each dimension. For object shaders, the value doesn’t
need to be a multiple of `threadsPerObjectThreadgroup`.

`threadsPerObjectThreadgroup`

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

`threadsPerMeshThreadgroup`

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

---

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)