spectral

cl_float4 ... and co...

Discussion created by spectral on Mar 1, 2011
Latest reply on Mar 1, 2011 by spectral

Hi,

I try to play with float4, float8 etc.... in c++ so I use cl_float4 by example.

Here is the definition in the cl files.

typedef union
{
cl_float CL_ALIGNED(16) s[4];
#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_float x, y, z, w; };
__extension__ struct{ cl_float s0, s1, s2, s3; };
__extension__ struct{ cl_float2 lo, hi; };
#endif
#if defined( __CL_FLOAT2__)
__cl_float2 v2[2];
#endif
#if defined( __CL_FLOAT4__)
__cl_float4 v4;
#endif
}cl_float4;

What is strange is that I have to access the cl_float4 like this :

cl_float4 val;

val.s[0] = 1.f;
val.s[1] = 2.f;
val.s[2] = 3.f;

And I have no ".x" , ".y", ... under MSVC

Except form GNUC where there is the x,y,z,x and s0, s1, s2, s3 !

Why we don't have this for all platforms ?

 

Thx

Outcomes