In Metal we can create samplers like this
constexpr sampler s(coord::normalized, address::clamp_to_edge, filter::linear);
Then we can sample any texture using this sampler.
I am wondering if something similar is available in Metal Core Image Kernels or not.
Yes, there is! You can use a
CISamplerthat you can pass to your kernel instead of aCIImage:You can also set
kCISamplerAffineMatrixin theoptionsto define a transform that is applied to the coordinates when sampling (normalizedis the default behavior, I think).Alternatively, you can use these convenience helpers on
CIImageto set the wrap and filter modes:Using these methods you can also force built-in filters to use the corresponding modes.