Function

MTLCreateSystemDefaultDevice

Returns a reference to the preferred default Metal device object.

Declaration

id<MTLDevice> MTLCreateSystemDefaultDevice(void);

Return Value

A device object.

Discussion

In macOS, in order for the system to provide a default Metal device object, you must link to the CoreGraphics framework. You usually need to do this explicitly if you are writing apps that don't use graphics by default, such as command line tools.

See Also

Acquiring Device Objects

MTLCopyAllDevices

Returns an array of references to all Metal device objects in the system.

MTLCopyAllDevicesWithObserver

Fetches the available Metal devices and registers a notification observer for changes to the list.

MTLRemoveDeviceObserver

Removes a registered observer of device notifications.

CGDirectDisplayCopyCurrentMetalDevice

Returns a reference to the Metal device currently driving a given display.