1 Reply Latest reply on Feb 10, 2010 5:12 AM by nou

    Call function pointer inside OpenCL code

    bubu

      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