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

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

Encodes a draw command that renders multiple instances of a geometric primitive.

## Declaration

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

## Parameters

- `primitiveType`: A doc://com.apple.metal/documentation/Metal/MTLPrimitiveType represents 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 primitives with vertexCount vertices.

## 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 0 through (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:baseInstance:)](metal/mtl4rendercommandencoder/drawprimitives(primitivetype:vertexstart:vertexcount:instancecount:baseinstance:).md)
- [drawPrimitives(primitiveType:indirectBuffer:)](metal/mtl4rendercommandencoder/drawprimitives(primitivetype:indirectbuffer:).md)
