Instance Method

makeFunction(name:constantValues:)

Synchronously generates a specialized shader function.

Required.

Declaration

func makeFunction(name: String, constantValues: MTLFunctionConstantValues) throws -> MTLFunction

Parameters

name

The name of the specialized function.

constantValues

The set of constant values assigned to the function constants. Compilation fails if you do not provide valid constant values for all required function constants.

error

A pointer to an error object that describes compilation problems, if any. This object contains compiler errors if the specialized function is nil, and compiler warnings if the specialized function was created with warnings. If the specialized function was created successfully, without errors or warnings, this error object is nil.

Return Value

A specialized function, or nil if an error occurred.

Discussion

Function constant values are first looked up by their index, then by their name. Any values that do not correspond to a function constant in the named function are ignored (without generating errors or warnings).

See Also

Finding Shader Functions

func makeFunction(name: String) -> MTLFunction?

Returns an object representing a shader function in the library.

Required.