summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-09-19 11:15:23 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-09-19 11:15:23 -0600
commit52118862ba0946da3e4cfc558c3f457b0e6d0b2c (patch)
treec98c137c922cab800aec0eb5c95cde1ea4234e6c /indra
parent02dc270620bab6d3bd8035294af4be5b35894b1c (diff)
parente464b855abb85e03dfec59691b7eccac27a323c4 (diff)
Automated merge with http://bitbucket.org/lindenlab/viewer-interesting
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llvocache.cpp32
-rwxr-xr-xindra/newview/llvocache.h3
2 files changed, 20 insertions, 15 deletions
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 5932fb87c1..6d2a17882a 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -491,8 +491,7 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
mLODPeriod = 16;
mRegionp = regionp;
mPartitionType = LLViewerRegion::PARTITION_VO_CACHE;
- mDirty = FALSE;
-
+
for(S32 i = 0; i < LLViewerCamera::NUM_CAMERAS; i++)
{
mCulledTime[i] = 0;
@@ -501,17 +500,11 @@ LLVOCachePartition::LLVOCachePartition(LLViewerRegion* regionp)
new LLOcclusionCullingGroup(mOctree, this);
}
-void LLVOCachePartition::setDirty()
-{
- mDirty = TRUE;
-}
-
void LLVOCachePartition::addEntry(LLViewerOctreeEntry* entry)
{
llassert(entry->hasVOCacheEntry());
mOctree->insert(entry);
- setDirty();
}
void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry)
@@ -643,12 +636,28 @@ S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
}
mCulledTime[LLViewerCamera::sCurCameraID] = LLViewerOctreeEntryData::getCurrentFrame();
- if(!mDirty && !mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic())
+ if(!mCullHistory[LLViewerCamera::sCurCameraID] && LLViewerRegion::isViewerCameraStatic())
{
- return 0; //nothing changed, skip culling
+ static U32 hash = 0;
+
+ U32 seed = llmax(mLODPeriod >> 1, (U32)4);
+ if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
+ {
+ if(!(LLViewerOctreeEntryData::getCurrentFrame() % seed))
+ {
+ hash = (hash + 1) % seed;
+ }
+ }
+ if(LLViewerOctreeEntryData::getCurrentFrame() % seed != hash)
+ {
+ return 0; //nothing changed, reduce frequency of culling
+ }
}
- mCullHistory[LLViewerCamera::sCurCameraID] <<= 1;
+ if(LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
+ {
+ mCullHistory[LLViewerCamera::sCurCameraID] <<= 1;
+ }
//localize the camera
LLVector3 region_agent = mRegionp->getOriginAgent();
@@ -709,7 +718,6 @@ void LLVOCachePartition::resetOccluders()
group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION);
}
mOccludedGroups.clear();
- mDirty = FALSE;
sNeedsOcclusionCheck = FALSE;
}
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 1fa019cfa6..7c7b64ad5b 100755
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -172,14 +172,11 @@ public:
void resetOccluders();
void processOccluders(LLCamera* camera);
- void setDirty();
-
public:
static BOOL sNeedsOcclusionCheck;
//static LLTrace::MemStatHandle sMemStat;
private:
- BOOL mDirty;
U32 mCullHistory[LLViewerCamera::NUM_CAMERAS];
U32 mCulledTime[LLViewerCamera::NUM_CAMERAS];
std::set<LLOcclusionCullingGroup*> mOccludedGroups;