---
title: "drawIndexedPatches(_:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:controlPointIndexBuffer:controlPointIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlindirectrendercommand/drawindexedpatches(_:patchstart:patchcount:patchindexbuffer:patchindexbufferoffset:controlpointindexbuffer:controlpointindexbufferoffset:instancecount:baseinstance:tessellationfactorbuffer:tessellationfactorbufferoffset:tessellationfactorbu-4mdz8"
---

# 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

```swift
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

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:)](metal/mtlindirectrendercommand/drawprimitives(_:vertexstart:vertexcount:instancecount:baseinstance:).md)
- [drawIndexedPrimitives(_:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:)](metal/mtlindirectrendercommand/drawindexedprimitives(_:indexcount:indextype:indexbuffer:indexbufferoffset:instancecount:basevertex:baseinstance:).md)
- [drawPatches(_:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:tessellationFactorBuffer:tessellationFactorBufferOffset:tessellationFactorBufferInstanceStride:)](metal/mtlindirectrendercommand/drawpatches(_:patchstart:patchcount:patchindexbuffer:patchindexbufferoffset:instancecount:baseinstance:tessellationfactorbuffer:tessellationfactorbufferoffset:tessellationfactorbufferinstancestride:).md)
