<!--
{
  "availability" : [
    "macOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CompositorServices",
  "identifier" : "/documentation/CompositorServices/LayerRenderer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Compositor Services"
    ],
    "preciseIdentifier" : "c:objc(cs)CP_OBJECT_cp_layer_renderer"
  },
  "title" : "LayerRenderer"
}
-->

# LayerRenderer

A type that provides the Metal types and timing information you need to draw your content.

```
class LayerRenderer
```

## Overview

A layer renderer type creates a bridge between a SwiftUI scene and the Metal code you use to draw fully immersive experiences. When you present an immersive space with [`CompositorLayer`](/documentation/CompositorServices/CompositorLayer) content, the system creates a `LayerRenderer` type and makes it available to the content’s closure. Use the information in the layer renderer to set up your app’s rendering loop, and to start drawing frames of content.

Each layer renderer has information that tells the system how to configure the Metal textures and data types your app needs. Compositor Services provides a default configuration for layers, but you can customize the configuration as needed. Specify your custom configuration details using the [`CompositorLayerConfiguration`](/documentation/CompositorServices/CompositorLayerConfiguration) protocol and pass a type with those details to the initializer for your immersive space’s content. Use the layer renderer’s capability information to validate any configuration choices you make.

For information about how to create and configure a layer renderer and use it to run your rendering loop, see [Drawing fully immersive content using Metal](/documentation/CompositorServices/drawing-fully-immersive-content-using-metal).

## Topics

### Configuring the layer renderer

[`configuration`](/documentation/CompositorServices/LayerRenderer/configuration-swift.property)

The configuration details for the specified layer.

[`Configuration`](/documentation/CompositorServices/LayerRenderer/Configuration-swift.struct)

A type that stores the texture formats, layout information, and other details you use to configure your rendering loop code.

[`Capabilities`](/documentation/CompositorServices/LayerRenderer/Capabilities)

The color formats, depth formats, and features that you can use to configure your rendering engine.

[`CP_OBJECT_cp_layer_renderer_configuration`](/documentation/CompositorServices/CP_OBJECT_cp_layer_renderer_configuration)

[`CP_OBJECT_cp_layer_renderer_capabilities`](/documentation/CompositorServices/CP_OBJECT_cp_layer_renderer_capabilities)

### Getting the layer renderer properties

[`properties`](/documentation/CompositorServices/LayerRenderer/properties-swift.property)

The configured properties of the layer renderer.

[`Properties`](/documentation/CompositorServices/LayerRenderer/Properties-swift.struct)

A type that describes the organization of the layer renderer’s textures and the relationships between those textures and the views you use for drawing.

[`CP_OBJECT_cp_layer_renderer_properties`](/documentation/CompositorServices/CP_OBJECT_cp_layer_renderer_properties)

### Getting the GPU device

[`cp_layer_renderer_get_device`](/documentation/CompositorServices/LayerRenderer/device)

The GPU device that the layer renderer uses for drawing operations

### Managing the rendering loop

[`cp_layer_renderer_get_state`](/documentation/CompositorServices/LayerRenderer/state-swift.property)

A value that indicates whether the layer renderer is currently visible
and ready for you to draw content.

[`cp_layer_renderer_wait_until_running`](/documentation/CompositorServices/LayerRenderer/waitUntilRunning())

Stops further execution of your code until the layer renderer leaves the paused state.

[`State`](/documentation/CompositorServices/LayerRenderer/State-swift.enum)

The states of the layer renderer, which tell you how to proceed with drawing operations.

[`Clock`](/documentation/CompositorServices/LayerRenderer/Clock)

A type that supports operations that require a precise time measurement.

### Drawing a frame of content

[`queryNextFrame()`](/documentation/CompositorServices/LayerRenderer/queryNextFrame())

Returns the next frame to use for drawing.

[`Frame`](/documentation/CompositorServices/LayerRenderer/Frame)

A type that provides access to the timing information and data types you need to render a single frame of content.

[`Drawable`](/documentation/CompositorServices/LayerRenderer/Drawable)

A type that provides the textures and information you need to draw a frame of content.

[`cp_drawable_t`](/documentation/CompositorServices/cp_drawable_t)

A type that provides the textures and information you need to draw a frame of content.

### Handling events

### Configuring the frame update rate

[`cp_layer_renderer_get_minimum_frame_repeat_count`](/documentation/CompositorServices/LayerRenderer/minimumFrameRepeatCount)

The number of additional frames for which the system displays the same content.

### Defining quality level

[`cp_layer_renderer_get_render_quality`](/documentation/CompositorServices/LayerRenderer/renderQuality-swift.property)

Get the render quality to be used by the drawables.

[`defaultRenderQuality`](/documentation/CompositorServices/LayerRenderer/Capabilities/defaultRenderQuality)

The default render quality used on this platform.

[`maxRenderQuality`](/documentation/CompositorServices/LayerRenderer/Configuration-swift.struct/maxRenderQuality)

The max render quality the layer can use when drawing to the drawables.

[Defining layer renderer quality](/documentation/CompositorServices/defining-layer-renderer-quality)

Declare the render quality of your textures to enable high-quality rendering.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)