<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDevice/makeComputePipelineState(function:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLDevice(im)newComputePipelineStateWithFunction:completionHandler:"
  },
  "title" : "makeComputePipelineState(function:completionHandler:)"
}
-->

# makeComputePipelineState(function:completionHandler:)

Asynchronously creates a compute pipeline state with a function instance.

```
func makeComputePipelineState(function computeFunction: any MTLFunction, completionHandler: @escaping @Sendable ((any MTLComputePipelineState)?, (any Error)?) -> Void)
```

## Parameters

`computeFunction`

An [`MTLFunction`](/documentation/Metal/MTLFunction) instance.

`completionHandler`

A Swift closure or an Objective-C block the method calls when it finishes creating the compute pipeline state.

## Discussion

Use the compute pipeline state to configure a compute pass by calling the [`setComputePipelineState(_:)`](/documentation/Metal/MTLComputeCommandEncoder/setComputePipelineState(_:)) method of an [`MTLComputeCommandEncoder`](/documentation/Metal/MTLComputeCommandEncoder) 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)