The Metal interface to a GPU that you use to draw graphics or do parallel computation.
- iOS 8.0+
- macOS 10.11+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
MTLDevice protocol defines the interface to a GPU. You can query a
MTLDevice for the unique capabilities it offers your Metal app, and use the
MTLDevice to issue all of your Metal commands. Don't implement this protocol yourself; instead, request a GPU from the system at runtime using
MTLCreate in iOS or tvOS, and in macOS, get a list of available
MTLDevice objects using
MTLCopy. See Getting the Default GPU for a full discussion on choosing the right GPU(s).
MTLDevice objects are your go-to object to do anything in Metal, so all of the Metal objects your app interacts with come from the
MTLDevice instances you acquire at runtime.
MTLDevice-created objects are expensive but persistent; many of them are designed to be initialized once and reused through the lifetime of your app. However, these objects are specific to the
MTLDevice that issued them. If you use multiple
MTLDevice instances or want to switch from one
MTLDevice to another, you need to create a separate set of objects for each