dispatchThreadsPerTile(_:)
Encodes a command that invokes GPU functions from the encoder’s current tile render pipeline state.
Declaration
func dispatchThreadsPerTile(_ threadsPerTile: MTLSize)Parameters
- threadsPerTile:
An Mtlsize instance that represents the number of threads the render pass uses per tile.
Set the size’s Width and Height properties to values that are less than or equal to Tilewidth and Tileheight, respectively. Some GPU families only support square tile dispatches and require the same value for Width and Height. See the Metal Feature Set Tables to check which GPU families support nonsquare dispatches.
Set the Depth property to
1.
Discussion
The command invokes the GPU function that’s in the encoder’s current tile render pipeline state. You can configure that state with the following steps:
Configure an MTLTileRenderPipelineDescriptor instance.
Create a tile render pipeline state by calling one of the applicable methods of an MTLDevice instance, including makeRenderPipelineState(tileDescriptor:options:reflection:).
Apply that tile render pipeline state by calling the setRenderPipelineState(_:) method.
The method records the encoder’s current rendering state and resources the command needs as it runs. You can safely change the encoder’s render pipeline state to encode other commands after calling this method. Subsequent changes to the state don’t affect the commands already in the encoder’s MTLCommandBuffer.