---
title: "encode(commandBuffer:sourceMatrix:destinationImage:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsmatrixcopytoimage/encode(commandbuffer:sourcematrix:destinationimage:)"
---

# encode(commandBuffer:sourceMatrix:destinationImage:)

## Declaration

```swift
func encode(commandBuffer: any MTLCommandBuffer, sourceMatrix: MPSMatrix, destinationImage: MPSImage)
```
