From c0ba626c8009b22310b3923e8170e5db2a021253 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 15 Oct 2012 21:34:29 -0600 Subject: For SH-3333: Design and implement a new object cache system on viewer side --- indra/newview/lldrawable.cpp | 349 +++++++++++++++++++++---------------------- 1 file changed, 170 insertions(+), 179 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 46ec1abec1..e29551e83c 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -49,6 +49,7 @@ #include "llspatialpartition.h" #include "llviewerobjectlist.h" #include "llviewerwindow.h" +#include "llvocache.h" const F32 MIN_INTERPOLATE_DISTANCE_SQUARED = 0.001f * 0.001f; const F32 MAX_INTERPOLATE_DISTANCE_SQUARED = 10.f * 10.f; @@ -75,7 +76,6 @@ extern bool gShiftFrame; // // static -U32 LLDrawable::sCurVisible = 0; U32 LLDrawable::sNumZombieDrawables = 0; F32 LLDrawable::sCurPixelAngle = 0; LLDynamicArrayPtr > LLDrawable::sDeadList; @@ -85,33 +85,59 @@ LLDynamicArrayPtr > LLDrawable::sDeadList; // static void LLDrawable::incrementVisible() { - sCurVisible++; + LLViewerOctreeEntryData::incrementVisible(); sCurPixelAngle = (F32) gViewerWindow->getWindowHeightRaw()/LLViewerCamera::getInstance()->getView(); } -void LLDrawable::init() +LLDrawable::LLDrawable(LLViewerObject *vobj, bool new_entry) + : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE), + mVObjp(vobj) +{ + init(new_entry); +} + +void LLDrawable::init(bool new_entry) { // mXform mParent = NULL; mRenderType = 0; mCurrentScale = LLVector3(1,1,1); - mDistanceWRTCamera = 0.0f; - mPositionGroup.clear(); - mExtents[0].clear(); - mExtents[1].clear(); - + mDistanceWRTCamera = 0.0f; mState = 0; - mVObjp = NULL; - // mFaces - mSpatialGroupp = NULL; - mVisible = sCurVisible - 2;//invisible for the current frame and the last frame. - mRadius = 0.f; - mGeneration = -1; - mBinRadius = 1.f; - mBinIndex = -1; - + // mFaces + mRadius = 0.f; + mGeneration = -1; mSpatialBridge = NULL; + + LLViewerOctreeEntry* entry = NULL; + LLVOCacheEntry* vo_entry = NULL; + if(!new_entry && mVObjp && getRegion() != NULL) + { + vo_entry = getRegion()->getCacheEntryForOctree(mVObjp->getLocalID()); + if(vo_entry) + { + entry = vo_entry->getEntry(); + } + } + setOctreeEntry(entry); + if(vo_entry) + { + if(!entry) + { + vo_entry->setOctreeEntry(mEntry); + } + else if(vo_entry->getNumOfChildren() > 0) + { + getRegion()->addVisibleCacheEntry(vo_entry); //to load all children. + } + + getRegion()->addActiveCacheEntry(vo_entry); + } + + llassert(!vo_entry || vo_entry->getEntry() == mEntry); + + initVisible(sCurVisible - 2);//invisible for the current frame and the last frame. } // static @@ -155,6 +181,7 @@ void LLDrawable::markDead() llwarns << "Warning! Marking dead multiple times!" << llendl; return; } + setState(DEAD); if (mSpatialBridge) { @@ -164,8 +191,7 @@ void LLDrawable::markDead() sNumZombieDrawables++; - // We're dead. Free up all of our references to other objects - setState(DEAD); + // We're dead. Free up all of our references to other objects cleanupReferences(); // sDeadList.put(this); } @@ -219,6 +245,8 @@ void LLDrawable::cleanupReferences() gPipeline.unlinkDrawable(this); + removeFromOctree(); + { LLFastTimer t(FTM_DEREF_DRAWABLE); // Cleanup references to other objects @@ -227,6 +255,21 @@ void LLDrawable::cleanupReferences() } } +void LLDrawable::removeFromOctree() +{ + if(!mEntry) + { + return; + } + + mEntry->removeData(this); + if(mEntry->hasVOCacheEntry()) + { + getRegion()->removeActiveCacheEntry((LLVOCacheEntry*)mEntry->getVOCacheEntry(), this); + } + mEntry = NULL; +} + void LLDrawable::cleanupDeadDrawables() { /* @@ -715,7 +758,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) LLVOVolume* volume = getVOVolume(); if (volume) { - if (getSpatialGroup()) + if (getGroup()) { pos.set(getPositionGroup().getF32ptr()); } @@ -833,9 +876,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) } } - mExtents[0].add(shift_vector); - mExtents[1].add(shift_vector); - mPositionGroup.add(shift_vector); + shift(shift_vector); } else if (mSpatialBridge) { @@ -843,9 +884,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) } else if (isAvatar()) { - mExtents[0].add(shift_vector); - mExtents[1].add(shift_vector); - mPositionGroup.add(shift_vector); + shift(shift_vector); } mVObjp->onShift(shift_vector); @@ -857,40 +896,24 @@ const LLVector3& LLDrawable::getBounds(LLVector3& min, LLVector3& max) const return mXform.getPositionW(); } -const LLVector4a* LLDrawable::getSpatialExtents() const -{ - return mExtents; -} - -void LLDrawable::setSpatialExtents(const LLVector3& min, const LLVector3& max) -{ - mExtents[0].load3(min.mV); - mExtents[1].load3(max.mV); -} - -void LLDrawable::setSpatialExtents(const LLVector4a& min, const LLVector4a& max) -{ - mExtents[0] = min; - mExtents[1] = max; -} - -void LLDrawable::setPositionGroup(const LLVector4a& pos) -{ - mPositionGroup = pos; -} - void LLDrawable::updateSpatialExtents() { if (mVObjp) { - mVObjp->updateSpatialExtents(mExtents[0], mExtents[1]); + const LLVector4a* exts = getSpatialExtents(); + LLVector4a extents[2]; + extents[0] = exts[0]; + extents[1] = exts[1]; + + mVObjp->updateSpatialExtents(extents[0], extents[1]); + setSpatialExtents(extents[0], extents[1]); } updateBinRadius(); if (mSpatialBridge.notNull()) { - mPositionGroup.splat(0.f); + getGroupPosition().splat(0.f); } } @@ -899,11 +922,11 @@ void LLDrawable::updateBinRadius() { if (mVObjp.notNull()) { - mBinRadius = llmin(mVObjp->getBinRadius(), 256.f); + setBinRadius(llmin(mVObjp->getBinRadius(), 256.f)); } else { - mBinRadius = llmin(getRadius()*4.f, 256.f); + setBinRadius(llmin(getRadius()*4.f, 256.f)); } } @@ -937,20 +960,48 @@ void LLDrawable::updateUVMinMax() { } -LLSpatialGroup* LLDrawable::getSpatialGroup() const -{ - llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1); - return mSpatialGroupp; +//virtual +bool LLDrawable::isVisible() const +{ + if (LLViewerOctreeEntryData::isVisible()) + { + return true; + } + + { + LLviewerOctreeGroup* group = mEntry->getGroup(); + if (group && group->isVisible()) + { + LLViewerOctreeEntryData::setVisible(); + return true; + } + } + + return false; } -void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) +//virtual +bool LLDrawable::isRecentlyVisible() const { -/*if (mSpatialGroupp && (groupp != mSpatialGroupp)) + //currently visible or visible in the previous frame. + bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); + + if(!vis) { - mSpatialGroupp->setState(LLSpatialGroup::GEOM_DIRTY); - }*/ + LLviewerOctreeGroup* group = getGroup(); + if (group && group->isRecentlyVisible()) + { + LLViewerOctreeEntryData::setVisible(); + vis = TRUE ; + } + } + + return vis ; +} - if (mSpatialGroupp != groupp && getVOVolume()) +void LLDrawable::setGroup(LLviewerOctreeGroup *groupp) +{ + if (getGroup() != groupp && getVOVolume()) { //NULL out vertex buffer references for volumes on spatial group change to maintain //requirement that every face vertex buffer is either NULL or points to a vertex buffer //contained by its drawable's spatial group @@ -964,9 +1015,7 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp) } } - mSpatialGroupp = groupp; - - llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1); + LLViewerOctreeEntryData::setGroup(groupp); } LLSpatialPartition* LLDrawable::getSpatialPartition() @@ -985,11 +1034,11 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() { if (mVObjp->isHUDAttachment()) { - setSpatialBridge(new LLHUDBridge(this)); + setSpatialBridge(new LLHUDBridge(this, getRegion())); } else { - setSpatialBridge(new LLVolumeBridge(this)); + setSpatialBridge(new LLVolumeBridge(this, getRegion())); } } return mSpatialBridge->asPartition(); @@ -1008,89 +1057,26 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() return retval; } -const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. -//static -S32 LLDrawable::getMinVisFrameRange() +//virtual +S32 LLDrawable::getMinVisFrameRange() const { - return MIN_VIS_FRAME_RANGE ; -} - -BOOL LLDrawable::isRecentlyVisible() const -{ - //currently visible or visible in the previous frame. - BOOL vis = isVisible() || (sCurVisible - mVisible < MIN_VIS_FRAME_RANGE) ; - - if(!vis) - { - LLSpatialGroup* group = getSpatialGroup(); - if (group && group->isRecentlyVisible()) - { - mVisible = sCurVisible; - vis = TRUE ; - } - } - - return vis ; -} - -BOOL LLDrawable::isVisible() const -{ - if (mVisible == sCurVisible) - { - return TRUE; - } - -#if 0 - //disabling this code fixes DEV-20105. Leaving in place in case some other bug pops up as a a result. - //should be safe to just always ask the spatial group for visibility. - if (isActive()) - { - if (isRoot()) - { - LLSpatialGroup* group = mSpatialBridge.notNull() ? mSpatialBridge->getSpatialGroup() : - getSpatialGroup(); - if (group && group->isVisible()) - { - mVisible = sCurVisible; - return TRUE; - } - } - else - { - if (getParent()->isVisible()) - { - mVisible = sCurVisible; - return TRUE; - } - } - } - else -#endif - { - LLSpatialGroup* group = getSpatialGroup(); - if (group && group->isVisible()) - { - mVisible = sCurVisible; - return TRUE; - } - } + const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. - return FALSE; + return MIN_VIS_FRAME_RANGE ; } //======================================= // Spatial Partition Bridging Drawable //======================================= -LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask) -: LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB) +LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp) : + LLDrawable(root->getVObj(), true), + LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW_ARB, regionp) { mBridge = this; mDrawable = root; root->setSpatialBridge(this); - mBinIndex = -1; - mRenderType = mDrawable->mRenderType; mDrawableType = mDrawable->mRenderType; @@ -1111,10 +1097,13 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat LLSpatialBridge::~LLSpatialBridge() { - LLSpatialGroup* group = getSpatialGroup(); - if (group) + if(mEntry) { - group->mSpatialPartition->remove(this, group); + LLSpatialGroup* group = getSpatialGroup(); + if (group) + { + group->mSpatialPartition->remove(this, group); + } } //delete octree here so listeners will still be able to access bridge specific state @@ -1136,8 +1125,9 @@ void LLSpatialBridge::updateSpatialExtents() root->rebound(); } + const LLVector4a* root_bounds = root->getBounds(); LLVector4a offset; - LLVector4a size = root->mBounds[1]; + LLVector4a size = root_bounds[1]; //VECTORIZE THIS LLMatrix4a mat; @@ -1149,7 +1139,7 @@ void LLSpatialBridge::updateSpatialExtents() LLVector4a center; mat.affineTransform(t, center); - mat.rotate(root->mBounds[0], offset); + mat.rotate(root_bounds[0], offset); center.add(offset); LLVector4a v[4]; @@ -1171,12 +1161,9 @@ void LLSpatialBridge::updateSpatialExtents() scale.mul(size); mat.rotate(scale, v[3]); - - LLVector4a& newMin = mExtents[0]; - LLVector4a& newMax = mExtents[1]; - - newMin = newMax = center; - + LLVector4a newMin; + LLVector4a newMax; + newMin = newMax = center; for (U32 i = 0; i < 4; i++) { LLVector4a delta; @@ -1189,19 +1176,21 @@ void LLSpatialBridge::updateSpatialExtents() newMin.setMin(newMin, min); newMax.setMax(newMax, max); } - + setSpatialExtents(newMin, newMax); + LLVector4a diagonal; diagonal.setSub(newMax, newMin); mRadius = diagonal.getLength3().getF32() * 0.5f; - mPositionGroup.setAdd(newMin,newMax); - mPositionGroup.mul(0.5f); + LLVector4a& pos = getGroupPosition(); + pos.setAdd(newMin,newMax); + pos.mul(0.5f); updateBinRadius(); } void LLSpatialBridge::updateBinRadius() { - mBinRadius = llmin( mOctree->getSize()[0]*0.5f, 256.f); + setBinRadius(llmin( mOctree->getSize()[0]*0.5f, 256.f)); } LLCamera LLSpatialBridge::transformCamera(LLCamera& camera) @@ -1236,7 +1225,7 @@ LLCamera LLSpatialBridge::transformCamera(LLCamera& camera) void LLDrawable::setVisible(LLCamera& camera, std::vector* results, BOOL for_select) { - mVisible = sCurVisible; + LLViewerOctreeEntryData::setVisible(); #if 0 && !LL_RELEASE_FOR_DOWNLOAD //crazy paranoid rules checking @@ -1271,21 +1260,21 @@ void LLDrawable::setVisible(LLCamera& camera, std::vector* results, #endif } -class LLOctreeMarkNotCulled: public LLOctreeTraveler +class LLOctreeMarkNotCulled: public OctreeTraveler { public: LLCamera* mCamera; LLOctreeMarkNotCulled(LLCamera* camera_in) : mCamera(camera_in) { } - virtual void traverse(const LLOctreeNode* node) + virtual void traverse(const OctreeNode* node) { LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); group->setVisible(); - LLOctreeTraveler::traverse(node); + OctreeTraveler::traverse(node); } - void visit(const LLOctreeNode* branch) + void visit(const OctreeNode* branch) { gPipeline.markNotCulled((LLSpatialGroup*) branch->getListener(0), *mCamera); } @@ -1329,7 +1318,7 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector* } if (!group || - LLDrawable::getCurrentFrame() - av->mVisible > 1 || + LLDrawable::getCurrentFrame() - av->getVisible() > 1 || impostor || !loaded) { @@ -1343,16 +1332,17 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector* group->rebound(); LLVector4a center; - center.setAdd(mExtents[0], mExtents[1]); + const LLVector4a* exts = getSpatialExtents(); + center.setAdd(exts[0], exts[1]); center.mul(0.5f); LLVector4a size; - size.setSub(mExtents[1], mExtents[0]); + size.setSub(exts[1], exts[0]); size.mul(0.5f); if ((LLPipeline::sShadowRender && camera_in.AABBInFrustum(center, size)) || LLPipeline::sImpostorRender || (camera_in.AABBInFrustumNoFarClip(center, size) && - AABBSphereIntersect(mExtents[0], mExtents[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist))) + AABBSphereIntersect(exts[0], exts[1], camera_in.getOrigin(), camera_in.mFrustumCornerDist))) { if (!LLPipeline::sImpostorRender && !LLPipeline::sShadowRender && @@ -1467,22 +1457,28 @@ BOOL LLSpatialBridge::updateMove() void LLSpatialBridge::shiftPos(const LLVector4a& vec) { - mExtents[0].add(vec); - mExtents[1].add(vec); - mPositionGroup.add(vec); + LLDrawable::shift(vec); } void LLSpatialBridge::cleanupReferences() { + LLPointer dummy_entry; + if (mDrawable && mDrawable->isDead() && mDrawable->getEntry()->hasVOCacheEntry()) + { + //create a dummy entry to insert the entire LLSpatialBridge to the vo_cache partition so it can be reloaded. + + dummy_entry = new LLVOCacheEntry(); + dummy_entry->setOctreeEntry(mEntry); + dummy_entry->addChild((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry()); + llassert(!mDrawable->getParent()); + + mDrawable->mParent = this; + } + LLDrawable::cleanupReferences(); if (mDrawable) { - LLSpatialGroup* group = mDrawable->getSpatialGroup(); - if (group) - { - group->mOctreeNode->remove(mDrawable); - mDrawable->setSpatialGroup(NULL); - } + mDrawable->setGroup(NULL); if (mDrawable->getVObj()) { @@ -1494,12 +1490,7 @@ void LLSpatialBridge::cleanupReferences() LLDrawable* drawable = child->mDrawable; if (drawable) { - LLSpatialGroup* group = drawable->getSpatialGroup(); - if (group) - { - group->mOctreeNode->remove(drawable); - drawable->setSpatialGroup(NULL); - } + drawable->setGroup(NULL); } } } @@ -1571,8 +1562,8 @@ void LLDrawable::updateFaceSize(S32 idx) } } -LLBridgePartition::LLBridgePartition() -: LLSpatialPartition(0, FALSE, 0) +LLBridgePartition::LLBridgePartition(LLViewerRegion* regionp) +: LLSpatialPartition(0, FALSE, 0, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_AVATAR; mPartitionType = LLViewerRegion::PARTITION_BRIDGE; @@ -1580,8 +1571,8 @@ LLBridgePartition::LLBridgePartition() mSlopRatio = 0.25f; } -LLHUDBridge::LLHUDBridge(LLDrawable* drawablep) -: LLVolumeBridge(drawablep) +LLHUDBridge::LLHUDBridge(LLDrawable* drawablep, LLViewerRegion* regionp) +: LLVolumeBridge(drawablep, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_HUD; mPartitionType = LLViewerRegion::PARTITION_HUD; -- cgit v1.2.3 From c2859e4663c405950b6f433270ae558852330c76 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 8 Nov 2012 21:36:47 -0700 Subject: for SH-3472: prioritize object loading --- indra/newview/lldrawable.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index e29551e83c..c782fbfe7e 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -470,7 +470,13 @@ void LLDrawable::makeActive() } updatePartition(); } - + else if (!isRoot() && !mParent->isActive()) //this should not happen, but occasionally it does... + { + mParent->makeActive(); + //NOTE: linked set will now NEVER become static + mParent->setState(LLDrawable::ACTIVE_CHILD); + } + llassert(isAvatar() || isRoot() || mParent->isActive()); } @@ -1093,6 +1099,11 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat { part->put(this); } + + if(mDrawable->getEntry()->hasVOCacheEntry()) + { + ((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->setBridgeChild(); + } } LLSpatialBridge::~LLSpatialBridge() @@ -1470,9 +1481,9 @@ void LLSpatialBridge::cleanupReferences() dummy_entry = new LLVOCacheEntry(); dummy_entry->setOctreeEntry(mEntry); dummy_entry->addChild((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry()); - llassert(!mDrawable->getParent()); + //llassert(!mDrawable->getParent()); - mDrawable->mParent = this; + //mDrawable->mParent = this; } LLDrawable::cleanupReferences(); -- cgit v1.2.3 From e1247d631f24065a31d9668915cb8bc84f3abc7f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 18 Dec 2012 14:36:46 -0700 Subject: fix for SH-3619: some objects are missing --- indra/newview/lldrawable.cpp | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index c782fbfe7e..1b7a98ba54 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1473,19 +1473,6 @@ void LLSpatialBridge::shiftPos(const LLVector4a& vec) void LLSpatialBridge::cleanupReferences() { - LLPointer dummy_entry; - if (mDrawable && mDrawable->isDead() && mDrawable->getEntry()->hasVOCacheEntry()) - { - //create a dummy entry to insert the entire LLSpatialBridge to the vo_cache partition so it can be reloaded. - - dummy_entry = new LLVOCacheEntry(); - dummy_entry->setOctreeEntry(mEntry); - dummy_entry->addChild((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry()); - //llassert(!mDrawable->getParent()); - - //mDrawable->mParent = this; - } - LLDrawable::cleanupReferences(); if (mDrawable) { -- cgit v1.2.3 From 4e22f3e3ef15e24d7e9e0ad156e60d4cd1b2d5c9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 18 Dec 2012 23:16:50 -0700 Subject: fix for SH-3624: Object deletion does not work --- indra/newview/lldrawable.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 1b7a98ba54..3c68ac231e 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1099,11 +1099,6 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat { part->put(this); } - - if(mDrawable->getEntry()->hasVOCacheEntry()) - { - ((LLVOCacheEntry*)mDrawable->getEntry()->getVOCacheEntry())->setBridgeChild(); - } } LLSpatialBridge::~LLSpatialBridge() -- cgit v1.2.3 From cbff0e7ab8afeebb6ddab854d35ea12ef9a9930a Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 4 Jan 2013 13:48:35 -0800 Subject: SH-3468 WIP add memory tracking base class attempted fix for gcc compile errors can't use typeid() on a class that doesn't have a method defined in a translation unit fix is to force classes deriving from LLMemTrackable to use their own static member named sMemStat --- indra/newview/lldrawable.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 09bbafd54a..6ef437cefb 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -58,6 +58,7 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; +LLTrace::MemStat LLDrawable::sMemStat("LLDrawable"); //////////////////////// -- cgit v1.2.3 From 7cc37d949e9319a5b60641ff8453a0fed763d817 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 9 Jan 2013 22:43:10 -0700 Subject: fix the merge errors from the changeset 3eadda9666cf --- indra/newview/lldrawable.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index d91c7b0e1a..ba970671af 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1009,13 +1009,15 @@ bool LLDrawable::isRecentlyVisible() const void LLDrawable::setGroup(LLviewerOctreeGroup *groupp) { - //precondition: mGroupp MUST be null or DEAD or mGroupp MUST NOT contain this - llassert(!getGroup() || getGroup()->isDead() || !getGroup()->hasElement(this)); + LLSpatialGroup* cur_groupp = (LLSpatialGroup*)getGroup(); + + //precondition: mGroupp MUST be null or DEAD or mGroupp MUST NOT contain this + //llassert(!cur_groupp || cur_groupp->isDead() || !cur_groupp->hasElement(this)); //precondition: groupp MUST be null or groupp MUST contain this - llassert(!groupp || groupp->hasElement(this)); + llassert(!groupp || (LLSpatialGroup*)groupp->hasElement(this)); - if (getGroup() != groupp && getVOVolume()) + if (cur_groupp != groupp && getVOVolume()) { //NULL out vertex buffer references for volumes on spatial group change to maintain //requirement that every face vertex buffer is either NULL or points to a vertex buffer //contained by its drawable's spatial group @@ -1031,8 +1033,8 @@ void LLDrawable::setGroup(LLviewerOctreeGroup *groupp) //postcondition: if next group is NULL, previous group must be dead OR NULL OR binIndex must be -1 //postcondition: if next group is NOT NULL, binIndex must not be -1 - llassert(groupp == NULL ? (getGroup() == NULL || getGroup()->isDead()) || getBinIndex() == -1 : - getBinIndex() != -1); + //llassert(groupp == NULL ? (cur_groupp == NULL || cur_groupp->isDead()) || (!getEntry() || getEntry()->getBinIndex() == -1) : + // (getEntry() && getEntry()->getBinIndex() != -1)); LLViewerOctreeEntryData::setGroup(groupp); } @@ -1498,6 +1500,8 @@ void LLSpatialBridge::cleanupReferences() { drawable->setGroup(NULL); } + } + } LLDrawable* drawablep = mDrawable; mDrawable = NULL; -- cgit v1.2.3 From f07b9c2c69f1f6882dcf249aacf33cdfacf878ab Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 6 Mar 2013 11:08:25 -0800 Subject: renamed LLTrace stat gathering classes/methods to make the structure of LLTrace clearer Count becomes CountStatHandle Count.sum becomes sum(Count, value), etc. --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index ba970671af..9c3d9f4d34 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -59,7 +59,7 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; -LLTrace::MemStat LLDrawable::sMemStat("LLDrawable"); +LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); //////////////////////// -- cgit v1.2.3 From 8de397b19ec9e2f6206fd5ae57dba96c70e78b74 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 18 Mar 2013 08:43:03 -0700 Subject: SH-3931 WIP Interesting: Add graphs to visualize scene load metrics changed LLCriticalDamp to LLSmoothInterpolation and sped up interpolator lookup improvements to stats display of llstatbar added scene load stats floater accessed with ctrl|shift|2 --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 9c3d9f4d34..a0c71b0f73 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -557,7 +557,7 @@ F32 LLDrawable::updateXform(BOOL undamped) if (damped && isVisible()) { - F32 lerp_amt = llclamp(LLCriticalDamp::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); + F32 lerp_amt = llclamp(LLSmoothInterpolation::getInterpolant(OBJECT_DAMPING_TIME_CONSTANT), 0.f, 1.f); LLVector3 new_pos = lerp(old_pos, target_pos, lerp_amt); dist_squared = dist_vec_squared(new_pos, target_pos); -- cgit v1.2.3 From 6b81b8629e67d82a7620e48781ded73b6e6126ea Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Sun, 5 May 2013 17:45:35 -0700 Subject: Spring cleaning: removed unused .cpp and.h files, and cleaned up header dependencies --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 4d72dd1343..dbd4142d44 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -79,7 +79,7 @@ LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); // static U32 LLDrawable::sNumZombieDrawables = 0; F32 LLDrawable::sCurPixelAngle = 0; -LLDynamicArrayPtr > LLDrawable::sDeadList; +LLDynamicArray, 32 > LLDrawable::sDeadList; #define FORCE_INVISIBLE_AREA 16.f -- cgit v1.2.3 From 16616ae48d86da75b3809fa6be6c846a9d420603 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 23 May 2013 18:25:21 -0600 Subject: for SH-4145: Interesting: Implement occlusion culling for object cache --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 4d72dd1343..17f610829d 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1145,7 +1145,7 @@ LLSpatialBridge::~LLSpatialBridge() LLSpatialGroup* group = getSpatialGroup(); if (group) { - group->mSpatialPartition->remove(this, group); + group->getSpatialPartition()->remove(this, group); } } -- cgit v1.2.3 From 6827febd3027decb1bd8da013b6af413114239a9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Tue, 28 May 2013 14:55:37 -0600 Subject: change the way to handle creating/destroying a same object repeatedly --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 92b3ee4a26..0b935ced31 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1101,7 +1101,7 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() } //virtual -S32 LLDrawable::getMinVisFrameRange() const +S32 LLDrawable::getMinFrameRange() const { const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. -- cgit v1.2.3 From 427490edb566edf18da0b879f9d30a04dda0e9e0 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 10 Jun 2013 22:43:29 -0600 Subject: possible fix and new debug code for SH-4241: viewer crash shortly after login in LLViewerRegion::addNewObject --- indra/newview/lldrawable.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 93fb484f06..598b0d2ff4 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -133,7 +133,9 @@ void LLDrawable::init(bool new_entry) getRegion()->addVisibleCacheEntry(vo_entry); //to load all children. } - getRegion()->addActiveCacheEntry(vo_entry); + getRegion()->addActiveCacheEntry(vo_entry); + + llassert_always(!vo_entry->getGroup()); //not in the object cache octree. } llassert(!vo_entry || vo_entry->getEntry() == mEntry); -- cgit v1.2.3 From fc88265cffe3553803314c6e895a1e3a3c988171 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 13 Jun 2013 18:47:51 -0600 Subject: fix for SH-4241: viewer crash shortly after login in LLViewerRegion::addNewObject and SH-4261: interesting: crash in LLViewerRegion::addToVOCacheTree --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 598b0d2ff4..22a7c350d6 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -135,7 +135,7 @@ void LLDrawable::init(bool new_entry) getRegion()->addActiveCacheEntry(vo_entry); - llassert_always(!vo_entry->getGroup()); //not in the object cache octree. + llassert(!vo_entry->getGroup()); //not in the object cache octree. } llassert(!vo_entry || vo_entry->getEntry() == mEntry); -- cgit v1.2.3 From 9ed2f4d3cb02d5161bd8bb77cb7befa7feedf2d9 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 17 Jun 2013 15:24:15 -0600 Subject: add a debug setting "InvisibleObjectsInMemoryTime" to adjust the time invisible objects stay in memory. --- indra/newview/lldrawable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 22a7c350d6..30d1b7fdba 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1098,9 +1098,9 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() } //virtual -S32 LLDrawable::getMinFrameRange() const +U32 LLDrawable::getMinFrameRange() const { -const S32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. + const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. return MIN_VIS_FRAME_RANGE ; } -- cgit v1.2.3 From c5fc8f90060aa7a6c8fbb72313172423b01eddc5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 19 Jun 2013 08:23:53 -0700 Subject: SH-4246 FIX interesting: fast timers significantly decreases framerate moved collapsed flag to fast timer tree node --- indra/newview/lldrawable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 22a7c350d6..8430c32551 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -300,7 +300,7 @@ S32 LLDrawable::findReferences(LLDrawable *drawablep) return count; } -static LLFastTimer::DeclareTimer FTM_ALLOCATE_FACE("Allocate Face", true); +static LLFastTimer::DeclareTimer FTM_ALLOCATE_FACE("Allocate Face"); LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep) { -- cgit v1.2.3 From 04bdc8ba83c297945dd60489c241b88adf892ff4 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 1 Jul 2013 17:04:01 -0700 Subject: SH-4294 FIX Interesting: Statistics Texture cache hit rate is always 0% also, removed LLTrace::init and cleanup removed derived class implementation of memory stat for LLMemTrackable is automatic now --- indra/newview/lldrawable.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 628f7f7bfb..3dddf4b554 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -59,7 +59,6 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; -LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); //////////////////////// -- cgit v1.2.3 From 8208a40412fac35593d4b8b13f43c6be5e4d6990 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 1 Jul 2013 18:50:51 -0700 Subject: BUILDFIX: reverted changes that attempted to automate mem track stat definition as they don't work on gcc/clang --- indra/newview/lldrawable.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 3dddf4b554..628f7f7bfb 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -59,6 +59,7 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; +LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); //////////////////////// -- cgit v1.2.3 From a2e22732f195dc075a733c79f15156752f522a43 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 30 Jul 2013 19:13:45 -0700 Subject: Summer cleaning - removed a lot of llcommon dependencies to speed up build times consolidated most indra-specific constants in llcommon under indra_constants.h fixed issues with operations on mixed unit types (implicit and explicit) made LL_INFOS() style macros variadic in order to subsume other logging methods such as ll_infos added optional tag output to error recorders --- indra/newview/lldrawable.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 628f7f7bfb..c59ce04646 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -79,7 +79,7 @@ LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); // static U32 LLDrawable::sNumZombieDrawables = 0; F32 LLDrawable::sCurPixelAngle = 0; -LLDynamicArray, 32 > LLDrawable::sDeadList; +std::vector > LLDrawable::sDeadList; #define FORCE_INVISIBLE_AREA 16.f @@ -196,7 +196,7 @@ void LLDrawable::markDead() // We're dead. Free up all of our references to other objects cleanupReferences(); -// sDeadList.put(this); +// sDeadList.push_back(this); } LLVOVolume* LLDrawable::getVOVolume() const @@ -277,7 +277,7 @@ void LLDrawable::cleanupDeadDrawables() { /* S32 i; - for (i = 0; i < sDeadList.count(); i++) + for (i = 0; i < sDeadList.size(); i++) { if (sDeadList[i]->getNumRefs() > 1) { @@ -286,7 +286,7 @@ void LLDrawable::cleanupDeadDrawables() } } */ - sDeadList.reset(); + sDeadList.clear(); } S32 LLDrawable::findReferences(LLDrawable *drawablep) -- cgit v1.2.3 From e340009fc59d59e59b2e8d903a884acb76b178eb Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 9 Aug 2013 17:11:19 -0700 Subject: second phase summer cleaning replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc. --- indra/newview/lldrawable.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index c59ce04646..ad3df55ef1 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -163,7 +163,7 @@ void LLDrawable::destroy() if (LLSpatialGroup::sNoDelete) { - llerrs << "Illegal deletion of LLDrawable!" << llendl; + LL_ERRS() << "Illegal deletion of LLDrawable!" << LL_ENDL; } std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); @@ -172,7 +172,7 @@ void LLDrawable::destroy() /*if (!(sNumZombieDrawables % 10)) { - llinfos << "- Zombie drawables: " << sNumZombieDrawables << llendl; + LL_INFOS() << "- Zombie drawables: " << sNumZombieDrawables << LL_ENDL; }*/ } @@ -181,7 +181,7 @@ void LLDrawable::markDead() { if (isDead()) { - llwarns << "Warning! Marking dead multiple times!" << llendl; + LL_WARNS() << "Warning! Marking dead multiple times!" << LL_ENDL; return; } setState(DEAD); @@ -281,7 +281,7 @@ void LLDrawable::cleanupDeadDrawables() { if (sDeadList[i]->getNumRefs() > 1) { - llwarns << "Dead drawable has " << sDeadList[i]->getNumRefs() << " remaining refs" << llendl; + LL_WARNS() << "Dead drawable has " << sDeadList[i]->getNumRefs() << " remaining refs" << LL_ENDL; gPipeline.findReferences(sDeadList[i]); } } @@ -294,7 +294,7 @@ S32 LLDrawable::findReferences(LLDrawable *drawablep) S32 count = 0; if (mParent == drawablep) { - llinfos << this << ": parent reference" << llendl; + LL_INFOS() << this << ": parent reference" << LL_ENDL; count++; } return count; @@ -311,7 +311,7 @@ LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep) face = new LLFace(this, mVObjp); } - if (!face) llerrs << "Allocating new Face: " << mFaces.size() << llendl; + if (!face) LL_ERRS() << "Allocating new Face: " << mFaces.size() << LL_ENDL; if (face) { @@ -468,7 +468,7 @@ void LLDrawable::deleteFaces(S32 offset, S32 count) void LLDrawable::update() { - llerrs << "Shouldn't be called!" << llendl; + LL_ERRS() << "Shouldn't be called!" << LL_ENDL; } @@ -490,7 +490,7 @@ void LLDrawable::makeActive() pcode == LLViewerObject::LL_VO_GROUND || pcode == LLViewerObject::LL_VO_SKY) { - llerrs << "Static viewer object has active drawable!" << llendl; + LL_ERRS() << "Static viewer object has active drawable!" << LL_ENDL; } } #endif @@ -561,7 +561,7 @@ void LLDrawable::makeStatic(BOOL warning_enabled) { if (child_drawable->getParent() != this) { - llwarns << "Child drawable has unknown parent." << llendl; + LL_WARNS() << "Child drawable has unknown parent." << LL_ENDL; } child_drawable->makeStatic(warning_enabled); } @@ -734,7 +734,7 @@ BOOL LLDrawable::updateMove() { if (isDead()) { - llwarns << "Update move on dead drawable!" << llendl; + LL_WARNS() << "Update move on dead drawable!" << LL_ENDL; return TRUE; } @@ -809,7 +809,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) { if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD) { - llwarns << "Attempted to update distance for non-world camera." << llendl; + LL_WARNS() << "Attempted to update distance for non-world camera." << LL_ENDL; return; } @@ -874,7 +874,7 @@ void LLDrawable::updateTexture() { if (isDead()) { - llwarns << "Dead drawable updating texture!" << llendl; + LL_WARNS() << "Dead drawable updating texture!" << LL_ENDL; return; } @@ -900,7 +900,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector) { if (isDead()) { - llwarns << "Shifting dead drawable" << llendl; + LL_WARNS() << "Shifting dead drawable" << LL_ENDL; return; } @@ -1020,7 +1020,7 @@ F32 LLDrawable::getVisibilityRadius() const { return llmax(getRadius(), vov->getLightRadius()); } else { - // llwarns ? + // LL_WARNS() ? } } return getRadius(); @@ -1317,26 +1317,26 @@ void LLDrawable::setVisible(LLCamera& camera, std::vector* results, { if (isActive() && !mParent->isActive()) { - llerrs << "Active drawable has static parent!" << llendl; + LL_ERRS() << "Active drawable has static parent!" << LL_ENDL; } if (isStatic() && !mParent->isStatic()) { - llerrs << "Static drawable has active parent!" << llendl; + LL_ERRS() << "Static drawable has active parent!" << LL_ENDL; } if (mSpatialBridge) { - llerrs << "Child drawable has spatial bridge!" << llendl; + LL_ERRS() << "Child drawable has spatial bridge!" << LL_ENDL; } } else if (isActive() && !mSpatialBridge) { - llerrs << "Active root drawable has no spatial bridge!" << llendl; + LL_ERRS() << "Active root drawable has no spatial bridge!" << LL_ENDL; } else if (isStatic() && mSpatialBridge.notNull()) { - llerrs << "Static drawable has spatial bridge!" << llendl; + LL_ERRS() << "Static drawable has spatial bridge!" << LL_ENDL; } } #endif @@ -1512,7 +1512,7 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update) void LLSpatialBridge::makeActive() { //it is an error to make a spatial bridge active (it's already active) - llerrs << "makeActive called on spatial bridge" << llendl; + LL_ERRS() << "makeActive called on spatial bridge" << LL_ENDL; } void LLSpatialBridge::move(LLDrawable *drawablep, LLSpatialGroup *curp, BOOL immediate) -- cgit v1.2.3 From 7b5618aeaeb4df31bd3f9436e067b26fb5be866b Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 22 Aug 2013 12:22:34 -0600 Subject: fix for SH-4400: Interesting: Side effect 1 of unloading culled objects. --- indra/newview/lldrawable.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index ad3df55ef1..a480eed2e7 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1058,12 +1058,8 @@ bool LLDrawable::isRecentlyVisible() const if(!vis) { - LLviewerOctreeGroup* group = getGroup(); - if (group && group->isRecentlyVisible()) - { - LLViewerOctreeEntryData::setVisible(); - vis = TRUE ; - } + const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. + vis = (sCurVisible - getVisible() < MIN_VIS_FRAME_RANGE); } return vis ; @@ -1140,14 +1136,6 @@ LLSpatialPartition* LLDrawable::getSpatialPartition() return retval; } -//virtual -U32 LLDrawable::getMinFrameRange() const -{ - const U32 MIN_VIS_FRAME_RANGE = 2 ; //two frames:the current one and the last one. - - return MIN_VIS_FRAME_RANGE ; -} - //======================================= // Spatial Partition Bridging Drawable //======================================= -- cgit v1.2.3 From cbe397ad13665c7bc993e10d8fe1e4a876253378 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 5 Sep 2013 14:04:13 -0700 Subject: changed fast timer over to using macro another attempt to move mem stat into base class --- indra/newview/lldrawable.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index a480eed2e7..1837974604 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -56,10 +56,10 @@ const F32 MAX_INTERPOLATE_DISTANCE_SQUARED = 10.f * 10.f; const F32 OBJECT_DAMPING_TIME_CONSTANT = 0.06f; const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; -static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); +static LLTrace::TimeBlock FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; -LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); +//LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); //////////////////////// @@ -230,16 +230,16 @@ BOOL LLDrawable::isLight() const } } -static LLFastTimer::DeclareTimer FTM_CLEANUP_DRAWABLE("Cleanup Drawable"); -static LLFastTimer::DeclareTimer FTM_DEREF_DRAWABLE("Deref"); -static LLFastTimer::DeclareTimer FTM_DELETE_FACES("Faces"); +static LLTrace::TimeBlock FTM_CLEANUP_DRAWABLE("Cleanup Drawable"); +static LLTrace::TimeBlock FTM_DEREF_DRAWABLE("Deref"); +static LLTrace::TimeBlock FTM_DELETE_FACES("Faces"); void LLDrawable::cleanupReferences() { - LLFastTimer t(FTM_CLEANUP_DRAWABLE); + LL_RECORD_BLOCK_TIME(FTM_CLEANUP_DRAWABLE); { - LLFastTimer t(FTM_DELETE_FACES); + LL_RECORD_BLOCK_TIME(FTM_DELETE_FACES); std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); mFaces.clear(); } @@ -251,7 +251,7 @@ void LLDrawable::cleanupReferences() removeFromOctree(); { - LLFastTimer t(FTM_DEREF_DRAWABLE); + LL_RECORD_BLOCK_TIME(FTM_DEREF_DRAWABLE); // Cleanup references to other objects mVObjp = NULL; mParent = NULL; @@ -300,14 +300,14 @@ S32 LLDrawable::findReferences(LLDrawable *drawablep) return count; } -static LLFastTimer::DeclareTimer FTM_ALLOCATE_FACE("Allocate Face"); +static LLTrace::TimeBlock FTM_ALLOCATE_FACE("Allocate Face"); LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep) { LLFace *face; { - LLFastTimer t(FTM_ALLOCATE_FACE); + LL_RECORD_BLOCK_TIME(FTM_ALLOCATE_FACE); face = new LLFace(this, mVObjp); } @@ -335,7 +335,7 @@ LLFace* LLDrawable::addFace(const LLTextureEntry *te, LLViewerTexture *texturep) LLFace *face; { - LLFastTimer t(FTM_ALLOCATE_FACE); + LL_RECORD_BLOCK_TIME(FTM_ALLOCATE_FACE); face = new LLFace(this, mVObjp); } @@ -1192,7 +1192,7 @@ void LLSpatialBridge::updateSpatialExtents() LLSpatialGroup* root = (LLSpatialGroup*) mOctree->getListener(0); { - LLFastTimer ftm(FTM_CULL_REBOUND); + LL_RECORD_BLOCK_TIME(FTM_CULL_REBOUND); root->rebound(); } -- cgit v1.2.3 From 053d97db1b283ca2548dc1f64756ddfc5166158f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 25 Sep 2013 19:12:35 -0700 Subject: better memory usage for LLTrace (tighter packing of recording arrays) removed complicated and unnecessary fast timer gapless handoff logic (it should be gapless anyway) improved MemTrackable API, better separation of shadow and footprint added memory usage stats to floater_stats.xml --- indra/newview/lldrawable.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 1837974604..5baebab5a3 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -59,7 +59,6 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; static LLTrace::TimeBlock FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; -//LLTrace::MemStatHandle LLDrawable::sMemStat("LLDrawable"); //////////////////////// -- cgit v1.2.3 From 12f0f8cb72f789e21b01b45063dcc5f1f5292087 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 1 Oct 2013 13:46:43 -0700 Subject: changed over to manual naming of MemTrackable stats changed claimMem and disclaimMem behavior to not pass through argument added more mem tracking stats to floater_stats --- indra/newview/lldrawable.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5baebab5a3..2890d3f61c 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -90,8 +90,9 @@ void LLDrawable::incrementVisible() } LLDrawable::LLDrawable(LLViewerObject *vobj, bool new_entry) - : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE), - mVObjp(vobj) +: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLDRAWABLE), + LLTrace::MemTrackable("LLDrawable"), + mVObjp(vobj) { init(new_entry); } -- cgit v1.2.3 From 17df8988fec3f2ba991ca9e34ff8148253a2fc04 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 7 Oct 2013 13:38:03 -0700 Subject: renamed TraceType to StatType added more MemTrackable types optimized memory usage of LLTrace some more --- indra/newview/lldrawable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 4b6c80b51a..5981153bd5 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1047,7 +1047,7 @@ bool LLDrawable::isVisible() const } { - LLviewerOctreeGroup* group = mEntry->getGroup(); + LLViewerOctreeGroup* group = mEntry->getGroup(); if (group && group->isVisible()) { LLViewerOctreeEntryData::setVisible(); @@ -1073,7 +1073,7 @@ bool LLDrawable::isRecentlyVisible() const return vis ; } -void LLDrawable::setGroup(LLviewerOctreeGroup *groupp) +void LLDrawable::setGroup(LLViewerOctreeGroup *groupp) { LLSpatialGroup* cur_groupp = (LLSpatialGroup*)getGroup(); -- cgit v1.2.3 From 697d2e720ba75e142a4d56ae8794bab8d7698dad Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Oct 2013 20:24:42 -0700 Subject: renamed TimeBlock to BlockTimerStatHandle --- indra/newview/lldrawable.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5981153bd5..7414b24811 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -56,7 +56,7 @@ const F32 MAX_INTERPOLATE_DISTANCE_SQUARED = 10.f * 10.f; const F32 OBJECT_DAMPING_TIME_CONSTANT = 0.06f; const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f; -static LLTrace::TimeBlock FTM_CULL_REBOUND("Cull Rebound"); +static LLTrace::BlockTimerStatHandle FTM_CULL_REBOUND("Cull Rebound"); extern bool gShiftFrame; @@ -236,9 +236,9 @@ BOOL LLDrawable::isLight() const } } -static LLTrace::TimeBlock FTM_CLEANUP_DRAWABLE("Cleanup Drawable"); -static LLTrace::TimeBlock FTM_DEREF_DRAWABLE("Deref"); -static LLTrace::TimeBlock FTM_DELETE_FACES("Faces"); +static LLTrace::BlockTimerStatHandle FTM_CLEANUP_DRAWABLE("Cleanup Drawable"); +static LLTrace::BlockTimerStatHandle FTM_DEREF_DRAWABLE("Deref"); +static LLTrace::BlockTimerStatHandle FTM_DELETE_FACES("Faces"); void LLDrawable::cleanupReferences() { @@ -306,7 +306,7 @@ S32 LLDrawable::findReferences(LLDrawable *drawablep) return count; } -static LLTrace::TimeBlock FTM_ALLOCATE_FACE("Allocate Face"); +static LLTrace::BlockTimerStatHandle FTM_ALLOCATE_FACE("Allocate Face"); LLFace* LLDrawable::addFace(LLFacePool *poolp, LLViewerTexture *texturep) { -- cgit v1.2.3 From b49170b732e6e4b2cf11b40c12b3d75a8709cf5c Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 31 Jan 2014 18:24:55 -0700 Subject: fix some flaws for memory corruption --- indra/newview/lldrawable.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview/lldrawable.cpp') diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 7414b24811..c56006d9a3 100755 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -128,13 +128,14 @@ void LLDrawable::init(bool new_entry) { vo_entry->setOctreeEntry(mEntry); } - else if(vo_entry->getNumOfChildren() > 0) - { - getRegion()->addVisibleCacheEntry(vo_entry); //to load all children. - } - + getRegion()->addActiveCacheEntry(vo_entry); + if(vo_entry->getNumOfChildren() > 0) + { + getRegion()->addVisibleChildCacheEntry(vo_entry, NULL); //to load all children. + } + llassert(!vo_entry->getGroup()); //not in the object cache octree. } -- cgit v1.2.3