Fix infinite growth of mLoadingPhysicsShapes in mesh repository
parent
b82b197d28
commit
fba445762f
|
|
@ -261,6 +261,7 @@
|
||||||
// mDecompositionRequests mMutex rw.repo.mMutex, ro.repo.none [5]
|
// mDecompositionRequests mMutex rw.repo.mMutex, ro.repo.none [5]
|
||||||
// mPhysicsShapeRequests mMutex rw.repo.mMutex, ro.repo.none [5]
|
// mPhysicsShapeRequests mMutex rw.repo.mMutex, ro.repo.none [5]
|
||||||
// mDecompositionQ mMutex rw.repo.mLoadedMutex, rw.main.mLoadedMutex [5] (was: [0])
|
// mDecompositionQ mMutex rw.repo.mLoadedMutex, rw.main.mLoadedMutex [5] (was: [0])
|
||||||
|
// mPhysicsQ mMutex rw.repo.mLoadedMutex, rw.main.mLoadedMutex [5] (was: [0])
|
||||||
// mHeaderReqQ mMutex ro.repo.none [5], rw.repo.mMutex, rw.any.mMutex
|
// mHeaderReqQ mMutex ro.repo.none [5], rw.repo.mMutex, rw.any.mMutex
|
||||||
// mLODReqQ mMutex ro.repo.none [5], rw.repo.mMutex, rw.any.mMutex
|
// mLODReqQ mMutex ro.repo.none [5], rw.repo.mMutex, rw.any.mMutex
|
||||||
// mUnavailableQ mMutex rw.repo.none [0], ro.main.none [5], rw.main.mLoadedMutex
|
// mUnavailableQ mMutex rw.repo.none [0], ro.main.none [5], rw.main.mLoadedMutex
|
||||||
|
|
@ -1014,6 +1015,12 @@ LLMeshRepoThread::~LLMeshRepoThread()
|
||||||
mDecompositionQ.pop_front();
|
mDecompositionQ.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!mPhysicsQ.empty())
|
||||||
|
{
|
||||||
|
delete mPhysicsQ.front();
|
||||||
|
mPhysicsQ.pop_front();
|
||||||
|
}
|
||||||
|
|
||||||
delete mHttpRequest;
|
delete mHttpRequest;
|
||||||
mHttpRequest = nullptr;
|
mHttpRequest = nullptr;
|
||||||
delete mMutex;
|
delete mMutex;
|
||||||
|
|
@ -2672,7 +2679,7 @@ EMeshProcessingResult LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_
|
||||||
|
|
||||||
{
|
{
|
||||||
LLMutexLock lock(mLoadedMutex);
|
LLMutexLock lock(mLoadedMutex);
|
||||||
mDecompositionQ.push_back(d);
|
mPhysicsQ.push_back(d);
|
||||||
}
|
}
|
||||||
return MESH_OK;
|
return MESH_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -3548,13 +3555,14 @@ void LLMeshRepoThread::notifyLoadedMeshes()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mSkinInfoQ.empty() || !mSkinUnavailableQ.empty() || ! mDecompositionQ.empty())
|
if (!mSkinInfoQ.empty() || !mSkinUnavailableQ.empty() || !mDecompositionQ.empty() || !mPhysicsQ.empty())
|
||||||
{
|
{
|
||||||
if (mLoadedMutex->trylock())
|
if (mLoadedMutex->trylock())
|
||||||
{
|
{
|
||||||
std::deque<LLPointer<LLMeshSkinInfo>> skin_info_q;
|
std::deque<LLPointer<LLMeshSkinInfo>> skin_info_q;
|
||||||
std::deque<UUIDBasedRequest> skin_info_unavail_q;
|
std::deque<UUIDBasedRequest> skin_info_unavail_q;
|
||||||
std::list<LLModel::Decomposition*> decomp_q;
|
std::list<LLModel::Decomposition*> decomp_q;
|
||||||
|
std::list<LLModel::Decomposition*> physics_q;
|
||||||
|
|
||||||
if (! mSkinInfoQ.empty())
|
if (! mSkinInfoQ.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -3571,6 +3579,11 @@ void LLMeshRepoThread::notifyLoadedMeshes()
|
||||||
decomp_q.swap(mDecompositionQ);
|
decomp_q.swap(mDecompositionQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mPhysicsQ.empty())
|
||||||
|
{
|
||||||
|
physics_q.swap(mPhysicsQ);
|
||||||
|
}
|
||||||
|
|
||||||
mLoadedMutex->unlock();
|
mLoadedMutex->unlock();
|
||||||
|
|
||||||
// Process the elements free of the lock
|
// Process the elements free of the lock
|
||||||
|
|
@ -3587,9 +3600,15 @@ void LLMeshRepoThread::notifyLoadedMeshes()
|
||||||
|
|
||||||
while (! decomp_q.empty())
|
while (! decomp_q.empty())
|
||||||
{
|
{
|
||||||
gMeshRepo.notifyDecompositionReceived(decomp_q.front());
|
gMeshRepo.notifyDecompositionReceived(decomp_q.front(), false);
|
||||||
decomp_q.pop_front();
|
decomp_q.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!physics_q.empty())
|
||||||
|
{
|
||||||
|
gMeshRepo.notifyDecompositionReceived(physics_q.front(), true);
|
||||||
|
physics_q.pop_front();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4902,13 +4921,13 @@ void LLMeshRepository::notifySkinInfoUnavailable(const LLUUID& mesh_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLMeshRepository::notifyDecompositionReceived(LLModel::Decomposition* decomp)
|
void LLMeshRepository::notifyDecompositionReceived(LLModel::Decomposition* decomp, bool physics_mesh)
|
||||||
{
|
{
|
||||||
decomposition_map::iterator iter = mDecompositionMap.find(decomp->mMeshID);
|
LLUUID decomp_id = decomp->mMeshID; // Copy to avoid invalidation in below deletion
|
||||||
|
decomposition_map::iterator iter = mDecompositionMap.find(decomp_id);
|
||||||
if (iter == mDecompositionMap.end())
|
if (iter == mDecompositionMap.end())
|
||||||
{ //just insert decomp into map
|
{ //just insert decomp into map
|
||||||
mDecompositionMap[decomp->mMeshID] = decomp;
|
mDecompositionMap[decomp_id] = decomp;
|
||||||
mLoadingDecompositions.erase(decomp->mMeshID);
|
|
||||||
sCacheBytesDecomps += decomp->sizeBytes();
|
sCacheBytesDecomps += decomp->sizeBytes();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -4916,10 +4935,17 @@ void LLMeshRepository::notifyDecompositionReceived(LLModel::Decomposition* decom
|
||||||
sCacheBytesDecomps -= iter->second->sizeBytes();
|
sCacheBytesDecomps -= iter->second->sizeBytes();
|
||||||
iter->second->merge(decomp);
|
iter->second->merge(decomp);
|
||||||
sCacheBytesDecomps += iter->second->sizeBytes();
|
sCacheBytesDecomps += iter->second->sizeBytes();
|
||||||
|
|
||||||
mLoadingDecompositions.erase(decomp->mMeshID);
|
|
||||||
delete decomp;
|
delete decomp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (physics_mesh)
|
||||||
|
{
|
||||||
|
mLoadingPhysicsShapes.erase(decomp_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mLoadingDecompositions.erase(decomp_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLMeshRepository::notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVolume* volume, S32 lod)
|
void LLMeshRepository::notifyMeshLoaded(const LLVolumeParams& mesh_params, LLVolume* volume, S32 lod)
|
||||||
|
|
@ -5066,7 +5092,6 @@ void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id)
|
||||||
std::unordered_set<LLUUID>::iterator iter = mLoadingPhysicsShapes.find(mesh_id);
|
std::unordered_set<LLUUID>::iterator iter = mLoadingPhysicsShapes.find(mesh_id);
|
||||||
if (iter == mLoadingPhysicsShapes.end())
|
if (iter == mLoadingPhysicsShapes.end())
|
||||||
{ //no request pending for this skin info
|
{ //no request pending for this skin info
|
||||||
// *FIXME: Nothing ever deletes entries, can't be right
|
|
||||||
mLoadingPhysicsShapes.insert(mesh_id);
|
mLoadingPhysicsShapes.insert(mesh_id);
|
||||||
mPendingPhysicsShapeRequests.push(mesh_id);
|
mPendingPhysicsShapeRequests.push(mesh_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -531,6 +531,9 @@ public:
|
||||||
// list of completed Decomposition info requests
|
// list of completed Decomposition info requests
|
||||||
std::list<LLModel::Decomposition*> mDecompositionQ;
|
std::list<LLModel::Decomposition*> mDecompositionQ;
|
||||||
|
|
||||||
|
// list of completed Physics Mesh info requests
|
||||||
|
std::list<LLModel::Decomposition*> mPhysicsQ;
|
||||||
|
|
||||||
//queue of requested headers
|
//queue of requested headers
|
||||||
std::queue<HeaderRequest> mHeaderReqQ;
|
std::queue<HeaderRequest> mHeaderReqQ;
|
||||||
|
|
||||||
|
|
@ -886,7 +889,7 @@ public:
|
||||||
void notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 request_lod, S32 volume_lod);
|
void notifyMeshUnavailable(const LLVolumeParams& mesh_params, S32 request_lod, S32 volume_lod);
|
||||||
void notifySkinInfoReceived(LLMeshSkinInfo* info);
|
void notifySkinInfoReceived(LLMeshSkinInfo* info);
|
||||||
void notifySkinInfoUnavailable(const LLUUID& info);
|
void notifySkinInfoUnavailable(const LLUUID& info);
|
||||||
void notifyDecompositionReceived(LLModel::Decomposition* info);
|
void notifyDecompositionReceived(LLModel::Decomposition* info, bool physics_mesh);
|
||||||
|
|
||||||
S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
|
S32 getActualMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
|
||||||
static S32 getActualMeshLOD(LLMeshHeader& header, S32 lod);
|
static S32 getActualMeshLOD(LLMeshHeader& header, S32 lod);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue