On 8 August 2012 07:54, F i L <witte2...@gmail.com> wrote: > F i L wrote: > >> Okay, that makes a lot of sense and is inline with what I was reading >> last night about FPU/SSE assembly code. However I'm also a bit confused. At >> some point, like in your hightmap example, I'm going to need to do >> arithmetic work on single vector components. Is there some sort of SSE >> arithmetic/shuffle instruction which uses "masking" that I should use to >> isolate and manipulate components? >> >> If not, and manipulating components is just bad for performance reasons, >> then I've figured out a solution to my original concern. By using this code: >> >> @property @trusted pure nothrow >> { >> auto ref x(T:float4)(auto ref T v) { return v.ptr[0]; } >> auto ref y(T:float4)(auto ref T v) { return v.ptr[1]; } >> auto ref z(T:float4)(auto ref T v) { return v.ptr[2]; } >> auto ref w(T:float4)(auto ref T v) { return v.ptr[3]; } >> >> void x(T:float4)(ref float4 v, float val) { v.ptr[0] = val; } >> void y(T:float4)(ref float4 v, float val) { v.ptr[1] = val; } >> void z(T:float4)(ref float4 v, float val) { v.ptr[2] = val; } >> void w(T:float4)(ref float4 v, float val) { v.ptr[3] = val; } >> } >> >> I am able to perform arithmetic on single components: >> >> auto vec = Vectors.float4(x, y, 0, 1); // factory >> vec.x += scalar; // += components >> >> again, I'll abandon this approach if there's a better way to manipulate >> single components, like you mentioned above. I'm just not aware of how to >> do that using SSE instructions alone. I'll do more research, but would >> appreciate any insight you can give. >> > > > Okay, disregard this. I see you where talking about your function in > std.simd (setY), and I'm referring to that for an example of the > appropriate vector functions. >
>_<