---
title: "replaceIndices(commandBuffer:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/lowlevelmeshresource/replaceindices(commandbuffer:)"
---

# replaceIndices(commandBuffer:)

Retrieves a Metal index buffer for GPU replacement. The buffer’s contents are in an uninitialized state. The renderer waits for the command buffer to complete before using the buffer for rendering.

## Declaration

```swift
final func replaceIndices(commandBuffer: (any MTLCommandBuffer)?) -> any MTLBuffer
```

## Parameters

- `commandBuffer`: The command buffer writing to this buffer, or nil to skip synchronization.

## Return Value

Return Value A MTLBuffer ready for GPU write operations.

## See Also

### Accessing index data

- [readIndices(_:)](realitykit/lowlevelmeshresource/readindices(_:).md)
- [updateIndices(_:)](realitykit/lowlevelmeshresource/updateindices(_:).md)
- [replaceIndices(_:)](realitykit/lowlevelmeshresource/replaceindices(_:).md)
- [readIndices(commandBuffer:)](realitykit/lowlevelmeshresource/readindices(commandbuffer:).md)
