<!--
{
  "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(sourceAccelerationStructure:destinationAccelerationStructure:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTL4ComputeCommandEncoder(im)copyAccelerationStructure:toAccelerationStructure:"
  },
  "title" : "copy(sourceAccelerationStructure:destinationAccelerationStructure:)"
}
-->

# copy(sourceAccelerationStructure:destinationAccelerationStructure:)

Encodes an acceleration structure copy operation into the command buffer.

```
func copy(sourceAccelerationStructure: any MTLAccelerationStructure, destinationAccelerationStructure: any MTLAccelerationStructure)
```

## Parameters

`sourceAccelerationStructure`

Acceleration structure to copy from.

`destinationAccelerationStructure`

Acceleration structure to copy to.

## Discussion

You are responsible for ensuring the source and destination acceleration structures don’t overlap in memory.
If this is an instance acceleration structure, Metal preserves references to the primitive acceleration structures
it references.

Typically, the destination acceleration structure is at least as large as the source acceleration structure,
except in cases where you compact the source acceleration structure. In this case, you need to allocate the
destination acceleration to be at least as large as the compacted size of the source acceleration structure.

---

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)