From 92339583e6454bd6e769a6dcb0ad2eee31abfb1f Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 21 Jun 2013 13:02:20 -0600 Subject: for SH-4241: viewer crash shortly after login in LLViewerRegion::addNewObject --- indra/newview/llviewerregion.cpp | 2 +- indra/newview/llvocache.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index a2fd440895..c3c791c158 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -992,7 +992,7 @@ void LLViewerRegion::removeFromVOCacheTree(LLVOCacheEntry* entry) //add the visible entries void LLViewerRegion::addVisibleCacheEntry(LLVOCacheEntry* entry) { - if(mDead || !entry) + if(mDead || !entry || !entry->getEntry()) { return; } diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 93daf2e171..216a91e1dc 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -244,6 +244,13 @@ U32 LLVOCacheEntry::getMinFrameRange()const void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) { llassert(entry != NULL); + llassert(entry->getParentID() == mLocalID); + llassert(entry->getEntry() != NULL); + + if(!entry || !entry->getEntry() || entry->getParentID() != mLocalID) + { + return; + } mChildrenList.push_back(entry); } -- cgit v1.2.3 From 916b68d1cb706b2dc469219f1976f10baadaea08 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 21 Jun 2013 14:32:26 -0600 Subject: trivial: convert to unix line endings. --- indra/newview/llvocache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 216a91e1dc..b3c7b80c29 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -244,7 +244,7 @@ U32 LLVOCacheEntry::getMinFrameRange()const void LLVOCacheEntry::addChild(LLVOCacheEntry* entry) { llassert(entry != NULL); - llassert(entry->getParentID() == mLocalID); + llassert(entry->getParentID() == mLocalID); llassert(entry->getEntry() != NULL); if(!entry || !entry->getEntry() || entry->getParentID() != mLocalID) -- cgit v1.2.3 From d95d69cbc4063fae1d93ce2f0c4d22d3ef9c8edd Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Mon, 24 Jun 2013 11:42:32 -0600 Subject: fix for SH-4284: interesting: viewer does not render cacheable objects on far corner of region when camera moves --- indra/newview/llvieweroctree.cpp | 5 ++++ indra/newview/llvieweroctree.h | 1 + indra/newview/llvocache.cpp | 51 +++++++++++++++++++++++++++++++++++----- indra/newview/llvocache.h | 7 ++++++ 4 files changed, 58 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index d631985e82..576dbfd2c2 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -1022,6 +1022,11 @@ BOOL LLOcclusionCullingGroup::earlyFail(LLCamera* camera) return TRUE; } +U32 LLOcclusionCullingGroup::getLastOcclusionIssuedTime() +{ + return mOcclusionIssued[LLViewerCamera::sCurCameraID]; +} + void LLOcclusionCullingGroup::checkOcclusion() { if (LLPipeline::sUseOcclusion > 1) diff --git a/indra/newview/llvieweroctree.h b/indra/newview/llvieweroctree.h index 7f2ca6ed2d..e210d8f478 100644 --- a/indra/newview/llvieweroctree.h +++ b/indra/newview/llvieweroctree.h @@ -320,6 +320,7 @@ public: BOOL isOcclusionState(U32 state) const { return mOcclusionState[LLViewerCamera::sCurCameraID] & state ? TRUE : FALSE; } BOOL needsUpdate(); + U32 getLastOcclusionIssuedTime(); //virtual void handleChildAddition(const OctreeNode* parent, OctreeNode* child); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index b3c7b80c29..f23375adfa 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -399,9 +399,10 @@ void LLVOCachePartition::removeEntry(LLViewerOctreeEntry* entry) class LLVOCacheOctreeCull : public LLViewerOctreeCull { public: - LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, const LLVector3& shift, bool use_object_cache_occlusion) + LLVOCacheOctreeCull(LLCamera* camera, LLViewerRegion* regionp, const LLVector3& shift, bool use_object_cache_occlusion, LLVOCachePartition* part) : LLViewerOctreeCull(camera), - mRegionp(regionp) + mRegionp(regionp), + mPartition(part) { mLocalShift = shift; mUseObjectCacheOcclusion = (use_object_cache_occlusion && LLPipeline::sUseOcclusion); @@ -422,6 +423,7 @@ public: if (group->isOcclusionState(LLSpatialGroup::OCCLUDED)) { + mPartition->addOccluders(group); return true; } } @@ -473,9 +475,10 @@ public: } private: - LLViewerRegion* mRegionp; - LLVector3 mLocalShift; //shift vector from agent space to local region space. - bool mUseObjectCacheOcclusion; + LLVOCachePartition* mPartition; + LLViewerRegion* mRegionp; + LLVector3 mLocalShift; //shift vector from agent space to local region space. + bool mUseObjectCacheOcclusion; }; S32 LLVOCachePartition::cull(LLCamera &camera) @@ -493,12 +496,48 @@ S32 LLVOCachePartition::cull(LLCamera &camera) LLVector3 region_agent = mRegionp->getOriginAgent(); camera.calcRegionFrustumPlanes(region_agent); - LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, use_object_cache_occlusion); + mOccludedGroups.clear(); + + LLVOCacheOctreeCull culler(&camera, mRegionp, region_agent, use_object_cache_occlusion, this); culler.traverse(mOctree); + if(!mOccludedGroups.empty()) + { + processOccluders(&camera); + mOccludedGroups.clear(); + } + return 0; } +void LLVOCachePartition::addOccluders(LLviewerOctreeGroup* gp) +{ + LLOcclusionCullingGroup* group = (LLOcclusionCullingGroup*)gp; + + const U32 MIN_WAIT_TIME = 16; //wait 16 frames to issue a new occlusion request + U32 last_issued_time = group->getLastOcclusionIssuedTime(); + if(gFrameCount > last_issued_time && gFrameCount < last_issued_time + MIN_WAIT_TIME) + { + return; + } + + if(group && !group->isOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION)) + { + group->setOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION); + mOccludedGroups.insert(group); + } +} + +void LLVOCachePartition::processOccluders(LLCamera* camera) +{ + for(std::set::iterator iter = mOccludedGroups.begin(); iter != mOccludedGroups.end(); ++iter) + { + LLOcclusionCullingGroup* group = *iter; + group->doOcclusion(camera); + group->clearOcclusionState(LLOcclusionCullingGroup::ACTIVE_OCCLUSION); + } +} + //------------------------------------------------------------------- //LLVOCache //------------------------------------------------------------------- diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index b8a7ccac99..1aa58528db 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -156,8 +156,15 @@ public: void addEntry(LLViewerOctreeEntry* entry); void removeEntry(LLViewerOctreeEntry* entry); /*virtual*/ S32 cull(LLCamera &camera); + void addOccluders(LLviewerOctreeGroup* gp); static LLTrace::MemStatHandle sMemStat; + +private: + void processOccluders(LLCamera* camera); + +private: + std::set mOccludedGroups; }; // -- cgit v1.2.3