From a46f1145f5abfff154eec6556e9f4ba35bc14302 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 7 Oct 2019 11:56:31 -0400 Subject: [PATCH 1/7] Properly disable WER reporting --- indra/newview/CMakeLists.txt | 1 + indra/newview/llappviewerwin32.cpp | 38 +++++++----------------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index bebccf1e2..0b48e495a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1342,6 +1342,7 @@ if (WINDOWS) shell32 user32 Vfw32 + wer Wbemuuid winspool Normaliz diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 5cb22a34d..9ca2feeb6 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -47,7 +47,6 @@ #include //_O_APPEND #include //_open_osfhandle() -#include // for AddERExcludedApplicationA() #include // _spawnl() #include // For TCHAR support #include @@ -379,34 +378,15 @@ int APIENTRY WinMain(HINSTANCE hInstance, void LLAppViewerWin32::disableWinErrorReporting() { - const char win_xp_string[] = "Microsoft Windows XP"; - BOOL is_win_xp = ( getOSInfo().getOSString().substr(0, strlen(win_xp_string) ) == win_xp_string ); /* Flawfinder: ignore*/ - if( is_win_xp ) + std::string const& executable_name = gDirUtilp->getExecutableFilename(); + + if( S_OK == WerAddExcludedApplication( utf8str_to_utf16str(executable_name).c_str(), FALSE ) ) { - // Note: we need to use run-time dynamic linking, because load-time dynamic linking will fail - // on systems that don't have the library installed (all non-Windows XP systems) - HINSTANCE fault_rep_dll_handle = LoadLibrary(L"faultrep.dll"); /* Flawfinder: ignore */ - if( fault_rep_dll_handle ) - { - pfn_ADDEREXCLUDEDAPPLICATIONA pAddERExcludedApplicationA = (pfn_ADDEREXCLUDEDAPPLICATIONA) GetProcAddress(fault_rep_dll_handle, "AddERExcludedApplicationA"); - if( pAddERExcludedApplicationA ) - { - - // Strip the path off the name - const char* executable_name = gDirUtilp->getExecutableFilename().c_str(); - - if( 0 == pAddERExcludedApplicationA( executable_name ) ) - { - U32 error_code = GetLastError(); - LL_INFOS() << "AddERExcludedApplication() failed with error code " << error_code << LL_ENDL; - } - else - { - LL_INFOS() << "AddERExcludedApplication() success for " << executable_name << LL_ENDL; - } - } - FreeLibrary( fault_rep_dll_handle ); - } + LL_INFOS() << "WerAddExcludedApplication() succeeded for " << executable_name << LL_ENDL; + } + else + { + LL_INFOS() << "WerAddExcludedApplication() failed for " << executable_name << LL_ENDL; } } @@ -451,7 +431,7 @@ bool LLAppViewerWin32::init() { // Platform specific initialization. - // Turn off Windows XP Error Reporting + // Turn off Windows Error Reporting // (Don't send our data to Microsoft--at least until we are Logo approved and have a way // of getting the data back from them.) // From e1757d68a567e1dc368813859b47288e5fd9f397 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 7 Oct 2019 11:56:46 -0400 Subject: [PATCH 2/7] Enable cmake IDE folder generation --- indra/cmake/Variables.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index f2613035f..119c4815b 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -17,6 +17,8 @@ if(NOT DEFINED COMMON_CMAKE_DIR) set(COMMON_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake") endif(NOT DEFINED COMMON_CMAKE_DIR) +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + set(LIBS_CLOSED_PREFIX) set(LIBS_OPEN_PREFIX) set(SCRIPTS_PREFIX ../scripts) From e98e9391bffa730126eef3c0e52b4371bb5a5e2c Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 7 Oct 2019 11:57:39 -0400 Subject: [PATCH 3/7] Ignore pip lockfile --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 01cad3637..a299c3d6c 100644 --- a/.gitignore +++ b/.gitignore @@ -25,5 +25,4 @@ qtcreator-build/ /.pc /build-* /viewer-* - - +/Pipfile.lock From 2f4d254bc66afcc935e39ff07406bcff2eef1ee9 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 7 Oct 2019 12:03:15 -0400 Subject: [PATCH 4/7] Fix calling cmake -E to use proper cmake var --- indra/newview/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 0b48e495a..ae9e02c43 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1157,8 +1157,8 @@ source_group("CMake Rules" FILES ViewerInstall.cmake) # the summary.json file is created for the benefit of the TeamCity builds, where # it is used to provide descriptive information to the build results page add_custom_target(generate_viewer_version ALL - COMMAND cmake -E echo ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION} > ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt - COMMAND cmake -E echo {"Type":"viewer","Version":"${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}"} > ${CMAKE_BINARY_DIR}/summary.json + COMMAND ${CMAKE_COMMAND} -E echo ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION} > ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + COMMAND ${CMAKE_COMMAND} -E echo {"Type":"viewer","Version":"${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}"} > ${CMAKE_BINARY_DIR}/summary.json COMMENT "Generating viewer_version.txt for manifest processing" ) From b4243dc95bece2850c18cd56961851c093f6d262 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 7 Oct 2019 12:06:42 -0400 Subject: [PATCH 5/7] Enable larger resolution media surfaces for ultrawide monitors --- indra/llplugin/llpluginclassmedia.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index e1edaa80f..a6b041c46 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -332,11 +332,11 @@ void LLPluginClassMedia::setSizeInternal(void) mRequestedMediaHeight = nextPowerOf2(mRequestedMediaHeight); } - if(mRequestedMediaWidth > 2048) - mRequestedMediaWidth = 2048; + if(mRequestedMediaWidth > 6000) + mRequestedMediaWidth = 6000; - if(mRequestedMediaHeight > 2048) - mRequestedMediaHeight = 2048; + if(mRequestedMediaHeight > 6000) + mRequestedMediaHeight = 6000; } void LLPluginClassMedia::setAutoScale(bool auto_scale) From 77f8855fd6bc04ac150f7892115f57b1de0f9737 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 7 Oct 2019 12:07:00 -0400 Subject: [PATCH 6/7] Swap to absl hash maps on two extremely hot paths --- indra/newview/llmeshrepository.cpp | 6 +++--- indra/newview/llmeshrepository.h | 4 +++- indra/newview/llviewerobjectlist.cpp | 8 ++++---- indra/newview/llviewerobjectlist.h | 14 ++++++++------ 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 44599742d..4d2ea0251 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2685,7 +2685,7 @@ void LLMeshRepository::notifyLoadedMeshes() void LLMeshRepository::notifySkinInfoReceived(LLMeshSkinInfo& info) { - mSkinMap[info.mMeshID] = info; + mSkinMap.insert_or_assign(info.mMeshID, info); skin_load_map::iterator iter = mLoadingSkins.find(info.mMeshID); if (iter != mLoadingSkins.end()) @@ -2792,8 +2792,8 @@ const LLMeshSkinInfo* LLMeshRepository::getSkinInfo(const LLUUID& mesh_id, const { if (mesh_id.notNull()) { - skin_map::iterator iter = mSkinMap.find(mesh_id); - if (iter != mSkinMap.end()) + const auto iter = mSkinMap.find(mesh_id); + if (iter != mSkinMap.cend()) { return &(iter->second); } diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index 62666bc65..6931cd3df 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -39,6 +39,8 @@ #include "lluploadfloaterobservers.h" #include "aistatemachinethread.h" +#include + #ifndef BOOST_FUNCTION_HPP_INCLUDED #include #define BOOST_FUNCTION_HPP_INCLUDED @@ -561,7 +563,7 @@ public: typedef std::map > mesh_load_map; mesh_load_map mLoadingMeshes[4]; - typedef boost::unordered_map skin_map; + typedef absl::node_hash_map skin_map; skin_map mSkinMap; typedef std::map decomposition_map; diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index f0ca03ab7..42f9f5083 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -2002,13 +2002,13 @@ LLViewerObject *LLViewerObjectList::createObjectViewer(const LLPCode pcode, LLVi return NULL; } - mUUIDObjectMap[fullid] = objectp; + mUUIDObjectMap.insert_or_assign(fullid, objectp); if(objectp->isAvatar()) { LLVOAvatar *pAvatar = dynamic_cast(objectp); if(pAvatar) { - mUUIDAvatarMap[fullid] = pAvatar; + mUUIDAvatarMap.insert_or_assign(fullid, pAvatar); // if (LLFloaterIMPanel* im = find_im_floater(fullid)) im->addDynamicFocus(); @@ -2052,13 +2052,13 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe regionp->addToCreatedList(local_id); } - mUUIDObjectMap[fullid] = objectp; + mUUIDObjectMap.insert_or_assign(fullid, objectp); if(objectp->isAvatar()) { LLVOAvatar *pAvatar = dynamic_cast(objectp); if(pAvatar) { - mUUIDAvatarMap[fullid] = pAvatar; + mUUIDAvatarMap.insert_or_assign(fullid, pAvatar); // if (LLFloaterIMPanel* im = find_im_floater(fullid)) im->addDynamicFocus(); diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index aa86c5c5c..6ff21d3e5 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -36,6 +36,8 @@ #include #include +#include "absl/container/flat_hash_map.h" + // common includes #include "llstat.h" #include "llstring.h" @@ -219,8 +221,8 @@ public: uuid_set_t mDeadObjects; - boost::unordered_map > mUUIDObjectMap; - boost::unordered_map > mUUIDAvatarMap; + absl::flat_hash_map > mUUIDObjectMap; + absl::flat_hash_map > mUUIDAvatarMap; //set of objects that need to update their cost uuid_set_t mStaleObjectCost; @@ -272,8 +274,8 @@ extern LLViewerObjectList gObjectList; // Inlines inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) const { - boost::unordered_map >::const_iterator iter = mUUIDObjectMap.find(id); - if(iter != mUUIDObjectMap.end()) + auto iter = mUUIDObjectMap.find(id); + if(iter != mUUIDObjectMap.cend()) { return iter->second; } @@ -285,8 +287,8 @@ inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) const inline LLVOAvatar *LLViewerObjectList::findAvatar(const LLUUID &id) const { - boost::unordered_map >::const_iterator iter = mUUIDAvatarMap.find(id); - return (iter != mUUIDAvatarMap.end()) ? iter->second.get() : NULL; + auto iter = mUUIDAvatarMap.find(id); + return (iter != mUUIDAvatarMap.cend()) ? iter->second.get() : NULL; } inline LLViewerObject *LLViewerObjectList::getObject(const S32 index) From bcadee85754d1ab7e0391e29c47c5b2a787c2254 Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Mon, 7 Oct 2019 12:40:30 -0400 Subject: [PATCH 7/7] Apply a lil alchemy blackmagic --- indra/llmath/llmatrix3a.h | 10 ++++++---- indra/llmath/llmatrix4a.h | 16 +++++++++++++--- indra/llmath/llplane.h | 5 +++-- indra/llmath/llquaternion2.h | 5 +++-- indra/llmath/llsimdtypes.h | 11 ++++++----- indra/llmath/llvector4a.h | 7 ++++++- indra/llmath/llvector4logical.h | 4 +++- indra/newview/llface.cpp | 4 ---- indra/newview/pipeline.cpp | 2 ++ 9 files changed, 42 insertions(+), 22 deletions(-) diff --git a/indra/llmath/llmatrix3a.h b/indra/llmath/llmatrix3a.h index 40632644b..933a15081 100644 --- a/indra/llmath/llmatrix3a.h +++ b/indra/llmath/llmatrix3a.h @@ -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::value, "LLMatrix3a must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLMatrix3a must be a standard layout type"); -static_assert(std::is_trivially_copyable::value, "LLMatrix3a must be a trivially copyable type"); -static_assert(std::is_trivially_copyable::value, "LLRotation must be a trivially copyable type"); +static_assert(std::is_trivial::value, "LLRotation must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLRotation must be a standard layout type"); #endif diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index 301fec84d..29298886e 100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h @@ -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::value, "LLMatrix4a must be a trivially copyable type"); +static_assert(std::is_trivial::value, "LLMatrix4a must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLMatrix4a must be a standard layout type"); #endif diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index 0cbf02c83..b7dafd96f 100644 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h @@ -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::value, "LLPlane must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLPlane must be a standard layout type"); #endif // LL_LLPLANE_H diff --git a/indra/llmath/llquaternion2.h b/indra/llmath/llquaternion2.h index 6d616a9b3..8546c6b42 100644 --- a/indra/llmath/llquaternion2.h +++ b/indra/llmath/llquaternion2.h @@ -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::value, "LLQuaternion2 must be a trivially copyable type"); +static_assert(std::is_trivial::value, "LLQuaternion2 must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLQuaternion2 must be a standard layout type"); #endif diff --git a/indra/llmath/llsimdtypes.h b/indra/llmath/llsimdtypes.h index 86430b917..72f65a9d8 100644 --- a/indra/llmath/llsimdtypes.h +++ b/indra/llmath/llsimdtypes.h @@ -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(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::value, "LLBool32 must be a trivially copyable type"); -static_assert(std::is_trivially_copyable::value, "LLSimdScalar must be a trivially copyable type"); +static_assert(std::is_trivial::value, "LLBool32 must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLBool32 must be a standard layout type"); +static_assert(std::is_trivial::value, "LLSimdScalar must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLSimdScalar must be a standard layout type"); #endif //LL_SIMD_TYPES_H diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 04e2de2e2..9e5b269e4 100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h @@ -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::value, "LLVector4a must be a trivially copyable type"); +static_assert(std::is_trivial::value, "LLVector4a must be a be a trivial type"); +static_assert(std::is_standard_layout::value, "LLVector4a must be a standard layout type"); #endif diff --git a/indra/llmath/llvector4logical.h b/indra/llmath/llvector4logical.h index 5e2cc413b..46b92a7b3 100644 --- a/indra/llmath/llvector4logical.h +++ b/indra/llmath/llvector4logical.h @@ -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::value, "LLVector4Logical must be a trivial type"); +static_assert(std::is_standard_layout::value, "LLVector4Logical must be a standard layout type"); #endif //LL_VECTOR4ALOGICAL_H diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 8cde987a9..c0271b306 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -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; - // 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])); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 2fc5c822f..a68b191ca 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -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;