How do I get multiple image inputs to an OpenCL kernel program?
I want to convert pixels of one image into a vertex array, and sample color information from another image to create an array of colour float4s. Both images will have the same dimensions.
You can have multiple images as arguments to your kernel. I believe the minimum number required to be OpenCL compliant is 8, but you can query how many your device supports with clGetDeviceInfo. The only real restriction is that you can not read-from and write-to the same image in one kernel.
Sorry if this is a really basic question, but how would I declare the second image input, and sample from it?
I’m having problems finding documentation on writing OpenCL programs- plenty on backend setup etc. but not much in terms of the basics of the OpenCL language itself.
__kernel void
foo(read_only image2d_t imgA, read_only image2d_t imgB, sampler_t sampler, …)
{
int x = (int)get_global_id(0);
int y = (int)get_global_id(1);