An object that represents a public shader function in a Metal library.
- iOS 8.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
MTLFunction objects to specify which shaders a Metal pipeline calls when the GPU executes commands that specify that pipeline. For more information on creating pipeline state objects, see
MTLFunction object is a specialized function if the shader contains function constants, otherwise it is a non-specialized function.
Don’t use standard allocation and initialization techniques to create a
MTLFunction object. Instead, use the function creation methods provided by the
MTLLibrary protocol. To create a nonspecialized function, call the
To create a specialized function, call one of these
MTLFunction objects can use a significant amount of memory; release any strong references to them after you finish creating pipeline objects.