drawIndexedPatches(_:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)
Encodes a command to render a number of instances of tessellated patches, using a control point index buffer.
Declaration
func drawIndexedPatches(_ numberOfPatchControlPoints: Int, patchStart: Int, patchCount: Int, patchIndexBuffer: (any MTLBuffer)?, patchIndexBufferOffset: Int, controlPointIndexBuffer: any MTLBuffer, controlPointIndexBufferOffset: 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.
- controlPointIndexBuffer:
A buffer that contains indices to the control points of a patch.
- controlPointIndexBufferOffset:
The byte offset within controlPointIndexBuffer to start reading indices from.
- instanceCount:
instanceCount
- 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 drawIndexedPatches(numberOfPatchControlPoints:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:).
See Also
Encoding a drawing command
drawPrimitives(_:vertexStart:vertexCount:instanceCount:baseInstance:)drawIndexedPrimitives(_:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:)drawPatches(_:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)