<!--
{
  "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/setComputePipelineStates(_:with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "s:So18MTLArgumentEncoderP5MetalE24setComputePipelineStates_4withySPySo010MTLComputeF5State_pSgG_So8_NSRangeVtF"
  },
  "title" : "setComputePipelineStates(_:with:)"
}
-->

# setComputePipelineStates(_:with:)

Encodes references to an array of compute pipeline states into the argument buffer.

```
func setComputePipelineStates(_ pipelines: UnsafePointer<(any MTLComputePipelineState)?>, with range: NSRange)
```

## Parameters

`pipelines`

An array of pipeline states the method encodes.

`range`

A range of indices within the argument buffer for each element in `pipelines`.
The values correspond to either the index IDs of declarations in
Metal Shading Language (MSL) or the [`index`](/documentation/Metal/MTLArgumentDescriptor/index) property
of [`MTLArgumentDescriptor`](/documentation/Metal/MTLArgumentDescriptor) instances.

## Discussion

---

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)