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

# copy(from:sourceSlice:sourceLevel:sourceOrigin:sourceSize:to:destinationSlice:destinationLevel:destinationOrigin:)

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

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

## Parameters

`sourceTexture`

A texture with an [`isFramebufferOnly`](/documentation/Metal/MTLTexture/isFramebufferOnly) property value of <doc://com.apple.documentation/documentation/Swift/false> that the command copies data from.

    For a texture that uses a compressed pixel format, align the copy region (    `sourceOrigin`     and     `sourceSize`    ) to the pixel format’s block size.

`sourceSlice`

A slice within `sourceTexture`.

`sourceLevel`

A mipmap level within `sourceTexture`.

`sourceOrigin`

A location within `sourceTexture` that the command begins copying data from.

    Assign     `0`     to each dimension that’s not relevant to     `sourceTexture`    . For example:

- If the source texture is a 2D texture, set the origin’s [`z`](/documentation/Metal/MTLOrigin/z) property to `0`.
- If the source texture is a 1D texture, set the origin’s [`y`](/documentation/Metal/MTLOrigin/y) and [`z`](/documentation/Metal/MTLOrigin/z) properties to `0`.

`sourceSize`

An [`MTLSize`](/documentation/Metal/MTLSize) instance, which can represent a 3D region, that instructs the command how many pixels to copy from `sourceTexture`, starting at `sourceOrigin`.

    Assign     `1`     to each dimension that’s not relevant to     `sourceTexture`    . For example:

- If the source texture is a 2D texture, set the size’s [`depth`](/documentation/Metal/MTLSize/depth) property to `1`.
- If the source texture is a 1D texture, set the size’s [`height`](/documentation/Metal/MTLSize/height) and [`depth`](/documentation/Metal/MTLSize/depth) properties to `1`.

    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`

A texture the command copies data to that has the following configuration:

- The [`isFramebufferOnly`](/documentation/Metal/MTLTexture/isFramebufferOnly) property value is <doc://com.apple.documentation/documentation/Swift/false>.
- The pixel format is the same as `sourceTexture`.
- The sample count is the same as `sourceTexture`.

    For a texture that uses a compressed pixel format, align the copy region (    `destinationOrigin`    ) to the pixel format’s block size.

`destinationSlice`

A slice within `destinationTexture`.

`destinationLevel`

A mipmap level within `destinationTexture`.

`destinationOrigin`

A location within `destinationTexture` that the command begins copying data to.

    Assign     `0`     to each dimension that’s not relevant to     `destinationTexture`    . For example:

- If the destination texture is a 2D texture, set the origin’s [`z`](/documentation/Metal/MTLOrigin/z) property to `0`.
- If the destination texture is a 1D texture, set the origin’s [`y`](/documentation/Metal/MTLOrigin/y) and [`z`](/documentation/Metal/MTLOrigin/z) properties to `0`.

## Discussion

For textures that use a PVRTC pixel format, you can use this method to copy the entire texture, but not a subregion of the texture.

> Important:
> Copying data to overlapping regions within the same texture may result in unexpected behavior.

---

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)