1. __kernel void reconstruct(      __write_only image2d_t backbuffer,
  2.                                 __global float4* traceResult,
  3.                 const int num,
  4.                 const int w,
  5.                 const int h)
  6. {
  7.         int idx = get_global_id(0);
  8.  
  9.         if(idx < num)
  10.         {
  11.             int2 coord = (int2)(idx % w, idx / w);
  12.             float4 barycentric = traceResult[idx];
  13.             barycentric.z = 1.0 - barycentric.x - barycentric.y;
  14.             barycentric.w = 1.0;
  15.             write_imagef(backbuffer, coord, barycentric);
  16.         }
  17. }