---
title: "dispatchThreads(indirectBuffer:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4computecommandencoder/dispatchthreads(indirectbuffer:)"
---

# dispatchThreads(indirectBuffer:)

Encodes a compute dispatch command with an arbitrarily sized grid, using an indirect buffer for arguments.

## Declaration

```swift
func dispatchThreads(indirectBuffer: MTLGPUAddress)
```

## Parameters

- `indirectBuffer`: GPUAddress of a doc://com.apple.metal/documentation/Metal/MTLBuffer instance providing arguments. Lay out the data in this buffer as described in the doc://com.apple.metal/documentation/Metal/MTLDispatchThreadsIndirectArguments structure. This address requires 4-byte alignment.

## See Also

### Running dispatch commands

- [dispatchThreads(threadsPerGrid:threadsPerThreadgroup:)](metal/mtl4computecommandencoder/dispatchthreads(threadspergrid:threadsperthreadgroup:).md)
- [dispatchThreadgroups(threadgroupsPerGrid:threadsPerThreadgroup:)](metal/mtl4computecommandencoder/dispatchthreadgroups(threadgroupspergrid:threadsperthreadgroup:).md)
- [dispatchThreadgroups(indirectBuffer:threadsPerThreadgroup:)](metal/mtl4computecommandencoder/dispatchthreadgroups(indirectbuffer:threadsperthreadgroup:).md)
