---
title: "replace(using:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/lowleveltexture/replace(using:)"
---

# replace(using:)

Retrieves a Metal texture that your app’s shaders can write to when they run on a GPU.

## Declaration

```swift
@MainActor func replace(using commandBuffer: any MTLCommandBuffer) -> any MTLTexture
```

## Parameters

- `commandBuffer`: The doc://com.apple.documentation/documentation/Metal/MTLCommandBuffer you intend to use for texture modifications. RealityKit waits for the command buffer to complete before utilizing the texture for rendering.

## Discussion

Discussion The buffer’s contents are in an uninitialized state.
