add some debug settings for easier tuning up performance.

master
Xiaohong Bao 2013-08-29 13:14:56 -06:00
parent 126a977bf8
commit 1751650dbc
4 changed files with 68 additions and 7 deletions

View File

@ -721,6 +721,17 @@
<integer>0</integer>
</map>
<key>BackDistanceFactor</key>
<map>
<key>Comment</key>
<string>Keep invisible objects in memory which are in the distance range (the factor * draw_distance) to the camera</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>0.125</real>
</map>
<key>BackgroundYieldTime</key>
<map>
<key>Comment</key>
@ -732,6 +743,17 @@
<key>Value</key>
<integer>40</integer>
</map>
<key>BackProjectionAngleSquared</key>
<map>
<key>Comment</key>
<string>squared tan(object bbox projection angle). that of invisible objects greater than this threshold are kept in memory</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>0.0311</real>
</map>
<key>BottomPanelNew</key>
<map>
<key>Comment</key>
@ -6306,6 +6328,17 @@
<key>Value</key>
<integer>64</integer>
</map>
<key>NewObjectCreationThrottleDelayTime</key>
<map>
<key>Comment</key>
<string>time in seconds NewObjectCreationThrottle to take effect after the progress screen is lifted</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>2.0</real>
</map>
<key>NextOwnerCopy</key>
<map>
<key>Comment</key>

View File

@ -1233,6 +1233,7 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time)
void LLViewerRegion::calcNewObjectCreationThrottle()
{
static LLCachedControl<S32> new_object_creation_throttle(gSavedSettings,"NewObjectCreationThrottle");
static LLCachedControl<F32> 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())

View File

@ -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<F32> back_dist_factor(gSavedSettings,"BackDistanceFactor");
//squared tan(projection angle of the bbox), default is 10 (degree)
static LLCachedControl<F32> 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;

View File

@ -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<LLVOCacheEntry*> 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<LLVOCachePartition>