public void MathSharp_Wrappers() { HwVector2 newScale = _mathSharpScale_Wrapper * _mathSharpAmount_Wrapper; HwVector2 deltaT = _mathSharpScale_Wrapper * (Vector.One - _mathSharpAmount_Wrapper); deltaT *= _mathSharpAnchor_Wrapper; ((_mathSharpTranslation_Wrapper + deltaT) * newScale).Store(out _result); }
public void MathSharp() { Vector128 <float> newScale = Vector.Multiply(_mathSharpScale, _mathSharpAmount); Vector128 <float> deltaT = Vector.Multiply(_mathSharpScale, Vector.Subtract(Vector.One, _mathSharpAmount)); deltaT = Vector.Multiply(deltaT, _mathSharpAnchor); HwVector2 result = Vector.Multiply((Vector.Add(_mathSharpTranslation, deltaT)), newScale); result.Store(out _result); }
public static void Store(this HwVector2 hwVector, out Vector2 vector) { if (Sse.IsSupported) { fixed(void *pDest = &vector) { Sse.StoreLow((float *)pDest, hwVector); } return; } Store_Software(hwVector, out vector); }
public static HwVector2 Load(this Vector2 vector) { if (Sse.IsSupported) { // Construct 2 separate vectors, each having the first element being the value // and the rest being 0 HwVector2 lo = Sse.LoadScalarVector128(&vector.X); HwVector2 hi = Sse.LoadScalarVector128(&vector.Y); // Unpack these to (lo, mid, 0, 0), the desired vector return(Sse.UnpackLow(lo, hi)); } return(SoftwareFallback(vector));
public void Setup() { _openTkTranslation = new Vector2(1.7f, 2.3f); _openTkAnchor = new Vector2(1.0f, 0.0f); _openTkScale = new Vector2(7.0f, 3.6f); _openTkAmount = new Vector2(0.5f, 0.25f); _mathSharpTranslation = Vector128.Create(1.7f, 2.3f, 0f, 0f); _mathSharpAnchor = Vector128.Create(1.0f, 0.0f, 0f, 0f); _mathSharpScale = Vector128.Create(7.0f, 3.6f, 0f, 0f); _mathSharpAmount = Vector128.Create(0.5f, 0.25f, 0f, 0f); _mathSharpTranslation_Wrapper = _mathSharpTranslation; _mathSharpAnchor_Wrapper = _mathSharpAnchor; _mathSharpScale_Wrapper = _mathSharpScale; _mathSharpAmount_Wrapper = _mathSharpAmount; }
public static void Store_Software(this HwVector2 hwVector, out Vector2 vector) { vector = Unsafe.As <HwVector2, Vector2>(ref hwVector); }