I’m just playing around with OpenCL and trying to get some simple c++ routines adapted for opencl.
Basically - i’m trying to do something of the kind:
// function prototype
int CL_TestFunction(float2 *pts)
// opencl kernel
kernel void CL_TestKernel(global float2 *pts)
{
// so let's do some stuff
int id = get_global_id(0);
// blah
float x = pts[id].x;
float y = pts[id].y;
// and then let's use a c style function, which passes in the array of float2
int num = CL_TestFunction(pts);
}
int CL_TestFunction(float2 *pts)
{
// do some things in here:
return 0;
}
Now - the problem i’m getting is when i try passing in the pts array into the CL_TestFunction. I get a build error.
When i’ve used other functions, which don’t use the global parameters, it’s absolutely fine (to my knowledge anyway).
So - i’m guessing that i’m unable to do this. So - is there a way around this? I imagine i’m missing the point somewhat in regards global variables etc, so any help would be really appreciated.
The code i’m working on is a lot more complicated than what i’ve displayed above, so there are good reasons (to me) for trying to pass the pts array.
Hope that makes some sort of sense.