<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4ComputeCommandEncoder/copy(sourceTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:destinationTexture:destinationSlice:destinationLevel:destinationOrigin:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTL4ComputeCommandEncoder(im)copyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:"
  },
  "title" : "copy(sourceTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:destinationTexture:destinationSlice:destinationLevel:destinationOrigin:)"
}
-->

# copy(sourceTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:destinationTexture:destinationSlice:destinationLevel:destinationOrigin:)

Encodes a command that copies image data from a slice of a texture into a slice of another texture.

```
func copy(sourceTexture: any MTLTexture, sourceSlice: Int, sourceLevel: Int, sourceOrigin: MTLOrigin, sourceSize: MTLSize, destinationTexture: any MTLTexture, destinationSlice: Int, destinationLevel: Int, destinationOrigin: MTLOrigin)
```

## Parameters

`sourceTexture`

An [`MTLTexture`](/documentation/Metal/MTLTexture) texture that the command copies data from. To read the source
texture contents, you need to set its [`isFramebufferOnly`](/documentation/Metal/MTLTexture/isFramebufferOnly) property
to <doc://com.apple.documentation/documentation/Swift/false> prior to drawing into it.

`sourceSlice`

A slice within `sourceTexture` the command uses as a starting point to copy
data from. Set this to `0` if `sourceTexture` isn’t a texture array or a
cube texture.

`sourceLevel`

A mipmap level within `sourceTexture`.

`sourceOrigin`

An [`MTLOrigin`](/documentation/Metal/MTLOrigin) instance that represents a location within `sourceTexture`
that the command begins copying data from. Assign `0` to each dimension
that’s not relevant to `sourceTexture`.

`sourceSize`

An [`MTLSize`](/documentation/Metal/MTLSize) instance that represents the size of the region, in pixels,
that the command copies from `sourceTexture`, starting at `sourceOrigin`.
Assign `1` to each dimension that’s not relevant to `sourceTexture`. If
sourceTexture uses a compressed pixel format, set `sourceSize` to a multiple
of the pixel format’s block size. If the block extends outside the bounds of
the texture, clamp `sourceSize` to the edge of the texture.

`destinationTexture`

Another [`MTLTexture`](/documentation/Metal/MTLTexture) the command copies the data to that has the same
[`pixelFormat`](/documentation/Metal/MTLTexture/pixelFormat) and [`sampleCount`](/documentation/Metal/MTLTexture/sampleCount) as `sourceTexture`.
To write the contents into this texture, you need to set its [`isFramebufferOnly`](/documentation/Metal/MTLTexture/isFramebufferOnly)
property to <doc://com.apple.documentation/documentation/Swift/false>.

`destinationSlice`

A slice within `destinationTexture` the command uses as its starting point
for copying data to. Set this to `0` if `destinationTexture` isn’t a texture
array or a cube texture.

`destinationLevel`

A mipmap level within `destinationTexture`. The mipmap level you reference needs to
have the same size as the `sourceTexture` slice’s mipmap at `sourceLevel`.

`destinationOrigin`

An [`MTLOrigin`](/documentation/Metal/MTLOrigin) instance that represents a location within `destinationTexture`
that the command begins copying data to. Assign `0` to each dimension that’s
not relevant to `destinationTexture`.

---

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)