<!--
{
  "availability" : [
    "iOS: 17.0.0 - 27.0.0",
    "iPadOS: 17.0.0 - 27.0.0",
    "macCatalyst: -",
    "macOS: 14.0.0 - 27.0.0",
    "tvOS: 17.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Cinematic",
  "identifier" : "/documentation/Cinematic/CNRenderingSession-1hzh8/encodeRender(to:frameAttributes:sourceImage:sourceDisparity:destinationRGBA:)-3ff9",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Cinematic"
    ],
    "preciseIdentifier" : "s:9Cinematic18CNRenderingSessionC12encodeRender2to15frameAttributes11sourceImage0I9Disparity15destinationRGBASbSo16MTLCommandBuffer_p_AC05FrameH0VSo11CVBufferRefaANSo10MTLTexture_ptF"
  },
  "title" : "encodeRender(to:frameAttributes:sourceImage:sourceDisparity:destinationRGBA:)"
}
-->

# encodeRender(to:frameAttributes:sourceImage:sourceDisparity:destinationRGBA:)

Encode a command to render a shallow depth of field (SDoF) image to a metal texture as RGBA.

```
func encodeRender(to commandBuffer: any MTLCommandBuffer, frameAttributes: CNRenderingSession.FrameAttributes, sourceImage: CVPixelBuffer, sourceDisparity: CVPixelBuffer, destinationRGBA: any MTLTexture) -> Bool
```

## Parameters

`commandBuffer`

the metal command buffer on which to encode the command

`frameAttributes`

controls the focus distance and aperture of the rendering

`sourceImage`

a pixel buffer read from the cinematicVideoTrack

`sourceDisparity`

a pixel buffer read from the cinematicDisparityTrack

`destinationRGBA`

a metal texture to which the SDoF image is rendered in RGBA format

## Return Value

whether encoding the render command was successful

---

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)