summaryrefslogtreecommitdiff
path: root/indra/llmath
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath')
-rw-r--r--indra/llmath/llcalcparser.h2
-rw-r--r--indra/llmath/llquaternion.h8
-rw-r--r--indra/llmath/llsimdtypes.h18
-rw-r--r--indra/llmath/llvolume.cpp40
-rw-r--r--indra/llmath/llvolumeoctree.h2
-rw-r--r--indra/llmath/v3color.h12
-rw-r--r--indra/llmath/v4color.h8
-rw-r--r--indra/llmath/v4math.h8
8 files changed, 40 insertions, 58 deletions
diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h
index e8fdcc9ae3..ea71752ebc 100644
--- a/indra/llmath/llcalcparser.h
+++ b/indra/llmath/llcalcparser.h
@@ -175,7 +175,7 @@ private:
F32 _exp(const F32& a) const { return exp(a); }
F32 _fabs(const F32& a) const { return fabs(a); }
F32 _floor(const F32& a) const { return (F32)llfloor(a); }
- F32 _ceil(const F32& a) const { return llceil(a); }
+ F32 _ceil(const F32& a) const { return (F32)llceil(a); }
F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }
LLCalc::calc_map_t* mConstants;
diff --git a/indra/llmath/llquaternion.h b/indra/llmath/llquaternion.h
index 6136c59ed1..762d13eded 100644
--- a/indra/llmath/llquaternion.h
+++ b/indra/llmath/llquaternion.h
@@ -186,10 +186,10 @@ inline LLSD LLQuaternion::getValue() const
inline void LLQuaternion::setValue(const LLSD& sd)
{
- mQ[0] = sd[0].asReal();
- mQ[1] = sd[1].asReal();
- mQ[2] = sd[2].asReal();
- mQ[3] = sd[3].asReal();
+ mQ[0] = (F32)sd[0].asReal();
+ mQ[1] = (F32)sd[1].asReal();
+ mQ[2] = (F32)sd[2].asReal();
+ mQ[3] = (F32)sd[3].asReal();
}
// checker
diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h
index 11462170fb..a407f51029 100644
--- a/indra/llmath/llsimdtypes.h
+++ b/indra/llmath/llsimdtypes.h
@@ -33,20 +33,6 @@
typedef __m128 LLQuad;
-
-#if LL_WINDOWS
-#pragma warning(push)
-#pragma warning( disable : 4800 3 ) // Disable warning about casting int to bool for this class.
-#if defined(_MSC_VER) && (_MSC_VER < 1500)
-// VC++ 2005 is missing these intrinsics
-// __forceinline is MSVC specific and attempts to override compiler inlining judgment. This is so
-// even in debug builds this call is a NOP.
-__forceinline const __m128 _mm_castsi128_ps( const __m128i a ) { return reinterpret_cast<const __m128&>(a); }
-__forceinline const __m128i _mm_castps_si128( const __m128 a ) { return reinterpret_cast<const __m128i&>(a); }
-#endif // _MSC_VER
-
-#endif // LL_WINDOWS
-
class LLBool32
{
public:
@@ -63,10 +49,6 @@ private:
int m_bool{ 0 };
};
-#if LL_WINDOWS
-#pragma warning(pop)
-#endif
-
class LLSimdScalar
{
public:
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index f3db9424d9..56ac22ca18 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -734,7 +734,7 @@ S32 LLProfile::getNumPoints(const LLProfileParams& params, bool path_open,F32 de
bool LLProfile::generate(const LLProfileParams& params, bool path_open,F32 detail, S32 split,
bool is_sculpted, S32 sculpt_size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if ((!mDirty) && (!is_sculpted))
{
@@ -1216,7 +1216,7 @@ S32 LLPath::getNumNGonPoints(const LLPathParams& params, S32 sides, F32 startOff
void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 end_scale, F32 twist_scale)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
// Generates a circular path, starting at (1, 0, 0), counterclockwise along the xz plane.
constexpr F32 tableScale[] = { 1, 1, 1, 0.5f, 0.707107f, 0.53f, 0.525f, 0.5f };
@@ -1452,7 +1452,7 @@ S32 LLPath::getNumPoints(const LLPathParams& params, F32 detail)
bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split,
bool is_sculpted, S32 sculpt_size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if ((!mDirty) && (!is_sculpted))
{
@@ -2029,7 +2029,7 @@ LLVolume::~LLVolume()
bool LLVolume::generate()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LL_CHECK_MEMORY
llassert_always(mProfilep);
@@ -2289,7 +2289,7 @@ bool LLVolumeFace::VertexData::compareNormal(const LLVolumeFace::VertexData& rhs
bool LLVolume::unpackVolumeFaces(std::istream& is, S32 size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//input stream is now pointing at a zlib compressed block of LLSD
//decompress block
@@ -2345,11 +2345,11 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
continue;
}
- LLSD::Binary pos = mdl[i]["Position"];
- LLSD::Binary norm = mdl[i]["Normal"];
- LLSD::Binary tangent = mdl[i]["Tangent"];
- LLSD::Binary tc = mdl[i]["TexCoord0"];
- LLSD::Binary idx = mdl[i]["TriangleList"];
+ const LLSD::Binary& pos = mdl[i]["Position"].asBinary();
+ const LLSD::Binary& norm = mdl[i]["Normal"].asBinary();
+ const LLSD::Binary& tangent = mdl[i]["Tangent"].asBinary();
+ const LLSD::Binary& tc = mdl[i]["TexCoord0"].asBinary();
+ const LLSD::Binary& idx = mdl[i]["TriangleList"].asBinary();
//copy out indices
auto num_indices = idx.size() / 2;
@@ -2538,7 +2538,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
continue;
}
- LLSD::Binary weights = mdl[i]["Weights"];
+ const LLSD::Binary& weights = mdl[i]["Weights"].asBinary();
U32 idx = 0;
@@ -2776,7 +2776,7 @@ S32 LLVolume::getNumFaces() const
void LLVolume::createVolumeFaces()
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if (mGenerateSingleFace)
{
@@ -3741,7 +3741,7 @@ void LLVolume::generateSilhouetteVertices(std::vector<LLVector3> &vertices,
const LLMatrix3& norm_mat_in,
S32 face_mask)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LLMatrix4a mat;
mat.loadu(mat_in);
@@ -4870,7 +4870,7 @@ void LLVolumeFace::freeData()
bool LLVolumeFace::create(LLVolume* volume, bool partial_build)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//tree for this face is no longer valid
destroyOctree();
@@ -5462,7 +5462,11 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
U32 stream_count = data.w.empty() ? 4 : 5;
- S32 vert_count = static_cast<S32>(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count));
+ S32 vert_count = 0;
+ if (!data.p.empty())
+ {
+ vert_count = static_cast<S32>(meshopt_generateVertexRemapMulti(&remap[0], nullptr, data.p.size(), data.p.size(), mos, stream_count));
+ }
if (vert_count < 65535 && vert_count != 0)
{
@@ -5545,7 +5549,7 @@ bool LLVolumeFace::cacheOptimize(bool gen_tangents)
void LLVolumeFace::createOctree(F32 scaler, const LLVector4a& center, const LLVector4a& size)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
if (getOctree())
{
@@ -6556,7 +6560,7 @@ void LLVolumeFace::fillFromLegacyData(std::vector<LLVolumeFace::VertexData>& v,
bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LL_CHECK_MEMORY
bool flat = mTypeMask & FLAT_MASK;
@@ -7090,7 +7094,7 @@ bool LLVolumeFace::createSide(LLVolume* volume, bool partial_build)
void LLCalculateTangentArray(U32 vertexCount, const LLVector4a *vertex, const LLVector4a *normal,
const LLVector2 *texcoord, U32 triangleCount, const U16* index_array, LLVector4a *tangent)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
//LLVector4a *tan1 = new LLVector4a[vertexCount * 2];
LLVector4a* tan1 = (LLVector4a*) ll_aligned_malloc_16(vertexCount*2*sizeof(LLVector4a));
diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h
index 05d45f7b5f..1d74644715 100644
--- a/indra/llmath/llvolumeoctree.h
+++ b/indra/llmath/llvolumeoctree.h
@@ -143,7 +143,7 @@ public:
virtual void visit(const LLOctreeNode<LLVolumeTriangle, LLVolumeTriangle*>* branch)
{ //this is a depth first traversal, so it's safe to assum all children have complete
//bounding data
- LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
LLVolumeOctreeListener* node = (LLVolumeOctreeListener*)branch->getListener(0);
diff --git a/indra/llmath/v3color.h b/indra/llmath/v3color.h
index 7b92f85a0c..f7af469e66 100644
--- a/indra/llmath/v3color.h
+++ b/indra/llmath/v3color.h
@@ -209,10 +209,6 @@ inline LLColor3::LLColor3(const F32 *vec)
mV[VBLUE] = vec[VBLUE];
}
-#if LL_WINDOWS
-# pragma warning( disable : 4996 ) // strncpy teh sux0r
-#endif
-
inline LLColor3::LLColor3(const char* color_string) // takes a string of format "RRGGBB" where RR is hex 00..FF
{
if (strlen(color_string) < 6) /* Flawfinder: ignore */
@@ -517,9 +513,9 @@ inline const LLVector3 linearColor3v(const T& a) {
template<typename T>
const LLColor3& LLColor3::set(const std::vector<T>& v)
{
- for (S32 i = 0; i < llmin((S32)v.size(), 3); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 3); ++i)
{
- mV[i] = v[i];
+ mV[i] = (F32)v[i];
}
return *this;
@@ -530,9 +526,9 @@ const LLColor3& LLColor3::set(const std::vector<T>& v)
template<typename T>
void LLColor3::write(std::vector<T>& v) const
{
- for (int i = 0; i < llmin((S32)v.size(), 3); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 3); ++i)
{
- v[i] = mV[i];
+ v[i] = (T)mV[i];
}
}
diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h
index e9bb6a07ba..cafdbd9d7c 100644
--- a/indra/llmath/v4color.h
+++ b/indra/llmath/v4color.h
@@ -702,9 +702,9 @@ inline const LLColor4 linearColor4(const LLColor4 &a)
template<typename T>
const LLColor4& LLColor4::set(const std::vector<T>& v)
{
- for (S32 i = 0; i < llmin((S32)v.size(), 4); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 4); ++i)
{
- mV[i] = v[i];
+ mV[i] = (F32)v[i];
}
return *this;
@@ -713,9 +713,9 @@ const LLColor4& LLColor4::set(const std::vector<T>& v)
template<typename T>
void LLColor4::write(std::vector<T>& v) const
{
- for (int i = 0; i < llmin((S32)v.size(), 4); ++i)
+ for (size_t i = 0; i < llmin(v.size(), 4); ++i)
{
- v[i] = mV[i];
+ v[i] = (T)mV[i];
}
}
diff --git a/indra/llmath/v4math.h b/indra/llmath/v4math.h
index 7ed22212d3..a5b6f506d7 100644
--- a/indra/llmath/v4math.h
+++ b/indra/llmath/v4math.h
@@ -67,10 +67,10 @@ class LLVector4
void setValue(const LLSD& sd)
{
- mV[0] = sd[0].asReal();
- mV[1] = sd[1].asReal();
- mV[2] = sd[2].asReal();
- mV[3] = sd[3].asReal();
+ mV[0] = (F32)sd[0].asReal();
+ mV[1] = (F32)sd[1].asReal();
+ mV[2] = (F32)sd[2].asReal();
+ mV[3] = (F32)sd[3].asReal();
}