
Using Metal Shading Language for Custom CIKernels - Metal & Swift
<aside> ☝️ Core Image provides a set of language extensions to MSL in CIKernelMetalLib.h. These extensions include three new data types for working with images: sampler (for accessing the input image), sample_t (represents a single color sample from the input image), and destination (for accessing the output image). The extensions also include convenience functions such as color conversion and premultiply / unpremultiply.
Whereas in CIKL, you typically called global functions when working with, for example, coordinates and samples, these functions are implemented as member functions on the new types.
The following table shows a summary of CIKL global functions and their equivalent MSL functions.
</aside>