<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4RenderCommandEncoder/drawPrimitives(primitiveType:indirectBuffer:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTL4RenderCommandEncoder(im)drawPrimitives:indirectBuffer:"
  },
  "title" : "drawPrimitives(primitiveType:indirectBuffer:)"
}
-->

# drawPrimitives(primitiveType:indirectBuffer:)

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

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

## Parameters

`primitiveType`

A [`MTLPrimitiveType`](/documentation/Metal/MTLPrimitiveType) representing how the command interprets vertex argument data.

`indirectBuffer`

GPUAddress of a [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance with data that matches the layout of the
[`MTLDrawPrimitivesIndirectArguments`](/documentation/Metal/MTLDrawPrimitivesIndirectArguments) structure. You are responsible for ensuring that the
alignment of this address is 4 bytes.

## Discussion

When you use this function, Metal reads the parameters to the draw command from an [`MTLBuffer`](/documentation/Metal/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`](/documentation/Metal/MTLDrawPrimitivesIndirectArguments).

Use an instance of [`MTLResidencySet`](/documentation/Metal/MTLResidencySet) to mark residency of the indirect buffer that the `indirectBuffer` parameter
references.

---

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)