summaryrefslogtreecommitdiff
path: root/indra/newview/llvocache.cpp
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-06-19 11:46:51 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-06-19 11:46:51 -0600
commit7d88994edc38cf1c037877a5c7c86e35818b7b79 (patch)
tree94bcc8c30dacf3955c26b9aa54ce3f47e40f52a8 /indra/newview/llvocache.cpp
parentc5fc8f90060aa7a6c8fbb72313172423b01eddc5 (diff)
parentb38170e6817b3f69274d9b5953584a1278a17ca2 (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-interesting
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rwxr-xr-xindra/newview/llvocache.cpp20
1 files changed, 14 insertions, 6 deletions
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;
}