Hi all,
I’m very new to OpenCL and I’m trying to figure out how I’d write a (very) simple function. Essentially I need to be able to alter the values of the arguments to a function without returning them. Is there an equivalent to the inout parameter in GLSL?
In C it would be
void ContourTree::switchPoints(Point& a, Point& b)
{
Point switch_point = a;
a = b;
b = switch_point;
}
In GLSL it looks like
void switchPoints(inout vec3 a, inout vec3 b)
{
vec3 switch_pt = a;
a = b;
b = switch_pt;
}
I thought that this would work, but it doesn’t seem to for some reason:
void
test( float* a,
float* b)
{
float* temp = a;
a = b;
b = temp;
}
wherein I call it like so
test(&a, &b);
I’m sure I’m missing something very basic here.