summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGraham Madarasz <graham@lindenlab.com>2013-05-24 04:46:18 -0700
committerGraham Madarasz <graham@lindenlab.com>2013-05-24 04:46:18 -0700
commit0004f418f4716c1d0fc1277b1ea2a7c7ed6689dd (patch)
tree45f4c5f2f014f0d95784dda5a071cbcf8c86f76f /indra/newview
parent260afbcece7db436af411abcba28495bf99fa08b (diff)
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
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llmaterialmgr.h27
1 files 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<TEMaterialPair, get_callback_te_t*> 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<TEMaterialPair, get_callback_te_t*, TEMaterialPairHasher> get_callback_te_map_t;
get_callback_te_map_t mGetTECallbacks;
#endif