---
title: "drawPrimitives(type:indirectBuffer:indirectBufferOffset:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlrendercommandencoder/drawprimitives(type:indirectbuffer:indirectbufferoffset:)"
---

# drawPrimitives(type:indirectBuffer:indirectBufferOffset:)

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

## Declaration

```swift
func drawPrimitives(type primitiveType: MTLPrimitiveType, indirectBuffer: any MTLBuffer, indirectBufferOffset: Int)
```

## Parameters

- `primitiveType`: An doc://com.apple.metal/documentation/Metal/MTLPrimitiveType instance that represents how the command interprets vertex argument data. See the doc://com.apple.metal/documentation/Metal/MTLRenderCommandEncoder/setVertexBuffer(_:offset:index:) method and its siblings for more information about setting an entry in the vertex shader argument table for buffers.
- `indirectBuffer`: An doc://com.apple.metal/documentation/Metal/MTLBuffer instance with data that matches the layout of the doc://com.apple.metal/documentation/Metal/MTLDrawPrimitivesIndirectArguments structure.
- `indirectBufferOffset`: An integer that represents the location, in bytes, from the start of indirectBuffer where the indirect arguments structure begins. See the https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf to check for offset alignment requirements for buffers in device and constant address space.

## Discussion

Discussion Indirect drawing methods may help your app avoid expensive latency costs. This is because the command reads arguments from an MTLBuffer instance instead of using the CPU to pass parameters to the command. 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.

## See Also

### Drawing with vertices

- [drawPrimitives(type:vertexStart:vertexCount:)](metal/mtlrendercommandencoder/drawprimitives(type:vertexstart:vertexcount:).md)
- [drawPrimitives(type:vertexStart:vertexCount:instanceCount:)](metal/mtlrendercommandencoder/drawprimitives(type:vertexstart:vertexcount:instancecount:).md)
- [drawPrimitives(type:vertexStart:vertexCount:instanceCount:baseInstance:)](metal/mtlrendercommandencoder/drawprimitives(type:vertexstart:vertexcount:instancecount:baseinstance:).md)
