makeFunction(name:)
Creates an instance that represents a shader function in the library.
Declaration
func makeFunction(name functionName: String) -> (any MTLFunction)?Parameters
- functionName:
The name of the function.
Return Value
An MTLFunction, or nil if the named function isn’t found in the library.
Discussion
If you call this method to retrieve a function that doesn’t use function constants, it returns an MTLFunction instance 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, you can only use the returned instance to query the functionConstants property for the list of function constants. You can’t use to create a render or compute pipeline. To get a specialized instance that you can use to create a pipeline instance, call the makeFunction(name:constantValues:completionHandler:) method or makeFunction(name:constantValues:) to generate a specialized function.
See Also
Related Documentation
- Metal Shading Language Guide
- Metal Programming Guide