replace(deviceResource:using:)
Replaces this object’s underlying texture with an existing Lowleveldeviceresource created and managed by the application.
Declaration
@MainActor func replace(deviceResource: LowLevelDeviceResource, using commandBuffer: (any MTLCommandBuffer)? = nil)Parameters
- deviceResource:
The underlying texture this object should refer to.
- commandBuffer:
The Mtlcommandbuffer you intend to use for texture modifications. RealityKit waits for the command buffer to complete before utilizing the texture for rendering.
Discussion
While it’s valid to replace a LowLevelTexture with an externally-managed texture having different dimensions, the LowLevelTexture will remember its initial size and calling replace(using:) to obtain a new MTLTexture will respect the initial size.