Hello,
let me explain. A test case with to kernels
col := a floating-point buffer, alloc size = 4 * sizeof(cl_float) * cnt;
buf := uchar buffer, alloc size = 3 * sizeof(cl_uchar) * cnt;
__kernel void initBuf ( __global float3 col )
{
const size_t index = get_global_id (0);
col[index] = 0.1 * 100.0;
}
__kernel void convertToUChar ( __constant float3 col, __global uchar buf )
{
const size_t index = get_global_id (0);
float3 c = col[index];
buf[index * 3 + 0] = (uchar) (c.x);
buf[index * 3 + 1] = (uchar) (c.y);
buf[index * 3 + 2] = (uchar) (c.z);
}
Problem: After running "initBuf" and than "convertToUChar" the values of buf are zero. If I replace the line "col[index] = 0.1 * 100.0;" with "col[index] = 1.0 * 10.0;" the values of are correct (10).
I'm running the OpenCL example on an HP nw8240 with Ubuntu 11.04, AMD APP SDK 2.4 and use the CPU.
Where is my mistake?