An object that can capture, track, and manage resource dependencies across command encoders.


protocol MTLFence


A MTLFence object is typically used to track a sub-allocated resource created from a MTLHeap object. However, it can also track a non-heap resource that specifies a hazardTrackingModeUntracked resource option.

Don’t implement this protocol yourself; instead, to create a MTLFence object, call the makeFence() method of a MTLDevice object. A command encoder can either update a fence or wait for a fence. Refer to the methods listed in the following table for further information.


Identifying the Fence

var device: MTLDevice

The device object that created the fence.


var label: String?

A string that identifies the fence.


Specifying Render Stages

struct MTLRenderStages

The render stage at which a synchronization command is triggered.


Inherits From

See Also


Image Filter Graph with Heaps and Fences

Demonstrates how to use heaps and fences to optimize a multistage image filter.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software