summaryrefslogtreecommitdiff
path: root/indra/newview/llmeshrepository.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-xindra/newview/llmeshrepository.cpp67
1 files changed, 54 insertions, 13 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index d2f76eceb0..a2b0ac09af 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -470,7 +470,12 @@ LLMeshRepoThread::LLMeshRepoThread()
LLMeshRepoThread::~LLMeshRepoThread()
{
-
+ delete mMutex;
+ mMutex = NULL;
+ delete mHeaderMutex;
+ mHeaderMutex = NULL;
+ delete mSignal;
+ mSignal = NULL;
}
void LLMeshRepoThread::run()
@@ -573,6 +578,11 @@ void LLMeshRepoThread::run()
}
}
+ if (mSignal->isLocked())
+ { //make sure to let go of the mutex associated with the given signal before shutting down
+ mSignal->unlock();
+ }
+
res = LLConvexDecomposition::quitThread();
if (res != LLCD_OK)
{
@@ -580,7 +590,7 @@ void LLMeshRepoThread::run()
}
delete mCurlRequest;
- delete mMutex;
+ mCurlRequest = NULL;
}
void LLMeshRepoThread::loadMeshSkinInfo(const LLUUID& mesh_id)
@@ -2115,13 +2125,24 @@ void LLMeshRepository::init()
void LLMeshRepository::shutdown()
{
- mThread->mSignal->signal();
+ llinfos << "Shutting down mesh repository." << llendl;
+ mThread->mSignal->signal();
+
+ while (!mThread->isStopped())
+ {
+ apr_sleep(10);
+ }
delete mThread;
mThread = NULL;
for (U32 i = 0; i < mUploads.size(); ++i)
{
+ llinfos << "Waiting for pending mesh upload " << i << "/" << mUploads.size() << llendl;
+ while (!mUploads[i]->isStopped())
+ {
+ apr_sleep(10);
+ }
delete mUploads[i];
}
@@ -2130,9 +2151,11 @@ void LLMeshRepository::shutdown()
delete mMeshMutex;
mMeshMutex = NULL;
+ llinfos << "Shutting down decomposition system." << llendl;
+
if (mDecompThread)
{
- mDecompThread->shutdown();
+ mDecompThread->shutdown();
delete mDecompThread;
mDecompThread = NULL;
}
@@ -2160,7 +2183,7 @@ S32 LLMeshRepository::update()
return size ;
}
-S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail)
+S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail, S32 last_lod)
{
if (detail < 0 || detail > 4)
{
@@ -2201,7 +2224,19 @@ S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_para
if (group)
{
- //first see what the next lowest LOD available might be
+ //first, see if last_lod is available (don't transition down to avoid funny popping a la SH-641)
+ if (last_lod >= 0)
+ {
+ LLVolume* lod = group->refLOD(last_lod);
+ if (lod && !lod->isTetrahedron() && lod->getNumVolumeFaces() > 0)
+ {
+ group->derefLOD(lod);
+ return last_lod;
+ }
+ group->derefLOD(lod);
+ }
+
+ //next, see what the next lowest LOD available might be
for (S32 i = detail-1; i >= 0; --i)
{
LLVolume* lod = group->refLOD(i);
@@ -2299,7 +2334,7 @@ void LLMeshRepository::notifyLoadedMeshes()
if (gAgent.getRegion())
{ //update capability url
- if (gAgent.getRegion()->getName() != region_name)
+ if (gAgent.getRegion()->getName() != region_name && gAgent.getRegion()->capabilitiesReceived())
{
region_name = gAgent.getRegion()->getName();
@@ -3118,6 +3153,11 @@ LLPhysicsDecomp::LLPhysicsDecomp()
LLPhysicsDecomp::~LLPhysicsDecomp()
{
shutdown();
+
+ delete mSignal;
+ mSignal = NULL;
+ delete mMutex;
+ mMutex = NULL;
}
void LLPhysicsDecomp::shutdown()
@@ -3127,9 +3167,9 @@ void LLPhysicsDecomp::shutdown()
mQuitting = true;
mSignal->signal();
- while (!mDone)
+ while (!isStopped())
{
- apr_sleep(100);
+ apr_sleep(10);
}
}
}
@@ -3507,10 +3547,11 @@ void LLPhysicsDecomp::run()
decomp->quitThread();
- //delete mSignal;
- delete mMutex;
- mSignal = NULL;
- mMutex = NULL;
+ if (mSignal->isLocked())
+ { //let go of mSignal's associated mutex
+ mSignal->unlock();
+ }
+
mDone = true;
}