From 3cb64c5038b7cde8bd44ec3a029d477e415085ee Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 3 Dec 2013 15:52:36 -0800 Subject: SH-4606 FIX Interesting: Small objects do not load until they are very close. changed culling to use inverse distance to calculate solid angle, not distance squared --- indra/llcommon/lltracethreadrecorder.cpp | 21 ++------------------- indra/newview/llvieweroctree.cpp | 5 +---- indra/newview/llvocache.cpp | 16 ++++++---------- indra/newview/llvocache.h | 10 +++++----- 4 files changed, 14 insertions(+), 38 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index aec36ef2c4..d62fabe3df 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -130,7 +130,6 @@ TimeBlockTreeNode* ThreadRecorder::getTimeBlockTreeNode( S32 index ) return NULL; } - AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* recording) { ActiveRecording* active_recording = new ActiveRecording(recording); @@ -215,8 +214,7 @@ void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording ) ThreadRecorder::ActiveRecording::ActiveRecording( AccumulatorBufferGroup* target ) : mTargetRecording(target) -{ -} +{} void ThreadRecorder::ActiveRecording::movePartialToTarget() { @@ -238,21 +236,7 @@ void ThreadRecorder::addChildRecorder( class ThreadRecorder* child ) void ThreadRecorder::removeChildRecorder( class ThreadRecorder* child ) { { LLMutexLock lock(&mChildListMutex); - for (child_thread_recorder_list_t::iterator it = mChildThreadRecorders.begin(), end_it = mChildThreadRecorders.end(); - it != end_it; - ++it) - { - if ((*it) == child) - { - // FIXME: this won't do any good, as the child stores the "pushed" values internally - // and it is in the process of being deleted. - // We need a way to finalize the stats from the outgoing thread, but the storage - // for those stats needs to be outside the child's thread recorder - //(*it)->pushToParent(); - mChildThreadRecorders.erase(it); - break; - } - } + mChildThreadRecorders.remove(child); } } @@ -316,5 +300,4 @@ void set_thread_recorder( ThreadRecorder* recorder ) get_thread_recorder_ptr() = recorder; } - } diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp index aef632e913..88f3c7d6f9 100644 --- a/indra/newview/llvieweroctree.cpp +++ b/indra/newview/llvieweroctree.cpp @@ -1440,11 +1440,8 @@ S32 LLViewerOctreeCull::AABBRegionSphereIntersectObjectExtents(const LLViewerOct //------------------------------------------ //check if the objects projection large enough -static LLTrace::BlockTimerStatHandle sProjectedAreaCheckTimeStat("Object projected area check", "Culling objects based on projected area"); - bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLVector4a& size, const LLVector3& shift, F32 pixel_threshold, F32 near_radius) { - LL_RECORD_BLOCK_TIME(sProjectedAreaCheckTimeStat); LLVector3 local_orig = mCamera->getOrigin() - shift; LLVector4a origin; origin.load3(local_orig.mV); @@ -1462,7 +1459,7 @@ bool LLViewerOctreeCull::checkProjectionArea(const LLVector4a& center, const LLV distance -= near_radius; F32 squared_rad = size.dot3(size).getF32(); - return squared_rad / (distance * distance) > pixel_threshold; + return squared_rad / distance > pixel_threshold; } //virtual diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 956f9a2667..515cc003c0 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -433,11 +433,8 @@ bool LLVOCacheEntry::isAnyVisible(const LLVector4a& camera_origin, const LLVecto return vis; } -static LLTrace::BlockTimerStatHandle sSceneContributionCalc("Calculate scene contribution", "Calculates relative importance of object to scene, to control object load from cache"); - -void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 dist_threshold) +void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool needs_update, U32 last_update, F32 max_dist) { - LL_RECORD_BLOCK_TIME(sSceneContributionCalc); if(!needs_update && getVisible() >= last_update) { return; //no need to update @@ -446,8 +443,9 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool LLVector4a lookAt; lookAt.setSub(getPositionGroup(), camera_origin); F32 distance = lookAt.getLength3().getF32(); + distance -= sNearRadius; - if(distance <= sNearRadius) + if(distance <= 0.f) { //nearby objects, set a large number const F32 LARGE_SCENE_CONTRIBUTION = 1000.f; //a large number to force to load the object. @@ -455,14 +453,12 @@ void LLVOCacheEntry::calcSceneContribution(const LLVector4a& camera_origin, bool } else { - distance -= sNearRadius; - F32 rad = getBinRadius(); - dist_threshold += rad; + max_dist += rad; - if(distance < dist_threshold) + if(distance + sNearRadius < max_dist) { - mSceneContrib = (rad * rad) / (distance * distance); + mSceneContrib = (rad * rad) / distance; } else { diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 80268d4e9c..c32b4f8984 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -158,11 +158,11 @@ protected: F32 mBSphereRadius; //bounding sphere radius public: - static U32 sMinFrameRange; - static F32 sNearRadius; - static F32 sRearFarRadius; - static F32 sFrontPixelThreshold; - static F32 sRearPixelThreshold; + static U32 sMinFrameRange; + static F32 sNearRadius; + static F32 sRearFarRadius; + static F32 sFrontPixelThreshold; + static F32 sRearPixelThreshold; }; class LLVOCacheGroup : public LLOcclusionCullingGroup -- cgit v1.2.3