diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index c691527c3fedb3a68009260845d9ea94a4f83ff5..9b2f08c88f4b5a97a1ed28e2ef1587571e814681 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -2763,126 +2763,116 @@ void LLMeshRepoThread::notifyLoadedMeshes() return; } - if (!mLoadedQ.empty()) + std::deque<LoadedMesh> loaded_queue; + std::deque<LODRequest> unavil_queue; + std::vector<LLMeshSkinInfo*> skin_info_q; + std::deque<UUIDBasedRequest> skin_info_unavail_q; + std::deque<std::unique_ptr<LLModel::Decomposition>> decomp_q; + std::deque<std::unique_ptr<LLModel::Decomposition>> physics_q; { - std::deque<LoadedMesh> loaded_queue; - LLMutexLock mtx_lock(mMutex); if (!mLoadedQ.empty()) { loaded_queue.swap(mLoadedQ); - mtx_lock.unlock(); - - update_metrics = true; - - // Process the elements free of the lock - for (const auto& mesh : loaded_queue) - { - if (mesh.mVolume && mesh.mVolume->getNumVolumeFaces() > 0) - { - gMeshRepo.notifyMeshLoaded(mesh.mMeshParams, mesh.mVolume); - } - else - { - gMeshRepo.notifyMeshUnavailable(mesh.mMeshParams, - LLVolumeLODGroup::getVolumeDetailFromScale(mesh.mVolume->getDetail())); - } - } } - } - - if (!mUnavailableQ.empty()) - { - std::deque<LODRequest> unavil_queue; - LLMutexLock mtx_lock(mMutex); if (!mUnavailableQ.empty()) { unavil_queue.swap(mUnavailableQ); - mtx_lock.unlock(); - - update_metrics = true; + } - // Process the elements free of the lock - for (const auto& req : unavil_queue) - { - gMeshRepo.notifyMeshUnavailable(req.mMeshParams, req.mLOD); - } + if (!mSkinInfoQ.empty()) + { + skin_info_q.swap(mSkinInfoQ); } - } - if (!mSkinInfoQ.empty()) - { - std::vector<LLMeshSkinInfo*> skin_info_q; + if (!mSkinUnavailableQ.empty()) + { + skin_info_unavail_q.swap(mSkinUnavailableQ); + } - LLMutexTrylock mtx_lock(mMutex); - if (mtx_lock.isLocked() && !mSkinInfoQ.empty()) + if (!mDecompositionQ.empty()) { - skin_info_q.swap(mSkinInfoQ); - mtx_lock.unlock(); + decomp_q.swap(mDecompositionQ); + } - // Process the elements free of the lock - for (auto& skin_info : skin_info_q) - { - gMeshRepo.notifySkinInfoReceived(skin_info); - } + if (!mPhysicsQ.empty()) + { + physics_q.swap(mPhysicsQ); } } - if (!mSkinUnavailableQ.empty()) + + if (!loaded_queue.empty()) { - std::deque<UUIDBasedRequest> skin_info_unavail_q; + update_metrics = true; - LLMutexTrylock mtx_lock(mMutex); - if (mtx_lock.isLocked() && !mSkinUnavailableQ.empty()) + // Process the elements free of the lock + for (const auto& mesh : loaded_queue) { - skin_info_unavail_q.swap(mSkinUnavailableQ); - mtx_lock.unlock(); - - // Process the elements free of the lock - for (const auto& skin_info : skin_info_unavail_q) + if (mesh.mVolume && mesh.mVolume->getNumVolumeFaces() > 0) { - gMeshRepo.notifySkinInfoUnavailable(skin_info.mId); + gMeshRepo.notifyMeshLoaded(mesh.mMeshParams, mesh.mVolume); + } + else + { + gMeshRepo.notifyMeshUnavailable(mesh.mMeshParams, + LLVolumeLODGroup::getVolumeDetailFromScale(mesh.mVolume->getDetail())); } } } - if (!mDecompositionQ.empty()) + if (!unavil_queue.empty()) { - std::deque<std::unique_ptr<LLModel::Decomposition>> decomp_q; + update_metrics = true; - LLMutexTrylock mtx_lock(mMutex); - if (mtx_lock.isLocked() && !mDecompositionQ.empty()) + // Process the elements free of the lock + for (const auto& req : unavil_queue) { - decomp_q.swap(mDecompositionQ); - mtx_lock.unlock(); + gMeshRepo.notifyMeshUnavailable(req.mMeshParams, req.mLOD); + } + } - // Process the elements free of the lock - for (auto& decomp : decomp_q) - { - gMeshRepo.notifyDecompositionReceived(std::move(decomp)); - } + + + if (!skin_info_q.empty()) + { + // Process the elements free of the lock + for (auto& skin_info : skin_info_q) + { + gMeshRepo.notifySkinInfoReceived(skin_info); } } - if (!mPhysicsQ.empty()) + if (!skin_info_unavail_q.empty()) { - std::deque<std::unique_ptr<LLModel::Decomposition>> physics_q; + // Process the elements free of the lock + for (const auto& skin_info : skin_info_unavail_q) + { + gMeshRepo.notifySkinInfoUnavailable(skin_info.mId); + } + } - LLMutexTrylock mtx_lock(mMutex); - if (mtx_lock.isLocked() && !mPhysicsQ.empty()) + if (!decomp_q.empty()) + { + // Process the elements free of the lock + for (auto& decomp : decomp_q) { - physics_q.swap(mPhysicsQ); - mtx_lock.unlock(); + gMeshRepo.notifyDecompositionReceived(std::move(decomp)); + } + } - // Process the elements free of the lock - for (auto& decomp : physics_q) - { - gMeshRepo.notifyPhysicsReceived(std::move(decomp)); - } + + if (!physics_q.empty()) + { + // Process the elements free of the lock + for (auto& decomp : physics_q) + { + gMeshRepo.notifyPhysicsReceived(std::move(decomp)); } } + if (update_metrics) { // Ping time-to-load metrics for mesh download operations.