bubu

Call function pointer inside OpenCL code

Discussion created by bubu on Feb 10, 2010
Latest reply on Feb 10, 2010 by nou

Is it possible to call a function pointer from OpenCL code?

 

Example:

 

__device int MyAddFunction ( const int a, const int b )

{

   return a+b;

}

 

typedef void (*func) ( const int a, const int b );

__kernel void main ( global int *a, global int*b, global int *out )

{

      func myFunc = MyAddFunction;

      const int idx = get_global_id(0);

      out[idx] = myFunc(a[idx],b[idx]);

}

 

???

thx

Outcomes