According OpenCL 1.1 specification clSetKernelArg arg_value
could be NULL object.
So, the construction (below) is valid:
cl_mem null_buffer = NULL;
errid = clSetKernelArg(m_KernelContainer[kernelIdx], argIdx, sizeof(cl_mem), &null_buffer);
However, on Intel OpenCL SDK 1.5, I am keep getting error:
OpenCL Error : CL_INVALID_MEM_OBJECT
I've tried same construction on Nvidia OpenCL 1.1, it works fine. no error at all.
Am I missing something or that could be a bug?
According to the spec. you can pass the NULL pointer toas anargument if target parameter is a buffer.
From the spec:
"If the argument is a buffer object, the arg_value pointer can be
NULL or point to a NULL value in which case a NULL value will be used as the value for the
argument declared as a pointer to __global or __constant memory in the kernel"
We will try to reproduce the issue and update your accordingly.
I've just recently checked this issue again with latest Intel 2012 x64 SDK.
It is still there!!!
We need this feature sometimes, otherwise we have to make different kernels with different number of arguments to work around it.
Could you please make a bug report and hopefully fix it for next release?