Passing an array to a Metal Shader

Background: I've been using Core Image for almost a decade, but in my latest project I have a filter which samples surrounding pixels in order to update the pixel. Currently I'm passing an image/texture to the kernel which contains the locations to sample. It's not as fast as I would like and I beleive some of that is because it has to do a read to get the location, to then go and read the pixel (I store two locations in one pixel), so two for every two pixels, it has to do 3 texture reads.


I would like to avoid this extra read and simply use an array of locations, however I'm not able to figure out how to do this with Core Image. For OpenGL, you can create an array constant or a uniform array, but I couldn't get either to work in Core Image.


If I were to create a custom Metal Shader, could I pass it an array of locations (vec2/float2)?

Passing an array to a Metal Shader
 
 
Q