---
title: "drawPrimitives(primitiveType:vertexStart:vertexCount:instanceCount:baseInstance:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4rendercommandencoder/drawprimitives(primitivetype:vertexstart:vertexcount:instancecount:baseinstance:)"
---

# drawPrimitives(primitiveType:vertexStart:vertexCount:instanceCount:baseInstance:)

Encodes a draw command that renders multiple instances of a geometric primitive, starting with a custom instance identification number.

## Declaration

```swift
func drawPrimitives(primitiveType: MTLPrimitiveType, vertexStart: Int, vertexCount: Int, instanceCount: Int, baseInstance: Int)
```

## Parameters

- `primitiveType`: A doc://com.apple.metal/documentation/Metal/MTLPrimitiveType representing how the command interprets vertex argument data.
- `vertexStart`: The lowest value the command passes to your vertex shader function’s parameter with the vertex_id attribute.
- `vertexCount`: An integer that represents the number of vertices of primitiveType the command draws.
- `instanceCount`: An integer that represents the number of times the command draws primitiveType with vertexCount vertices.
- `baseInstance`: The lowest value the command passes to your vertex shader function’s parameter with the instance_id attribute.

## Discussion

Discussion The command assigns each vertex a unique vertex_id value within its drawing instance that increases from vertexStart through (vertexStart + vertexCount - 1). Additionally, the command assigns each drawing instance a unique instance_id value that increases from baseInstance through (baseInstance + instanceCount - 1). Your vertex shader can use the vertex_id value to uniquely identify each vertex in each drawing instance, and the instance_id value to identify which instance that vertex belongs to.

## See Also

### Drawing with vertices

- [drawPrimitives(primitiveType:vertexStart:vertexCount:)](metal/mtl4rendercommandencoder/drawprimitives(primitivetype:vertexstart:vertexcount:).md)
- [drawPrimitives(primitiveType:vertexStart:vertexCount:instanceCount:)](metal/mtl4rendercommandencoder/drawprimitives(primitivetype:vertexstart:vertexcount:instancecount:).md)
- [drawPrimitives(primitiveType:indirectBuffer:)](metal/mtl4rendercommandencoder/drawprimitives(primitivetype:indirectbuffer:).md)
