---
title: "copy(from:to:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlblitcommandencoder/copy(from:to:)"
---

# copy(from:to:)

Encodes a command that copies data from one texture to another.

## Declaration

```swift
func copy(from sourceTexture: any MTLTexture, to destinationTexture: any MTLTexture)
```

## Parameters

- `sourceTexture`: A texture the command copies data from.
- `destinationTexture`: Another texture the command copies the data to that has the same pixel format and sample count as sourceTexture.

## Mentioned in

Copying data into or out of mipmaps

## Discussion

Discussion The textures can be different sizes as long as the larger texture has a mipmap level that’s the same size as the smaller texture’s level 0 mipmap. The command copies all identical mipmap sizes. If both textures are arrays, the command copies as many texture slices (array elements) as possible.

## See Also

### Copying texture data to another texture

- [copy(from:sourceSlice:sourceLevel:to:destinationSlice:destinationLevel:sliceCount:levelCount:)](metal/mtlblitcommandencoder/copy(from:sourceslice:sourcelevel:to:destinationslice:destinationlevel:slicecount:levelcount:).md)
- [copy(from:sourceSlice:sourceLevel:sourceOrigin:sourceSize:to:destinationSlice:destinationLevel:destinationOrigin:)](metal/mtlblitcommandencoder/copy(from:sourceslice:sourcelevel:sourceorigin:sourcesize:to:destinationslice:destinationlevel:destinationorigin:).md)
- [copy(from:sourceOrigin:sourceDimensions:to:destinationOrigin:destinationDimensions:)](metal/mtlblitcommandencoder/copy(from:sourceorigin:sourcedimensions:to:destinationorigin:destinationdimensions:).md)
