From f2a97daa0b4bade83a7bcb2314f877e136a1c04b Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Sat, 17 Dec 2022 18:10:05 -0500
Subject: [PATCH] Cleanup std unordered stuff

---
 indra/llrender/llglslshader.h              | 8 ++++----
 indra/llrender/llshadermgr.cpp             | 4 ++--
 indra/llrender/llshadermgr.h               | 2 +-
 indra/newview/llspatialpartition.h         | 6 +++---
 indra/newview/llviewerprecompiledheaders.h | 2 ++
 indra/newview/llviewershadermgr.cpp        | 2 +-
 indra/newview/llvoavatar.cpp               | 4 ++++
 7 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 8689446a4e8..d13959490a1 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -30,7 +30,7 @@
 #include "llgl.h"
 #include "llrender.h"
 #include "llstaticstringtable.h"
-#include <unordered_map>
+#include <boost/unordered/unordered_map.hpp>
 
 class LLShaderFeatures
 {
@@ -272,8 +272,8 @@ class LLGLSLShader
 	U32 mAttributeMask;  //mask of which reserved attributes are set (lines up with LLVertexBuffer::getTypeMask())
 	std::vector<GLint> mUniform;   //lookup table of uniform enum to uniform location
 	LLStaticStringTable<GLint> mUniformMap; //lookup map of uniform name to uniform location
-    typedef std::unordered_map<GLint, std::string> uniform_name_map_t;
-    typedef std::unordered_map<GLint, LLVector4> uniform_value_map_t;
+    typedef boost::unordered_flat_map<GLint, std::string> uniform_name_map_t;
+    typedef boost::unordered_flat_map<GLint, LLVector4> uniform_value_map_t;
     uniform_name_map_t mUniformNameMap; //lookup map of uniform location to uniform name
 	uniform_value_map_t mValue; //lookup map of uniform location to last known value
 	std::vector<GLint> mTexture;
@@ -285,7 +285,7 @@ class LLGLSLShader
 	LLShaderFeatures mFeatures;
 	std::vector< std::pair< std::string, GLenum > > mShaderFiles;
 	std::string mName;
-    typedef std::unordered_map<std::string, std::string> defines_map_t;
+    typedef boost::unordered_map<std::string, std::string> defines_map_t;
 	defines_map_t mDefines;
 
 	//statistcis for profiling shader performance
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 9d9bb0df669..b762c0bd7fd 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -579,7 +579,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string&
 	}
  }
 
-GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels)
+GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, boost::unordered_map<std::string, std::string>* defines, S32 texture_index_channels)
 {
 
 // endsure work-around for missing GLSL funcs gets propogated to feature shader files (e.g. srgbF.glsl)
@@ -775,7 +775,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 	
 	if (defines)
 	{
-		for (std::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
+		for (boost::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
 		{
 			std::string define = "#define " + iter->first + " " + iter->second + "\n";
 			extra_code_text[extra_code_count++] = (GLcharARB *) strdup(define.c_str());
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 809f39124d8..489a179663e 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -244,7 +244,7 @@ class LLShaderMgr
     void dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text);
 	BOOL	linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
 	BOOL	validateProgramObject(GLhandleARB obj);
-	GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1);
+	GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, boost::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1);
 
 	// Implemented in the application to actually point to the shader directory.
 	virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 5544a99fac4..a5db551dd84 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -228,10 +228,10 @@ class LLSpatialGroup final : public LLOcclusionCullingGroup
 	typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t;
 	typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t;
 	typedef std::vector<LLPointer<LLDrawInfo> > drawmap_elem_t; 
-	typedef std::unordered_map<U32, drawmap_elem_t > draw_map_t;	
+	typedef boost::unordered_map<U32, drawmap_elem_t > draw_map_t;	
 	typedef std::vector<LLPointer<LLVertexBuffer> > buffer_list_t;
-	typedef std::unordered_map<LLFace*, buffer_list_t> buffer_texture_map_t;
-	typedef std::unordered_map<U32, buffer_texture_map_t> buffer_map_t;
+	typedef boost::unordered_map<LLFace*, buffer_list_t> buffer_texture_map_t;
+	typedef boost::unordered_map<U32, buffer_texture_map_t> buffer_map_t;
 
 	struct CompareDistanceGreater
 	{
diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h
index 5210df1fd93..26e4967efea 100644
--- a/indra/newview/llviewerprecompiledheaders.h
+++ b/indra/newview/llviewerprecompiledheaders.h
@@ -115,4 +115,6 @@
 #include "llui.h"
 #include "lluictrl.h"
 
+#include "llviewerbuildconfig.h"
+
 #endif
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index b7050ed9913..d0c19c5be67 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -897,7 +897,7 @@ std::string LLViewerShaderMgr::loadBasicShaders()
 	}
 	shaders.push_back( make_pair( "objects/nonindexedTextureV.glsl",        1 ) );
 
-	std::unordered_map<std::string, std::string> attribs;
+	boost::unordered_map<std::string, std::string> attribs;
 	attribs["MAX_JOINTS_PER_MESH_OBJECT"] = 
 		fmt::to_string(LLSkinningUtil::getMaxJointCount());
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index a5e24b80628..d9f6ddd78e5 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -778,6 +778,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 
 S32 LLVOAvatar::getNumBakes() const 
 {
+#if !LL_HAVOK
 	// BAKED_LEFT_ARM is equal to the pre-BOM BAKED_NUM_INDICES
 	if(LLViewerRegion* regionp = getRegion())
 	{
@@ -794,6 +795,9 @@ S32 LLVOAvatar::getNumBakes() const
 	// 				<< LL_ENDL;
 	// fallback, in SL assume BOM, elsewhere assume not.
 	return LLGridManager::instance().isInSecondlife() ? BAKED_NUM_INDICES : BAKED_LEFT_ARM;
+#else
+	return BAKED_NUM_INDICES;
+#endif
 }
 std::string LLVOAvatar::avString() const
 {
-- 
GitLab