---
title: "setComputePipelineState(_:index:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlargumentencoder/setcomputepipelinestate(_:index:)"
---

# setComputePipelineState(_:index:)

Encodes a reference to a compute pipeline state into the argument buffer.

## Declaration

```swift
func setComputePipelineState(_ pipeline: (any MTLComputePipelineState)?, index: Int)
```

## Parameters

- `pipeline`: A pipeline state the method encodes.
- `index`: The index of a pipeline state within the argument buffer. The value corresponds to either the index ID of a declaration in Metal Shading Language (MSL) or the doc://com.apple.metal/documentation/Metal/MTLArgumentDescriptor/index property of an doc://com.apple.metal/documentation/Metal/MTLArgumentDescriptor instance.

## See Also

### Encoding pipeline states

- [setRenderPipelineState(_:index:)](metal/mtlargumentencoder/setrenderpipelinestate(_:index:).md)
- [setRenderPipelineStates(_:range:)](metal/mtlargumentencoder/setrenderpipelinestates(_:range:).md)
- [setComputePipelineStates(_:with:)](metal/mtlargumentencoder/setcomputepipelinestates(_:with:).md)
- [setComputePipelineState(_:at:)](metal/mtlargumentencoder/setcomputepipelinestate(_:at:).md)
- [setComputePipelineStates(_:range:)](metal/mtlargumentencoder/setcomputepipelinestates(_:range:).md)
