summaryrefslogtreecommitdiff
path: root/indra/llmath/llvector4a.inl
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2013-09-19 17:39:56 -0700
committerGraham Linden <graham@lindenlab.com>2013-09-19 17:39:56 -0700
commitd3e954cfaca067adf60f2e3c161028c6549263e4 (patch)
tree54826d4b8ff8fa7683770876bb654c3afdaaf076 /indra/llmath/llvector4a.inl
parent79836e32d575248642cfd6af837548aac054988f (diff)
parentad777b46d0fe5d790e43efb1771e9f64f3ad3dfb (diff)
Merge 3.6.6 Materials RC and update Intel HD gpu_table entries to expect GL 4.2 to nag resis to get the fixed Intel driver
Diffstat (limited to 'indra/llmath/llvector4a.inl')
-rwxr-xr-xindra/llmath/llvector4a.inl20
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/llmath/llvector4a.inl b/indra/llmath/llvector4a.inl
index 7c52ffef21..558fe09323 100755
--- a/indra/llmath/llvector4a.inl
+++ b/indra/llmath/llvector4a.inl
@@ -409,6 +409,26 @@ inline void LLVector4a::normalize3fast()
mQ = _mm_mul_ps( mQ, approxRsqrt );
}
+inline void LLVector4a::normalize3fast_checked(LLVector4a* d)
+{
+ if (!isFinite3())
+ {
+ *this = d ? *d : LLVector4a(0,1,0,1);
+ return;
+ }
+
+ LLVector4a lenSqrd; lenSqrd.setAllDot3( *this, *this );
+
+ if (lenSqrd.getF32ptr()[0] <= FLT_EPSILON)
+ {
+ *this = d ? *d : LLVector4a(0,1,0,1);
+ return;
+ }
+
+ const LLQuad approxRsqrt = _mm_rsqrt_ps(lenSqrd.mQ);
+ mQ = _mm_mul_ps( mQ, approxRsqrt );
+}
+
// Return true if this vector is normalized with respect to x,y,z up to tolerance
inline LLBool32 LLVector4a::isNormalized3( F32 tolerance ) const
{