---
title: "update(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlresourcestatecommandencoder/update(_:)"
---

# update(_:)

Encodes a command that instructs the GPU to update a fence, which signals passes waiting on the fence.

## Declaration

```swift
func update(_ fence: any MTLFence)
```

```swift
optional func update(_ fence: any MTLFence)
```

## Parameters

- `fence`: An doc://com.apple.metal/documentation/Metal/MTLFence instance to update.

## Discussion

Discussion Fences maintain order to prevent GPU data hazards as the GPU runs various passes within the same command queue. This encoded command notifies any passes waiting for fence. The GPU driver evaluates the fences that apply to the pass and the commands that depend on those fences when your app commits the enclosing MTLCommandBuffer.

## See Also

### Performing fence operations

- [wait(for:)](metal/mtlresourcestatecommandencoder/wait(for:).md)
