<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.5.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderCommandEncoder/dispatchThreadsPerTile(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLRenderCommandEncoder(im)dispatchThreadsPerTile:"
  },
  "title" : "dispatchThreadsPerTile(_:)"
}
-->

# dispatchThreadsPerTile(_:)

Encodes a command that invokes GPU functions from the encoder’s current tile render pipeline state.

```
func dispatchThreadsPerTile(_ threadsPerTile: MTLSize)
```

## Parameters

`threadsPerTile`

An [`MTLSize`](/documentation/Metal/MTLSize) instance that represents the number of threads the render pass uses per tile.

    Set the size’s [`width`](/documentation/Metal/MTLSize/width)     and [`height`](/documentation/Metal/MTLSize/height)     properties to values that are less than or equal to [`tileWidth`](/documentation/Metal/MTLRenderCommandEncoder/tileWidth)     and [`tileHeight`](/documentation/Metal/MTLRenderCommandEncoder/tileHeight)    , respectively. Some GPU families only support square tile dispatches and require the same value for [`width`](/documentation/Metal/MTLSize/width)     and [`height`](/documentation/Metal/MTLSize/height)    . See the     [Metal feature set tables (PDF)](https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf)     to check which GPU families support nonsquare dispatches.

    Set the [`depth`](/documentation/Metal/MTLSize/depth)     property to     `1`    .

## Discussion

The command invokes the GPU function that’s in the encoder’s current tile render pipeline state. You can configure that state with the following steps:

1. Configure an [`MTLTileRenderPipelineDescriptor`](/documentation/Metal/MTLTileRenderPipelineDescriptor) instance.
2. Create a tile render pipeline state by calling one of the applicable methods of an [`MTLDevice`](/documentation/Metal/MTLDevice) instance, including [`makeRenderPipelineState(tileDescriptor:options:reflection:)`](/documentation/Metal/MTLDevice/makeRenderPipelineState(tileDescriptor:options:reflection:)).
3. Apply that tile render pipeline state by calling the [`setRenderPipelineState(_:)`](/documentation/Metal/MTLRenderCommandEncoder/setRenderPipelineState(_:)) method.

The method records the encoder’s current rendering state and resources the command needs as it runs. You can safely change the encoder’s render pipeline state to encode other commands after calling this method. Subsequent changes to the state don’t affect the commands already in the encoder’s [`MTLCommandBuffer`](/documentation/Metal/MTLCommandBuffer).

---

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)