diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2013-09-26 22:28:21 -0600 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2013-09-26 22:28:21 -0600 |
commit | 2fad2cc7365803b63bfe2466da2558182a1c25b9 (patch) | |
tree | 21bee002ad15bf761fc03eae8100badc5a2deb4a | |
parent | 5cbd814d497c6772424cc555812da620370db37b (diff) |
more optimization for memory footprint.
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 7 | ||||
-rwxr-xr-x | indra/newview/llvocache.cpp | 28 | ||||
-rwxr-xr-x | indra/newview/llvocache.h | 7 |
3 files changed, 17 insertions, 25 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 24f419b4b1..18232e75c9 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1303,6 +1303,9 @@ void LLViewerRegion::calcNewObjectCreationThrottle() } } } + + //update some LLVOCacheEntry debug setting factors. + LLVOCacheEntry::updateDebugSettings(); } BOOL LLViewerRegion::isViewerCameraStatic() @@ -1332,9 +1335,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) std::vector<LLDrawable*> delete_list; S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); - LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); - - LLVOCacheEntry::updateBackCullingFactors(); + LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) { diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 91a5d4f973..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(); @@ -345,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"); @@ -353,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; @@ -363,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) { @@ -668,7 +658,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera) if(mBackSlectionEnabled < 0) { - mBackSlectionEnabled = LLVOCacheEntry::getInvisibleObjectsLiveTime() - 1; + mBackSlectionEnabled = LLVOCacheEntry::sMinFrameRange - 1; mBackSlectionEnabled = llmax(mBackSlectionEnabled, (S32)1); } diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 70900a7e22..cc755b6231 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -125,8 +125,7 @@ public: void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} - static void updateBackCullingFactors(); - static U32 getInvisibleObjectsLiveTime(); + static void updateDebugSettings(); private: void updateParentBoundingInfo(const LLVOCacheEntry* child); @@ -149,7 +148,6 @@ protected: U8 *mBuffer; F32 mSceneContrib; //projected scene contributuion of this object. - U32 mMinFrameRange; U32 mState; //high 16 bits reserved for special use. std::vector<LLVOCacheEntry*> mChildrenList; //children entries in a linked set. @@ -157,6 +155,9 @@ protected: static F32 sBackDistanceSquared; static F32 sBackAngleTanSquared; + +public: + static U32 sMinFrameRange; }; class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable<LLVOCachePartition> |