diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index a5045e6a4c094980cb8063352e59ded51995a624..a1b7bfe72a0d5877b27123679be7755dd40c305c 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 6202fb11cbf28060eb4e3f0de0e2d8d3478e3ccf..1774baf0fe8245cb4fdc83252632954e3b7bb465 100755 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -422,7 +422,7 @@ class LLSpatialPartition: public LLViewerOctreePartition, public LLGeometryManag 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 7c85231ce0d573aa27497acea6378351ad7ec80c..7fdb5661d8d11d308f494e1a9de9c385a71f9f2d 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -357,7 +357,7 @@ class LLViewerOctreePartition 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 49bb05d88e2c5577ec30dfe37d922e1fa122575a..117ccdea336393f9f059f890710e7478389f5a8a 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 11f31fcb9a25e3eb71a772b10d7087b0a51c8cb8..82485d7fdcf6870267128658a7e17706f28b5773 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -495,7 +495,7 @@ class LLVOCacheOctreeCull : public LLViewerOctreeCull 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 @@ class LLVOCacheOctreeCull : public LLViewerOctreeCull 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 ef9edf991bca43f63f7bc251b85127238eb96c43..04463088fa5069e87f412144ddbc50f2bdfb5378 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -159,7 +159,7 @@ class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTr 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 1696f1962c3cf336a39f120fa084525a59c12726..1abaaa49ac04792b5e0494c4ad0f2a67b6f9d79e 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); } }