I dunno how you are doing in CUDA. But this is completely forbiden as an argument to an OpenCL kernel.
You can't copy to the device a pointer value and then use it directly because the memory adresses are different.
In order to do it you need to:
- Copy only the indexes of img_history (not the pointer) referencing an image table.
- Operate with thouse indexes as you like (integer operation).
- Use these indexes to access the image table or do whatever you want. If you need to acess the img with these indexes, then it has to be a parameter to the kernel. And you have to copy all of it. (the full length img array)
Example:
__kernel foo(
__global int* img,
__global int* img_history,
__private int* private_history,
uint history_length)//could be local
{
for (int i = 0; i < history_length; i++)
private_history[i] = img_history[i];
/* img[private_history[i]] */ //Use it as you wish
}