kernel arguments restrction

Hi forum,

In the manual it is mentioned that

“Arguments to __kernel functions in a program cannot be declared with the built-in scalar types bool, half, size_t, ptrdiff_t, intptr_t, and uintptr_t”. I need the pitch value to be passed to the kernel of type size_t.

Is there any other way to get around this issue?


Hi duonganh!
You can send size_t inside in the some pointer to struct, or as pointer to size_t

struct SomeData {
// Other data

size_t pitchValue;

// Other data

__kernel OpenCLKernel(…, __global SomeData* data

__kernel OpenCLKernel(…, __global size_t* pitchValue

The reason of this restriction is that The OpenCL loves to get the big parts of the data, not single scalar data.