summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-10-24 19:48:44 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-10-24 19:48:44 -0600
commitbd8f98ff3d870e17893154ba0d9ecf7396899bec (patch)
tree5b50838df1685f2c19ef94777818d76bad06a2fd /indra/newview
parentd98b6a932deb3125422c5b544aced9d05ff8f89f (diff)
add throttle to number of pokes to potential visible objects per frame.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llviewerregion.cpp61
1 files changed, 44 insertions, 17 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index d619a2af8b..dee52abea7 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1049,6 +1049,8 @@ void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry)
F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
{
+ static LLCachedControl<F32> projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF");
+
if(mDead)
{
return max_time;
@@ -1059,8 +1061,27 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
return max_time;
}
+ if(!sNewObjectCreationThrottle)
+ {
+ return max_time;
+ }
+ U32 new_obj_count = sNewObjectCreationThrottle;
+ if(sNewObjectCreationThrottle < 0)
+ {
+ new_obj_count = (U32)-1; //maximum
+ }
+ else
+ {
+ new_obj_count *= 1.5f; //load 50% more for selection
+ }
+
LLTimer update_timer;
+ //object projected area threshold
+ F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
+ F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f;
+ projection_threshold *= projection_threshold;
+
const F32 LARGE_SCENE_CONTRIBUTION = 100.f; //a large number to force to load the object.
const LLVector3 camera_origin = LLViewerCamera::getInstance()->getOrigin();
const U32 cur_frame = LLViewerOctreeEntryData::getCurrentFrame();
@@ -1068,7 +1089,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
U32 last_update = mImpl->mLastCameraUpdate;
//process visible entries
- for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();)
+ for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); new_obj_count > 0 && iter != mImpl->mVisibleEntries.end();)
{
LLVOCacheEntry* vo_entry = *iter;
@@ -1078,6 +1099,10 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
if(vo_entry->getState() < LLVOCacheEntry::WAITING)
{
mImpl->mWaitingList.insert(vo_entry);
+ if(!(--new_obj_count))
+ {
+ break;
+ }
}
LLVOCacheEntry* child;
@@ -1090,6 +1115,11 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
{
child->setSceneContribution(LARGE_SCENE_CONTRIBUTION); //a large number to force to load the child.
mImpl->mWaitingList.insert(child);
+
+ if(!(--new_obj_count))
+ {
+ break;
+ }
}
else
{
@@ -1123,7 +1153,7 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
//process visible groups
std::set< LLPointer<LLViewerOctreeGroup> >::iterator group_iter = mImpl->mVisibleGroups.begin();
- for(; group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
+ for(; new_obj_count > 0 && group_iter != mImpl->mVisibleGroups.end(); ++group_iter)
{
LLPointer<LLViewerOctreeGroup> group = *group_iter;
if(group->getNumRefs() < 3 || //group to be deleted
@@ -1145,7 +1175,16 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
}
vo_entry->calcSceneContribution(camera_origin, needs_update, last_update);
- mImpl->mWaitingList.insert(vo_entry);
+
+ if(vo_entry->getSceneContribution() > projection_threshold)
+ {
+ mImpl->mWaitingList.insert(vo_entry);
+
+ if(!(--new_obj_count))
+ {
+ break;
+ }
+ }
}
}
}
@@ -1161,8 +1200,6 @@ F32 LLViewerRegion::updateVisibleEntries(F32 max_time)
F32 LLViewerRegion::createVisibleObjects(F32 max_time)
{
- static LLCachedControl<F32> projection_area_cutoff(gSavedSettings,"ObjectProjectionAreaCutOFF");
-
if(mDead)
{
return max_time;
@@ -1171,12 +1208,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time)
{
mImpl->mVOCachePartition->setCullHistory(FALSE);
return max_time;
- }
-
- //object projected area threshold
- F32 pixel_meter_ratio = LLViewerCamera::getInstance()->getPixelMeterRatio();
- F32 projection_threshold = pixel_meter_ratio > 0.f ? projection_area_cutoff / pixel_meter_ratio : 0.f;
- projection_threshold *= projection_threshold;
+ }
S32 throttle = sNewObjectCreationThrottle;
BOOL has_new_obj = FALSE;
@@ -1184,12 +1216,7 @@ F32 LLViewerRegion::createVisibleObjects(F32 max_time)
for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin();
iter != mImpl->mWaitingList.end(); ++iter)
{
- LLVOCacheEntry* vo_entry = *iter;
-
- if(vo_entry->getSceneContribution() < projection_threshold)
- {
- break;
- }
+ LLVOCacheEntry* vo_entry = *iter;
if(vo_entry->getState() < LLVOCacheEntry::WAITING)
{