makeFunction(name:constantValues:)
Synchronously creates a specialized shader function.
Declaration
func makeFunction(name: String, constantValues: MTLFunctionConstantValues) throws -> any MTLFunctionParameters
- name:
The name of the specialized function.
- constantValues:
The set of constant values for the function constants. The compiler can’t compile the function if any value is invalid for the function constants it requires.
Return Value
A new MTLFunction instance if the method completes successfully; otherwise Swift throws an error and Objective-C returns nil.
Discussion
Function constant values are first looked up by their index, then by their name. The compiler ignores any values that don’t correspond to a function constant in the named function, and doesn’t generate errors or warnings.