<!--
{
  "availability" : [
    "macOS: 26.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CompositorServices",
  "identifier" : "/documentation/CompositorServices/cp_drawable_t",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Compositor Services"
    ],
    "preciseIdentifier" : "c:@T@cp_drawable_t"
  },
  "title" : "cp_drawable_t"
}
-->

# cp_drawable_t

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

```
typedef struct cp_drawable * cp_drawable_t;
```

## Discussion

When you draw a frame of content, the frame’s  [`cp_drawable_t`](/documentation/CompositorServices/cp_drawable_t) type provides
the actual textures and rendering information you need.
Do as much work as possible in advance to prepare for rendering, and retrieve
the [`cp_drawable_t`](/documentation/CompositorServices/cp_drawable_t) only when you’re ready to start encoding commands into
your Metal command buffers.
The system recycles frames and their drawables for efficiency,
so if you retrieve the drawable too early, it might not be ready to use.

Use the drawable’s [`LayerRenderer.Drawable.View`](/documentation/CompositorServices/LayerRenderer/Drawable/View) instances to determine where
to draw your content in the provided textures.
After you finish encoding your content, call
[`encodePresent(commandBuffer:)`](/documentation/CompositorServices/LayerRenderer/Drawable/encodePresent(commandBuffer:)) to add a presentation
notification to your command buffer.
This command tells Compositor Services when to display the frame,
and is essential for displaying your frame on time.

## Topics

### Getting the views

[`typedef struct cp_view * cp_view_t;`](/documentation/CompositorServices/cp_view_t)

A type that provides information on how to render content into the frame’s textures.

### Enqueueing a command buffer

[`func encodePresent(commandBuffer: any MTLCommandBuffer)`](/documentation/CompositorServices/LayerRenderer/Drawable/encodePresent(commandBuffer:))

Encodes a notification event to the specified command buffer to present the drawable’s content onscreen.

### Getting the projection matrix

[`enum AxisDirectionConvention`](/documentation/CompositorServices/AxisDirectionConvention)

Constants that indicate the axis and direction to use for a perspective projection matrix.

### Accessing pixel depth information

[`var depthRange: simd_float2`](/documentation/CompositorServices/LayerRenderer/Drawable/depthRange)

The distances to the far and near clipping planes from the person viewing the content, in meters.

### Managing the state machine

[`var state: LayerRenderer.Drawable.State`](/documentation/CompositorServices/LayerRenderer/Drawable/state-swift.property)

The current operational state of a drawable instance.

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

The state of ownership for the drawable.

### Synchronizing the drawing operation

[`var frameTiming: LayerRenderer.Frame.Timing`](/documentation/CompositorServices/LayerRenderer/Drawable/frameTiming)

The timing information for the drawable’s frame.

[`var presentationFrameIndex: CompositorFrameIndex`](/documentation/CompositorServices/LayerRenderer/Drawable/presentationFrameIndex)

The sequential index of a drawable’s frame.



---

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)