add a debug setting "InvisibleObjectsInMemoryTime" to adjust the time invisible objects stay in memory.

master
Xiaohong Bao 2013-06-17 15:24:15 -06:00
parent 1bc1d532cf
commit 9ed2f4d3cb
6 changed files with 34 additions and 12 deletions

View File

@ -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>

View File

@ -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 ;
}

View File

@ -193,7 +193,7 @@ public:
LLSpatialPartition* getSpatialPartition();
virtual S32 getMinFrameRange()const;
virtual U32 getMinFrameRange()const;
void removeFromOctree();
void setSpatialBridge(LLSpatialBridge* bridge) { mSpatialBridge = (LLDrawable*) bridge; }

View File

@ -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;

View File

@ -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;
}

View File

@ -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.