diff options
author | Dave Parks <davep@lindenlab.com> | 2010-09-02 19:13:48 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-09-02 19:13:48 -0500 |
commit | 7399c39a2fef7ffaa232047bf2ea16ebef682506 (patch) | |
tree | 5dc1a16e2914e7312d2ed3a50bd5b7eca3280534 /indra/newview | |
parent | a32920f627f900e1717959982d942bb54924d4c0 (diff) |
Fix for crash when loading models (Don't hit UI from the main thread). Added asserts to LLFastTimer to verify main thread use only.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llface.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llfloatermodelpreview.h | 2 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 3 |
4 files changed, 23 insertions, 34 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index bac636286e..7c24eb77cd 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -198,18 +198,8 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) mHasMedia = FALSE ; } -static LLFastTimer::DeclareTimer FTM_DESTROY_FACE("Destroy Face"); -static LLFastTimer::DeclareTimer FTM_DESTROY_TEXTURE("Texture"); -static LLFastTimer::DeclareTimer FTM_DESTROY_DRAWPOOL("Drawpool"); -static LLFastTimer::DeclareTimer FTM_DESTROY_TEXTURE_MATRIX("Texture Matrix"); -static LLFastTimer::DeclareTimer FTM_DESTROY_DRAW_INFO("Draw Info"); -static LLFastTimer::DeclareTimer FTM_DESTROY_ATLAS("Atlas"); -static LLFastTimer::DeclareTimer FTM_FACE_DEREF("Deref"); - void LLFace::destroy() { - LLFastTimer t(FTM_DESTROY_FACE); - if (gDebugGL) { gPipeline.checkReferences(this); @@ -217,14 +207,11 @@ void LLFace::destroy() if(mTexture.notNull()) { - LLFastTimer t(FTM_DESTROY_TEXTURE); mTexture->removeFace(this) ; } if (mDrawPoolp) { - LLFastTimer t(FTM_DESTROY_DRAWPOOL); - #if LL_MESH_ENABLED if (this->isState(LLFace::RIGGED) && mDrawPoolp->getType() == LLDrawPool::POOL_AVATAR) { @@ -241,7 +228,6 @@ void LLFace::destroy() if (mTextureMatrix) { - LLFastTimer t(FTM_DESTROY_TEXTURE_MATRIX); delete mTextureMatrix; mTextureMatrix = NULL; @@ -256,22 +242,12 @@ void LLFace::destroy() } } - { - LLFastTimer t(FTM_DESTROY_DRAW_INFO); - setDrawInfo(NULL); - } - - { - LLFastTimer t(FTM_DESTROY_ATLAS); - removeAtlas(); - } + setDrawInfo(NULL); + removeAtlas(); + + mDrawablep = NULL; + mVObjp = NULL; - { - LLFastTimer t(FTM_FACE_DEREF); - mDrawablep = NULL; - mVObjp = NULL; - } - ll_aligned_free_16(mExtents); mExtents = NULL; } diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index a283be7aa7..b0cde6962b 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -557,6 +557,8 @@ void LLFloaterModelPreview::draw() LLFloater::draw(); LLRect r = getRect(); + mModelPreview->update(); + if (!mLoading) { childSetTextArg("status", "[STATUS]", getString("status_idle")); @@ -1813,6 +1815,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloaterModelPreview* fmp mTextureName = 0; mPreviewLOD = 3; mModelLoader = NULL; + mDirty = false; mLODMode[0] = 0; @@ -1881,7 +1884,7 @@ U32 LLModelPreview::calcResourceCost() mFMP->childSetTextArg(info_name[LLModel::LOD_PHYSICS], "[POINTS]", llformat("%d",num_points)); updateStatusMessages(); - + return cost; } @@ -2024,8 +2027,8 @@ void LLModelPreview::loadModelCallback(S32 lod) clearIncompatible(lod); - mResourceCost = calcResourceCost(); - + mDirty = true; + mPreviewTarget = (mModelLoader->mExtents[0] + mModelLoader->mExtents[1]) * 0.5f; mPreviewScale = (mModelLoader->mExtents[1] - mModelLoader->mExtents[0]) * 0.5f; setPreviewTarget(mPreviewScale.magVec()*2.f); @@ -2864,6 +2867,15 @@ void LLModelPreview::genBuffers(S32 lod) } } +void LLModelPreview::update() +{ + if (mDirty) + { + mDirty = false; + mResourceCost = calcResourceCost(); + } +} + //----------------------------------------------------------------------------- // render() //----------------------------------------------------------------------------- diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 1f9de2e2b9..97e681a6a8 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -118,6 +118,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex void setTexture(U32 name) { mTextureName = name; } BOOL render(); + void update(); void genBuffers(S32 lod); void refresh(); void rotate(F32 yaw_radians, F32 pitch_radians); @@ -145,6 +146,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex LLFloaterModelPreview* mFMP; BOOL mNeedsUpdate; + bool mDirty; U32 mTextureName; F32 mCameraDistance; F32 mCameraYaw; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index e8052aa5a0..d4ee7e36e6 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -2367,8 +2367,7 @@ void LLPipeline::markGLRebuild(LLGLUpdate* glu) void LLPipeline::markRebuild(LLSpatialGroup* group, BOOL priority) { LLMemType mt(LLMemType::MTYPE_PIPELINE); - //assert_main_thread(); - + if (group && !group->isDead() && group->mSpatialPartition) { if (group->mSpatialPartition->mPartitionType == LLViewerRegion::PARTITION_HUD) |