Add abseil hashmaps and use in texture list, also fix bugs in texture list insertion
This commit is contained in:
@@ -68,18 +68,18 @@
|
||||
<key>archive</key>
|
||||
<map>
|
||||
<key>hash</key>
|
||||
<string>b95e484e5b6cc0d10da48d3cf0ad37cd</string>
|
||||
<string>b82d5aa8380926240f3415279480c831</string>
|
||||
<key>hash_algorithm</key>
|
||||
<string>md5</string>
|
||||
<key>url</key>
|
||||
<string>http://depot.alchemyviewer.org/pub/packages/common/abseil_cpp-20190327.190862343-common-190862343.tar.bz2</string>
|
||||
<string>https://pkg.alchemyviewer.org/repository/autobuild-external/abseil-cpp/common/abseil_cpp-ac78ffc.1-common-1.tar.bz2</string>
|
||||
</map>
|
||||
<key>name</key>
|
||||
<string>common</string>
|
||||
</map>
|
||||
</map>
|
||||
<key>version</key>
|
||||
<string>20190327.190862343</string>
|
||||
<string>ac78ffc.1</string>
|
||||
</map>
|
||||
<key>apr_suite</key>
|
||||
<map>
|
||||
|
||||
@@ -17,6 +17,7 @@ project(${ROOT_PROJECT_NAME})
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
||||
|
||||
include(Variables)
|
||||
include(00-Common)
|
||||
include(BuildVersion)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
@@ -27,6 +28,9 @@ if (NOT CMAKE_BUILD_TYPE)
|
||||
"Build type. One of: Debug Release RelWithDebInfo" FORCE)
|
||||
endif (NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
include(Abseil-CPP)
|
||||
# Dependencies
|
||||
add_subdirectory(${ABSEIL_SRC_DIR} ${ABSEIL_BIN_DIR})
|
||||
add_subdirectory(cmake)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}aistatemachine)
|
||||
add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
|
||||
|
||||
@@ -39,3 +39,9 @@ set_source_files_properties(${aistatemachine_HEADER_FILES}
|
||||
list(APPEND aistatemachine_SOURCE_FILES ${aistatemachine_HEADER_FILES})
|
||||
|
||||
add_library (aistatemachine ${aistatemachine_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
aistatemachine
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
8
indra/cmake/Abseil-CPP.cmake
Normal file
8
indra/cmake/Abseil-CPP.cmake
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
|
||||
set(BUILD_TESTING OFF)
|
||||
use_prebuilt_binary(abseil-cpp)
|
||||
set(ABSEIL_SRC_DIR ${LIBS_PREBUILT_DIR}/abseil-cpp)
|
||||
set(ABSEIL_BIN_DIR ${CMAKE_BINARY_DIR}/abseil-cpp)
|
||||
|
||||
@@ -8,6 +8,7 @@ set(cmake_SOURCE_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
00-Common.cmake
|
||||
Abseil-CPP.cmake
|
||||
AIStateMachine.cmake
|
||||
APR.cmake
|
||||
Audio.cmake
|
||||
|
||||
@@ -33,3 +33,8 @@ set_source_files_properties(${libndhacd_HEADER_FILES}
|
||||
|
||||
add_library( nd_hacdConvexDecomposition STATIC ${libndhacd_SOURCE_FILES} ${libndhacd_HEADER_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
nd_hacdConvexDecomposition
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -30,3 +30,8 @@ set_source_files_properties(${libpathing_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
add_library(nd_Pathing STATIC ${libpathing_SOURCE_FILES} ${libpathing_HEADER_FILES} )
|
||||
|
||||
target_link_libraries(nd_Pathing
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -81,3 +81,9 @@ set_source_files_properties(${llaudio_HEADER_FILES}
|
||||
list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES})
|
||||
|
||||
add_library (llaudio ${llaudio_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llaudio
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -77,3 +77,9 @@ set_source_files_properties(${llcharacter_HEADER_FILES}
|
||||
list(APPEND llcharacter_SOURCE_FILES ${llcharacter_HEADER_FILES})
|
||||
|
||||
add_library (llcharacter ${llcharacter_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llcharacter
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -4,7 +4,9 @@ project(llcommon)
|
||||
|
||||
include(Cwdebug)
|
||||
include(00-Common)
|
||||
include(Linking)
|
||||
include(LLCommon)
|
||||
include(EXPAT)
|
||||
include(APR)
|
||||
include(Linking)
|
||||
include(Boost)
|
||||
@@ -287,6 +289,8 @@ endif(LLCOMMON_LINK_SHARED)
|
||||
|
||||
target_link_libraries(
|
||||
llcommon
|
||||
PUBLIC
|
||||
absl::hash
|
||||
${BREAKPAD_EXCEPTION_HANDLER_LIBRARIES}
|
||||
${APRUTIL_LIBRARIES}
|
||||
${APR_LIBRARIES}
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <boost/unordered_set.hpp>
|
||||
#include "stdtypes.h"
|
||||
#include "llpreprocessor.h"
|
||||
#include <absl/hash/hash.h>
|
||||
|
||||
class LLMutex;
|
||||
|
||||
@@ -94,6 +95,11 @@ public:
|
||||
bool operator<(const LLUUID &rhs) const;
|
||||
bool operator>(const LLUUID &rhs) const;
|
||||
|
||||
template <typename H>
|
||||
friend H AbslHashValue(H h, const LLUUID& id) {
|
||||
return H::combine_contiguous(std::move(h), id.mData, UUID_BYTES);
|
||||
}
|
||||
|
||||
// xor functions. Useful since any two random uuids xored together
|
||||
// will yield a determinate third random unique id that can be
|
||||
// used as a key in a single uuid that represents 2.
|
||||
@@ -294,24 +300,22 @@ typedef std::set<LLUUID, lluuid_less> uuid_list_t;
|
||||
|
||||
namespace std {
|
||||
template <> struct hash<LLUUID>
|
||||
{
|
||||
public:
|
||||
{
|
||||
size_t operator()(const LLUUID & id) const
|
||||
{
|
||||
return id.hash();
|
||||
return absl::Hash<LLUUID>{}(id);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
template<> class hash<LLUUID>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const LLUUID& id) const
|
||||
template<> struct hash<LLUUID>
|
||||
{
|
||||
return id.hash();
|
||||
}
|
||||
};
|
||||
size_t operator()(const LLUUID& id) const
|
||||
{
|
||||
return absl::Hash<LLUUID>{}(id);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -57,6 +57,8 @@ add_library (llimage ${llimage_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llimage
|
||||
PUBLIC
|
||||
llcommon
|
||||
${JPEG_LIBRARIES}
|
||||
${PNG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
|
||||
@@ -44,6 +44,8 @@ add_library (llimagej2coj ${llimagej2coj_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llimagej2coj
|
||||
PUBLIC
|
||||
llcommon
|
||||
${OPENJPEG_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
@@ -69,3 +69,9 @@ set_source_files_properties(${llinventory_HEADER_FILES}
|
||||
list(APPEND llinventory_SOURCE_FILES ${llinventory_HEADER_FILES})
|
||||
|
||||
add_library (llinventory ${llinventory_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llinventory
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -102,3 +102,9 @@ set_source_files_properties(${llmath_HEADER_FILES}
|
||||
list(APPEND llmath_SOURCE_FILES ${llmath_HEADER_FILES})
|
||||
|
||||
add_library (llmath ${llmath_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llmath
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -219,6 +219,8 @@ add_library (llmessage ${llmessage_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llmessage
|
||||
PUBLIC
|
||||
llcommon
|
||||
${CURL_LIBRARIES}
|
||||
${CARES_LIBRARIES}
|
||||
${CRYPTO_LIBRARIES}
|
||||
|
||||
@@ -58,8 +58,14 @@ list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
|
||||
|
||||
add_library (llplugin ${llplugin_SOURCE_FILES})
|
||||
if(LINUX AND STANDALONE)
|
||||
target_link_libraries (llplugin rt dl)
|
||||
endif(LINUX AND STANDALONE)
|
||||
target_link_libraries (llplugin llcommon rt dl)
|
||||
else()
|
||||
target_link_libraries(
|
||||
llplugin
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory(slplugin)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
project(SLPlugin)
|
||||
|
||||
include(00-Common)
|
||||
include(Linking)
|
||||
include(LLCommon)
|
||||
include(LLPlugin)
|
||||
include(Linking)
|
||||
|
||||
@@ -71,3 +71,9 @@ set_source_files_properties(${llprimitive_HEADER_FILES}
|
||||
list(APPEND llprimitive_SOURCE_FILES ${llprimitive_HEADER_FILES})
|
||||
|
||||
add_library (llprimitive ${llprimitive_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llprimitive
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -84,3 +84,9 @@ endif (DARWIN)
|
||||
list(APPEND llrender_SOURCE_FILES ${llrender_HEADER_FILES})
|
||||
|
||||
add_library (llrender ${llrender_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llrender
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -62,6 +62,8 @@ list(APPEND llvfs_SOURCE_FILES ${llvfs_HEADER_FILES})
|
||||
add_library (llvfs ${llvfs_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(llvfs
|
||||
PUBLIC
|
||||
llcommon
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
)
|
||||
|
||||
@@ -148,4 +148,4 @@ endif (llwindow_HEADER_FILES)
|
||||
${viewer_SOURCE_FILES}
|
||||
)
|
||||
|
||||
target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES})
|
||||
target_link_libraries (llwindow PUBLIC llcommon ${llwindow_LINK_LIBRARIES})
|
||||
|
||||
@@ -40,5 +40,7 @@ add_library (llxml ${llxml_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
llxml
|
||||
PUBLIC
|
||||
llcommon
|
||||
${EXPAT_LIBRARIES}
|
||||
)
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
project(viewer)
|
||||
|
||||
include(00-Common)
|
||||
# DON'T move Linking.cmake to its place in the alphabetized list below: it
|
||||
# sets variables on which the 3p .cmake files depend.
|
||||
include(Linking)
|
||||
|
||||
include(Boost)
|
||||
include(BuildPackagesInfo)
|
||||
include(BuildVersion)
|
||||
@@ -31,7 +35,6 @@ include(LLUI)
|
||||
include(LLVFS)
|
||||
include(LLWindow)
|
||||
include(LLXML)
|
||||
include(Linking)
|
||||
include(NDOF)
|
||||
include(NVAPI)
|
||||
include(OPENAL)
|
||||
@@ -1680,6 +1683,8 @@ target_link_libraries(${VIEWER_BINARY_NAME}
|
||||
${HUNSPELL_LIBRARY}
|
||||
${LLPHYSICSEXTENSIONS_LIBRARIES}
|
||||
${LLAPPEARANCE_LIBRARIES}
|
||||
absl::flat_hash_map
|
||||
absl::node_hash_map
|
||||
)
|
||||
|
||||
if (LINUX)
|
||||
|
||||
@@ -120,6 +120,7 @@ void LLViewerTextureList::doPreloadImages()
|
||||
llassert_always(mInitialized) ;
|
||||
llassert_always(mImageList.empty()) ;
|
||||
llassert_always(mUUIDMap.empty()) ;
|
||||
llassert_always(mUUIDDict.empty());
|
||||
|
||||
// Set the "missing asset" image
|
||||
LLViewerFetchedTexture::sMissingAssetImagep = LLViewerTextureManager::getFetchedTextureFromFile("missing_asset.tga", FTT_LOCAL_FILE, MIPMAP_NO, LLViewerFetchedTexture::BOOST_UI);
|
||||
@@ -692,8 +693,12 @@ void LLViewerTextureList::addImage(LLViewerFetchedTexture *new_image)
|
||||
sNumImages++;
|
||||
|
||||
addImageToList(new_image);
|
||||
mUUIDMap.emplace(image_id, new_image);
|
||||
mUUIDDict.emplace(image_id, new_image);
|
||||
auto ret_pair = mUUIDMap.emplace(image_id, new_image);
|
||||
if (!ret_pair.second)
|
||||
{
|
||||
ret_pair.first->second = new_image;
|
||||
}
|
||||
mUUIDDict.insert_or_assign(image_id, new_image);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
|
||||
const U32 LL_IMAGE_REZ_LOSSLESS_CUTOFF = 128;
|
||||
|
||||
const BOOL MIPMAP_YES = TRUE;
|
||||
@@ -188,8 +190,8 @@ public:
|
||||
private:
|
||||
typedef std::map< LLUUID, LLPointer<LLViewerFetchedTexture> > uuid_map_t;
|
||||
uuid_map_t mUUIDMap;
|
||||
typedef std::unordered_map< LLUUID, LLPointer<LLViewerFetchedTexture>* > uuid_dict_t;
|
||||
uuid_map_t mUUIDDict;
|
||||
typedef absl::flat_hash_map< LLUUID, LLViewerFetchedTexture* > uuid_dict_t;
|
||||
uuid_dict_t mUUIDDict;
|
||||
LLUUID mLastUpdateUUID;
|
||||
LLUUID mLastFetchUUID;
|
||||
|
||||
|
||||
@@ -56,3 +56,9 @@ set_source_files_properties(${statemachine_HEADER_FILES}
|
||||
list(APPEND statemachine_SOURCE_FILES ${statemachine_HEADER_FILES})
|
||||
|
||||
add_library (statemachine ${statemachine_SOURCE_FILES})
|
||||
|
||||
target_link_libraries(
|
||||
statemachine
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -41,3 +41,8 @@ list(APPEND basic_plugin_base_SOURCE_FILES ${basic_plugin_base_HEADER_FILES})
|
||||
add_library(basic_plugin_base
|
||||
${basic_plugin_base_SOURCE_FILES}
|
||||
)
|
||||
|
||||
target_link_libraries(basic_plugin_base
|
||||
PUBLIC
|
||||
llcommon
|
||||
)
|
||||
|
||||
@@ -57,5 +57,7 @@ add_library(media_plugin_base
|
||||
)
|
||||
|
||||
target_link_libraries(media_plugin_base
|
||||
PUBLIC
|
||||
llcommon
|
||||
${BASIC_PLUGIN_BASE_LIBRARIES}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user