summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorXiaohong Bao <bao@lindenlab.com>2013-08-07 22:53:27 -0600
committerXiaohong Bao <bao@lindenlab.com>2013-08-07 22:53:27 -0600
commita2c7b0485576c6bb92f6d0eddc762f5e37d5caac (patch)
tree400b50815c54740834a2a2d0810a5f72e712af70 /indra
parentf6a342438c59548276f0ee9f3033b47229d5d6d3 (diff)
more fix for SH-4397: Object cache occlusion culling results are not always correct
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llspatialpartition.cpp2
-rwxr-xr-xindra/newview/llspatialpartition.h2
-rw-r--r--indra/newview/llvieweroctree.h2
-rwxr-xr-xindra/newview/llviewerregion.cpp7
-rwxr-xr-xindra/newview/llvocache.cpp8
-rwxr-xr-xindra/newview/llvocache.h2
-rwxr-xr-xindra/newview/pipeline.cpp7
7 files changed, 15 insertions, 15 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index a5045e6a4c..a1b7bfe72a 100755
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -1476,7 +1476,7 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result
return 0;
}
-S32 LLSpatialPartition::cull(LLCamera &camera)
+S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion)
{
#if LL_OCTREE_PARANOIA_CHECK
((LLSpatialGroup*)mOctree->getListener(0))->checkStates();
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 6202fb11cb..1774baf0fe 100755
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -422,7 +422,7 @@ public:
virtual void rebuildMesh(LLSpatialGroup* group);
BOOL visibleObjectsInFrustum(LLCamera& camera);
- /*virtual*/ S32 cull(LLCamera &camera); // Cull on arbitrary frustum
+ /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion=false); // Cull on arbitrary frustum
S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results, BOOL for_select); // Cull on arbitrary frustum
BOOL isVisible(const LLVector3& v);
diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h
index 7c85231ce0..7fdb5661d8 100644
--- a/indra/newview/llvieweroctree.h
+++ b/indra/newview/llvieweroctree.h
@@ -357,7 +357,7 @@ public:
virtual ~LLViewerOctreePartition();
// Cull on arbitrary frustum
- virtual S32 cull(LLCamera &camera) = 0;
+ virtual S32 cull(LLCamera &camera, bool do_occlusion) = 0;
BOOL isOcclusionEnabled();
public:
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 49bb05d88e..117ccdea33 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1204,13 +1204,8 @@ BOOL LLViewerRegion::idleUpdate(F32 max_update_time)
{
throttle = -1; //cancel the throttling
- S32 occlusion = LLPipeline::sUseOcclusion;
- LLPipeline::sUseOcclusion = 0; //disable occlusion
-
//apply octree cullings here to pick up visible objects because rendering pipeline stops view culling at this moment
- mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance());
-
- LLPipeline::sUseOcclusion = occlusion;
+ mImpl->mVOCachePartition->cull(*LLViewerCamera::getInstance(), false);
}
else if(throttle < 0) //just recoved from the login/teleport screen
{
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 11f31fcb9a..82485d7fdc 100755
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -495,7 +495,7 @@ public:
mPartition(part)
{
mLocalShift = shift;
- mUseObjectCacheOcclusion = (use_object_cache_occlusion && LLPipeline::sUseOcclusion);
+ mUseObjectCacheOcclusion = use_object_cache_occlusion;
}
virtual bool earlyFail(LLviewerOctreeGroup* base_group)
@@ -586,10 +586,10 @@ private:
bool mUseObjectCacheOcclusion;
};
-S32 LLVOCachePartition::cull(LLCamera &camera)
+S32 LLVOCachePartition::cull(LLCamera &camera, bool do_occlusion)
{
static LLCachedControl<bool> use_object_cache_occlusion(gSavedSettings,"UseObjectCacheOcclusion");
-
+
if(!LLViewerRegion::sVOCacheCullingEnabled)
{
return 0;
@@ -601,7 +601,7 @@ S32 LLVOCachePartition::cull(LLCamera &camera)
LLVector3 region_agent = mRegionp->getOriginAgent();
camera.calcRegionFrustumPlanes(region_agent);
- LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, use_object_cache_occlusion, this);
+ LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, do_occlusion && use_object_cache_occlusion, this);
culler.traverse(mOctree);
return 0;
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index ef9edf991b..04463088fa 100755
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -159,7 +159,7 @@ public:
void addEntry(LLViewerOctreeEntry* entry);
void removeEntry(LLViewerOctreeEntry* entry);
- /*virtual*/ S32 cull(LLCamera &camera);
+ /*virtual*/ S32 cull(LLCamera &camera, bool do_occlusion);
void addOccluders(LLviewerOctreeGroup* gp);
void resetOccluders();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 1696f1962c..1abaaa49ac 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2408,6 +2408,11 @@ static LLFastTimer::DeclareTimer FTM_CULL("Object Culling");
void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip, LLPlane* planep)
{
+ static LLCachedControl<bool> use_occlusion(gSavedSettings,"UseOcclusion");
+ static bool can_use_occlusion = LLGLSLShader::sNoFixedFunction
+ && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
+ && gGLManager.mHasOcclusionQuery;
+
LLFastTimer t(FTM_CULL);
grabReferences(result);
@@ -2530,7 +2535,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
LLVOCachePartition* vo_part = region->getVOCachePartition();
if(vo_part)
{
- vo_part->cull(camera);
+ vo_part->cull(camera, can_use_occlusion && use_occlusion && !gUseWireframe);
}
}