diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-05-28 14:55:37 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-05-28 14:55:37 -0600 |
commit | 6827febd3027decb1bd8da013b6af413114239a9 (patch) | |
tree | 3232168e83ad4ff1f0e6bd42b0e52181283ddb08 /indra/newview | |
parent | b5f98560c796d62e45ebd0e410254b79958c7f47 (diff) |
change the way to handle creating/destroying a same object repeatedly
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lldrawable.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lldrawable.h | 2 | ||||
-rw-r--r-- | indra/newview/llvieweroctree.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvieweroctree.h | 2 | ||||
-rw-r--r-- | indra/newview/llvocache.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llvocache.h | 7 |
6 files changed, 16 insertions, 29 deletions
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. diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index e400a8b5f2..4d31356ede 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -193,7 +193,7 @@ public: LLSpatialPartition* getSpatialPartition(); - virtual S32 getMinVisFrameRange()const; + virtual S32 getMinFrameRange()const; void removeFromOctree(); void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; } diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index d9e1774c6d..d631985e82 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -409,7 +409,7 @@ bool LLViewerOctreeEntryData::isRecentlyVisible() const return true; } - return (sCurVisible - mEntry->mVisible < getMinVisFrameRange()); + return (sCurVisible - mEntry->mVisible < getMinFrameRange()); } void LLViewerOctreeEntryData::setVisible() const diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 1d3533e95c..0a96676be1 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -149,7 +149,7 @@ public: virtual void setOctreeEntry(LLViewerOctreeEntry* entry); - virtual S32 getMinVisFrameRange()const = 0; + virtual S32 getMinFrameRange()const = 0; F32 getBinRadius() const {return mEntry->getBinRadius();} const LLVector4a* getSpatialExtents() const; diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index fdb14aa8d2..bcd9dda652 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -60,8 +60,7 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mDupeCount(0), mCRCChangeCount(0), mState(INACTIVE), - mRepeatedVisCounter(0), - mVisFrameRange(64), + mMinFrameRange(64), mSceneContrib(0.f), mTouched(TRUE), mParentID(0) @@ -81,8 +80,7 @@ LLVOCacheEntry::LLVOCacheEntry() mCRCChangeCount(0), mBuffer(NULL), mState(INACTIVE), - mRepeatedVisCounter(0), - mVisFrameRange(64), + mMinFrameRange(64), mSceneContrib(0.f), mTouched(TRUE), mParentID(0) @@ -95,8 +93,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mBuffer(NULL), mUpdateFlags(-1), mState(INACTIVE), - mRepeatedVisCounter(0), - mVisFrameRange(64), + mMinFrameRange(64), mSceneContrib(0.f), mTouched(FALSE), mParentID(0) @@ -215,35 +212,26 @@ void LLVOCacheEntry::setState(U32 state) if(getState() == ACTIVE) { - const S32 MIN_REAVTIVE_INTERVAL = 20; + const S32 MIN_REAVTIVE_INTERVAL = 32; U32 last_visible = getVisible(); setVisible(); - if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mVisFrameRange) + if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mMinFrameRange) { - mRepeatedVisCounter++; + mMinFrameRange = llmin(mMinFrameRange * 2, 2048); } else { - mRepeatedVisCounter = 0; - mVisFrameRange = 64; - } - - if(mRepeatedVisCounter > 2) - { - //if repeatedly becomes visible immediately after invisible, enlarge the visible frame range - - mRepeatedVisCounter = 0; - mVisFrameRange *= 2; + mMinFrameRange = 64; //reset } } } //virtual -S32 LLVOCacheEntry::getMinVisFrameRange()const +S32 LLVOCacheEntry::getMinFrameRange()const { - return mVisFrameRange; + return mMinFrameRange; } void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 7409b94d60..8a4975c786 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -87,7 +87,7 @@ public: U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } - S32 getMinVisFrameRange()const; + S32 getMinFrameRange()const; void calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update); void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;} @@ -116,7 +116,7 @@ public: void setTouched(BOOL touched = TRUE) {mTouched = touched;} BOOL isTouched() const {return mTouched;} - + void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} @@ -137,8 +137,7 @@ protected: U8 *mBuffer; F32 mSceneContrib; //projected scene contributuion of this object. - S32 mVisFrameRange; - S32 mRepeatedVisCounter; //number of repeatedly visible within a short time. + S32 mMinFrameRange; U32 mState; //high 16 bits reserved for special use. std::vector<LLVOCacheEntry*> mChildrenList; //children entries in a linked set. |