View Full Version : Single float2 Output from OpenCL Kernel

11-25-2009, 01:32 AM
Is it possible to have an OpenCL kernel output a single (float2, float4 etc. ) value based on an analysis of an image?
I must admit to being confused by how to specify input and output values for kernels, and haven't found a clear explanation.

I'm sorry if this is such a stupid question...


11-25-2009, 11:34 AM
Kerenls can't return values. They are always defined with the void type. To return values you can simply create a cl_mem object and write to it. The only tricky part is figuring out which work-item does the writing, since you will presumably have many work-items working together.

11-25-2009, 02:17 PM
Thanks for the reply.

I'm writing OpenCL kernels in Apple's Quartz Composer, so don't have full access to the way OpenCL is setup in the background. I'll try and find out more from the QC devlist.

Thanks a lot,


11-25-2009, 09:53 PM
You can do this in quartz composer but you may have to turn on the advanced options. Basically you need to define an output that's of size 2 to get 2 floats out from quartz composer. It will then generate a global float* output and you can write to output[0] and [1].