diff options
Diffstat (limited to 'indra/newview/llvocache.cpp')
-rwxr-xr-x | indra/newview/llvocache.cpp | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 25dd1f4d07..7ba0c31ffc 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -37,6 +37,7 @@ F32 LLVOCacheEntry::sBackDistanceSquared = 0.f; F32 LLVOCacheEntry::sBackAngleTanSquared = 0.f; +U32 LLVOCacheEntry::sMinFrameRange = 0; BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE; BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) @@ -53,14 +54,6 @@ 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), @@ -78,7 +71,6 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer & mBuffer = new U8[dp.getBufferSize()]; mDP.assignBuffer(mBuffer, dp.getBufferSize()); mDP = dp; - mMinFrameRange = getInvisibleObjectsLiveTime(); } LLVOCacheEntry::LLVOCacheEntry() @@ -96,7 +88,6 @@ LLVOCacheEntry::LLVOCacheEntry() mParentID(0) { mDP.assignBuffer(mBuffer, 0); - mMinFrameRange = getInvisibleObjectsLiveTime(); } LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) @@ -111,7 +102,6 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) S32 size = -1; BOOL success; - mMinFrameRange = getInvisibleObjectsLiveTime(); mDP.assignBuffer(mBuffer, 0); success = check_read(apr_file, &mLocalID, sizeof(U32)); @@ -222,7 +212,7 @@ void LLVOCacheEntry::setState(U32 state) if(getState() == ACTIVE) { - const S32 MIN_INTERVAL = 64 + mMinFrameRange; + const S32 MIN_INTERVAL = 64 + sMinFrameRange; U32 last_visible = getVisible(); setVisible(); @@ -312,11 +302,6 @@ void LLVOCacheEntry::dump() const BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const { - if(!mEntry) - { - return FALSE; - } - BOOL success; success = check_write(apr_file, (void*)&mLocalID, sizeof(U32)); if(success) @@ -350,7 +335,7 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const } //static -void LLVOCacheEntry::updateBackCullingFactors() +void LLVOCacheEntry::updateDebugSettings() { //distance to keep objects = back_dist_factor * draw_distance static LLCachedControl<F32> back_dist_factor(gSavedSettings,"BackDistanceFactor"); @@ -358,6 +343,11 @@ void LLVOCacheEntry::updateBackCullingFactors() //squared tan(projection angle of the bbox), default is 10 (degree) static LLCachedControl<F32> squared_back_angle(gSavedSettings,"BackProjectionAngleSquared"); + //the number of frames invisible objects stay in memory + static LLCachedControl<U32> inv_obj_time(gSavedSettings,"InvisibleObjectsInMemoryTime"); + + sMinFrameRange = inv_obj_time - 1; //make 0 to be the maximum + sBackDistanceSquared = back_dist_factor * gAgentCamera.mDrawDistance; sBackDistanceSquared *= sBackDistanceSquared; @@ -368,11 +358,6 @@ bool LLVOCacheEntry::isRecentlyVisible() const { bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); - if(!vis) - { - vis = (sCurVisible - getVisible() < mMinFrameRange); - } - //combination of projected area and squared distance if(!vis && !mParentID && mSceneContrib > sBackAngleTanSquared) { @@ -673,7 +658,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera) if(mBackSlectionEnabled < 0) { - mBackSlectionEnabled = LLVOCacheEntry::getInvisibleObjectsLiveTime() - 1; + mBackSlectionEnabled = LLVOCacheEntry::sMinFrameRange - 1; mBackSlectionEnabled = llmax(mBackSlectionEnabled, (S32)1); } @@ -1191,7 +1176,7 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca if(success) { - for (S32 i = 0; i < num_entries; i++) + for (S32 i = 0; i < num_entries && apr_file.eof() != APR_EOF; i++) { LLPointer<LLVOCacheEntry> entry = new LLVOCacheEntry(&apr_file); if (!entry->getLocalID()) @@ -1308,6 +1293,10 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: if(!removal_enabled || iter->second->isTouched()) { success = iter->second->writeToFile(&apr_file) ; + if(!success) + { + break; + } } } } @@ -1316,7 +1305,6 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry: if(!success) { removeEntry(entry) ; - } return ; |