make_float4(x,y,z,w) but reads as (w,x,y,z)

EDIT: I realized the issue is that the make_float4() and make_int4() function lists the values as {x,y,z,w}, but when you read from a float4 or int4 type is lists the values as {w,x,y,z}.

What is going on here? This caused a bug because it was assumed that the ordering would stay the same as the constructor function.

Not sure what you mean. Here is the implementation of this function in header file vector_functions.h:

static __inline__ __host__ __device__ float4 make_float4(float x, float y, float z, float w)
{
  float4 t; t.x = x; t.y = y; t.z = z; t.w = w; return t;
}

The components are assigned to the matching components of the struct as expected. The struct layout can be found in header file vector_types.h:

struct __device_builtin__ __builtin_align__(16) float4
{
    float x, y, z, w;
};

Nothing surprising there either: x is at the lowest address, w at the highest.

The problem actually is from the VisualStudio intellisense, which lists the values as {w,x,y,z}, (in alphabetical order?).

Because I saw that I assumed that was the way they were laid out.

Here is a link to imgur of the screenshot:

[url]http://i.imgur.com/y4LloNX.png[/url]

I can see how this could be very confusing. Isn’t there an option to display the members of struct in “native” rather than alphabetical order?

There probably is a way, I just got temporarily puzzled by that. All is fixed now, and will look up how to change that VisualStudio setting.

Thanks.