Instance Method

dispatchThreads(_:threadsPerThreadgroup:)

Encodes a dispatch call for a compute pass, using an arbitrarily-sized grid.

Required.

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.

Discussion

This method encodes a dispatch call that specifies an arbitrary number of threads in a grid (threadsPerGrid). You do not specify the number of threadgroups in the grid; Metal calculates these values for you and provides partial threadgroups if necessary.

See Also

Executing a Compute Function

func dispatchThreadgroups(MTLSize, threadsPerThreadgroup: MTLSize)

Encodes a dispatch call for a compute pass, using a grid aligned to threadgroup boundaries.

Required.

func dispatchThreadgroups(indirectBuffer: MTLBuffer, indirectBufferOffset: Int, threadsPerThreadgroup: MTLSize)

Encodes a dispatch call for a compute pass, using an indirect buffer that defines the size of a grid aligned to threadgroup boundaries.

Required.