---
title: "synchronize(texture:slice:level:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlblitcommandencoder/synchronize(texture:slice:level:)"
---

# synchronize(texture:slice:level:)

Encodes a command that synchronizes a part of the CPU’s copy of a texture so that it matches the GPU’s copy.

## Declaration

```swift
func synchronize(texture: any MTLTexture, slice: Int, level: Int)
```

## Parameters

- `texture`: An doc://com.apple.metal/documentation/Metal/MTLTexture instance with a doc://com.apple.metal/documentation/Metal/MTLResource/storageMode property that’s equal to doc://com.apple.metal/documentation/Metal/MTLStorageMode/managed.
- `slice`: A slice within texture.
- `level`: A mipmap level within texture.

## Mentioned in

Synchronizing a managed resource in macOS

## Discussion

Discussion This method ensures the CPU can correctly read the changes a GPU makes to a slice of a texture that uses the managed storage mode. For the resources you create with 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 texture after the synchronization command completes. note: The command this method encodes behaves similarly to the command that synchronize(resource:) encodes, except that it flushes only the applicable slice and mipmap level.

## See Also

### Synchronizing managed resources

- [synchronize(resource:)](metal/mtlblitcommandencoder/synchronize(resource:).md)
