<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLIndirectComputeCommand/setComputePipelineState(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLIndirectComputeCommand(im)setComputePipelineState:"
  },
  "title" : "setComputePipelineState(_:)"
}
-->

# setComputePipelineState(_:)

Sets the command’s compute pipeline state.

```
func setComputePipelineState(_ pipelineState: any MTLComputePipelineState)
```

## Parameters

`pipelineState`

A compute pipeline state instance.

## Discussion

You don’t need to call this method if you create an indirect command buffer with
its [`inheritPipelineState`](/documentation/Metal/MTLIndirectCommandBufferDescriptor/inheritPipelineState) property equal to
<doc://com.apple.documentation/documentation/Swift/true>.
The command gets the pipeline state from the parent encoder when you run the command.

If you create an indirect command buffer with its
[`inheritPipelineState`](/documentation/Metal/MTLIndirectCommandBufferDescriptor/inheritPipelineState) property equal to
<doc://com.apple.documentation/documentation/Swift/false>, you need to set the
pipeline state prior to encoding a drawing command.

---

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)