AnsweredAssumed Answered

Help! I can't get right result.

Question asked by hxmingzzz on Feb 26, 2013
Latest reply on Feb 27, 2013 by himanshu.gautam

Hi guys, I met a problem when I develop a kernel program with reading image. I have confirmed where the problem was, but I didn't know how to fix it. The following is the part of code:

          sampler_t dataSampler= CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_LINEAR;

          sampler_t transFuncSampler= CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;

 

          float scalar = read_imagef(data, dataSampler, pos).w;

          float4 result = read_imagef(transFunc, transFuncSampler, (int2)(convert_ushort_sat_rte(scalar * 65535.0f), 0));//after debugging, im sure the problem is here.

In the host side, the concerned C++ code is:        

          cl_image_format data;

          data.image_channel_order = CL_A;

          data.image_channel_data_type = CL_UNORM_INT16;

         

         cl_image_format transferFunc;

         transferFunc.image_channel_order = CL_RGBA;

         transferFunc.image_channel_data_type = CL_UNORM_INT8;

 

Anyone can help fix the problem? Thank you!

Outcomes