diff options
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 4873eaeabd..861db7fd5d 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1396,6 +1396,7 @@ LLMeshUploadThread::DecompRequest::DecompRequest(LLModel* mdl, LLModel* base_mod { mStage = "single_hull"; mModel = mdl; + mDecompID = &mdl->mDecompID; mBaseModel = base_model; mThread = thread; @@ -2262,6 +2263,9 @@ void LLMeshRepository::notifyLoadedMeshes() mInventoryQ.pop(); } } + + //call completed callbacks on finished decompositions + mDecompThread->notifyCompleted(); if (!mThread->mWaiting) { //curl thread is churning, wait for it to go idle @@ -3229,9 +3233,8 @@ void LLPhysicsDecomp::doDecomposition() mCurRequest->mHullMesh.clear(); mCurRequest->setStatusMessage("FAIL"); - mCurRequest->completed(); - - mCurRequest = NULL; + + completeCurrent(); } else { @@ -3282,13 +3285,33 @@ void LLPhysicsDecomp::doDecomposition() LLMutexLock lock(mMutex); mCurRequest->setStatusMessage("FAIL"); - mCurRequest->completed(); - - mCurRequest = NULL; + completeCurrent(); + } + } +} + +void LLPhysicsDecomp::completeCurrent() +{ + LLMutexLock lock(mMutex); + mCompletedQ.push(mCurRequest); + mCurRequest = NULL; +} + +void LLPhysicsDecomp::notifyCompleted() +{ + if (!mCompletedQ.empty()) + { + LLMutexLock lock(mMutex); + while (!mCompletedQ.empty()) + { + Request* req = mCompletedQ.front(); + req->completed(); + mCompletedQ.pop(); } } } + void make_box(LLPhysicsDecomp::Request * request) { LLVector3 min,max; @@ -3406,18 +3429,17 @@ void LLPhysicsDecomp::doDecompositionSingleHull() { - LLMutexLock lock(mMutex); - mCurRequest->completed(); - mCurRequest = NULL; + completeCurrent(); + } } + void LLPhysicsDecomp::run() { - LLConvexDecomposition::getInstance()->initThread(); - mInited = true; - LLConvexDecomposition* decomp = LLConvexDecomposition::getInstance(); + decomp->initThread(); + mInited = true; static const LLCDStageData* stages = NULL; static S32 num_stages = 0; @@ -3443,6 +3465,13 @@ void LLPhysicsDecomp::run() mRequestQ.pop(); } + S32& id = *(mCurRequest->mDecompID); + if (id == -1) + { + decomp->genDecomposition(id); + } + decomp->bindDecomposition(id); + if (mCurRequest->mStage == "single_hull") { doDecompositionSingleHull(); @@ -3454,7 +3483,7 @@ void LLPhysicsDecomp::run() } } - LLConvexDecomposition::getInstance()->quitThread(); + decomp->quitThread(); //delete mSignal; delete mMutex; |