concurrentDispatchThreads(_:threadsPerThreadgroup:)
Encodes a compute command using an arbitrarily sized grid.
Declaration
func concurrentDispatchThreads(_ 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
The command generated by this method is equivalent to calling dispatchThreads(_:threadsPerThreadgroup:).
Compute commands encoded into an indirect command buffer don’t automatically serialize access to resources with other commands in the indirect command buffer. Use barriers to serialize access to resources within a range of commands. See setBarrier().
When you execute the commands in an indirect command buffer, the dispatchType property of the compute command encoder determines whether the compute command encoder adds additional barriers. If dispatchType is MTLDispatchType.serial, the compute command encoder adds a barrier before and after the range of commands. If dispatchType is MTLDispatchType.concurrent, then the compute command encoder does nothing, and you are responsible for synchronizing access to resources.