dispatchThreads(_:threadsPerThreadgroup:)
Encodes a compute command using an arbitrarily sized grid.
Declaration
func dispatchThreads(_ threadsPerGrid: MTLSize, threadsPerThreadgroup: MTLSize)Parameters
- threadsPerGrid:
The number of threads in the grid, in each dimension.
- threadsPerThreadgroup:
The number of threads in one threadgroup, in each dimension.
Mentioned in
Discussion
This method encodes a call that uses an arbitrary number of threads in its execution grid. Metal calculates the number of threadgroups needed, providing partial threadgroups if necessary. Prefer this method to dispatchThreadgroups(_:threadsPerThreadgroup:) if your app requires bounds checking or you need extra data allocations to saturate a uniform grid.