From 637dc1f5a98e1c6cc6eecfb476ab1c20dca0c6aa Mon Sep 17 00:00:00 2001 From: Nicky Date: Fri, 22 Apr 2016 12:59:41 +0200 Subject: Windows x64: 64 bit implies SSE2, handle this accordingly when detecting if SSE2 is enabled. (transplanted from 93492b84cb752dc79c74d9667f11edd76ace8f0b) --- indra/llmath/llsimdmath.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h index cebd2ace7d..9f078ec1ef 100644 --- a/indra/llmath/llsimdmath.h +++ b/indra/llmath/llsimdmath.h @@ -31,7 +31,7 @@ #error "Please include llmath.h before this file." #endif -#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 ) ) +#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && !_M_AMD64 ) ) #error SSE2 not enabled. LLVector4a and related class will not compile. #endif -- cgit v1.2.3 From 7640c2fb446846005a191abb62d3cce1a64d2a6e Mon Sep 17 00:00:00 2001 From: Nicky Date: Fri, 22 Apr 2016 12:59:59 +0200 Subject: Windows x64: Cannot use inline assembly. (transplanted from 0b621f8a1ee707527325eb70e59ef02c63e2bd10) --- indra/llmath/llmath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 93b9f22b25..b66a3c63d6 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -153,7 +153,7 @@ inline F64 llabs(const F64 a) inline S32 lltrunc( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) +#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 ) // Avoids changing the floating point control word. // Add or subtract 0.5 - epsilon and then round const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF }; @@ -179,7 +179,7 @@ inline S32 lltrunc( F64 f ) inline S32 llfloor( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) +#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 ) // Avoids changing the floating point control word. // Accurate (unlike Stereopsis version) for all values between S32_MIN and S32_MAX and slightly faster than Stereopsis version. // Add -(0.5 - epsilon) and then round -- cgit v1.2.3 From e8aa2dd71fff7a39f2b03039b23afa8bdf804fcb Mon Sep 17 00:00:00 2001 From: Nicky Date: Fri, 22 Apr 2016 14:58:25 +0200 Subject: x64: Do not use a union of LLColor4U. Especially having the two pointer in there will blow up the struct to at least 8 byte, which will break VBO packing as this class needs to be 4 byte in size. (transplanted from 847df86d6b5daa69dcfc428df18876a9c1e8bef6) --- indra/llmath/v4coloru.h | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index fddad34978..31ae3e3c1a 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -47,14 +47,7 @@ class LLColor4U { public: - union - { - U8 mV[LENGTHOFCOLOR4U]; - U32 mAll; - LLColor4* mSources; - LLColor4U* mSourcesU; - }; - + U8 mV[LENGTHOFCOLOR4U]; LLColor4U(); // Initializes LLColor4U to (0, 0, 0, 1) LLColor4U(U8 r, U8 g, U8 b); // Initializes LLColor4U to (r, g, b, 1) @@ -132,6 +125,9 @@ public: return LLColor4(*this); } + U32 asRGBA() const; + void fromRGBA( U32 aVal ); + static LLColor4U white; static LLColor4U black; static LLColor4U red; @@ -565,6 +561,36 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color) mV[3] = 255; } +inline U32 LLColor4U::asRGBA() const +{ + U32 nRet( 0 ); + + // Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here + + nRet |= mV[ 3 ]; + nRet <<= 8; + nRet |= mV[ 2 ]; + nRet <<= 8; + nRet |= mV[ 1 ]; + nRet <<= 8; + nRet |= mV[ 0 ]; + + return nRet; +} + +inline void LLColor4U::fromRGBA( U32 aVal ) +{ + // Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here + + mV[ 0 ] = aVal & 0xFF; + aVal >>= 8; + mV[ 1 ] = aVal & 0xFF; + aVal >>= 8; + mV[ 2 ] = aVal & 0xFF; + aVal >>= 8; + mV[ 3 ] = aVal & 0xFF; +} + #endif -- cgit v1.2.3 From 944c497090b09e30377a67d60049c641b5e10e55 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sun, 24 Apr 2016 12:55:50 +0200 Subject: Code stylistics. (transplanted from 570ea799407270069974021eca3a5056d6908f58) --- indra/llmath/v4coloru.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index 31ae3e3c1a..704ce852d9 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -563,19 +563,9 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color) inline U32 LLColor4U::asRGBA() const { - U32 nRet( 0 ); - // Little endian: values are swapped in memory. The original code access the array like a U32, so we need to swap here - nRet |= mV[ 3 ]; - nRet <<= 8; - nRet |= mV[ 2 ]; - nRet <<= 8; - nRet |= mV[ 1 ]; - nRet <<= 8; - nRet |= mV[ 0 ]; - - return nRet; + return (mV[3] << 24) | (mV[2] << 16) | (mV[1] << 8) | mV[0]; } inline void LLColor4U::fromRGBA( U32 aVal ) -- cgit v1.2.3 From f5e983962703b5cb39278048b1c35e712b2b2263 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 16 Nov 2016 15:39:00 -0500 Subject: DRTVWR-418: Replace preprocessor tests for Windows-specific _M_AMD64 with tests on ADDRESS_SIZE, which is now set on the compiler command line. --- indra/llmath/llmath.h | 4 ++-- indra/llmath/llsimdmath.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index b66a3c63d6..92a48df53c 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -153,7 +153,7 @@ inline F64 llabs(const F64 a) inline S32 lltrunc( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 ) +#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && (ADDRESS_SIZE == 32) // Avoids changing the floating point control word. // Add or subtract 0.5 - epsilon and then round const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF }; @@ -179,7 +179,7 @@ inline S32 lltrunc( F64 f ) inline S32 llfloor( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined( _M_AMD64 ) +#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && (ADDRESS_SIZE == 32) // Avoids changing the floating point control word. // Accurate (unlike Stereopsis version) for all values between S32_MIN and S32_MAX and slightly faster than Stereopsis version. // Add -(0.5 - epsilon) and then round diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h index 9f078ec1ef..54a275633f 100644 --- a/indra/llmath/llsimdmath.h +++ b/indra/llmath/llsimdmath.h @@ -31,7 +31,7 @@ #error "Please include llmath.h before this file." #endif -#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && !_M_AMD64 ) ) +#if ( ( LL_DARWIN || LL_LINUX ) && !(__SSE2__) ) || ( LL_WINDOWS && ( _M_IX86_FP < 2 && ADDRESS_SIZE == 32 ) ) #error SSE2 not enabled. LLVector4a and related class will not compile. #endif -- cgit v1.2.3 From c20e57c48f957ef13d259e54de908153ac996ca7 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 20 Dec 2016 14:41:46 -0500 Subject: move debugging globals to the "lowest" library they are referenced in --- indra/llmath/CMakeLists.txt | 1 + indra/llmath/lloctree.cpp | 29 +++++++++++++++++++++++++++++ indra/llmath/llvolume.cpp | 2 +- indra/llmath/llvolume.h | 2 ++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 indra/llmath/lloctree.cpp (limited to 'indra/llmath') diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index 0614fd92ef..fc9bfe7210 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -20,6 +20,7 @@ set(llmath_SOURCE_FILES llline.cpp llmatrix3a.cpp llmodularmath.cpp + lloctree.cpp llperlin.cpp llquaternion.cpp llrect.cpp diff --git a/indra/llmath/lloctree.cpp b/indra/llmath/lloctree.cpp new file mode 100644 index 0000000000..3fcb3a27d7 --- /dev/null +++ b/indra/llmath/lloctree.cpp @@ -0,0 +1,29 @@ +/** + * @file lloctree.cpp + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "stdtypes.h" + +U32 gOctreeMaxCapacity; +F32 gOctreeMinSize; + diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 6f0b4b2410..f63a721c35 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -89,7 +89,7 @@ const F32 SKEW_MAX = 0.95f; const F32 SCULPT_MIN_AREA = 0.002f; const S32 SCULPT_MIN_AREA_DETAIL = 1; -extern BOOL gDebugGL; +BOOL gDebugGL = FALSE; BOOL check_same_clock_dir( const LLVector3& pt1, const LLVector3& pt2, const LLVector3& pt3, const LLVector3& norm) { diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index d66004cdad..bf81c978a0 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -199,6 +199,8 @@ const U8 LL_SCULPT_FLAG_MASK = LL_SCULPT_FLAG_INVERT | LL_SCULPT_FLAG_MIRROR; const S32 LL_SCULPT_MESH_MAX_FACES = 8; +extern BOOL gDebugGL; + class LLProfileParams { public: -- cgit v1.2.3 From a2a5bdf4b58e398f357b865ba49d7f8d380a0428 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 21 Dec 2016 13:17:18 -0500 Subject: DRTVWR-418: Use ensure_equals() on iffy lerp test to display values. --- indra/llmath/tests/v4math_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llmath') diff --git a/indra/llmath/tests/v4math_test.cpp b/indra/llmath/tests/v4math_test.cpp index 191ac864df..9779dfded3 100644 --- a/indra/llmath/tests/v4math_test.cpp +++ b/indra/llmath/tests/v4math_test.cpp @@ -355,7 +355,8 @@ namespace tut val3 = z1 + (z2 - z1)* val; val4 = w1 + (w2 - w1)* val; LLVector4 vec4b = lerp(vec4,vec4a,val); - ensure("lerp failed", ((val1 ==vec4b.mV[VX])&& (val2 ==vec4b.mV[VY]) && (val3 ==vec4b.mV[VZ])&& (val4 ==vec4b.mV[VW]))); + LLVector4 check(val1, val2, val3, val4); + ensure_equals("lerp failed", check, vec4b); } template<> template<> -- cgit v1.2.3 From 80a878a79289ba2245ad35e5ae67a0034d0271e3 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sat, 4 Feb 2017 08:54:01 -0500 Subject: DRTVWR-418: Merge from v-r makes llmath tests need Boost.Thread. --- indra/llmath/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/llmath') diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index fc9bfe7210..4c8bcdac91 100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt @@ -4,6 +4,7 @@ project(llmath) include(00-Common) include(LLCommon) +include(Boost) include_directories( ${LLCOMMON_INCLUDE_DIRS} @@ -118,6 +119,11 @@ if (LL_TESTS) v4color.cpp v4coloru.cpp ) + set_source_files_properties( + ${llmath_TEST_SOURCE_FILES} + PROPERTIES + LL_TEST_ADDITIONAL_LIBRARIES "${BOOST_THREAD_LIBRARY}" + ) LL_ADD_PROJECT_UNIT_TESTS(llmath "${llmath_TEST_SOURCE_FILES}") # INTEGRATION TESTS -- cgit v1.2.3 From ae0b3149badf369eb2b1f10aba830eef8b4af9b4 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 23 Feb 2017 16:49:49 -0500 Subject: DRTVWR-418: Fix a round of compile errors surfaced by -std=c++11. These are mostly things that were in fact erroneous, but accepted by older compilers. This changeset has not yet been built with Visual Studio 2013 or Linux gcc, even with -std=c++11. This changeset has not been built *without* -std=c++11. It should be used in conjunction with a corresponding change to LL_BUILD_DARWIN_BASE_SWITCHES in viewer-build-variables/variables. This is a work in progress. We do not assert that this changeset completes the work needed to turn on -std=c++11, even on the Mac. --- indra/llmath/v4color.cpp | 2 +- indra/llmath/v4color.h | 2 +- indra/llmath/v4coloru.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llmath') diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp index 79a64b24f2..a8768bda35 100644 --- a/indra/llmath/v4color.cpp +++ b/indra/llmath/v4color.cpp @@ -122,7 +122,7 @@ LLColor4 LLColor4::cyan6(0.2f, 0.6f, 0.6f, 1.0f); ////////////////////////////////////////////////////////////////////////////// // conversion -LLColor4::operator const LLColor4U() const +LLColor4::operator LLColor4U() const { return LLColor4U( (U8)llclampb(ll_round(mV[VRED]*255.f)), diff --git a/indra/llmath/v4color.h b/indra/llmath/v4color.h index 0d632f59be..8f353ead5a 100644 --- a/indra/llmath/v4color.h +++ b/indra/llmath/v4color.h @@ -131,7 +131,7 @@ class LLColor4 friend const LLColor4& operator*=(LLColor4 &a, const LLColor4 &b); // Doesn't multiply alpha! (for lighting) // conversion - operator const LLColor4U() const; + operator LLColor4U() const; // Basic color values. static LLColor4 red; diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index 704ce852d9..0f2eff3d14 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -120,7 +120,7 @@ public: static BOOL parseColor4U(const std::string& buf, LLColor4U* value); // conversion - operator const LLColor4() const + operator LLColor4() const { return LLColor4(*this); } -- cgit v1.2.3