OpenCL functions

M.Oostrik's picture

Hi all!

I'm messing around with a some (inline) functions within the openCL patch and I'm wondering if and what is possible.

for instance

__kernel void function_test_int( __global int *test)
{
   int  tid = get_global_id(0);
   test[tid] = func(1, 2.5);
}
 
int func(int a, int b) {
   return a + b;
}

result in an output of 3 as expected.

but

__kernel void function_test_float( __global float *test)
{
   int     tid = get_global_id(0);
 
   test[tid] = func(1.f,2.5);
}
 
float func(float a, float b) {
   return a + b;
}

results in a conflicting types for 'func' error

same thing for float4

what am i missing here?

PreviewAttachmentSize
function test.qtz1.87 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

cybero's picture
Re: OpenCL functions

Not as much as I, it would sem.

Both of these crash for me.

I do get the same error in the Editor that you report for the float based kernel. Both state they are outputting structures, not values.

idlefon's picture
Re: OpenCL functions

I don't get it either. Maybe it's one those bugs in QC->OpenCL which will be fixed with mac os x lion. There are other examples you know :D

http://www.mail-archive.com/quartzcomposer-dev@lists.apple.com/msg05534....

As memo tweeted recently:

"received an email from Apple, an opencl bug I submitted has been fixed for OSX Lion. I think there may actually be humans in there somewhere"

dust's picture
Re: OpenCL functions

you need to place the function above the main kernel is all.

cybero's picture
Re: OpenCL functions

deleted

M.Oostrik's picture
Re: OpenCL functions

HAHA I was indeed missing something simple.

Thanx Dust!

Found out I already did it right in the boids script! Why can't our memory be more like computers... cheers!