Synchronously creates a new compute pipeline state object, and associated reflection information, using a function object.
Required.
SDKs
- iOS 8.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
Framework
- Metal
Declaration
- (id<MTLCompute Pipeline State>)newComputePipelineStateWithFunction:(id<MTLFunction>)computeFunction options:(MTLPipeline Option)options reflection:(MTLAutoreleased Compute Pipeline Reflection *)reflection error:(NSError * _Nullable *)error;
Parameters
function
A function object to be compiled into a compute pipeline state object.
options
The type of reflection information that should be returned.
reflection
Reflection data about the compute function, including details about function arguments.
error
An error object that describes the problem, or
nil
if the operation succeeded.
Return Value
A new object that can be used as a compute pipeline state.
Discussion
To use the compute pipeline state for a compute pass, call the set
method of a MTLCompute
object with the MTLCompute
object.
Handling Errors in Swift:
In Swift, this method returns a nonoptional result and is marked with the throws
keyword to indicate that it throws an error in cases of failure.
You call this method in a try
expression and handle any errors in the catch
clauses of a do
statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.