diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-08-23 22:40:17 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2023-08-23 22:40:17 +0300 |
commit | 3d73a10da3e051b232b4ddc89c1463a8b097ca7f (patch) | |
tree | 8b32d955d0628ca1138301177e1413cc419229fd /indra/newview/llmaterialmgr.h | |
parent | 4b5b048cb6280cbd9fd303acd96fce73461d1fb4 (diff) | |
parent | d454512050e636a19e4b7545515dea4f4b1bbf0d (diff) |
Merge branch main (DRTVWR-582) into DRTVWR-567
# Conflicts:
# indra/newview/app_settings/settings.xml
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorymodel.cpp
# indra/newview/llinventoryobserver.cpp
# indra/newview/llinventoryobserver.h
# indra/newview/skins/default/xui/ja/floater_inventory_item_properties.xml
Diffstat (limited to 'indra/newview/llmaterialmgr.h')
-rw-r--r-- | indra/newview/llmaterialmgr.h | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index 843dc66fbc..8f1ec8584b 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -93,7 +93,11 @@ private: bool operator==(const TEMaterialPair& b) const { return (materialID == b.materialID) && (te == b.te); } }; - + + // definitions follow class + friend std::hash<TEMaterialPair>; + friend size_t hash_value(const TEMaterialPair&) noexcept; + friend inline bool operator<( const LLMaterialMgr::TEMaterialPair& lhs, const LLMaterialMgr::TEMaterialPair& rhs) @@ -102,13 +106,6 @@ private: (lhs.materialID < rhs.materialID); } - 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 std::set<LLMaterialID> material_queue_t; typedef std::map<LLUUID, material_queue_t> get_queue_t; typedef std::pair<const LLUUID, LLMaterialID> pending_material_t; @@ -116,7 +113,7 @@ private: typedef std::map<LLMaterialID, get_callback_t*> get_callback_map_t; - typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*, TEMaterialPairHasher> get_callback_te_map_t; + typedef boost::unordered_map<TEMaterialPair, get_callback_te_t*> get_callback_te_map_t; typedef std::set<LLUUID> getall_queue_t; typedef std::map<LLUUID, F64> getall_pending_map_t; typedef std::map<LLUUID, getall_callback_t*> getall_callback_map_t; @@ -146,5 +143,23 @@ private: U32 getMaxEntries(const LLViewerRegion* regionp); }; +// std::hash implementation for TEMaterialPair +namespace std +{ + template<> struct hash<LLMaterialMgr::TEMaterialPair> + { + inline size_t operator()(const LLMaterialMgr::TEMaterialPair& p) const noexcept + { + return size_t((p.te + 1) * p.materialID.getDigest64()); + } + }; +} + +// For use with boost containers. +inline size_t hash_value(const LLMaterialMgr::TEMaterialPair& p) noexcept +{ + return size_t((p.te + 1) * p.materialID.getDigest64()); +} + #endif // LL_LLMATERIALMGR_H |