---
title: "dispatchThreadsPerTile(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4rendercommandencoder/dispatchthreadspertile(_:)"
---

# dispatchThreadsPerTile(_:)

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

## Declaration

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

## Parameters

- `threadsPerTile`: A doc://com.apple.metal/documentation/Metal/MTLSize instance that represents the number of threads the render pass uses per tile. Set the size’s doc://com.apple.metal/documentation/Metal/MTLSize/width and doc://com.apple.metal/documentation/Metal/MTLSize/height properties to values that are less than or equal to doc://com.apple.metal/documentation/Metal/MTL4RenderCommandEncoder/tileWidth and doc://com.apple.metal/documentation/Metal/MTL4RenderCommandEncoder/tileHeight, respectively. Some GPU families only support square tile dispatches and require the same value for width and height. Set doc://com.apple.metal/documentation/Metal/MTLSize/depth to 1.

## See Also

### Drawing with tile shaders

- [tileWidth](metal/mtl4rendercommandencoder/tilewidth.md)
- [tileHeight](metal/mtl4rendercommandencoder/tileheight.md)
