I am defining a structure in C++, built a vector in a loop and created its buffer using clCreateBuffer() function, which is then passed to my CL kernel. My kernel code calls funcA where the buffer is passed as an argument. I am then using the buffer and calling funcB giving array as an argument.
typedef struct a {
float array[16];
unsigned int id;
} BUFFER_TYPE;
float RD_INLINE funcB(__global float4* m)
{
..
}
bool RD_INLINE funcA(__global BUFFER_TYPE* buffer)
{
..
float scale = funcB(buffer[0].array);
..
}
I am getting " warning: incompatible pointer types passing 'float __global[16]' to parameter of type '__global float4 *'". How do I resolve this? How can I typecast here?
(__global float4*)buffer[0].array
should work fine. - Mestkon