<!--
{
  "availability" : [
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CompositorServices",
  "identifier" : "/documentation/CompositorServices/LayerRenderer/Drawable/RenderContext",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Compositor Services",
      "CompositorServices"
    ],
    "preciseIdentifier" : "c:@S@cp_drawable_render_context_t"
  },
  "title" : "LayerRenderer.Drawable.RenderContext"
}
-->

# LayerRenderer.Drawable.RenderContext

An object the compositer uses for rendering all effects associated with a layer renderer drawable.

```
struct RenderContext
```

## Overview

A `RenderContext` is required for apps to render using the progressive immersion style.

## Topics

### Rendering with Metal 4

[`func drawMaskOnStencilAttachment(commandEncoder: any MTL4RenderCommandEncoder, value: UInt8)`](/documentation/CompositorServices/LayerRenderer/Drawable/RenderContext/drawMaskOnStencilAttachment(commandEncoder:value:)-7npim)

Store the value parameter in the stencil texture in the pixels that the Compositor displays onscreen.

[`func endEncoding(commandEncoder: any MTL4RenderCommandEncoder)`](/documentation/CompositorServices/LayerRenderer/Drawable/RenderContext/endEncoding(commandEncoder:)-2l6lk)

Finish encoding the render context.

### Rendering with Metal

[`func drawMaskOnStencilAttachment(commandEncoder: any MTLRenderCommandEncoder, value: UInt8)`](/documentation/CompositorServices/LayerRenderer/Drawable/RenderContext/drawMaskOnStencilAttachment(commandEncoder:value:)-65i67)

Store the value parameter in the stencil texture in the pixels that the compositor will display onscreen.

[`func endEncoding(commandEncoder: any MTLRenderCommandEncoder)`](/documentation/CompositorServices/LayerRenderer/Drawable/RenderContext/endEncoding(commandEncoder:)-4hx0m)

Finish encoding the render context.

### Initializers

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

Creates a new render context.

## Relationships

### Conforms To

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

---

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)