CL_INVALID_ARG_INDEX causes

Hi forum,

I am allocating a memory buffer and getting error value -49 with the following command :


      errNum |= clSetKernelArg(clKernel,1, sizeof(cl_mem),trgBuffer);

While allocating the trgBuffer i am not getting any error and it means that the memory creation was successful.

Any hint to track the reason of the error?

Thanks
Sajjad

Maybe your kernel has only one argument (argument index start at zero).
Furthermore, you must pass to clSetKernelArg() the address of the memory object, not the object itself.