MTLFunction
A interface that represents a public shader function in a Metal library.
Declaration
protocol MTLFunction : NSObjectProtocol, SendableOverview
Use MTLFunction instances to specify which shaders a Metal pipeline calls when the GPU executes commands that specify that pipeline. For more information on creating pipeline states, see MTLRenderPipelineDescriptor and MTLComputePipelineDescriptor.
An MTLFunction instance is a specialized function if the shader contains function constants, otherwise it is a nonspecialized function.
Don’t use standard allocation and initialization techniques to create an MTLFunction instance. Instead, use the function creation methods provided by the MTLLibrary protocol. To create a nonspecialized function, call the makeFunction(name:) method.
To create a specialized function, call one of these MTLLibrary methods:
MTLFunction instances can use a significant amount of memory; release any strong references to them after you finish creating pipeline instances.