diff options
Diffstat (limited to 'indra/newview')
| -rwxr-xr-x | indra/newview/llviewerregion.cpp | 7 | ||||
| -rwxr-xr-x | indra/newview/llvocache.cpp | 40 | ||||
| -rwxr-xr-x | indra/newview/llvocache.h | 7 | 
3 files changed, 22 insertions, 32 deletions
| diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 24f419b4b1..18232e75c9 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1303,6 +1303,9 @@ void LLViewerRegion::calcNewObjectCreationThrottle()  			}  		}  	} + +	//update some LLVOCacheEntry debug setting factors. +	LLVOCacheEntry::updateDebugSettings();  }  BOOL LLViewerRegion::isViewerCameraStatic() @@ -1332,9 +1335,7 @@ F32 LLViewerRegion::killInvisibleObjects(F32 max_time)  	std::vector<LLDrawable*> delete_list;  	S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); -	LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry);	 -	 -	LLVOCacheEntry::updateBackCullingFactors(); +	LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry);		  	for(; update_counter > 0; --update_counter, ++iter)  	{	 diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 25dd1f4d07..7ba0c31ffc 100755 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -37,6 +37,7 @@  F32 LLVOCacheEntry::sBackDistanceSquared = 0.f;  F32 LLVOCacheEntry::sBackAngleTanSquared = 0.f; +U32 LLVOCacheEntry::sMinFrameRange = 0;  BOOL LLVOCachePartition::sNeedsOcclusionCheck = FALSE;  BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes)  @@ -53,14 +54,6 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes)  //---------------------------------------------------------------------------  // LLVOCacheEntry  //--------------------------------------------------------------------------- -//return number of frames invisible objects should stay in memory -//static  -U32 LLVOCacheEntry::getInvisibleObjectsLiveTime() -{ -	static LLCachedControl<U32> inv_obj_time(gSavedSettings,"InvisibleObjectsInMemoryTime"); - -	return inv_obj_time - 1; //make 0 to be the maximum  -}  LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp)  	: LLViewerOctreeEntryData(LLViewerOctreeEntry::LLVOCACHEENTRY), @@ -78,7 +71,6 @@ LLVOCacheEntry::LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &  	mBuffer = new U8[dp.getBufferSize()];  	mDP.assignBuffer(mBuffer, dp.getBufferSize());  	mDP = dp; -	mMinFrameRange = getInvisibleObjectsLiveTime();  }  LLVOCacheEntry::LLVOCacheEntry() @@ -96,7 +88,6 @@ LLVOCacheEntry::LLVOCacheEntry()  	mParentID(0)  {  	mDP.assignBuffer(mBuffer, 0); -	mMinFrameRange = getInvisibleObjectsLiveTime();  }  LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file) @@ -111,7 +102,6 @@ LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)  	S32 size = -1;  	BOOL success; -	mMinFrameRange = getInvisibleObjectsLiveTime();  	mDP.assignBuffer(mBuffer, 0);  	success = check_read(apr_file, &mLocalID, sizeof(U32)); @@ -222,7 +212,7 @@ void LLVOCacheEntry::setState(U32 state)  	if(getState() == ACTIVE)  	{ -		const S32 MIN_INTERVAL = 64 + mMinFrameRange; +		const S32 MIN_INTERVAL = 64 + sMinFrameRange;  		U32 last_visible = getVisible();  		setVisible(); @@ -312,11 +302,6 @@ void LLVOCacheEntry::dump() const  BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const  { -	if(!mEntry) -	{ -		return FALSE; -	} -  	BOOL success;  	success = check_write(apr_file, (void*)&mLocalID, sizeof(U32));  	if(success) @@ -350,7 +335,7 @@ BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const  }  //static  -void LLVOCacheEntry::updateBackCullingFactors() +void LLVOCacheEntry::updateDebugSettings()  {  	//distance to keep objects = back_dist_factor * draw_distance  	static LLCachedControl<F32> back_dist_factor(gSavedSettings,"BackDistanceFactor"); @@ -358,6 +343,11 @@ void LLVOCacheEntry::updateBackCullingFactors()  	//squared tan(projection angle of the bbox), default is 10 (degree)  	static LLCachedControl<F32> squared_back_angle(gSavedSettings,"BackProjectionAngleSquared"); +	//the number of frames invisible objects stay in memory +	static LLCachedControl<U32> inv_obj_time(gSavedSettings,"InvisibleObjectsInMemoryTime"); + +	sMinFrameRange = inv_obj_time - 1; //make 0 to be the maximum  +  	sBackDistanceSquared = back_dist_factor * gAgentCamera.mDrawDistance;  	sBackDistanceSquared *= sBackDistanceSquared; @@ -368,11 +358,6 @@ bool LLVOCacheEntry::isRecentlyVisible() const  {  	bool vis = LLViewerOctreeEntryData::isRecentlyVisible(); -	if(!vis) -	{ -		vis = (sCurVisible - getVisible() < mMinFrameRange); -	} -  	//combination of projected area and squared distance  	if(!vis && !mParentID && mSceneContrib > sBackAngleTanSquared)   	{ @@ -673,7 +658,7 @@ void LLVOCachePartition::selectBackObjects(LLCamera &camera)  	if(mBackSlectionEnabled < 0)  	{ -		mBackSlectionEnabled = LLVOCacheEntry::getInvisibleObjectsLiveTime() - 1; +		mBackSlectionEnabled = LLVOCacheEntry::sMinFrameRange - 1;  		mBackSlectionEnabled = llmax(mBackSlectionEnabled, (S32)1);  	} @@ -1191,7 +1176,7 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca  				if(success)  				{ -					for (S32 i = 0; i < num_entries; i++) +					for (S32 i = 0; i < num_entries && apr_file.eof() != APR_EOF; i++)  					{  						LLPointer<LLVOCacheEntry> entry = new LLVOCacheEntry(&apr_file);  						if (!entry->getLocalID()) @@ -1308,6 +1293,10 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:  				if(!removal_enabled || iter->second->isTouched())  				{  					success = iter->second->writeToFile(&apr_file) ; +					if(!success) +					{ +						break; +					}  				}  			}  		} @@ -1316,7 +1305,6 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:  	if(!success)  	{  		removeEntry(entry) ; -  	}  	return ; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index 70900a7e22..cc755b6231 100755 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -125,8 +125,7 @@ public:  	void setUpdateFlags(U32 flags) {mUpdateFlags = flags;}  	U32  getUpdateFlags() const    {return mUpdateFlags;} -	static void updateBackCullingFactors(); -	static U32  getInvisibleObjectsLiveTime(); +	static void updateDebugSettings();  private:  	void updateParentBoundingInfo(const LLVOCacheEntry* child);	 @@ -149,7 +148,6 @@ protected:  	U8							*mBuffer;  	F32                         mSceneContrib; //projected scene contributuion of this object. -	U32                         mMinFrameRange;  	U32                         mState; //high 16 bits reserved for special use.  	std::vector<LLVOCacheEntry*> mChildrenList; //children entries in a linked set. @@ -157,6 +155,9 @@ protected:  	static F32                  sBackDistanceSquared;  	static F32                  sBackAngleTanSquared; + +public: +	static U32                  sMinFrameRange;  };  class LLVOCachePartition : public LLViewerOctreePartition, public LLTrace::MemTrackable<LLVOCachePartition> | 
