Shader
A reference to a function in a Metal shader library, along with its bound uniform argument values.
Declaration
struct ShaderOverview
Shader values can be used as filter effects on views, see the colorEffect(_:isEnabled:), distortionEffect(_:maxSampleOffset:isEnabled:), and layerEffect(_:maxSampleOffset:isEnabled:) functions.
Shaders also conform to the ShapeStyle protocol, letting their MSL shader function provide per-pixel color to fill any shape or text view. For a shader function to act as a fill pattern it must have a function signature matching:
[[ stitchable ]] half4 name(float2 position, args...)where position is the user-space coordinates of the pixel applied to the shader, and args... should be compatible with the uniform arguments bound to shader. The function should return the premultiplied color value in the color space of the destination (typically extended sRGB).