diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index e92680f9b45309c878905b8c1509b9fe2f0d26db..9fe89a91fe17f5718d74c7ea49b7431cfd9f9bd8 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1949,14 +1949,14 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (sShaderLevel > 0) { auto& mesh_cache = avatar->getRiggedMatrixCache(); - auto& mesh_id = skin->mMeshID; - auto rigged_matrix_data_iter = std::find_if(mesh_cache.begin(), mesh_cache.end(), [&mesh_id](const auto& entry) { return entry.first == mesh_id; }); + const auto& mesh_id = skin->mMeshID; + const auto& rigged_matrix_data_iter = mesh_cache.find(mesh_id); if (rigged_matrix_data_iter != mesh_cache.cend() && (!avatar->isSelf() || !avatar->isEditingAppearance())) { LLDrawPoolAvatar::sVertexProgram->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX, rigged_matrix_data_iter->second.first, FALSE, - (GLfloat*) rigged_matrix_data_iter->second.second.data()); + (GLfloat*)rigged_matrix_data_iter->second.second.data()); stop_glerror(); } @@ -1969,7 +1969,8 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) stop_glerror(); - std::array<F32, LL_MAX_JOINTS_PER_MESH_OBJECT * 12> mp; + std::vector<F32> mp; + mp.reserve(count * 12); for (U32 i = 0; i < count; ++i) { @@ -1992,12 +1993,11 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) mp[idx + 10] = m[10]; mp[idx + 11] = m[14]; } - mesh_cache.emplace_back(std::make_pair(skin->mMeshID, std::make_pair(count, mp))); LLDrawPoolAvatar::sVertexProgram->uniformMatrix3x4fv(LLViewerShaderMgr::AVATAR_MATRIX, count, FALSE, (GLfloat*) mp.data()); - + mesh_cache.emplace(mesh_id, std::make_pair(count, std::move(mp))); stop_glerror(); } } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 949816b216a60a82f48934ce0942286bda456e87..8f284f4a57c422955f880424d6f0636e569ab33a 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -1091,8 +1091,8 @@ protected: // Shared with LLVOAvatarSelf *******************************************************************************/ public: - typedef std::array<F32, LL_MAX_JOINTS_PER_MESH_OBJECT * 12> rigged_matrix_array_t; - typedef std::vector <std::pair< LLUUID, std::pair<U32, rigged_matrix_array_t> > > rigged_transformation_cache_t; + typedef std::vector<F32> rigged_matrix_array_t; + typedef absl::flat_hash_map<LLUUID, std::pair<U32, rigged_matrix_array_t> > rigged_transformation_cache_t; auto& getRiggedMatrixCache() { return mRiggedMatrixDataCache;