Drawable Objects

Obtain textures to draw into from drawable objects.


When a texture contains visual data, you might want to display its contents onscreen; for example, you might want to render and display a frame of animation in a game, or show an image after applying a filter to it. When you create a texture using a standard method, you can use it only in Metal. Because the underlying display subsystem isn't connected to the texture, it can't display the texture. To display a texture onscreen, you need the display subsystem to create it for you, and you can achieve that by using Metal and Core Animation together.

In Metal, objects that contain displayable content are called drawables. The underlying protocol, MTLDrawable, provides the interface you use to tell the display subsystem to present a drawable's contents. MTLDrawable doesn't specify how you create the drawable's contents or even the process used to present those contents onscreen; those details are determined by higher levels of the display subsystem.

Currently, using Core Animation is the only way to get drawable objects. A CAMetalLayer object is a Core Animation layer that uses Metal drawable objects to specify its contents. These drawable objects conform to MTLDrawable for presentation, and another protocol, CAMetalDrawable, that provides properties to retrieve the drawable's texture. You render or write to this texture and then tell the drawable to present it, at which point Core Animation updates the layer's contents, which are then animated and composited normally.

Displaying Your Graphics Onscreen

To create a Metal app that displays graphics onscreen, use one of these options:

An MTKView has an underlying CAMetalLayer object, so both choices provide similar workflows, but with different levels of detail and control. Use CAMetalLayer directly if you need behavior that you can’t create using an MTKView object.

Regardless of which mechanism you choose, pay close attention to how your app handles drawables. They exist within a limited and reusable resource pool, and a drawable may or may not be available when you request one. If none are available, Core Animation blocks your calling thread until a new drawable becomes available—usually at the next display refresh interval.


MetalKit View

Use a specialized view, with an optional drawing delegate, to create a display-centered Metal app.


A specialized view that creates, configures, and displays Metal objects.


Methods for responding to a MetalKit view's drawing and resizing events.

Core Animation Layer

Use a specialized backing layer to create a display-centered Metal app.

Creating a Custom Metal View

Implement a lightweight view for Metal rendering that’s customized to your app’s needs.

Displaying HDR Content in a Metal Layer

Bring your high dynamic range (HDR) content to compatible Mac displays.


A Core Animation layer that Metal can render into, typically to be displayed onscreen.

Metal Drawables

Render or write to a drawable and display it on the screen. Drawables are displayable resources available through either MetalKit or Core Animation.


A displayable resource that can be rendered or written to.


A Metal drawable associated with a Core Animation layer.