MTLDevice protocol defines the interface to a single graphics processor (GPU). You use an object that conforms to this protocol to query the capabilities of the processor and to allocate objects used to access those capabilities.
- iOS 8.0+
- macOS 10.11+
- tvOS 8.0+
Your app does not define classes that implement this protocol; it is used by Metal to provide a device object to your app. To obtain a system device, call the
MTLCreate function or select a result from the
Most objects in Metal that perform graphics rendering and computational work are associated directly with a specific device. For example, texture objects are created by a device object and can be used only with that device. Most methods on a
MTLDevice object create non-transient objects, including command queues, resources (such as buffers and textures), and pipeline states. These objects can be expensive to create and you are encouraged to create them soon after your app launches and reuse them throughout the lifetime of your app. Avoid creating these objects in performance sensitive code.