Instance Method

makeFunction(name:)

Returns an object representing a shader function in the library.

Required.

Declaration

func makeFunction(name functionName: String) -> MTLFunction?

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 makeFunction(name:constantValues:completionHandler:) method or makeFunction(name:constantValues:) to generate a specialized function.

See Also

Finding Shader Functions

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