<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 - 27.0.0",
    "macOS: 10.11.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLBlitCommandEncoder/synchronize(resource:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLBlitCommandEncoder(im)synchronizeResource:"
  },
  "title" : "synchronize(resource:)"
}
-->

# synchronize(resource:)

Encodes a command that synchronizes the CPU’s copy of a managed resource, such as a buffer or texture, so that it matches the GPU’s copy.

```
func synchronize(resource: any MTLResource)
```

## Parameters

`resource`

An [`MTLResource`](/documentation/Metal/MTLResource) instance — such as an [`MTLBuffer`](/documentation/Metal/MTLBuffer) or [`MTLTexture`](/documentation/Metal/MTLTexture) — with a [`storageMode`](/documentation/Metal/MTLResource/storageMode) property that’s equal to [`MTLStorageMode.managed`](/documentation/Metal/MTLStorageMode/managed).

## Discussion

This method ensures the CPU can correctly read all the changes a GPU makes to a resource that uses the managed storage mode. For the resources you create with [`MTLStorageMode.managed`](/documentation/Metal/MTLStorageMode/managed), the CPU and GPU each have a copy of that resource. As the GPU modifies its copy, the CPU’s copy remains unchanged until you synchronize with a command, such as this one.

The CPU can access the updated content from its copy of the resources after the synchronization command completes.

> Note:
> You can encode a command that selectively synchronizes parts of an ``doc://com.apple.metal/documentation/Metal/MTLTexture`` by calling the ``doc://com.apple.metal/documentation/Metal/MTLBlitCommandEncoder/synchronize(texture:slice:level:)`` method.

---

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)