---
title: "encodeRender(to:frameAttributes:sourceImage:sourceDisparity:destinationRGBA:)"
framework: Cinematic
role: symbol
role_heading: Instance Method
platforms: [iOS 17.0+, iPadOS 17.0+, macOS 14.0+, tvOS 17.0+]
path: "cinematic/cnrenderingsession-1hzh8/encoderender(to:frameattributes:sourceimage:sourcedisparity:destinationrgba:)-3ff9"
---

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

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

## Declaration

```swift
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

Return Value Whether encoding the render command was successful
