Apply a lil alchemy blackmagic

This commit is contained in:
Rye Mutt
2019-10-07 12:40:30 -04:00
parent 77f8855fd6
commit bcadee8575
9 changed files with 42 additions and 22 deletions

View File

@@ -57,7 +57,7 @@ public:
//////////////////////////
// Ctor
LLMatrix3a() {}
LLMatrix3a() = default;
// Ctor for setting by columns
inline LLMatrix3a( const LLVector4a& c0, const LLVector4a& c1, const LLVector4a& c2 );
@@ -121,12 +121,14 @@ class LLRotation : public LLMatrix3a
{
public:
LLRotation() {}
LLRotation() = default;
// Returns true if this rotation is orthonormal with det ~= 1
inline bool isOkRotation() const;
} LL_ALIGN_POSTFIX(16);
static_assert(std::is_trivial<LLMatrix3a>::value, "LLMatrix3a must be a trivial type");
static_assert(std::is_standard_layout<LLMatrix3a>::value, "LLMatrix3a must be a standard layout type");
static_assert(std::is_trivially_copyable<LLMatrix3a>::value, "LLMatrix3a must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLRotation>::value, "LLRotation must be a trivially copyable type");
static_assert(std::is_trivial<LLRotation>::value, "LLRotation must be a trivial type");
static_assert(std::is_standard_layout<LLRotation>::value, "LLRotation must be a standard layout type");
#endif

View File

@@ -50,13 +50,22 @@ public:
return ll_aligned_malloc_16(size);
}
void* operator new[](size_t size)
{
return ll_aligned_malloc_16(size);
}
void operator delete(void* ptr)
{
ll_aligned_free_16(ptr);
}
LLMatrix4a()
{}
void operator delete[](void* ptr)
{
ll_aligned_free_16(ptr);
}
LLMatrix4a() = default;
LLMatrix4a(const LLQuad& q1,const LLQuad& q2,const LLQuad& q3,const LLQuad& q4)
{
mMatrix[0] = q1;
@@ -709,5 +718,6 @@ inline std::ostream& operator<<(std::ostream& s, const LLMatrix4a& m)
void matMulBoundBox(const LLMatrix4a &a, const LLVector4a *in_extents, LLVector4a *out_extents);
static_assert(std::is_trivially_copyable<LLMatrix4a>::value, "LLMatrix4a must be a trivially copyable type");
static_assert(std::is_trivial<LLMatrix4a>::value, "LLMatrix4a must be a trivial type");
static_assert(std::is_standard_layout<LLMatrix4a>::value, "LLMatrix4a must be a standard layout type");
#endif

View File

@@ -43,7 +43,7 @@ class LLPlane
public:
// Constructors
LLPlane() {}; // no default constructor
LLPlane() = default; // no default constructor
LLPlane(const LLVector3 &p0, F32 d) { setVec(p0, d); }
LLPlane(const LLVector3 &p0, const LLVector3 &n) { setVec(p0, n); }
inline void setVec(const LLVector3 &p0, F32 d) { mV.set(p0[0], p0[1], p0[2], d); }
@@ -104,6 +104,7 @@ private:
LL_ALIGN_16(LLVector4a mV);
} LL_ALIGN_POSTFIX(16);
static_assert(std::is_trivial<LLPlane>::value, "LLPlane must be a trivial type");
static_assert(std::is_standard_layout<LLPlane>::value, "LLPlane must be a standard layout type");
#endif // LL_LLPLANE_H

View File

@@ -50,7 +50,7 @@ public:
//////////////////////////
// Ctor
LLQuaternion2() {}
LLQuaternion2() = default;
// Ctor from LLQuaternion
explicit LLQuaternion2( const class LLQuaternion& quat );
@@ -105,6 +105,7 @@ protected:
} LL_ALIGN_POSTFIX(16);
static_assert(std::is_trivially_copyable<LLQuaternion2>::value, "LLQuaternion2 must be a trivially copyable type");
static_assert(std::is_trivial<LLQuaternion2>::value, "LLQuaternion2 must be a trivial type");
static_assert(std::is_standard_layout<LLQuaternion2>::value, "LLQuaternion2 must be a standard layout type");
#endif

View File

@@ -50,7 +50,7 @@ __forceinline const __m128i _mm_castps_si128( const __m128 a ) { return reinterp
class LLBool32
{
public:
inline LLBool32() {}
inline LLBool32() = default;
inline LLBool32(int rhs) : m_bool(rhs) {}
inline LLBool32(unsigned int rhs) : m_bool(rhs) {}
inline LLBool32(bool rhs) { m_bool = static_cast<const int>(rhs); }
@@ -70,7 +70,7 @@ private:
class LLSimdScalar
{
public:
inline LLSimdScalar() {}
inline LLSimdScalar() = default;
inline LLSimdScalar(LLQuad q)
{
mQ = q;
@@ -120,8 +120,9 @@ public:
private:
LLQuad mQ;
};
static_assert(std::is_trivially_copyable<LLBool32>::value, "LLBool32 must be a trivially copyable type");
static_assert(std::is_trivially_copyable<LLSimdScalar>::value, "LLSimdScalar must be a trivially copyable type");
static_assert(std::is_trivial<LLBool32>::value, "LLBool32 must be a trivial type");
static_assert(std::is_standard_layout<LLBool32>::value, "LLBool32 must be a standard layout type");
static_assert(std::is_trivial<LLSimdScalar>::value, "LLSimdScalar must be a trivial type");
static_assert(std::is_standard_layout<LLSimdScalar>::value, "LLSimdScalar must be a standard layout type");
#endif //LL_SIMD_TYPES_H

View File

@@ -93,9 +93,13 @@ public:
////////////////////////////////////
LLVector4a()
#if !defined(LL_DEBUG)
= default;
#else
{ //DO NOT INITIALIZE -- The overhead is completely unnecessary
ll_assert_aligned(this,16);
}
#endif
LLVector4a(F32 x, F32 y, F32 z, F32 w = 0.f)
{
@@ -346,5 +350,6 @@ inline std::ostream& operator<<(std::ostream& s, const LLVector4a& v)
return s;
}
static_assert(std::is_trivially_copyable<LLVector4a>::value, "LLVector4a must be a trivially copyable type");
static_assert(std::is_trivial<LLVector4a>::value, "LLVector4a must be a be a trivial type");
static_assert(std::is_standard_layout<LLVector4a>::value, "LLVector4a must be a standard layout type");
#endif

View File

@@ -61,7 +61,7 @@ public:
};
// Empty default ctor
LLVector4Logical() {}
LLVector4Logical() = default;
LLVector4Logical( const LLQuad& quad )
{
@@ -122,5 +122,7 @@ private:
LLQuad mQ;
};
static_assert(std::is_trivial<LLVector4Logical>::value, "LLVector4Logical must be a trivial type");
static_assert(std::is_standard_layout<LLVector4Logical>::value, "LLVector4Logical must be a standard layout type");
#endif //LL_VECTOR4ALOGICAL_H

View File

@@ -796,9 +796,6 @@ static void xform4a(LLVector4a &tex_coord, const LLVector4a& trans, const LLVect
// Texture transforms are done about the center of the face.
st.setAdd(tex_coord, trans);
// Handle rotation
LLVector4a rot_st;
// <s0 * cosAng, s0*-sinAng, s1*cosAng, s1*-sinAng>
LLVector4a s0;
s0.splat(st, 0);
@@ -873,7 +870,6 @@ BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
//VECTORIZE THIS
LLMatrix4a mat_vert = mat_vert_in;
LLVector4a new_extents[2];
llassert(less_than_max_mag(face.mExtents[0]));
llassert(less_than_max_mag(face.mExtents[1]));

View File

@@ -6391,6 +6391,7 @@ LLVOPartGroup* LLPipeline::lineSegmentIntersectParticle(const LLVector4a& start,
LLVector4a local_end = end;
LLVector4a position;
position.clear();
LLDrawable* drawable = NULL;
@@ -6442,6 +6443,7 @@ LLViewerObject* LLPipeline::lineSegmentIntersectInWorld(const LLVector4a& start,
LLVector4a local_end = end;
LLVector4a position;
position.clear();
sPickAvatar = FALSE; //LLToolMgr::getInstance()->inBuildMode() ? FALSE : TRUE;