From 1751650dbcad4ea66b2c3779aa52960ec1640466 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 29 Aug 2013 13:14:56 -0600 Subject: add some debug settings for easier tuning up performance. --- indra/newview/app_settings/settings.xml | 33 +++++++++++++++++++++++++++++++++ indra/newview/llviewerregion.cpp | 13 ++++++++++--- indra/newview/llvocache.cpp | 24 ++++++++++++++++++++---- indra/newview/llvocache.h | 5 +++++ 4 files changed, 68 insertions(+), 7 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b2e3c8b683..93cc605be0 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -721,6 +721,17 @@ 0 + BackDistanceFactor + + Comment + Keep invisible objects in memory which are in the distance range (the factor * draw_distance) to the camera + Persist + 1 + Type + F32 + Value + 0.125 + BackgroundYieldTime Comment @@ -732,6 +743,17 @@ Value 40 + BackProjectionAngleSquared + + Comment + squared tan(object bbox projection angle). that of invisible objects greater than this threshold are kept in memory + Persist + 1 + Type + F32 + Value + 0.0311 + BottomPanelNew Comment @@ -6306,6 +6328,17 @@ Value 64 + NewObjectCreationThrottleDelayTime + + Comment + time in seconds NewObjectCreationThrottle to take effect after the progress screen is lifted + Persist + 1 + Type + F32 + Value + 2.0 + NextOwnerCopy Comment diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index da01c0406a..9c038d54d5 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1233,6 +1233,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time) void LLViewerRegion::calcNewObjectCreationThrottle() { static LLCachedControl new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle"); + static LLCachedControl throttle_delay_time(gSavedSettings,"NewObjectCreationThrottleDelayTime"); static LLFrameTimer timer; // @@ -1243,16 +1244,20 @@ void LLViewerRegion::calcNewObjectCreationThrottle() //>0: valid throttling number // - if(gViewerWindow->getProgressView()->getVisible()) + if(gViewerWindow->getProgressView()->getVisible() && throttle_delay_time > 0.f) { sNewObjectCreationThrottle = -2; //cancel the throttling timer.reset(); } - else if(sNewObjectCreationThrottle < 0) //just recoved from the login/teleport screen + else if(sNewObjectCreationThrottle < -1) //just recoved from the login/teleport screen { - if(new_object_creation_throttle > 0 && timer.getElapsedTimeF32() > 2.0f) //wait for two seconds to reset the throttle + if(timer.getElapsedTimeF32() > throttle_delay_time) //wait for throttle_delay_time to reset the throttle { sNewObjectCreationThrottle = new_object_creation_throttle; //reset + if(sNewObjectCreationThrottle < -1) + { + sNewObjectCreationThrottle = -1; + } } } } @@ -1285,6 +1290,8 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time) S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); + LLVOCacheEntry::updateBackCullingFactors(); + for(; update_counter > 0; --update_counter, ++iter) { if(iter == mImpl->mActiveSet.end()) diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index dcd1ae391d..1cfda038a8 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -33,7 +33,10 @@ #include "lldrawable.h" #include "llviewerregion.h" #include "pipeline.h" +#include "llagentcamera.h" +F32 LLVOCacheEntry::sBackDistanceSquared = 0.f; +F32 LLVOCacheEntry::sBackAngleTanSquared = 0.f; BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE; LLTrace::MemStatHandle LLVOCachePartition::sMemStat("LLVOCachePartition"); @@ -353,6 +356,21 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const return success ; } +//static +void LLVOCacheEntry::updateBackCullingFactors() +{ + //distance to keep objects = back_dist_factor * draw_distance + static LLCachedControl back_dist_factor(gSavedSettings,"BackDistanceFactor"); + + //squared tan(projection angle of the bbox), default is 10 (degree) + static LLCachedControl squared_back_angle(gSavedSettings,"BackProjectionAngleSquared"); + + sBackDistanceSquared = back_dist_factor * gAgentCamera.mDrawDistance; + sBackDistanceSquared *= sBackDistanceSquared; + + sBackAngleTanSquared = squared_back_angle; +} + bool LLVOCacheEntry::isRecentlyVisible() const { bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); @@ -363,12 +381,10 @@ bool LLVOCacheEntry::isRecentlyVisible() const } //combination of projected area and squared distance - if(!vis && !mParentID && mSceneContrib > 0.0311f) //projection angle > 10 (degree) + if(!vis && !mParentID && mSceneContrib > sBackAngleTanSquared) { - //squared distance - const F32 SQUARED_CUT_OFF_DIST = 256.0; //16m F32 rad = getBinRadius(); - vis = (rad * rad / mSceneContrib < SQUARED_CUT_OFF_DIST); + vis = (rad * rad / mSceneContrib < sBackDistanceSquared); } return vis; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index a385610a10..52b25b7f91 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -123,6 +123,8 @@ public: void setUpdateFlags(U32 flags) {mUpdateFlags = flags;} U32 getUpdateFlags() const {return mUpdateFlags;} + static void updateBackCullingFactors(); + private: static U32 getInvisibleObjectsLiveTime(); @@ -151,6 +153,9 @@ protected: std::vector mChildrenList; //children entries in a linked set. BOOL mTouched; //if set, this entry is valid, otherwise it is invalid. + + static F32 sBackDistanceSquared; + static F32 sBackAngleTanSquared; }; class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable -- cgit v1.2.3