A GPU-based image processing routine used to create custom Core Image filters.
- iOS 8.0+
- macOS 10.4+
- tvOS 9.0+
- Core Image
The kernel language routine for a general-purpose filter kernel has the following characteristics:
Its return type is
vec4(Core Image Kernel Language) or
float4(Metal Shading Language); that is, it returns a pixel color for the output image.
It may use zero or more input images. Each input image is represented by a parameter of type
A kernel routine typically produces its output by calculating source image coordinates (using the
sampler functions or the
sampler function), samples from the source images (using the
sample function), and computes a final pixel color (output using the
return keyword). For example, the Metal Shading Language source below implements a filter that passes through its input image unchanged.
The equivalent code in Core Image Kernel Language is: