Instance Method

newFunctionWithName:

Returns an object representing a shader function in the library.

Required.

Declaration

- (id<MTLFunction>)newFunctionWithName:(NSString *)functionName;

Parameters

functionName

The name of the function.

Return Value

A MTLFunction, or nil if the named function is not found in the library.

Discussion

If you call this method to retrieve a function that does not use function constants, it returns a MTLFunction object that you can use to build a render or compute pipeline.

If you call this method to retrieve a function that uses function constants to specialize its behavior, the returned function can be used only to query the functionConstants property for the list of function constants. It cannot be used to build a render or compute pipeline. To get a specialized object that can be used to create a pipeline object, call the newFunctionWithName:constantValues:completionHandler: method or newFunctionWithName:constantValues:error: to generate a specialized function.

See Also

Finding Shader Functions

- newFunctionWithName:constantValues:completionHandler:

Asynchronously generates a specialized shader function.

Required.

- newFunctionWithName:constantValues:error:

Synchronously generates a specialized shader function.

Required.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software