Contents

drawPatches(_:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)

Encodes a command to render a number of instances of tessellated patches.

Declaration

func drawPatches(_ numberOfPatchControlPoints: Int, patchStart: Int, patchCount: Int, patchIndexBuffer: (any MTLBuffer)?, patchIndexBufferOffset: Int, instanceCount: Int, baseInstance: Int, tessellationFactorBuffer buffer: any MTLBuffer, tessellationFactorBufferOffset offset: Int, tessellationFactorBufferInstanceStride instanceStride: Int)

Parameters

  • numberOfPatchControlPoints:

    The number of control points per patch. This value needs to be between 0 and 32, inclusive.

  • patchStart:

    The first patch to draw.

  • patchCount:

    The number of patches in each instance.

  • patchIndexBuffer:

    A buffer that contains indices to patches.

  • patchIndexBufferOffset:

    The byte offset within patchIndexBuffer to start reading indices from.

  • instanceCount:

    The number of instances to draw.

  • baseInstance:

    The first instance to draw.

  • buffer:

    The per-patch tessellation factors buffer.

  • offset:

    The distance, in bytes, between the start of the data and the start of the buffer. This value needs to be a multiple of 4 bytes.

  • instanceStride:

    The distance, in bytes, between two instances of data in the buffer.

Discussion

The command generated by this method is equivalent to calling setTessellationFactorBuffer(_:offset:instanceStride:) followed by drawPatches(numberOfPatchControlPoints:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:).

See Also

Encoding a drawing command