Contents

drawMeshThreadgroups(indirectBuffer:threadsPerObjectThreadgroup:threadsPerMeshThreadgroup:)

Encodes a draw command that invokes a mesh shader and, optionally, an object shader with indirect arguments.

Declaration

func drawMeshThreadgroups(indirectBuffer: MTLGPUAddress, threadsPerObjectThreadgroup: MTLSize, threadsPerMeshThreadgroup: MTLSize)

Parameters

  • indirectBuffer:

    GPUAddress of an Mtlbuffer instance with data that matches the layout of the Mtldispatchthreadgroupsindirectarguments structure. This address requires 4-byte alignment.

  • threadsPerObjectThreadgroup:

    A Mtlsize instance that represents the number of threads in an object shader threadgroup, if applicable.

  • threadsPerMeshThreadgroup:

    A Mtlsize instance that represents the number of threads in a mesh shader threadgroup.

Discussion

This method enables you to determine the number of threadgroups per grid indirectly, in the GPU timeline. Metal expects this buffer’s contents to match the layout of structure MTLDispatchThreadgroupsIndirectArguments. You are responsible for ensuring the address of this buffer has 4-byte alignment.

Use an instance of MTLResidencySet to mark residency of the indirect buffer that the indirectBuffer parameter references.

See Also

Drawing with meshes