Class

CAMetalLayer

A layer that manages a pool of Metal drawables.

Declaration

@interface CAMetalLayer : CALayer

Overview

To use Metal for rendering in your app, use this class as the backing layer for a view by returning it from your view’s layerClass class method. To render the layer’s content, use the nextDrawable method to retrieve a texture, then use it as a render target in a Metal rendering pipeline. After rendering each frame, you present the new content for display with the presentDrawable: or presentDrawable:atTime: method of the command buffer you used for rendering.

Topics

Configuring the Metal Layer

pixelFormat

The pixel format of textures for rendering layer content.

framebufferOnly

A Boolean value that determines whether the layer’s textures are restricted for use as framebuffer attachments.

drawableSize

The size, in pixels, of textures for rendering layer content.

colorspace

The color space of the rendered content.

presentsWithTransaction

A Boolean value that determines whether the layer presents its content using a Core Animation transaction.

wantsExtendedDynamicRangeContent

Enables extended dynamic range values on the screen.

EDRMetadata

Metadata describing the tone mapping to apply to the extended dynamic range (EDR) values in the layer.

Beta
displaySyncEnabled

A Boolean value that determines whether the Metal layer and it's drawables are synchronized with the display's refresh rate.

allowsNextDrawableTimeout

A Boolean value that determines whether Metal drawables are allowed to time out or wait indefinitely.

maximumDrawableCount

An integer value that controls the number of Metal drawables in the resource pool managed by Core Animation.

Obtaining a Metal Drawable

- nextDrawable

Returns a Metal drawable.

Obtaining the Metal Device

device

The Metal device responsible for the layer’s drawable resources.

Relationships

Inherits From

See Also

Metal and OpenGL

CAMetalDrawable

A displayable resource that can be rendered or written to by Metal.

CAEAGLLayer

A layer that supports drawing OpenGL content in iOS and tvOS applications.

Deprecated
CAEDRMetadata

Metadata describing how extended dynamic range (EDR) values should be tone mapped.

Beta
CAOpenGLLayer

A layer that provides a layer suitable for rendering OpenGL content.

Deprecated
CARenderer

A layer that allows an application to render a layer tree into a Core OpenGL context.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software