diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-06-17 15:24:15 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-06-17 15:24:15 -0600 |
commit | 9ed2f4d3cb02d5161bd8bb77cb7befa7feedf2d9 (patch) | |
tree | cf8d2c90a4f8a17f27b565ea3d0087c78302b9af | |
parent | 1bc1d532cff1539bb5366f87b602970f1d2a8929 (diff) |
add a debug setting "InvisibleObjectsInMemoryTime" to adjust the time invisible objects stay in memory.
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 11 | ||||
-rwxr-xr-x | indra/newview/lldrawable.cpp | 4 | ||||
-rwxr-xr-x | indra/newview/lldrawable.h | 2 | ||||
-rw-r--r-- | indra/newview/llvieweroctree.h | 2 | ||||
-rwxr-xr-x | indra/newview/llvocache.cpp | 20 | ||||
-rwxr-xr-x | indra/newview/llvocache.h | 7 |
6 files changed, 34 insertions, 12 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4d5b0c62e4..29427bbaa3 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4590,6 +4590,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>InvisibleObjectsInMemoryTime</key> + <map> + <key>Comment</key> + <string>Number of frames invisible objects stay in memory before being removed. 0 means never to remove.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>64</integer> + </map> <key>JoystickAvatarEnabled</key> <map> <key>Comment</key> 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 ; } diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 98f0b51a97..ebda188618 100755 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -193,7 +193,7 @@ public: LLSpatialPartition* getSpatialPartition(); - virtual S32 getMinFrameRange()const; + virtual U32 getMinFrameRange()const; void removeFromOctree(); void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; } diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 0a96676be1..7f2ca6ed2d 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -149,7 +149,7 @@ public: virtual void setOctreeEntry(LLViewerOctreeEntry* entry); - virtual S32 getMinFrameRange()const = 0; + virtual U32 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 68f21ed2b3..93daf2e171 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -50,6 +50,14 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) //--------------------------------------------------------------------------- // LLVOCacheEntry //--------------------------------------------------------------------------- +//return number of frames invisible objects should stay in memory +//static +U32 LLVOCacheEntry::getInvisibleObjectsLiveTime() +{ + static LLCachedControl<U32> inv_obj_time(gSavedSettings,"InvisibleObjectsInMemoryTime"); + + return inv_obj_time - 1; //make 0 to be the maximum +} LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp) : LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), @@ -60,7 +68,6 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mDupeCount(0), mCRCChangeCount(0), mState(INACTIVE), - mMinFrameRange(64), mSceneContrib(0.f), mTouched(TRUE), mParentID(0) @@ -68,6 +75,7 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); mDP = dp; + mMinFrameRange = getInvisibleObjectsLiveTime(); } LLVOCacheEntry::LLVOCacheEntry() @@ -80,12 +88,12 @@ LLVOCacheEntry::LLVOCacheEntry() mCRCChangeCount(0), mBuffer(NULL), mState(INACTIVE), - mMinFrameRange(64), mSceneContrib(0.f), mTouched(TRUE), mParentID(0) { mDP.assignBuffer(mBuffer, 0); + mMinFrameRange = getInvisibleObjectsLiveTime(); } LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) @@ -93,7 +101,6 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) mBuffer(NULL), mUpdateFlags(-1), mState(INACTIVE), - mMinFrameRange(64), mSceneContrib(0.f), mTouched(FALSE), mParentID(0) @@ -101,6 +108,7 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) S32 size = -1; BOOL success; + mMinFrameRange = getInvisibleObjectsLiveTime(); mDP.assignBuffer(mBuffer, 0); success = check_read(apr_file, &mLocalID, sizeof(U32)); @@ -218,17 +226,17 @@ void LLVOCacheEntry::setState(U32 state) if(getVisible() - last_visible < MIN_REAVTIVE_INTERVAL + mMinFrameRange) { - mMinFrameRange = llmin(mMinFrameRange * 2, 2048); + mMinFrameRange = llmin(mMinFrameRange * 2, getInvisibleObjectsLiveTime() * 32); } else { - mMinFrameRange = 64; //reset + mMinFrameRange = getInvisibleObjectsLiveTime(); //reset } } } //virtual -S32 LLVOCacheEntry::getMinFrameRange()const +U32 LLVOCacheEntry::getMinFrameRange()const { return mMinFrameRange; } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index e46fec9dc3..b8a7ccac99 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -88,7 +88,7 @@ public: U32 getCRC() const { return mCRC; } S32 getHitCount() const { return mHitCount; } S32 getCRCChangeCount() const { return mCRCChangeCount; } - S32 getMinFrameRange()const; + U32 getMinFrameRange()const; void calcSceneContribution(const LLVector3& camera_origin, bool needs_update, U32 last_update); void setSceneContribution(F32 scene_contrib) {mSceneContrib = scene_contrib;} @@ -121,6 +121,9 @@ public: void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} +private: + static U32 getInvisibleObjectsLiveTime(); + public: typedef std::map<U32, LLPointer<LLVOCacheEntry> > vocache_entry_map_t; typedef std::set<LLVOCacheEntry*> vocache_entry_set_t; @@ -138,7 +141,7 @@ protected: U8 *mBuffer; F32 mSceneContrib; //projected scene contributuion of this object. - S32 mMinFrameRange; + U32 mMinFrameRange; U32 mState; //high 16 bits reserved for special use. std::vector<LLVOCacheEntry*> mChildrenList; //children entries in a linked set. |