<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/LowLevelTexture/replace(using:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation15LowLevelTextureC7replace5usingSo10MTLTexture_pSo16MTLCommandBuffer_p_tF"
  },
  "title" : "replace(using:)"
}
-->

# replace(using:)

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

```
@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

The buffer’s contents are in an uninitialized state.

---

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)