Contents

MTLDevice

The main Metal interface to a GPU that apps use to draw graphics and run computations in parallel.

Declaration

protocol MTLDevice : NSObjectProtocol, Sendable

Mentioned in

Overview

You can get the default MTLDevice at runtime by calling MTLCreateSystemDefaultDevice() (see Getting the default GPU). Each Metal device instance represents a GPU and is the main starting point for your app’s interaction with it. With a Metal device instance, you can inspect a GPU’s features and capabilities (see Device inspection) and create subsidiary type instances with its factory methods.

  • Buffers, textures, and other resources store, synchronize, and pass data between the GPU and CPU (see Resource fundamentals).

  • Input/Output command queues efficiently load resources from the file system (see Resource loading).

  • Command queues create command encoders and schedule work for the GPU, including rendering and compute commands (see Render passes and Compute passes).

  • Pipeline states store render or compute pipeline configurations — which can be expensive to create — so that you can reuse them, potentially many times.

If your app uses more than one GPU (see Multi-GPU systems), ensure that instances of these types only interact with others from the same device. For example, your app can pass a texture to a command encoder that comes from the same Metal device, but not to another device.

Topics

Working with GPU devices

Instance Properties

Instance Methods

See Also

Locating and inspecting a GPU device