I have also try this, but I got a crash !
cl_kernel k = (cl_kernel)kernel;
::clSetKernelArg(k, 5, 0, NULL);
::clSetKernelArg(k, 6, 0, NULL);
Are you getting a crash or the -38 error?
Could you provide a testcase to reproduce the issue?
Have you tried:
void* ptr = NULL;
::clSetKernelArg(k, 5, sizeof(cl_mem), &ptr);
If the argument is declared with the
arg_valueentry must be NULL. If the argument is of type
arg_valueentry must be a pointer to the sampler object. For all other kernel arguments, the
arg_valueentry must be a pointer to the actual data to be used as argument value.
I'm not really sure why you would declare a parameter as __local instead of just putting it in the function body. If you do what I suggested, you should get __global type* param, where param == NULL.