Expanding 1D code to 3D code, so making use of float4 would be useful for coalescing.
But if I only wish to manipulate the x,y and z component of float4 can I just refer to them, or do I also need to refer to the w component even though it is redundant?
For example, what happens with the following code?
float4 pos; pos.x+=2; pos.y+=3; pos.z+=1;
Would this be coalesced? If not would I need to add a statement referring to pos.w for coalescing?
And in order for the compiler to interpret the three (or four) statements as coalesced do they need to be sequential? i.e. as above or can statements be inserted in between, such as
float4 pos; int c; pos.x+=2; c+=10; pos.y+=3; pos.z+=1;
Also, the compiler tells me that operations such as adding two float4s cannot be done, such as
float4 pos1,pos2,pos3; pos3 = pos1 + pos2;
and that if adding two float4s the addition must be written explicitly, such as
float4 pos1,pos2,pos3; pos3.x = pos1.x + pos2.x; pos3.y = pos1.y + pos2.y; pos3.z = pos1.z + pos2.z;
If this is true when will float4 addition be available? I am using a C870.