---
title: "drawPrimitives(primitiveType:indirectBuffer:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtl4rendercommandencoder/drawprimitives(primitivetype:indirectbuffer:)"
---

# drawPrimitives(primitiveType:indirectBuffer:)

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

## Declaration

```swift
func drawPrimitives(primitiveType: MTLPrimitiveType, indirectBuffer: MTLGPUAddress)
```

## Parameters

- `primitiveType`: A doc://com.apple.metal/documentation/Metal/MTLPrimitiveType representing how the command interprets vertex argument data.
- `indirectBuffer`: GPUAddress of a doc://com.apple.metal/documentation/Metal/MTLBuffer instance with data that matches the layout of the doc://com.apple.metal/documentation/Metal/MTLDrawPrimitivesIndirectArguments structure. You are responsible for ensuring that the alignment of this address is 4 bytes.

## Discussion

Discussion When you use this function, Metal reads the parameters to the draw command from an MTLBuffer instance, allowing you to implement a GPU-driven workflow where a compute pipeline state determines the draw arguments. You are responsible for ensuring that the address of the indirect buffer you provide to this method has 4-byte alignment. Because this is a non-indexed draw call, Metal interprets the contents of the indirect buffer to match the layout of struct MTLDrawPrimitivesIndirectArguments. Use an instance of MTLResidencySet to mark residency of the indirect buffer that the indirectBuffer parameter references.

## 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:vertexStart:vertexCount:instanceCount:baseInstance:)](metal/mtl4rendercommandencoder/drawprimitives(primitivetype:vertexstart:vertexcount:instancecount:baseinstance:).md)
