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:
data.image_channel_order = CL_A;
data.image_channel_data_type = CL_UNORM_INT16;
transferFunc.image_channel_order = CL_RGBA;
transferFunc.image_channel_data_type = CL_UNORM_INT8;
Anyone can help fix the problem? Thank you!