Fix for crash when loading models (Don't hit UI from the main thread). Added asserts to LLFastTimer to verify main thread use only.
parent
a32920f627
commit
7399c39a2f
|
|
@ -37,12 +37,17 @@
|
|||
|
||||
#define FAST_TIMER_ON 1
|
||||
#define TIME_FAST_TIMERS 0
|
||||
#define DEBUG_FAST_TIMER_THREADS 1
|
||||
|
||||
class LLMutex;
|
||||
|
||||
#include <queue>
|
||||
#include "llsd.h"
|
||||
|
||||
#if DEBUG_FAST_TIMER_THREADS
|
||||
void assert_main_thread();
|
||||
#endif
|
||||
|
||||
class LL_COMMON_API LLFastTimer
|
||||
{
|
||||
public:
|
||||
|
|
@ -181,6 +186,9 @@ public:
|
|||
#if TIME_FAST_TIMERS
|
||||
U64 timer_end = getCPUClockCount64();
|
||||
sTimerCycles += timer_end - timer_start;
|
||||
#endif
|
||||
#if DEBUG_FAST_TIMER_THREADS
|
||||
assert_main_thread();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,15 @@ U32 ll_thread_local sThreadID = 0;
|
|||
|
||||
U32 LLThread::sIDIter = 0;
|
||||
|
||||
void assert_main_thread()
|
||||
{
|
||||
static U32 s_thread_id = LLThread::currentID();
|
||||
if (LLThread::currentID() != s_thread_id)
|
||||
{
|
||||
llerrs << "Illegal execution outside main thread." << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handed to the APR thread creation function
|
||||
//
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
setDrawInfo(NULL);
|
||||
removeAtlas();
|
||||
|
||||
mDrawablep = NULL;
|
||||
mVObjp = NULL;
|
||||
|
||||
{
|
||||
LLFastTimer t(FTM_DESTROY_ATLAS);
|
||||
removeAtlas();
|
||||
}
|
||||
|
||||
{
|
||||
LLFastTimer t(FTM_FACE_DEREF);
|
||||
mDrawablep = NULL;
|
||||
mVObjp = NULL;
|
||||
}
|
||||
|
||||
ll_aligned_free_16(mExtents);
|
||||
mExtents = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue