<!--
{
  "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/MTL4MeshRenderPipelineDescriptor/maxTotalThreadsPerMeshThreadgroup",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTL4MeshRenderPipelineDescriptor(py)maxTotalThreadsPerMeshThreadgroup"
  },
  "title" : "maxTotalThreadsPerMeshThreadgroup"
}
-->

# maxTotalThreadsPerMeshThreadgroup

Controls the largest number of threads the pipeline state can execute in a single mesh shader threadgroup dispatch.

```
var maxTotalThreadsPerMeshThreadgroup: Int { get set }
```

## Discussion

This number represents the maximum size of the product of the components of parameter `threadsPerMeshThreadgroup`
that Metal can use when drawing with this pipeline in mesh shader dispatch methods, such as
[`drawMeshThreadgroups(threadgroupsPerGrid:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)`](/documentation/Metal/MTL4RenderCommandEncoder/drawMeshThreadgroups(threadgroupsPerGrid:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)).

The compiler’s optimizer can use the value of this property to generate more efficient code, specifically when
the value doesn’t exceed the thread execution width of the underlying GPU.

The default value of this property is `0`, thish indicates that the Metal Shader Language attribute
`[[max_total_threads_per_threadgroup]]` you attache to the pipeline’s mesh shader function determines
the value of this property.

When you specify both the `[[max_total_threads_per_threadgroup(N)]]` attribute and this property, you are responsible
for making sure these values match.

Additionally, you are responsible for ensuring this value doesn’t exceed the “maximum threads per threadgroup”
device limit documented in the “Metal Feature Set Tables” PDF:
<https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf>.

---

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)