From 0004f418f4716c1d0fc1277b1ea2a7c7ed6689dd Mon Sep 17 00:00:00 2001 From: Graham Madarasz Date: Fri, 24 May 2013 04:46:18 -0700 Subject: NORSPEC-210 fix issues with the map used to store TE-specific registrations which was only invoking the CB for the last TE on log-in by replacing std::map with boost::unordered_map --- indra/newview/llmaterialmgr.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 0c030623ba..8a2a9be255 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -88,23 +88,32 @@ protected: #if USE_TE_SPECIFIC_REGISTRATION // struct for TE-specific material ID query - struct TEMaterialPair + class TEMaterialPair { + public: + U32 te; LLMaterialID materialID; - }; - // needed for std::map compliance only - // + bool operator==(const TEMaterialPair& b) const { return (materialID == b.materialID) && (te == b.te); } + }; + friend inline bool operator<( - const struct LLMaterialMgr::TEMaterialPair& lhs, - const struct LLMaterialMgr::TEMaterialPair& rhs) + const LLMaterialMgr::TEMaterialPair& lhs, + const LLMaterialMgr::TEMaterialPair& rhs) { - return (lhs.materialID < rhs.materialID) ? TRUE : - (lhs.te < rhs.te) ? TRUE : FALSE; + return (lhs.te < rhs.te) ? TRUE : + (lhs.materialID < rhs.materialID); } - typedef std::map get_callback_te_map_t; + struct TEMaterialPairHasher + { + enum { bucket_size = 8 }; + size_t operator()(const TEMaterialPair& key_value) const { return *((size_t*)key_value.materialID.get()); } // cheesy, but effective + bool operator()(const TEMaterialPair& left, const TEMaterialPair& right) const { return left < right; } + }; + + typedef boost::unordered_map get_callback_te_map_t; get_callback_te_map_t mGetTECallbacks; #endif -- cgit v1.2.3