<!--
{
  "availability" : [
    "iOS: 13.0.0 - 14.0.0",
    "iPadOS: 13.0.0 - 14.0.0",
    "tvOS: 13.0.0 - 14.0.0",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLArgumentEncoder/setComputePipelineState(_:at:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So18MTLArgumentEncoderP5MetalE23setComputePipelineState_2atySo010MTLComputefG0_pSg_SitF"
  },
  "title" : "setComputePipelineState(_:at:)"
}
-->

# setComputePipelineState(_:at:)

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

```
func setComputePipelineState(_ pipeline: (any MTLComputePipelineState)?, at 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 [`index`](/documentation/Metal/MTLArgumentDescriptor/index) property of
an [`MTLArgumentDescriptor`](/documentation/Metal/MTLArgumentDescriptor) instance.

---

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)