<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LowLevelRenderer/render(using:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:19RealityCoreRenderer08LowLevelC0C6render5using_ySo16MTLCommandBuffer_p_yAC11RenderStateVzXEtF"
  },
  "title" : "render(using:_:)"
}
-->

# render(using:_:)

Encodes draw calls for the frame into the given command buffer using a caller-controlled
render callback.

```
final func render(using commandBuffer: any MTLCommandBuffer, _ callback: @_lifetime(0: copy 0) (inout LowLevelRenderer.RenderState) -> ())
```

## Parameters

`commandBuffer`

The Metal command buffer to encode draw calls into.

`callback`

A closure that receives a `RenderState` and issues draw calls.

## Discussion

Inside the callback, call `state.render(meshInstancesArrayIndex:meshInstanceIndex:)` or
`state.render(meshInstancesArrayIndex:range:)` to encode draw calls in any order.
You control which instances are drawn and in what sequence — use
`sortMeshInstances(_:indices:configuration:)` for built-in depth sorting,
`cullMeshInstances(_:indices:configuration:)` to remove instances outside the view
frustum before drawing, or supply your own ordering.

You are responsible for committing the command buffer after this call returns.

---

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)