<!--
{
  "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(sourceBuffer:sourceOffset:destinationBuffer:destinationOffset:size:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTL4ComputeCommandEncoder(im)copyFromBuffer:sourceOffset:toBuffer:destinationOffset:size:"
  },
  "title" : "copy(sourceBuffer:sourceOffset:destinationBuffer:destinationOffset:size:)"
}
-->

# copy(sourceBuffer:sourceOffset:destinationBuffer:destinationOffset:size:)

Encodes a command that copies data from a buffer instance into another.

```
func copy(sourceBuffer: any MTLBuffer, sourceOffset: Int, destinationBuffer: any MTLBuffer, destinationOffset: Int, size: Int)
```

## Parameters

`sourceBuffer`

An [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance the command copies data from.

`sourceOffset`

A byte offset within `sourceBuffer` the command copies from.

`destinationBuffer`

An [`MTLBuffer`](/documentation/Metal/MTLBuffer) instance the command copies data to.

`destinationOffset`

A byte offset within `destinationBuffer` the command copies to.

`size`

The number of bytes the command copies from `sourceBuffer` to `destinationBuffer`.

---

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)