Problem with OpenCL kernel patch

utopianational's picture

Hi,

I'm trying to create a OpenCL kernel but I cannot get it work well. This program is to convert X/Y mouse position queue to an image. It looks work fine, but it gets gradually slower, and finally crashes MacOSX after several minutes.

__kernel void main(__global const float *X,__global const float *Y,__wr image2d_t output)
{
 
 
   int2   pos = (int2)(get_global_id(0), get_global_id(1));
   float4 color;
 
   color.x=X[pos.x]; //R
   color.y=Y[pos.x]; //G
   color.z=0.0; //B
   if(color.x<0)
      color.x=0;
   if(color.y<0)
      color.y=0;
   if(color.x>1)
      color.x=1;
   if(color.y>1)
      color.y=1;      
   write_imagef(output, pos, color);
 
}

I set queue size to 80 in qc, so that it creates 80x1 pixels image.

I found that it gets work well when I continue to click "Sample Now" button in "Advanced Kernel Settings" every minute, but I have no idea to get code work stably. Could you help me?

Cheers

PreviewAttachmentSize
kernel.png
kernel.png120.02 KB