---
title: "waitForCommandBuffer(_:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/lowlevelrendercontext/waitforcommandbuffer(_:)"
---

# waitForCommandBuffer(_:)

Adds a command buffer that the renderer should wait on before using resources for rendering.

## Declaration

```swift
func waitForCommandBuffer(_ commandBuffer: any MTLCommandBuffer)
```

## Parameters

- `commandBuffer`: The command buffer whose completion the renderer waits for before using the updated GPU resources.

## Discussion

Discussion Instead of passing the same command buffer to every individual replace(commandBuffer:) call, you can call this method once and then pass nil to each GPU replace call on this context. The renderer waits for this command buffer to complete before using any of those resources for rendering.
