---
title: "encode(commandBuffer:)"
framework: MetalFX
role: symbol
role_heading: Instance Method
platforms: [iOS 16.0+, iPadOS 16.0+, Mac Catalyst 16.0+, macOS 13.0+, tvOS 27.1+, visionOS 1.0+]
path: "metalfx/mtlfxspatialscaler/encode(commandbuffer:)"
---

# encode(commandBuffer:)

Adds the spatial scaler to a render pass’s command buffer.

## Declaration

```swift
func encode(commandBuffer: any MTLCommandBuffer)
```

## Parameters

- `commandBuffer`: The destination doc://com.apple.documentation/documentation/Metal/MTLCommandBuffer instance for a render pass.
