<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLRenderCommandEncoder/drawPatches(numberOfPatchControlPoints:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLRenderCommandEncoder(im)drawPatches:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:"
  },
  "title" : "drawPatches(numberOfPatchControlPoints:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:)"
}
-->

# drawPatches(numberOfPatchControlPoints:patchStart:patchCount:patchIndexBuffer:patchIndexBufferOffset:instanceCount:baseInstance:)

Encodes a draw command that renders multiple instances of tessellated patches.

```
func drawPatches(numberOfPatchControlPoints: Int, patchStart: Int, patchCount: Int, patchIndexBuffer: (any MTLBuffer)?, patchIndexBufferOffset: Int, instanceCount: Int, baseInstance: Int)
```

## Parameters

`numberOfPatchControlPoints`

The number of control points for each patch, which needs to be in the range `[0, 32]`.

`patchStart`

The first patch the command draws.

`patchCount`

The number of patches the command draws for each instance.

`patchIndexBuffer`

An [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance that contains the indices to patches.

`patchIndexBufferOffset`

An integer that represents the location, in bytes, from the start of `patchIndexBuffer` where the patch indices begin.

`instanceCount`

The number of times the command draws `patchCount` patches.

`baseInstance`

The lowest value the command passes to your vertex shader’s parameter with the `instance_id` attribute.

    The command assigns each drawing instance a unique     `instance_id`     value that increases from     `baseInstance`     through     `(baseInstance + instanceCount - 1)`    . Your shader can use that value to identify which instance the vertex belongs to.

    For more information about the     `instance_id`     argument attribute for vertex shaders, see the     [Metal Shading Language Specification (PDF)](https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf)    .

## Discussion

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`](/documentation/Metal/MTLCommandBuffer).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)