diff options
| author | Oz Linden <oz@lindenlab.com> | 2012-07-13 13:04:16 -0400 | 
|---|---|---|
| committer | Oz Linden <oz@lindenlab.com> | 2012-07-13 13:04:16 -0400 | 
| commit | c3d9f0e41cc0cde6f1383225a8937d128e5838d8 (patch) | |
| tree | 24d60b5329c102c672ccd55e31527a1f304eca6a | |
| parent | 254c2703632ef5d7a875597d4907804c63ed8e72 (diff) | |
| parent | e51a60536dc082be563c2f5b3b4f86df843d3a14 (diff) | |
merge changes for DRTVWR-179
92 files changed, 1418 insertions, 780 deletions
| @@ -339,4 +339,5 @@ bce218b2b45b730b22cc51e4807aa8b571cadef3 DRTVWR-173  f91d003091a61937a044652c4c674447f7dcbb7a 3.3.4-beta1  82b5330bc8b17d0d4b598832e9c5a92e90075682 3.3.4-beta2  eb539c65e6ee26eea2bf373af2d0f4b52dc91289 DRTVWR-177 +4ad8a3afe40e0200309e3ada68932c4295ac2795 DRTVWR-179  a8057e1b9a1246b434a27405be35e030f7d28b0c 3.3.4-beta3 diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake index 98eeed09b3..00baf626d2 100644 --- a/indra/cmake/00-Common.cmake +++ b/indra/cmake/00-Common.cmake @@ -69,6 +69,7 @@ if (WINDOWS)        /Oy-        /Zc:wchar_t-        /arch:SSE2 +      /fp:fast        )    # Are we using the crummy Visual Studio KDU build workaround? diff --git a/indra/cmake/FindGooglePerfTools.cmake b/indra/cmake/FindGooglePerfTools.cmake index bb125d538e..bb125d538e 100755..100644 --- a/indra/cmake/FindGooglePerfTools.cmake +++ b/indra/cmake/FindGooglePerfTools.cmake diff --git a/indra/cmake/GooglePerfTools.cmake b/indra/cmake/GooglePerfTools.cmake index 09501e0406..09501e0406 100755..100644 --- a/indra/cmake/GooglePerfTools.cmake +++ b/indra/cmake/GooglePerfTools.cmake diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index a6f69a09e9..a6f69a09e9 100755..100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index c9fb8534f1..0a6a8f9fa6 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -189,6 +189,7 @@ void LLCharacter::requestStopMotion( LLMotion* motion)  //-----------------------------------------------------------------------------  static LLFastTimer::DeclareTimer FTM_UPDATE_ANIMATION("Update Animation");  static LLFastTimer::DeclareTimer FTM_UPDATE_HIDDEN_ANIMATION("Update Hidden Anim"); +static LLFastTimer::DeclareTimer FTM_UPDATE_MOTIONS("Update Motions");  void LLCharacter::updateMotions(e_update_t update_type)  { @@ -206,7 +207,10 @@ void LLCharacter::updateMotions(e_update_t update_type)  			mMotionController.unpauseAllMotions();  		}  		bool force_update = (update_type == FORCE_UPDATE); -		mMotionController.updateMotions(force_update); +		{ +			LLFastTimer t(FTM_UPDATE_MOTIONS); +			mMotionController.updateMotions(force_update); +		}  	}  } diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index bb892f4a7f..4f6351709e 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -542,6 +542,8 @@ void LLMotionController::updateIdleActiveMotions()  //-----------------------------------------------------------------------------  // updateMotionsByType()  //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_MOTION_ON_UPDATE("Motion onUpdate"); +  void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type)  {  	BOOL update_result = TRUE; @@ -699,7 +701,10 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty  			}  			// perform motion update -			update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); +			{ +				LLFastTimer t(FTM_MOTION_ON_UPDATE); +				update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); +			}  		}  		//********************** @@ -810,7 +815,7 @@ void LLMotionController::updateMotions(bool force_update)  	// Always cap the number of loaded motions  	purgeExcessMotions(); -	 +		  	// Update timing info for this time step.  	if (!mPaused)  	{ @@ -832,6 +837,7 @@ void LLMotionController::updateMotions(bool force_update)  				}  				updateLoadingMotions(); +				  				return;  			} @@ -850,7 +856,7 @@ void LLMotionController::updateMotions(bool force_update)  	}  	updateLoadingMotions(); - +	  	resetJointSignatures();  	if (mPaused && !force_update) @@ -861,11 +867,12 @@ void LLMotionController::updateMotions(bool force_update)  	{  		// update additive motions  		updateAdditiveMotions(); +				  		resetJointSignatures(); - +		  		// update all regular motions  		updateRegularMotions(); - +		  		if (use_quantum)  		{  			mPoseBlender.blendAndCache(TRUE); diff --git a/indra/llcommon/llallocator.cpp b/indra/llcommon/llallocator.cpp index 87654b5b97..87654b5b97 100755..100644 --- a/indra/llcommon/llallocator.cpp +++ b/indra/llcommon/llallocator.cpp diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index afaf366668..afaf366668 100755..100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 9dd776ff57..9dd776ff57 100755..100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h diff --git a/indra/llmath/CMakeLists.txt b/indra/llmath/CMakeLists.txt index 5865ae030c..5865ae030c 100755..100644 --- a/indra/llmath/CMakeLists.txt +++ b/indra/llmath/CMakeLists.txt diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index 0b591be622..0b591be622 100755..100644 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h diff --git a/indra/llmath/llmatrix3a.cpp b/indra/llmath/llmatrix3a.cpp index ab077abcb0..ab077abcb0 100755..100644 --- a/indra/llmath/llmatrix3a.cpp +++ b/indra/llmath/llmatrix3a.cpp diff --git a/indra/llmath/llmatrix4a.h b/indra/llmath/llmatrix4a.h index c4cefdb4fa..c4cefdb4fa 100755..100644 --- a/indra/llmath/llmatrix4a.h +++ b/indra/llmath/llmatrix4a.h diff --git a/indra/llmath/lloctree.h b/indra/llmath/lloctree.h index 6c7744cdf1..c3f6f7de2a 100644 --- a/indra/llmath/lloctree.h +++ b/indra/llmath/lloctree.h @@ -31,7 +31,6 @@  #include "v3math.h"  #include "llvector4a.h"  #include <vector> -#include <set>  #define OCT_ERRS LL_WARNS("OctreeErrors") @@ -79,11 +78,13 @@ public:  	typedef LLOctreeTraveler<T>									oct_traveler;  	typedef LLTreeTraveler<T>									tree_traveler; -	typedef typename std::set<LLPointer<T> >					element_list; -	typedef typename element_list::iterator						element_iter; -	typedef typename element_list::const_iterator	const_element_iter; +	typedef LLPointer<T>*										element_list; +	typedef LLPointer<T>*										element_iter; +	typedef const LLPointer<T>*									const_element_iter;  	typedef typename std::vector<LLTreeListener<T>*>::iterator	tree_listener_iter; -	typedef typename std::vector<LLOctreeNode<T>* >				child_list; +	typedef LLOctreeNode<T>**									child_list; +	typedef LLOctreeNode<T>**									child_iter; +  	typedef LLTreeNode<T>		BaseType;  	typedef LLOctreeNode<T>		oct_node;  	typedef LLOctreeListener<T>	oct_listener; @@ -105,6 +106,9 @@ public:  	:	mParent((oct_node*)parent),   		mOctant(octant)   	{  +		mData = NULL; +		mDataEnd = NULL; +  		mCenter = center;  		mSize = size; @@ -123,6 +127,16 @@ public:  	{   		BaseType::destroyListeners();  +		for (U32 i = 0; i < mElementCount; ++i) +		{ +			mData[i]->setBinIndex(-1); +			mData[i] = NULL; +		} + +		free(mData); +		mData = NULL; +		mDataEnd = NULL; +  		for (U32 i = 0; i < getChildCount(); i++)  		{  			delete getChild(i); @@ -219,12 +233,17 @@ public:  	}  	void accept(oct_traveler* visitor)				{ visitor->visit(this); } -	virtual bool isLeaf() const						{ return mChild.empty(); } +	virtual bool isLeaf() const						{ return mChildCount == 0; }  	U32 getElementCount() const						{ return mElementCount; } +	bool isEmpty() const							{ return mElementCount == 0; }  	element_list& getData()							{ return mData; }  	const element_list& getData() const				{ return mData; } -	 +	element_iter getDataBegin()						{ return mData; } +	element_iter getDataEnd()						{ return mDataEnd; } +	const_element_iter getDataBegin() const			{ return mData; } +	const_element_iter getDataEnd() const			{ return mDataEnd; } +		  	U32 getChildCount()	const						{ return mChildCount; }  	oct_node* getChild(U32 index)					{ return mChild[index]; }  	const oct_node* getChild(U32 index) const		{ return mChild[index]; } @@ -289,7 +308,7 @@ public:  	virtual bool insert(T* data)  	{ -		if (data == NULL) +		if (data == NULL || data->getBinIndex() != -1)  		{  			OCT_ERRS << "!!! INVALID ELEMENT ADDED TO OCTREE BRANCH !!!" << llendl;  			return false; @@ -302,13 +321,16 @@ public:  			if ((getElementCount() < gOctreeMaxCapacity && contains(data->getBinRadius()) ||  				(data->getBinRadius() > getSize()[0] &&	parent && parent->getElementCount() >= gOctreeMaxCapacity)))   			{ //it belongs here -				//if this is a redundant insertion, error out (should never happen) -				llassert(mData.find(data) == mData.end()); +				mElementCount++; +				mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); -				mData.insert(data); -				BaseType::insert(data); +				//avoid unref on uninitialized memory +				memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>)); -				mElementCount = mData.size(); +				mData[mElementCount-1] = data; +				mDataEnd = mData + mElementCount; +				data->setBinIndex(mElementCount-1); +				BaseType::insert(data);  				return true;  			}  			else @@ -342,10 +364,16 @@ public:  				if( lt == 0x7 )  				{ -					mData.insert(data); -					BaseType::insert(data); +					mElementCount++; +					mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); + +					//avoid unref on uninitialized memory +					memset(mData+mElementCount-1, 0, sizeof(LLPointer<T>)); -					mElementCount = mData.size(); +					mData[mElementCount-1] = data; +					mDataEnd = mData + mElementCount; +					data->setBinIndex(mElementCount-1); +					BaseType::insert(data);  					return true;  				} @@ -394,23 +422,59 @@ public:  		return false;  	} +	void _remove(T* data, S32 i) +	{ //precondition -- mElementCount > 0, idx is in range [0, mElementCount) + +		mElementCount--; +		data->setBinIndex(-1);  +		 +		if (mElementCount > 0) +		{ +			if (mElementCount != i) +			{ +				mData[i] = mData[mElementCount]; //might unref data, do not access data after this point +				mData[i]->setBinIndex(i); +			} + +			mData[mElementCount] = NULL; //needed for unref +			mData = (element_list) realloc(mData, sizeof(LLPointer<T>)*mElementCount); +			mDataEnd = mData+mElementCount; +		} +		else +		{ +			mData[0] = NULL; //needed for unref +			free(mData); +			mData = NULL; +			mDataEnd = NULL; +		} + +		notifyRemoval(data); +		checkAlive(); +	} +  	bool remove(T* data)  	{ -		if (mData.find(data) != mData.end()) -		{	//we have data -			mData.erase(data); -			mElementCount = mData.size(); -			notifyRemoval(data); -			checkAlive(); -			return true; -		} -		else if (isInside(data)) +		S32 i = data->getBinIndex(); + +		if (i >= 0 && i < mElementCount) +		{ +			if (mData[i] == data) +			{ //found it +				_remove(data, i); +				llassert(data->getBinIndex() == -1); +				return true; +			} +		} +		 +		if (isInside(data))  		{  			oct_node* dest = getNodeAt(data);  			if (dest != this)  			{ -				return dest->remove(data); +				bool ret = dest->remove(data); +				llassert(data->getBinIndex() == -1); +				return ret;  			}  		} @@ -429,19 +493,20 @@ public:  		//node is now root  		llwarns << "!!! OCTREE REMOVING FACE BY ADDRESS, SEVERE PERFORMANCE PENALTY |||" << llendl;  		node->removeByAddress(data); +		llassert(data->getBinIndex() == -1);  		return true;  	}  	void removeByAddress(T* data)  	{ -        if (mData.find(data) != mData.end()) +        for (U32 i = 0; i < mElementCount; ++i)  		{ -			mData.erase(data); -			mElementCount = mData.size(); -			notifyRemoval(data); -			llwarns << "FOUND!" << llendl; -			checkAlive(); -			return; +			if (mData[i] == data) +			{ //we have data +				_remove(data, i); +				llwarns << "FOUND!" << llendl; +				return; +			}  		}  		for (U32 i = 0; i < getChildCount(); i++) @@ -453,8 +518,8 @@ public:  	void clearChildren()  	{ -		mChild.clear();  		mChildCount = 0; +  		U32* foo = (U32*) mChildMap;  		foo[0] = foo[1] = 0xFFFFFFFF;  	} @@ -516,7 +581,7 @@ public:  		mChildMap[child->getOctant()] = mChildCount; -		mChild.push_back(child); +		mChild[mChildCount] = child;  		++mChildCount;  		child->setParent(this); @@ -543,9 +608,12 @@ public:  			mChild[index]->destroy();  			delete mChild[index];  		} -		mChild.erase(mChild.begin() + index); +  		--mChildCount; +		mChild[index] = mChild[mChildCount]; +		 +  		//rebuild child map  		U32* foo = (U32*) mChildMap;  		foo[0] = foo[1] = 0xFFFFFFFF; @@ -601,11 +669,12 @@ protected:  	oct_node* mParent;  	U8 mOctant; -	child_list mChild; +	LLOctreeNode<T>* mChild[8];  	U8 mChildMap[8];  	U32 mChildCount;  	element_list mData; +	element_iter mDataEnd;  	U32 mElementCount;  };  diff --git a/indra/llmath/llplane.h b/indra/llmath/llplane.h index 3c32441b11..3c32441b11 100755..100644 --- a/indra/llmath/llplane.h +++ b/indra/llmath/llplane.h diff --git a/indra/llmath/llsimdmath.h b/indra/llmath/llsimdmath.h index 01458521ec..01458521ec 100755..100644 --- a/indra/llmath/llsimdmath.h +++ b/indra/llmath/llsimdmath.h diff --git a/indra/llmath/llvector4a.cpp b/indra/llmath/llvector4a.cpp index 6edeb0fefe..6edeb0fefe 100755..100644 --- a/indra/llmath/llvector4a.cpp +++ b/indra/llmath/llvector4a.cpp diff --git a/indra/llmath/llvector4a.h b/indra/llmath/llvector4a.h index 0526793d3a..0526793d3a 100755..100644 --- a/indra/llmath/llvector4a.h +++ b/indra/llmath/llvector4a.h diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 11fa7080ce..53d56e96da 100755..100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -317,16 +317,16 @@ public:  		LLVector4a& min = node->mExtents[0];  		LLVector4a& max = node->mExtents[1]; -		if (!branch->getData().empty()) +		if (!branch->isEmpty())  		{ //node has data, find AABB that binds data set -			const LLVolumeTriangle* tri = *(branch->getData().begin()); +			const LLVolumeTriangle* tri = *(branch->getDataBegin());  			//initialize min/max to first available vertex  			min = *(tri->mV[0]);  			max = *(tri->mV[0]);  			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =  -				branch->getData().begin(); iter != branch->getData().end(); ++iter) +				branch->getDataBegin(); iter != branch->getDataEnd(); ++iter)  			{ //for each triangle in node  				//stretch by triangles in node @@ -341,7 +341,7 @@ public:  				max.setMax(max, *tri->mV[2]);  			}  		} -		else if (!branch->getChildren().empty()) +		else if (!branch->isLeaf())  		{ //no data, but child nodes exist  			LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(0)->getListener(0); diff --git a/indra/llmath/llvolumeoctree.cpp b/indra/llmath/llvolumeoctree.cpp index b5a935c2b5..cc83cb7235 100644 --- a/indra/llmath/llvolumeoctree.cpp +++ b/indra/llmath/llvolumeoctree.cpp @@ -131,7 +131,7 @@ void LLOctreeTriangleRayIntersect::traverse(const LLOctreeNode<LLVolumeTriangle>  void LLOctreeTriangleRayIntersect::visit(const LLOctreeNode<LLVolumeTriangle>* node)  {  	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter =  -			node->getData().begin(); iter != node->getData().end(); ++iter) +			node->getDataBegin(); iter != node->getDataEnd(); ++iter)  	{  		const LLVolumeTriangle* tri = *iter; @@ -236,8 +236,8 @@ void LLVolumeOctreeValidate::visit(const LLOctreeNode<LLVolumeTriangle>* branch)  	}  	//children fit, check data -	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin();  -			iter != branch->getData().end(); ++iter) +	for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin();  +			iter != branch->getDataEnd(); ++iter)  	{  		const LLVolumeTriangle* tri = *iter; diff --git a/indra/llmath/llvolumeoctree.h b/indra/llmath/llvolumeoctree.h index dac97b14b5..9ae34a0c4e 100755..100644 --- a/indra/llmath/llvolumeoctree.h +++ b/indra/llmath/llvolumeoctree.h @@ -49,7 +49,7 @@ public:  	LLVolumeTriangle()  	{ -		 +		mBinIndex = -1;	  	}  	LLVolumeTriangle(const LLVolumeTriangle& rhs) @@ -74,9 +74,16 @@ public:  	U16 mIndex[3];  	F32 mRadius; +	mutable S32 mBinIndex; +  	virtual const LLVector4a& getPositionGroup() const;  	virtual const F32& getBinRadius() const; +	 +	S32 getBinIndex() const { return mBinIndex; } +	void setBinIndex(S32 idx) const { mBinIndex = idx; } + +  };  class LLVolumeOctreeListener : public LLOctreeListener<LLVolumeTriangle> diff --git a/indra/llmath/tests/alignment_test.cpp b/indra/llmath/tests/alignment_test.cpp index ac0c45ae6f..ac0c45ae6f 100755..100644 --- a/indra/llmath/tests/alignment_test.cpp +++ b/indra/llmath/tests/alignment_test.cpp diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index a16f5c7bf0..f3f0007205 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -289,6 +289,8 @@ LLIOPipe::EStatus LLURLRequest::handleError(  }  static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST("URL Request"); +static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result"); +static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");  // virtual  LLIOPipe::EStatus LLURLRequest::process_impl( @@ -358,7 +360,6 @@ LLIOPipe::EStatus LLURLRequest::process_impl(  	{  		PUMP_DEBUG;  		LLIOPipe::EStatus status = STATUS_BREAK; -		static LLFastTimer::DeclareTimer FTM_URL_PERFORM("Perform");  		{  			LLFastTimer t(FTM_URL_PERFORM);  			if(!mDetail->mCurlRequest->wait()) @@ -371,8 +372,6 @@ LLIOPipe::EStatus LLURLRequest::process_impl(  		{  			CURLcode result; -			static LLFastTimer::DeclareTimer FTM_PROCESS_URL_REQUEST_GET_RESULT("Get Result"); -  			bool newmsg = false;  			{  				LLFastTimer t(FTM_PROCESS_URL_REQUEST_GET_RESULT); diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index 843c3bcc4b..e338d4ec71 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -258,6 +258,7 @@ namespace tut  	void HTTPClientTestObject::test<1>()  	{  		LLHTTPClient::get(local_server, newResult()); +  		runThePump();  		ensureStatusOK();  		ensure("result object wasn't destroyed", mResultDeleted); diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 659d3ca409..a842211764 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -237,9 +237,11 @@ S32 LLImageGL::dataFormatComponents(S32 dataformat)  //---------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_STATS("Image Stats");  // static  void LLImageGL::updateStats(F32 current_time)  { +	LLFastTimer t(FTM_IMAGE_UPDATE_STATS);  	sLastFrameTime = current_time;  	sBoundTextureMemoryInBytes = sCurBoundTextureMemory;  	sCurBoundTextureMemory = 0; diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index 99f0da330c..cc5c232380 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -69,6 +69,42 @@ LLRenderTarget::~LLRenderTarget()  	release();  } +void LLRenderTarget::resize(U32 resx, U32 resy, U32 color_fmt) +{  +	//for accounting, get the number of pixels added/subtracted +	S32 pix_diff = (resx*resy)-(mResX*mResY); +		 +	mResX = resx; +	mResY = resy; + +	for (U32 i = 0; i < mTex.size(); ++i) +	{ //resize color attachments +		gGL.getTexUnit(0)->bindManual(mUsage, mTex[i]); +		LLImageGL::setManualImage(LLTexUnit::getInternalType(mUsage), 0, color_fmt, mResX, mResY, GL_RGBA, GL_UNSIGNED_BYTE, NULL, false); +		sBytesAllocated += pix_diff*4; +	} + +	if (mDepth) +	{ //resize depth attachment +		if (mStencil) +		{ +			//use render buffers where stencil buffers are in play +			glBindRenderbuffer(GL_RENDERBUFFER, mDepth); +			glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, mResX, mResY); +			glBindRenderbuffer(GL_RENDERBUFFER, 0); +		} +		else +		{ +			gGL.getTexUnit(0)->bindManual(mUsage, mDepth); +			U32 internal_type = LLTexUnit::getInternalType(mUsage); +			LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); +		} + +		sBytesAllocated += pix_diff*4; +	} +} +	 +  bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage, bool use_fbo, S32 samples)  {  	stop_glerror(); diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 8360458840..e1a51304f1 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -57,8 +57,6 @@  */ -class LLMultisampleBuffer; -  class LLRenderTarget  {  public: @@ -74,6 +72,12 @@ public:  	//multiple calls will release previously allocated resources  	bool allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, bool stencil, LLTexUnit::eTextureType usage = LLTexUnit::TT_TEXTURE, bool use_fbo = false, S32 samples = 0); +	//resize existing attachments to use new resolution and color format +	// CAUTION: if the GL runs out of memory attempting to resize, this render target will be undefined +	// DO NOT use for screen space buffers or for scratch space for an image that might be uploaded +	// DO use for render targets that resize often and aren't likely to ruin someone's day if they break +	void resize(U32 resx, U32 resy, U32 color_fmt); +  	//add color buffer attachment  	//limit of 4 color attachments per render target  	bool addColorAttachment(U32 color_fmt); diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 953546a36f..739b31204d 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -38,10 +38,6 @@  #include "llglslshader.h"  #include "llmemory.h" -#if LL_DARWIN -#define LL_VBO_POOLING 1 -#else -#endif  //Next Highest Power Of Two  //helper function, returns first number > v that is a power of 2, or v if v is already a power of 2  U32 nhpo2(U32 v) @@ -294,6 +290,7 @@ void LLVBOPool::seedPool()  } +  void LLVBOPool::cleanup()  {  	U32 size = LL_VBO_BLOCK_SIZE; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 9783601696..9783601696 100755..100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index efa24796e5..024c25538c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -89,6 +89,7 @@  #include "lllogininstance.h"  #include "llprogressview.h"  #include "llvocache.h" +#include "llvopartgroup.h"  #include "llweb.h"  #include "llsecondlifeurls.h"  #include "llupdaterservice.h" @@ -678,6 +679,9 @@ bool LLAppViewer::init()  	// initialize SSE options  	LLVector4a::initClass(); +	//initialize particle index pool +	LLVOPartGroup::initClass(); +  	// Need to do this initialization before we do anything else, since anything  	// that touches files should really go through the lldir API  	gDirUtilp->initAppDirs("SecondLife"); diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 53c77fa22e..53c77fa22e 100755..100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 98246162f0..563b9b9cab 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -57,6 +57,8 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f;  static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound"); +extern bool gShiftFrame; +  ////////////////////////  // @@ -108,6 +110,8 @@ void LLDrawable::init()  	mGeneration = -1;  	mBinRadius = 1.f; +	mBinIndex = -1; +  	mSpatialBridge = NULL;  } @@ -714,6 +718,11 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)  		return;  	} +	if (gShiftFrame) +	{ +		return; +	} +  	//switch LOD with the spatial group to avoid artifacts  	//LLSpatialGroup* sg = getSpatialGroup(); @@ -823,14 +832,19 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)  		mXform.setPosition(mVObjp->getPositionAgent());  	} -	mXform.setRotation(mVObjp->getRotation()); -	mXform.setScale(1,1,1);  	mXform.updateMatrix();  	if (isStatic())  	{  		LLVOVolume* volume = getVOVolume(); -		if (!volume) + +		bool rebuild = (!volume &&  +						getRenderType() != LLPipeline::RENDER_TYPE_TREE && +						getRenderType() != LLPipeline::RENDER_TYPE_TERRAIN && +						getRenderType() != LLPipeline::RENDER_TYPE_SKY && +						getRenderType() != LLPipeline::RENDER_TYPE_GROUND); + +		if (rebuild)  		{  			gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);  		} @@ -844,7 +858,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)  				facep->mExtents[0].add(shift_vector);  				facep->mExtents[1].add(shift_vector); -				if (!volume && facep->hasGeometry()) +				if (rebuild && facep->hasGeometry())  				{  					facep->clearVertexBuffer();  				} @@ -955,6 +969,12 @@ void LLDrawable::updateUVMinMax()  {  } +LLSpatialGroup* LLDrawable::getSpatialGroup() const +{  +	llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1); +	return mSpatialGroupp;  +} +  void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)  {  /*if (mSpatialGroupp && (groupp != mSpatialGroupp)) @@ -977,6 +997,8 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)  	}  	mSpatialGroupp = groupp; + +	llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1);  }  LLSpatialPartition* LLDrawable::getSpatialPartition() @@ -1099,6 +1121,8 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat  	mDrawable = root;  	root->setSpatialBridge(this); +	mBinIndex = -1; +  	mRenderType = mDrawable->mRenderType;  	mDrawableType = mDrawable->mRenderType; @@ -1402,6 +1426,11 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)  		markDead();  		return;  	} +	 +	if (gShiftFrame) +	{ +		return; +	}  	if (mDrawable->getVObj())  	{ @@ -1480,7 +1509,13 @@ void LLSpatialBridge::cleanupReferences()  	LLDrawable::cleanupReferences();  	if (mDrawable)  	{ -		mDrawable->setSpatialGroup(NULL); +		LLSpatialGroup* group = mDrawable->getSpatialGroup(); +		if (group) +		{ +			group->mOctreeNode->remove(mDrawable); +			mDrawable->setSpatialGroup(NULL); +		} +		  		if (mDrawable->getVObj())  		{  			LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren(); @@ -1491,7 +1526,12 @@ void LLSpatialBridge::cleanupReferences()  				LLDrawable* drawable = child->mDrawable;					  				if (drawable)  				{ -					drawable->setSpatialGroup(NULL); +					LLSpatialGroup* group = drawable->getSpatialGroup(); +					if (group) +					{ +						group->mOctreeNode->remove(drawable); +						drawable->setSpatialGroup(NULL); +					}  				}  			}  		} diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 8c7db61502..960c64fa9e 100755..100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -120,6 +120,9 @@ public:  	F32			          getIntensity() const			{ return llmin(mXform.getScale().mV[0], 4.f); }  	S32					  getLOD() const				{ return mVObjp ? mVObjp->getLOD() : 1; }  	F32					  getBinRadius() const			{ return mBinRadius; } +	S32					  getBinIndex() const			{ return mBinIndex; } +	void				  setBinIndex(S32 index) const	{ mBinIndex = index; } +  	void  getMinMax(LLVector3& min,LLVector3& max) const { mXform.getMinMax(min,max); }  	LLXformMatrix*		getXform() { return &mXform; } @@ -205,7 +208,7 @@ public:  	S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators...  	void setSpatialGroup(LLSpatialGroup *groupp); -	LLSpatialGroup *getSpatialGroup() const			{ return mSpatialGroupp; } +	LLSpatialGroup *getSpatialGroup() const;  	LLSpatialPartition* getSpatialPartition();  	// Statics @@ -326,6 +329,7 @@ private:  	mutable U32		mVisible;  	F32				mRadius;  	F32				mBinRadius; +	mutable S32		mBinIndex;  	S32				mGeneration;  	LLVector3		mCurrentScale; diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 35f8a85796..6c0be0a5c2 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -253,48 +253,6 @@ void LLFacePool::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures  {  } -// static -S32 LLFacePool::drawLoop(face_array_t& face_list) -{ -	S32 res = 0; -	if (!face_list.empty()) -	{ -		for (std::vector<LLFace*>::iterator iter = face_list.begin(); -			 iter != face_list.end(); iter++) -		{ -			LLFace *facep = *iter; -			res += facep->renderIndexed(); -		} -	} -	return res; -} - -// static -S32 LLFacePool::drawLoopSetTex(face_array_t& face_list, S32 stage) -{ -	S32 res = 0; -	if (!face_list.empty()) -	{ -		for (std::vector<LLFace*>::iterator iter = face_list.begin(); -			 iter != face_list.end(); iter++) -		{ -			LLFace *facep = *iter; -			gGL.getTexUnit(stage)->bind(facep->getTexture(), TRUE) ; -			gGL.getTexUnit(0)->activate(); -			res += facep->renderIndexed(); -		} -	} -	return res; -} - -void LLFacePool::drawLoop() -{ -	if (!mDrawFace.empty()) -	{ -		drawLoop(mDrawFace); -	} -} -  void LLFacePool::enqueue(LLFace* facep)  {  	mDrawFace.push_back(facep); @@ -442,7 +400,7 @@ void LLRenderPass::renderTexture(U32 type, U32 mask)  void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)  { -	for (LLCullResult::drawinfo_list_t::iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)	 +	for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)	  	{  		LLDrawInfo* pparams = *i;  		if (pparams)  diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 64774d06df..e0f2da41d7 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -186,10 +186,6 @@ public:  	void buildEdges(); -	static S32 drawLoop(face_array_t& face_list); -	static S32 drawLoopSetTex(face_array_t& face_list, S32 stage); -	void drawLoop(); -  	void addFaceReference(LLFace *facep);  	void removeFaceReference(LLFace *facep); diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 5f2a982ed3..b4f6bf9383 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -348,7 +348,7 @@ void LLDrawPoolAlpha::render(S32 pass)  void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)  { -	for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) +	for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (group->mSpatialPartition->mRenderByGroup && @@ -385,7 +385,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)  	BOOL use_shaders = gPipeline.canUseVertexShaders(); -	for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i) +	for (LLCullResult::sg_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		llassert(group); @@ -411,6 +411,12 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)  					continue;  				} +				if ((params.mVertexBuffer->getTypeMask() & mask) != mask) +				{ //FIXME! +					llwarns << "Missing required components, skipping render batch." << llendl; +					continue; +				} +  				LLRenderPass::applyModelMatrix(params); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index ace3a20bbb..730ad1a364 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1036,9 +1036,13 @@ void LLDrawPoolAvatar::endDeferredSkinned()  	gGL.getTexUnit(0)->activate();  } +static LLFastTimer::DeclareTimer FTM_RENDER_AVATARS("renderAvatars"); +  void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  { +	LLFastTimer t(FTM_RENDER_AVATARS); +  	if (pass == -1)  	{  		for (S32 i = 1; i < getNumPasses(); i++) @@ -1195,15 +1199,6 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  	if (pass >= 7 && pass < 9)  	{ -		LLGLEnable blend(GL_BLEND); - -		gGL.setColorMask(true, true); -		gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, -					  LLRender::BF_ONE_MINUS_SOURCE_ALPHA, -					  LLRender::BF_ZERO, -					  LLRender::BF_ONE_MINUS_SOURCE_ALPHA); - -		  		if (pass == 7)  		{  			renderRiggedAlpha(avatarp); @@ -1219,20 +1214,8 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass)  	if (pass == 9)  	{ -		LLGLEnable blend(GL_BLEND); -		LLGLDisable test(GL_ALPHA_TEST); -		gGL.flush(); - -		LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); -		glPolygonOffset(-1.0f, -1.0f); -		gGL.setSceneBlendType(LLRender::BT_ADD); - -		LLGLDepthTest depth(GL_TRUE, GL_FALSE); -		gGL.setColorMask(false, true); -  		renderRiggedGlow(avatarp); -		gGL.setColorMask(true, false); -		gGL.setSceneBlendType(LLRender::BT_ALPHA); +		  		return;  	} @@ -1430,7 +1413,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*  void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)  { -	if (avatar->isSelf() && !gAgent.needsRenderAvatar() || !gMeshRepo.meshRezEnabled()) +	if (avatar->isSelf() && !gAgent.needsRenderAvatar())  	{  		return;  	} @@ -1559,8 +1542,12 @@ void LLDrawPoolAvatar::renderDeferredRiggedBump(LLVOAvatar* avatar)  	renderRigged(avatar, RIGGED_DEFERRED_BUMP);  } +static LLFastTimer::DeclareTimer FTM_RIGGED_VBO("Rigged VBO"); +  void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)  { +	LLFastTimer t(FTM_RIGGED_VBO); +  	//update rigged vertex buffers  	for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type)  	{ @@ -1632,17 +1619,56 @@ void LLDrawPoolAvatar::renderRiggedFullbrightShiny(LLVOAvatar* avatar)  void LLDrawPoolAvatar::renderRiggedAlpha(LLVOAvatar* avatar)  { -	renderRigged(avatar, RIGGED_ALPHA); +	if (!mRiggedFace[RIGGED_ALPHA].empty()) +	{ +		LLGLEnable blend(GL_BLEND); + +		gGL.setColorMask(true, true); +		gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA, +						LLRender::BF_ZERO, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA); + +		renderRigged(avatar, RIGGED_ALPHA); +	}  }  void LLDrawPoolAvatar::renderRiggedFullbrightAlpha(LLVOAvatar* avatar)  { -	renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA); +	if (!mRiggedFace[RIGGED_FULLBRIGHT_ALPHA].empty()) +	{ +		LLGLEnable blend(GL_BLEND); + +		gGL.setColorMask(true, true); +		gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA, +						LLRender::BF_ZERO, +						LLRender::BF_ONE_MINUS_SOURCE_ALPHA); + +		renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA); +	}  }  void LLDrawPoolAvatar::renderRiggedGlow(LLVOAvatar* avatar)  { -	renderRigged(avatar, RIGGED_GLOW, true); +	if (!mRiggedFace[RIGGED_GLOW].empty()) +	{ +		LLGLEnable blend(GL_BLEND); +		LLGLDisable test(GL_ALPHA_TEST); +		gGL.flush(); + +		LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); +		glPolygonOffset(-1.0f, -1.0f); +		gGL.setSceneBlendType(LLRender::BT_ADD); + +		LLGLDepthTest depth(GL_TRUE, GL_FALSE); +		gGL.setColorMask(false, true); + +		renderRigged(avatar, RIGGED_GLOW, true); + +		gGL.setColorMask(true, false); +		gGL.setSceneBlendType(LLRender::BT_ALPHA); +	}  } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 6f71e6ebc8..a264eae302 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -847,12 +847,12 @@ void LLDrawPoolBump::renderDeferred(S32 pass)  	LLFastTimer ftm(FTM_RENDER_BUMP);  	U32 type = LLRenderPass::PASS_BUMP; -	LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); -	LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); +	LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); +	LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);  	U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_BINORMAL | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR; -	for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i)	 +	for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)	  	{  		LLDrawInfo& params = **i; @@ -1448,10 +1448,10 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI  void LLDrawPoolBump::renderBump(U32 type, U32 mask)  {	 -	LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type); -	LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type); +	LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type); +	LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type); -	for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i)	 +	for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)	  	{  		LLDrawInfo& params = **i; diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index b95d8296fa..7fc78fb382 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -294,6 +294,34 @@ void LLDrawPoolTerrain::renderShadow(S32 pass)  	//glCullFace(GL_BACK);  } + +void LLDrawPoolTerrain::drawLoop() +{ +	if (!mDrawFace.empty()) +	{ +		for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); +			 iter != mDrawFace.end(); iter++) +		{ +			LLFace *facep = *iter; + +			LLMatrix4* model_matrix = &(facep->getDrawable()->getRegion()->mRenderMatrix); + +			if (model_matrix != gGLLastMatrix) +			{ +				gGLLastMatrix = model_matrix; +				gGL.loadMatrix(gGLModelView); +				if (model_matrix) +				{ +					gGL.multMatrix((GLfloat*) model_matrix->mMatrix); +				} +				gPipeline.mMatrixOpCount++; +			} + +			facep->renderIndexed(); +		} +	} +} +  void LLDrawPoolTerrain::renderFullShader()  {  	// Hack! Get the region that this draw pool is rendering from! diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 283ed87f1a..2163d087e1 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -83,6 +83,7 @@ protected:  	void renderFull2TU();  	void renderFull4TU();  	void renderFullShader(); +	void drawLoop();  };  #endif // LL_LLDRAWPOOLSIMPLE_H diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 3165a3516c..83f04e45a8 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -37,6 +37,7 @@  #include "llviewershadermgr.h"  #include "llrender.h"  #include "llviewercontrol.h" +#include "llviewerregion.h"  S32 LLDrawPoolTree::sDiffTex = 0;  static LLGLSLShader* shader = NULL; @@ -104,8 +105,22 @@ void LLDrawPoolTree::render(S32 pass)  	{  		LLFace *face = *iter;  		LLVertexBuffer* buff = face->getVertexBuffer(); +  		if(buff)  		{ +			LLMatrix4* model_matrix = &(face->getDrawable()->getRegion()->mRenderMatrix); + +			if (model_matrix != gGLLastMatrix) +			{ +				gGLLastMatrix = model_matrix; +				gGL.loadMatrix(gGLModelView); +				if (model_matrix) +				{ +					gGL.multMatrix((GLfloat*) model_matrix->mMatrix); +				} +				gPipeline.mMatrixOpCount++; +			} +  			buff->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);  			buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0);   			gPipeline.addTrianglesDrawn(buff->getNumIndices()); diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index 64eb11fc9b..885cae1737 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -155,6 +155,7 @@ LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) :  	mAvatarp(avatarp),   	mWearablep(NULL)  { +	mDefaultVec.clear();  }  LLDriverParam::LLDriverParam(LLWearable *wearablep) :  @@ -162,6 +163,7 @@ LLDriverParam::LLDriverParam(LLWearable *wearablep) :  	mAvatarp(NULL),   	mWearablep(wearablep)  { +	mDefaultVec.clear();  }  LLDriverParam::~LLDriverParam() @@ -341,18 +343,19 @@ F32	LLDriverParam::getTotalDistortion()  	return sum;   } -const LLVector3	&LLDriverParam::getAvgDistortion()	 +const LLVector4a	&LLDriverParam::getAvgDistortion()	  {  	// It's not actually correct to take the average of averages, but it good enough here. -	LLVector3 sum; +	LLVector4a sum; +	sum.clear();  	S32 count = 0;  	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )  	{  		LLDrivenEntry* driven = &(*iter); -		sum += driven->mParam->getAvgDistortion(); +		sum.add(driven->mParam->getAvgDistortion());  		count++;  	} -	sum /= (F32)count; +	sum.mul( 1.f/(F32)count);  	mDefaultVec = sum;  	return mDefaultVec;  @@ -375,21 +378,22 @@ F32	LLDriverParam::getMaxDistortion()  } -LLVector3	LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh) +LLVector4a	LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)  { -	LLVector3 sum; +	LLVector4a sum; +	sum.clear();  	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )  	{  		LLDrivenEntry* driven = &(*iter); -		sum += driven->mParam->getVertexDistortion( index, poly_mesh ); +		sum.add(driven->mParam->getVertexDistortion( index, poly_mesh ));  	}  	return sum;  } -const LLVector3*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)  {  	mCurrentDistortionParam = NULL; -	const LLVector3* v = NULL; +	const LLVector4a* v = NULL;  	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )  	{  		LLDrivenEntry* driven = &(*iter); @@ -404,7 +408,7 @@ const LLVector3*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly  	return v;  }; -const LLVector3*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)  {  	llassert( mCurrentDistortionParam );  	if( !mCurrentDistortionParam ) @@ -432,7 +436,7 @@ const LLVector3*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_  	}  	// We're already in the middle of a param's distortions, so get the next one. -	const LLVector3* v = driven->mParam->getNextDistortion( index, poly_mesh ); +	const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh );  	if( (!v) && (iter != mDriven.end()) )  	{  		// This param is finished, so start the next param.  It might not have any diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h index fb1b44458c..7a4d711d4e 100644 --- a/indra/newview/lldriverparam.h +++ b/indra/newview/lldriverparam.h @@ -105,18 +105,18 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion(); -	/*virtual*/ const LLVector3&	getAvgDistortion(); +	/*virtual*/ const LLVector4a&	getAvgDistortion();  	/*virtual*/ F32					getMaxDistortion(); -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);  protected:  	F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);  	void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake); -	LLVector3	mDefaultVec; // temp holder +	LLVector4a	mDefaultVec; // temp holder  	typedef std::vector<LLDrivenEntry> entry_list_t;  	entry_list_t mDriven;  	LLViewerVisualParam* mCurrentDistortionParam; diff --git a/indra/newview/lldynamictexture.h b/indra/newview/lldynamictexture.h index c51e7d1e1a..c51e7d1e1a 100755..100644 --- a/indra/newview/lldynamictexture.h +++ b/indra/newview/lldynamictexture.h diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index d32994cd31..4f3208474d 100755..100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -163,16 +163,10 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)  	mGeomCount		= 0;  	mGeomIndex		= 0;  	mIndicesCount	= 0; -	if (drawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || -		drawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES) -	{ //indicate to LLParticlePartition that this particle is uninitialized -		mIndicesIndex = 0xFFFFFFFF; -	} -	else -	{ -		mIndicesIndex	= 0; -	} -	mIndexInTex = 0; + +	//special value to indicate uninitialized position +	mIndicesIndex	= 0xFFFFFFFF; +  	mTexture		= NULL;  	mTEOffset		= -1;  	mTextureIndex = 255; @@ -207,13 +201,10 @@ void LLFace::destroy()  		mTexture->removeFace(this) ;  	} -	if (mDrawablep.notNull() && -		(mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES || -		mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES) && -		mIndicesIndex != 0xFFFFFFFF) +	if (isState(LLFace::PARTICLE))  	{  		LLVOPartGroup::freeVBSlot(getGeomIndex()/4); -		mIndicesIndex = 0xFFFFFFFF; +		clearState(LLFace::PARTICLE);  	}  	if (mDrawPoolp) @@ -1194,19 +1185,25 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,  	{  		if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())  		{ -			llwarns	<< "Index buffer overflow!" << llendl; -			llwarns << "Indices Count: " << mIndicesCount -					<< " VF Num Indices: " << num_indices -					<< " Indices Index: " << mIndicesIndex -					<< " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl; -			llwarns	<< " Face Index: " << f -					<< " Pool Type: " << mPoolType << llendl; +			if (gDebugGL) +			{ +				llwarns	<< "Index buffer overflow!" << llendl; +				llwarns << "Indices Count: " << mIndicesCount +						<< " VF Num Indices: " << num_indices +						<< " Indices Index: " << mIndicesIndex +						<< " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl; +				llwarns	<< " Face Index: " << f +						<< " Pool Type: " << mPoolType << llendl; +			}  			return FALSE;  		}  		if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts())  		{ -			llwarns << "Vertex buffer overflow!" << llendl; +			if (gDebugGL) +			{ +				llwarns << "Vertex buffer overflow!" << llendl; +			}  			return FALSE;  		}  	} diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 5dca27487f..efc3424858 100755..100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -90,6 +90,7 @@ public:  		USE_FACE_COLOR	= 0x0010,  		TEXTURE_ANIM	= 0x0020,   		RIGGED			= 0x0040, +		PARTICLE		= 0x0080,  	};  	static void initClass(); diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 11edb60712..c4dca4cb79 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -65,7 +65,7 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD  	mFrameNum = 0;  	mCollisionSphereRadius = 0.f;  	mRenderRes = 1; - +	  	if(mVO->mDrawable.notNull())  	{  		mVO->mDrawable->makeActive() ; @@ -255,50 +255,28 @@ void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, cons  {  } -//--------------------------------------------------------------------------------- -// This calculates the physics of the flexible object. Note that it has to be 0 -// updated every time step. In the future, perhaps there could be an  -// optimization similar to what Havok does for objects that are stationary.  -//--------------------------------------------------------------------------------- -static LLFastTimer::DeclareTimer FTM_FLEXIBLE_UPDATE("Update Flexies"); -BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) -{ -	if (mVO->mDrawable.isNull()) -	{ -		// Don't do anything until we have a drawable -		return FALSE; // (we are not initialized or updated) -	} - -	BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE; -	//flexible objects never go static -	mVO->mDrawable->mQuietCount = 0; -	if (!mVO->mDrawable->isRoot()) -	{ -		LLViewerObject* parent = (LLViewerObject*) mVO->getParent(); -		parent->mDrawable->mQuietCount = 0; -	} +void LLVolumeImplFlexible::updateRenderRes() +{ +	LLDrawable* drawablep = mVO->mDrawable; -	LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); -		  	S32 new_res = mAttributes->getSimulateLOD(); -	//number of segments only cares about z axis -	F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, mVO->mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); +#if 1 //optimal approximation of previous behavior that doesn't rely on atan2 +	F32 app_angle = mVO->getScale().mV[2]/drawablep->mDistanceWRTCamera;  	// Rendering sections increases with visible angle on the screen -	mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView()); -	if (mRenderRes > FLEXIBLE_OBJECT_MAX_SECTIONS) -	{ -		mRenderRes = FLEXIBLE_OBJECT_MAX_SECTIONS; -	} - +	mRenderRes = (S32) (12.f*app_angle); +#else //legacy behavior +	//number of segments only cares about z axis +	F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); -	// Bottom cap at 1/4 the original number of sections -	if (mRenderRes < mAttributes->getSimulateLOD()-1) -	{ -		mRenderRes = mAttributes->getSimulateLOD()-1; -	} + 	// Rendering sections increases with visible angle on the screen +	mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView()); +#endif +		 +	mRenderRes = llclamp(mRenderRes, new_res-1, (S32) FLEXIBLE_OBJECT_MAX_SECTIONS); +		  	// Throttle back simulation of segments we're not rendering  	if (mRenderRes < new_res)  	{ @@ -311,43 +289,65 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6  		setAttributesOfAllSections();  		mInitialized = TRUE;  	} -	if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) -	{ -		return FALSE; // (we are not initialized or updated) -	} - -	bool visible = mVO->mDrawable->isVisible(); +} +//--------------------------------------------------------------------------------- +// This calculates the physics of the flexible object. Note that it has to be 0 +// updated every time step. In the future, perhaps there could be an  +// optimization similar to what Havok does for objects that are stationary.  +//--------------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_FLEXIBLE_UPDATE("Update Flexies"); +void LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) +{ +	LLDrawable* drawablep = mVO->mDrawable; -	if (force_update && visible) -	{ -		gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE); -	} -	else if	(visible && -		!mVO->mDrawable->isState(LLDrawable::IN_REBUILD_Q1) && -		mVO->getPixelArea() > 256.f) +	if (drawablep)  	{ -		U32 id; -		F32 pixel_area = mVO->getPixelArea(); +		//LLFastTimer ftm(FTM_FLEXIBLE_UPDATE); -		if (mVO->isRootEdit()) +		//flexible objects never go static +		drawablep->mQuietCount = 0; +		if (!drawablep->isRoot())  		{ -			id = mID; +			LLViewerObject* parent = (LLViewerObject*) mVO->getParent(); +			parent->mDrawable->mQuietCount = 0;  		} -		else + +		if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))  		{ -			LLVOVolume* parent = (LLVOVolume*) mVO->getParent(); -			id = parent->getVolumeInterfaceID(); -		} +			bool visible = drawablep->isVisible(); -		U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; +			if ((mSimulateRes == 0) && visible) +			{ +				updateRenderRes(); +				gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); +			} +			else if	(visible && +				!drawablep->isState(LLDrawable::IN_REBUILD_Q1) && +				mVO->getPixelArea() > 256.f) +			{ +				U32 id; +				F32 pixel_area = mVO->getPixelArea(); -		if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) -		{ -			gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE); +				if (mVO->isRootEdit()) +				{ +					id = mID; +				} +				else +				{ +					LLVOVolume* parent = (LLVOVolume*) mVO->getParent(); +					id = parent->getVolumeInterfaceID(); +				} + +				U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1; + +				if ((LLDrawable::getCurrentFrame()+id)%update_period == 0) +				{ +					updateRenderRes(); +					gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE); +				} +			}  		}  	} -	 -	return force_update;  }  inline S32 log2(S32 x) @@ -369,7 +369,9 @@ void LLVolumeImplFlexible::doFlexibleUpdate()  	if ((mSimulateRes == 0 || !mInitialized) && mVO->mDrawable->isVisible())   	{  		//mVO->markForUpdate(TRUE); -		if (!doIdleUpdate(gAgent, *LLWorld::getInstance(), 0.0)) +		doIdleUpdate(gAgent, *LLWorld::getInstance(), 0.0); + +		if (mSimulateRes == 0)  		{  			return;	// we did not get updated or initialized, proceeding without can be dangerous  		} diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h index 371d6a0773..56d579d86f 100644 --- a/indra/newview/llflexibleobject.h +++ b/indra/newview/llflexibleobject.h @@ -78,7 +78,8 @@ class LLVolumeImplFlexible : public LLVolumeInterface  		LLVector3 getFramePosition() const;  		LLQuaternion getFrameRotation() const;  		LLVolumeInterfaceType getInterfaceType() const		{ return INTERFACE_FLEXIBLE; } -		BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); +		void updateRenderRes(); +		void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);  		BOOL doUpdateGeometry(LLDrawable *drawable);  		LLVector3 getPivotPosition() const;  		void onSetVolume(const LLVolumeParams &volume_params, const S32 detail); @@ -128,7 +129,7 @@ class LLVolumeImplFlexible : public LLVolumeInterface  		LLVector3					mCollisionSpherePosition;  		F32							mCollisionSphereRadius;  		U32							mID; - +		  		//--------------------------------------  		// private methods  		//-------------------------------------- diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp index bca4b5e447..809d344d01 100644 --- a/indra/newview/llfloaterbuycontents.cpp +++ b/indra/newview/llfloaterbuycontents.cpp @@ -211,8 +211,8 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,  		BOOL item_is_multi = FALSE;  		if ((inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED -			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) -			&& !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK)) +		     || inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) +		     && !(inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK))  		{  			item_is_multi = TRUE;  		} diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 61da99fe3a..df8ecb6fd9 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2212,8 +2212,8 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)  	BOOL allow_damage		= !self->mCheckSafe->get();  	BOOL allow_fly			= self->mCheckFly->get();  	BOOL allow_landmark		= TRUE; // cannot restrict landmark creation -	BOOL allow_group_scripts	= self->mCheckGroupScripts->get() || self->mCheckOtherScripts->get();  	BOOL allow_other_scripts	= self->mCheckOtherScripts->get(); +	BOOL allow_group_scripts	= self->mCheckGroupScripts->get() || allow_other_scripts;  	BOOL allow_publish		= FALSE;  	BOOL mature_publish		= self->mMatureCtrl->get();  	BOOL push_restriction	= self->mPushRestrictionCtrl->get(); @@ -2226,11 +2226,16 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)  	LLViewerRegion* region;  	region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); -	if (!allow_other_scripts && region && region->getAllowDamage()) -	{ - -		LLNotificationsUtil::add("UnableToDisableOutsideScripts"); -		return; +	if (region && region->getAllowDamage()) +	{	// Damage is allowed on the region - server will always allow scripts +		if ( (!allow_other_scripts && parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS)) || +			 (!allow_group_scripts && parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS)) ) +		{	// Don't allow turning off "Run Scripts" if damage is allowed in the region +			self->mCheckOtherScripts->set(parcel->getParcelFlag(PF_ALLOW_OTHER_SCRIPTS));	// Restore UI to actual settings +			self->mCheckGroupScripts->set(parcel->getParcelFlag(PF_ALLOW_GROUP_SCRIPTS)); +			LLNotificationsUtil::add("UnableToDisableOutsideScripts"); +			return; +		}  	}  	// Push data into current parcel diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 9ce64a630f..7d047ec67e 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -2235,12 +2235,16 @@ void LLFolderView::doIdle()  		arrangeAll();  	} +	mNeedsAutoSelect = mFilter->hasFilterString() && +							!(gFocusMgr.childHasKeyboardFocus(this) || gFocusMgr.getMouseCapture()); + +		  	if (mFilter->isModified() && mFilter->isNotDefault())  	{  		mNeedsAutoSelect = TRUE;  	}  	mFilter->clearModified(); - +			  	// filter to determine visibility before arranging  	filterFromRoot(); diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp index e124916c48..cb6989c9dd 100644 --- a/indra/newview/llphysicsmotion.cpp +++ b/indra/newview/llphysicsmotion.cpp @@ -67,6 +67,19 @@ inline F64 llsgn(const F64 a)  class LLPhysicsMotion  {  public: +	typedef enum +	{ +		SMOOTHING = 0, +		MASS, +		GRAVITY, +		SPRING, +		GAIN, +		DAMPING, +		DRAG, +		MAX_EFFECT, +		NUM_PARAMS +	} eParamName; +          /*            param_driver_name: The param that controls the params that are being affected by the physics.            joint_name: The joint that the body part is attached to.  The joint is @@ -98,6 +111,11 @@ public:                  mPositionLastUpdate_local(0)          {                  mJointState = new LLJointState; + +				for (U32 i = 0; i < NUM_PARAMS; ++i) +				{ +					mParamCache[i] = NULL; +				}          }          BOOL initialize(); @@ -111,16 +129,43 @@ public:                  return mJointState;          }  protected: -        F32 getParamValue(const std::string& controller_key) -        { -                const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key); + +		F32 getParamValue(eParamName param) +		{ +			static std::string controller_key[] =  +			{ +				"Smoothing", +				"Mass", +				"Gravity", +				"Spring", +				"Gain", +				"Damping", +				"Drag", +				"MaxEffect" +			}; + +			if (!mParamCache[param]) +			{ +				const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key[param]);                  if (entry == mParamControllers.end())                  { -                        return sDefaultController[controller_key]; +                        return sDefaultController[controller_key[param]];                  }                  const std::string& param_name = (*entry).second.c_str(); -                return mCharacter->getVisualParamWeight(param_name.c_str()); -        } +                mParamCache[param] = mCharacter->getVisualParam(param_name.c_str()); +			} +				 +			if (mParamCache[param]) +			{ +				return mParamCache[param]->getWeight(); +			} +			else +			{ +				return sDefaultController[controller_key[param]]; +			} +		} + +                  void setParamValue(LLViewerVisualParam *param,                             const F32 new_value_local,                                                     F32 behavior_maxeffect); @@ -150,6 +195,8 @@ private:          F32 mLastTime; +		LLVisualParam* mParamCache[NUM_PARAMS]; +          static default_controller_map_t sDefaultController;  }; @@ -427,7 +474,6 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)          return TRUE;  } -  // Return TRUE if character has to update visual params.  BOOL LLPhysicsMotion::onUpdate(F32 time)  { @@ -471,15 +517,16 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)          LLJoint *joint = mJointState->getJoint(); -        const F32 behavior_mass = getParamValue("Mass"); -        const F32 behavior_gravity = getParamValue("Gravity"); -        const F32 behavior_spring = getParamValue("Spring"); -        const F32 behavior_gain = getParamValue("Gain"); -        const F32 behavior_damping = getParamValue("Damping"); -        const F32 behavior_drag = getParamValue("Drag"); -        const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts. +		const F32 behavior_mass = getParamValue(MASS); +		const F32 behavior_gravity = getParamValue(GRAVITY); +		const F32 behavior_spring = getParamValue(SPRING); +		const F32 behavior_gain = getParamValue(GAIN); +		const F32 behavior_damping = getParamValue(DAMPING); +		const F32 behavior_drag = getParamValue(DRAG); +		F32 behavior_maxeffect = getParamValue(MAX_EFFECT); +		 +		const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts. -        F32 behavior_maxeffect = getParamValue("MaxEffect");          if (physics_test)                  behavior_maxeffect = 1.0f; diff --git a/indra/newview/llpolymesh.cpp b/indra/newview/llpolymesh.cpp index 0860506086..70f3b5335e 100755..100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/newview/llpolymesh.cpp @@ -229,15 +229,19 @@ U32 LLPolyMeshSharedData::getNumKB()  BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )  {          U32 i; -        mBaseCoords = (LLVector3*) ll_aligned_malloc_16(numVertices*sizeof(LLVector3)); -        mBaseNormals = (LLVector3*) ll_aligned_malloc_16(numVertices*sizeof(LLVector3)); -        mBaseBinormals = (LLVector3*) ll_aligned_malloc_16(numVertices*sizeof(LLVector3)); +        mBaseCoords = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); +        mBaseNormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a)); +        mBaseBinormals = (LLVector4a*) ll_aligned_malloc_16(numVertices*sizeof(LLVector4a));          mTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2));          mDetailTexCoords = (LLVector2*) ll_aligned_malloc_16(numVertices*sizeof(LLVector2));          mWeights = (F32*) ll_aligned_malloc_16(numVertices*sizeof(F32));          for (i = 0; i < numVertices; i++)          { -                mWeights[i] = 0.f; +			mBaseCoords[i].clear(); +			mBaseNormals[i].clear(); +			mBaseBinormals[i].clear(); +			mTexCoords[i].clear(); +            mWeights[i] = 0.f;          }          mNumVertices = numVertices;          return TRUE; @@ -408,39 +412,47 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )                          allocateVertexData( numVertices );       -                        //---------------------------------------------------------------- -                        // Coords -                        //---------------------------------------------------------------- -                        numRead = fread(mBaseCoords, 3*sizeof(float), numVertices, fp); -                        llendianswizzle(mBaseCoords, sizeof(float), 3*numVertices); -                        if (numRead != numVertices) -                        { -                                llerrs << "can't read Coordinates from " << fileName << llendl; -                                return FALSE; -                        } - -                        //---------------------------------------------------------------- -                        // Normals -                        //---------------------------------------------------------------- -                        numRead = fread(mBaseNormals, 3*sizeof(float), numVertices, fp); -                        llendianswizzle(mBaseNormals, sizeof(float), 3*numVertices); -                        if (numRead != numVertices) -                        { -                                llerrs << " can't read Normals from " << fileName << llendl; -                                return FALSE; -                        } - -                        //---------------------------------------------------------------- -                        // Binormals -                        //---------------------------------------------------------------- -                        numRead = fread(mBaseBinormals, 3*sizeof(float), numVertices, fp); -                        llendianswizzle(mBaseBinormals, sizeof(float), 3*numVertices); -                        if (numRead != numVertices) -                        { -                                llerrs << " can't read Binormals from " << fileName << llendl; -                                return FALSE; -                        } - +						for (U16 i = 0; i < numVertices; ++i) +						{ +							//---------------------------------------------------------------- +							// Coords +							//---------------------------------------------------------------- +							numRead = fread(&mBaseCoords[i], sizeof(float), 3, fp); +							llendianswizzle(&mBaseCoords[i], sizeof(float), 3); +							if (numRead != 3) +							{ +									llerrs << "can't read Coordinates from " << fileName << llendl; +									return FALSE; +							} +						} + +						for (U16 i = 0; i < numVertices; ++i) +						{ +							//---------------------------------------------------------------- +							// Normals +							//---------------------------------------------------------------- +							numRead = fread(&mBaseNormals[i], sizeof(float), 3, fp); +							llendianswizzle(&mBaseNormals[i], sizeof(float), 3); +							if (numRead != 3) +							{ +									llerrs << " can't read Normals from " << fileName << llendl; +									return FALSE; +							} +						} + +						for (U16 i = 0; i < numVertices; ++i) +						{ +							//---------------------------------------------------------------- +							// Binormals +							//---------------------------------------------------------------- +							numRead = fread(&mBaseBinormals[i], sizeof(float), 3, fp); +							llendianswizzle(&mBaseBinormals[i], sizeof(float), 3); +							if (numRead != 3) +							{ +									llerrs << " can't read Binormals from " << fileName << llendl; +									return FALSE; +							} +						}                          //----------------------------------------------------------------                          // TexCoords @@ -767,21 +779,28 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_  	{  		// Allocate memory without initializing every vector  		// NOTE: This makes asusmptions about the size of LLVector[234] -		int nverts = mSharedData->mNumVertices; -		int nfloats = nverts * (2*4 + 3*3 + 2 + 4); +		S32 nverts = mSharedData->mNumVertices; +		//make sure it's an even number of verts for alignment +		nverts += nverts%2; +		S32 nfloats = nverts * ( +					4 + //coords +					4 + //normals +					4 + //weights +					2 + //coords +					4 + //scaled normals +					4 + //binormals +					4); //scaled binormals +  		//use 16 byte aligned vertex data to make LLPolyMesh SSE friendly  		mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4); -		int offset = 0; -		mCoords				= 	(LLVector4*)(mVertexData + offset); offset += 4*nverts; -		mNormals			=	(LLVector4*)(mVertexData + offset); offset += 4*nverts; -		mClothingWeights	= 	(LLVector4*)(mVertexData + offset); offset += 4*nverts; -		mTexCoords			= 	(LLVector2*)(mVertexData + offset); offset += 2*nverts; - -		// these members don't need to be 16-byte aligned, but the first one might be -		// read during an aligned memcpy of mTexCoords -		mScaledNormals =                (LLVector3*)(mVertexData + offset); offset += 3*nverts; -		mBinormals =                    (LLVector3*)(mVertexData + offset); offset += 3*nverts; -		mScaledBinormals =              (LLVector3*)(mVertexData + offset); offset += 3*nverts;  +		S32 offset = 0; +		mCoords				= 	(LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mNormals			=	(LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mClothingWeights	= 	(LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mTexCoords			= 	(LLVector2*)(mVertexData + offset);  offset += 2*nverts; +		mScaledNormals		=   (LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mBinormals			=   (LLVector4a*)(mVertexData + offset); offset += 4*nverts; +		mScaledBinormals	=   (LLVector4a*)(mVertexData + offset); offset += 4*nverts;   		initializeForMorph();  	}  } @@ -906,7 +925,7 @@ void LLPolyMesh::dumpDiagInfo()  //-----------------------------------------------------------------------------  // getWritableCoords()  //----------------------------------------------------------------------------- -LLVector4 *LLPolyMesh::getWritableCoords() +LLVector4a *LLPolyMesh::getWritableCoords()  {          return mCoords;  } @@ -914,7 +933,7 @@ LLVector4 *LLPolyMesh::getWritableCoords()  //-----------------------------------------------------------------------------  // getWritableNormals()  //----------------------------------------------------------------------------- -LLVector4 *LLPolyMesh::getWritableNormals() +LLVector4a *LLPolyMesh::getWritableNormals()  {          return mNormals;  } @@ -922,7 +941,7 @@ LLVector4 *LLPolyMesh::getWritableNormals()  //-----------------------------------------------------------------------------  // getWritableBinormals()  //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getWritableBinormals() +LLVector4a *LLPolyMesh::getWritableBinormals()  {          return mBinormals;  } @@ -931,7 +950,7 @@ LLVector3 *LLPolyMesh::getWritableBinormals()  //-----------------------------------------------------------------------------  // getWritableClothingWeights()  //----------------------------------------------------------------------------- -LLVector4       *LLPolyMesh::getWritableClothingWeights() +LLVector4a       *LLPolyMesh::getWritableClothingWeights()  {          return mClothingWeights;  } @@ -947,7 +966,7 @@ LLVector2       *LLPolyMesh::getWritableTexCoords()  //-----------------------------------------------------------------------------  // getScaledNormals()  //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getScaledNormals() +LLVector4a *LLPolyMesh::getScaledNormals()  {          return mScaledNormals;  } @@ -955,7 +974,7 @@ LLVector3 *LLPolyMesh::getScaledNormals()  //-----------------------------------------------------------------------------  // getScaledBinormals()  //----------------------------------------------------------------------------- -LLVector3 *LLPolyMesh::getScaledBinormals() +LLVector4a *LLPolyMesh::getScaledBinormals()  {          return mScaledBinormals;  } @@ -966,17 +985,17 @@ LLVector3 *LLPolyMesh::getScaledBinormals()  //-----------------------------------------------------------------------------  void LLPolyMesh::initializeForMorph()  { -    for (U32 i = 0; i < mSharedData->mNumVertices; ++i) +    LLVector4a::memcpyNonAliased16((F32*) mCoords, (F32*) mSharedData->mBaseCoords, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mScaledNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices); +	LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2)); + +	for (U32 i = 0; i < mSharedData->mNumVertices; ++i)  	{ -		mCoords[i] = LLVector4(mSharedData->mBaseCoords[i]); -		mNormals[i] = LLVector4(mSharedData->mBaseNormals[i]); +		mClothingWeights[i].clear();  	} - -	memcpy(mScaledNormals, mSharedData->mBaseNormals, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/ -	memcpy(mBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices);	/*Flawfinder: ignore*/ -	memcpy(mScaledBinormals, mSharedData->mBaseBinormals, sizeof(LLVector3) * mSharedData->mNumVertices);		/*Flawfinder: ignore*/ -	memcpy(mTexCoords, mSharedData->mTexCoords, sizeof(LLVector2) * mSharedData->mNumVertices);		/*Flawfinder: ignore*/ -	memset(mClothingWeights, 0, sizeof(LLVector4) * mSharedData->mNumVertices);  }  //----------------------------------------------------------------------------- @@ -1098,7 +1117,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)  LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp)  {          mAvatar = avatarp; -        mDefaultVec.setVec(0.001f, 0.001f, 0.001f); +        mDefaultVec.splat(0.001f);  }  //----------------------------------------------------------------------------- @@ -1171,8 +1190,12 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)  //-----------------------------------------------------------------------------  // apply()  //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion"); +  void LLPolySkeletalDistortion::apply( ESex avatar_sex )  { +	LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY); +          F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();          LLJoint* joint; @@ -1228,11 +1251,14 @@ LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,  {          LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);          cloned_morph_data->mName = name; +		LLVector4a dir; +		dir.load3(direction.mV); +          for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)          { -                cloned_morph_data->mCoords[v] = direction; -                cloned_morph_data->mNormals[v] = LLVector3(0,0,0); -                cloned_morph_data->mBinormals[v] = LLVector3(0,0,0); +                cloned_morph_data->mCoords[v] = dir; +                cloned_morph_data->mNormals[v].clear(); +                cloned_morph_data->mBinormals[v].clear();          }          return cloned_morph_data;  } @@ -1243,17 +1269,27 @@ LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,  {          LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);          cloned_morph_data->mName = name; + +		LLVector4a sc; +		sc.splat(scale); + +		LLVector4a nsc; +		nsc.set(scale, -scale, scale, scale); +          for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)          { -                cloned_morph_data->mCoords[v] = src_data->mCoords[v]*scale; -                cloned_morph_data->mNormals[v] = src_data->mNormals[v]*scale; -                cloned_morph_data->mBinormals[v] = src_data->mBinormals[v]*scale; -                if (cloned_morph_data->mCoords[v][1] < 0) -                { -                        cloned_morph_data->mCoords[v][1] *= -1; -                        cloned_morph_data->mNormals[v][1] *= -1; -                        cloned_morph_data->mBinormals[v][1] *= -1; -                } +            if (cloned_morph_data->mCoords[v][1] < 0) +            { +                cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc); +				cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc); +				cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc); +			} +			else +			{ +				cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc); +				cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc); +				cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc); +			}          }          return cloned_morph_data;  } diff --git a/indra/newview/llpolymesh.h b/indra/newview/llpolymesh.h index ba2bf85570..ffb11a3f7e 100644 --- a/indra/newview/llpolymesh.h +++ b/indra/newview/llpolymesh.h @@ -73,9 +73,9 @@ private:  	// vertex data			  	S32						mNumVertices; -	LLVector3				*mBaseCoords; -	LLVector3				*mBaseNormals; -	LLVector3				*mBaseBinormals; +	LLVector4a				*mBaseCoords; +	LLVector4a				*mBaseNormals; +	LLVector4a				*mBaseBinormals;  	LLVector2				*mTexCoords;  	LLVector2				*mDetailTexCoords;  	F32						*mWeights; @@ -217,41 +217,41 @@ public:  	}  	// Get coords -	const LLVector4	*getCoords() const{ +	const LLVector4a	*getCoords() const{  		return mCoords;  	}  	// non const version -	LLVector4 *getWritableCoords(); +	LLVector4a *getWritableCoords();  	// Get normals -	const LLVector4	*getNormals() const{  +	const LLVector4a	*getNormals() const{   		return mNormals;   	}  	// Get normals -	const LLVector3	*getBinormals() const{  +	const LLVector4a	*getBinormals() const{   		return mBinormals;   	}  	// Get base mesh normals -	const LLVector3 *getBaseNormals() const{ +	const LLVector4a *getBaseNormals() const{  		llassert(mSharedData);  		return mSharedData->mBaseNormals;  	}  	// Get base mesh normals -	const LLVector3 *getBaseBinormals() const{ +	const LLVector4a *getBaseBinormals() const{  		llassert(mSharedData);  		return mSharedData->mBaseBinormals;  	}  	// intermediate morphed normals and output normals -	LLVector4 *getWritableNormals(); -	LLVector3 *getScaledNormals(); +	LLVector4a *getWritableNormals(); +	LLVector4a *getScaledNormals(); -	LLVector3 *getWritableBinormals(); -	LLVector3 *getScaledBinormals(); +	LLVector4a *getWritableBinormals(); +	LLVector4a *getScaledBinormals();  	// Get texCoords  	const LLVector2	*getTexCoords() const {  @@ -275,9 +275,9 @@ public:  	F32			*getWritableWeights() const; -	LLVector4	*getWritableClothingWeights(); +	LLVector4a	*getWritableClothingWeights(); -	const LLVector4		*getClothingWeights() +	const LLVector4a		*getClothingWeights()  	{  		return mClothingWeights;	  	} @@ -341,17 +341,17 @@ protected:  	// Single array of floats for allocation / deletion  	F32						*mVertexData;  	// deformed vertices (resulting from application of morph targets) -	LLVector4				*mCoords; +	LLVector4a				*mCoords;  	// deformed normals (resulting from application of morph targets) -	LLVector3				*mScaledNormals; +	LLVector4a				*mScaledNormals;  	// output normals (after normalization) -	LLVector4				*mNormals; +	LLVector4a				*mNormals;  	// deformed binormals (resulting from application of morph targets) -	LLVector3				*mScaledBinormals; +	LLVector4a				*mScaledBinormals;  	// output binormals (after normalization) -	LLVector3				*mBinormals; +	LLVector4a				*mBinormals;  	// weight values that mark verts as clothing/skin -	LLVector4				*mClothingWeights; +	LLVector4a				*mClothingWeights;  	// output texture coordinates  	LLVector2				*mTexCoords; @@ -419,17 +419,17 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion() { return 0.1f; } -	/*virtual*/ const LLVector3&	getAvgDistortion()	{ return mDefaultVec; } +	/*virtual*/ const LLVector4a&	getAvgDistortion()	{ return mDefaultVec; }  	/*virtual*/ F32					getMaxDistortion() { return 0.1f; } -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector3(0.001f, 0.001f, 0.001f);} -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;}; +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);} +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;}; +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};  protected:  	typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;  	joint_vec_map_t mJointScales;  	joint_vec_map_t mJointOffsets; -	LLVector3	mDefaultVec; +	LLVector4a	mDefaultVec;  	// Backlink only; don't make this an LLPointer.  	LLVOAvatar *mAvatar;  }; diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp index cefd7df3fe..d25d1420ee 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/newview/llpolymorph.cpp @@ -48,7 +48,7 @@ LLPolyMorphData::LLPolyMorphData(const std::string& morph_name)  	mNumIndices = 0;  	mCurrentIndex = 0;  	mTotalDistortion = 0.f; -	mAvgDistortion.zeroVec(); +	mAvgDistortion.clear();  	mMaxDistortion = 0.f;  	mVertexIndices = NULL;  	mCoords = NULL; @@ -73,9 +73,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :  {  	const S32 numVertices = mNumIndices; -	mCoords = new LLVector3[numVertices]; -	mNormals = new LLVector3[numVertices]; -	mBinormals = new LLVector3[numVertices]; +	mCoords = new LLVector4a[numVertices]; +	mNormals = new LLVector4a[numVertices]; +	mBinormals = new LLVector4a[numVertices];  	mTexCoords = new LLVector2[numVertices];  	mVertexIndices = new U32[numVertices]; @@ -121,16 +121,16 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)  	//-------------------------------------------------------------------------  	// allocate vertices  	//------------------------------------------------------------------------- -	mCoords = new LLVector3[numVertices]; -	mNormals = new LLVector3[numVertices]; -	mBinormals = new LLVector3[numVertices]; +	mCoords = new LLVector4a[numVertices]; +	mNormals = new LLVector4a[numVertices]; +	mBinormals = new LLVector4a[numVertices];  	mTexCoords = new LLVector2[numVertices];  	// Actually, we are allocating more space than we need for the skiplist  	mVertexIndices = new U32[numVertices];  	mNumIndices = 0;  	mTotalDistortion = 0.f;  	mMaxDistortion = 0.f; -	mAvgDistortion.zeroVec(); +	mAvgDistortion.clear();  	mMesh = mesh;  	//------------------------------------------------------------------------- @@ -152,36 +152,36 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)  		} -		numRead = fread(&mCoords[v].mV, sizeof(F32), 3, fp); -		llendianswizzle(&mCoords[v].mV, sizeof(F32), 3); +		numRead = fread(&mCoords[v], sizeof(F32), 3, fp); +		llendianswizzle(&mCoords[v], sizeof(F32), 3);  		if (numRead != 3)  		{  			llwarns << "Can't read morph target vertex coordinates" << llendl;  			return FALSE;  		} -		F32 magnitude = mCoords[v].magVec(); +		F32 magnitude = mCoords[v].getLength3().getF32();  		mTotalDistortion += magnitude; -		mAvgDistortion.mV[VX] += fabs(mCoords[v].mV[VX]); -		mAvgDistortion.mV[VY] += fabs(mCoords[v].mV[VY]); -		mAvgDistortion.mV[VZ] += fabs(mCoords[v].mV[VZ]); +		LLVector4a t; +		t.setAbs(mCoords[v]); +		mAvgDistortion.add(t);  		if (magnitude > mMaxDistortion)  		{  			mMaxDistortion = magnitude;  		} -		numRead = fread(&mNormals[v].mV, sizeof(F32), 3, fp); -		llendianswizzle(&mNormals[v].mV, sizeof(F32), 3); +		numRead = fread(&mNormals[v], sizeof(F32), 3, fp); +		llendianswizzle(&mNormals[v], sizeof(F32), 3);  		if (numRead != 3)  		{  			llwarns << "Can't read morph target normal" << llendl;  			return FALSE;  		} -		numRead = fread(&mBinormals[v].mV, sizeof(F32), 3, fp); -		llendianswizzle(&mBinormals[v].mV, sizeof(F32), 3); +		numRead = fread(&mBinormals[v], sizeof(F32), 3, fp); +		llendianswizzle(&mBinormals[v], sizeof(F32), 3);  		if (numRead != 3)  		{  			llwarns << "Can't read morph target binormal" << llendl; @@ -200,8 +200,8 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)  		mNumIndices++;  	} -	mAvgDistortion = mAvgDistortion * (1.f/(F32)mNumIndices); -	mAvgDistortion.normVec(); +	mAvgDistortion.mul(1.f/(F32)mNumIndices); +	mAvgDistortion.normalize3fast();  	return TRUE;  } @@ -367,9 +367,9 @@ BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node)  //-----------------------------------------------------------------------------  // getVertexDistortion()  //----------------------------------------------------------------------------- -LLVector3 LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh) +LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh)  { -	if (!mMorphData || mMesh != mesh) return LLVector3::zero; +	if (!mMorphData || mMesh != mesh) return LLVector4a::getZero();  	for(U32 index = 0; index < mMorphData->mNumIndices; index++)  	{ @@ -379,17 +379,17 @@ LLVector3 LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh  		}  	} -	return LLVector3::zero; +	return LLVector4a::getZero();  }  //-----------------------------------------------------------------------------  // getFirstDistortion()  //----------------------------------------------------------------------------- -const LLVector3 *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)  { -	if (!mMorphData) return &LLVector3::zero; +	if (!mMorphData) return &LLVector4a::getZero(); -	LLVector3* resultVec; +	LLVector4a* resultVec;  	mMorphData->mCurrentIndex = 0;  	if (mMorphData->mNumIndices)  	{ @@ -411,11 +411,11 @@ const LLVector3 *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **  //-----------------------------------------------------------------------------  // getNextDistortion()  //----------------------------------------------------------------------------- -const LLVector3 *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh) +const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)  { -	if (!mMorphData) return &LLVector3::zero; +	if (!mMorphData) return &LLVector4a::getZero(); -	LLVector3* resultVec; +	LLVector4a* resultVec;  	mMorphData->mCurrentIndex++;  	if (mMorphData->mCurrentIndex < mMorphData->mNumIndices)  	{ @@ -451,7 +451,7 @@ F32	LLPolyMorphTarget::getTotalDistortion()  //-----------------------------------------------------------------------------  // getAvgDistortion()  //----------------------------------------------------------------------------- -const LLVector3& LLPolyMorphTarget::getAvgDistortion()	 +const LLVector4a& LLPolyMorphTarget::getAvgDistortion()	  {  	if (mMorphData)   	{ @@ -459,7 +459,7 @@ const LLVector3& LLPolyMorphTarget::getAvgDistortion()  	}  	else   	{ -		return LLVector3::zero; +		return LLVector4a::getZero();  	}  } @@ -481,6 +481,8 @@ F32	LLPolyMorphTarget::getMaxDistortion()  //-----------------------------------------------------------------------------  // apply()  //----------------------------------------------------------------------------- +static LLFastTimer::DeclareTimer FTM_APPLY_MORPH_TARGET("Apply Morph"); +  void LLPolyMorphTarget::apply( ESex avatar_sex )  {  	if (!mMorphData || mNumMorphMasksPending > 0) @@ -488,6 +490,8 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  		return;  	} +	LLFastTimer t(FTM_APPLY_MORPH_TARGET); +  	mLastSex = avatar_sex;  	// Check for NaN condition (NaN is detected if a variable doesn't equal itself. @@ -508,15 +512,15 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  	if (delta_weight != 0.f)  	{  		llassert(!mMesh->isLOD()); -		LLVector4 *coords = mMesh->getWritableCoords(); +		LLVector4a *coords = mMesh->getWritableCoords(); -		LLVector3 *scaled_normals = mMesh->getScaledNormals(); -		LLVector4 *normals = mMesh->getWritableNormals(); +		LLVector4a *scaled_normals = mMesh->getScaledNormals(); +		LLVector4a *normals = mMesh->getWritableNormals(); -		LLVector3 *scaled_binormals = mMesh->getScaledBinormals(); -		LLVector3 *binormals = mMesh->getWritableBinormals(); +		LLVector4a *scaled_binormals = mMesh->getScaledBinormals(); +		LLVector4a *binormals = mMesh->getWritableBinormals(); -		LLVector4 *clothing_weights = mMesh->getWritableClothingWeights(); +		LLVector4a *clothing_weights = mMesh->getWritableClothingWeights();  		LLVector2 *tex_coords = mMesh->getWritableTexCoords();  		F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL; @@ -531,31 +535,38 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  				maskWeight = maskWeightArray[vert_index_morph];  			} -			coords[vert_index_mesh] += LLVector4(mMorphData->mCoords[vert_index_morph] * delta_weight * maskWeight); + +			LLVector4a pos = mMorphData->mCoords[vert_index_morph]; +			pos.mul(delta_weight*maskWeight); +			coords[vert_index_mesh].add(pos);  			if (getInfo()->mIsClothingMorph && clothing_weights)  			{ -				LLVector3 clothing_offset = mMorphData->mCoords[vert_index_morph] * delta_weight * maskWeight; -				LLVector4* clothing_weight = &clothing_weights[vert_index_mesh]; -				clothing_weight->mV[VX] += clothing_offset.mV[VX]; -				clothing_weight->mV[VY] += clothing_offset.mV[VY]; -				clothing_weight->mV[VZ] += clothing_offset.mV[VZ]; -				clothing_weight->mV[VW] = maskWeight; +				LLVector4a clothing_offset = mMorphData->mCoords[vert_index_morph]; +				clothing_offset.mul(delta_weight * maskWeight); +				LLVector4a* clothing_weight = &clothing_weights[vert_index_mesh]; +				clothing_weight->add(clothing_offset); +				clothing_weight->getF32ptr()[VW] = maskWeight;  			}  			// calculate new normals based on half angles -			scaled_normals[vert_index_mesh] += mMorphData->mNormals[vert_index_morph] * delta_weight * maskWeight * NORMAL_SOFTEN_FACTOR; -			LLVector3 normalized_normal = scaled_normals[vert_index_mesh]; -			normalized_normal.normVec(); -			normals[vert_index_mesh] = LLVector4(normalized_normal); +			LLVector4a norm = mMorphData->mNormals[vert_index_morph]; +			norm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); +			scaled_normals[vert_index_mesh].add(norm); +			norm = scaled_normals[vert_index_mesh]; +			norm.normalize3fast(); +			normals[vert_index_mesh] = norm;  			// calculate new binormals -			scaled_binormals[vert_index_mesh] += mMorphData->mBinormals[vert_index_morph] * delta_weight * maskWeight * NORMAL_SOFTEN_FACTOR; -			LLVector3 tangent = scaled_binormals[vert_index_mesh] % normalized_normal; -			LLVector3 normalized_binormal = normalized_normal % tangent;  -			normalized_binormal.normVec(); -			binormals[vert_index_mesh] = normalized_binormal; - +			LLVector4a binorm = mMorphData->mBinormals[vert_index_morph]; +			binorm.mul(delta_weight*maskWeight*NORMAL_SOFTEN_FACTOR); +			scaled_binormals[vert_index_mesh].add(binorm); +			LLVector4a tangent; +			tangent.setCross3(scaled_binormals[vert_index_mesh], norm); +			LLVector4a& normalized_binormal = binormals[vert_index_mesh]; +			normalized_binormal.setCross3(norm, tangent);  +			normalized_binormal.normalize3fast(); +			  			tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight;  		} @@ -582,7 +593,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )  //-----------------------------------------------------------------------------  void	LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert)  { -	LLVector4 *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL; +	LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL;  	if (!mVertMask)  	{ @@ -596,29 +607,47 @@ void	LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3  		if (maskWeights)  		{ -			LLVector4 *coords = mMesh->getWritableCoords(); -			LLVector3 *scaled_normals = mMesh->getScaledNormals(); -			LLVector3 *scaled_binormals = mMesh->getScaledBinormals(); +			LLVector4a *coords = mMesh->getWritableCoords(); +			LLVector4a *scaled_normals = mMesh->getScaledNormals(); +			LLVector4a *scaled_binormals = mMesh->getScaledBinormals();  			LLVector2 *tex_coords = mMesh->getWritableTexCoords(); +			LLVector4Logical clothing_mask; +			clothing_mask.clear(); +			clothing_mask.setElement<0>(); +			clothing_mask.setElement<1>(); +			clothing_mask.setElement<2>(); + +  			for(U32 vert = 0; vert < mMorphData->mNumIndices; vert++)  			{  				F32 lastMaskWeight = mLastWeight * maskWeights[vert];  				S32 out_vert = mMorphData->mVertexIndices[vert];  				// remove effect of existing masked morph -				coords[out_vert] -= LLVector4(mMorphData->mCoords[vert]) * lastMaskWeight; -				scaled_normals[out_vert] -= mMorphData->mNormals[vert] * lastMaskWeight * NORMAL_SOFTEN_FACTOR; -				scaled_binormals[out_vert] -= mMorphData->mBinormals[vert] * lastMaskWeight * NORMAL_SOFTEN_FACTOR; +				LLVector4a t; +				t = mMorphData->mCoords[vert]; +				t.mul(lastMaskWeight); +				coords[out_vert].sub(t); + +				t = mMorphData->mNormals[vert]; +				t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); +				scaled_normals[out_vert].sub(t); + +				t = mMorphData->mBinormals[vert]; +				t.mul(lastMaskWeight*NORMAL_SOFTEN_FACTOR); +				scaled_binormals[out_vert].sub(t); +  				tex_coords[out_vert] -= mMorphData->mTexCoords[vert] * lastMaskWeight;  				if (clothing_weights)  				{ -					LLVector3 clothing_offset = mMorphData->mCoords[vert] * lastMaskWeight; -					LLVector4* clothing_weight = &clothing_weights[out_vert]; -					clothing_weight->mV[VX] -= clothing_offset.mV[VX]; -					clothing_weight->mV[VY] -= clothing_offset.mV[VY]; -					clothing_weight->mV[VZ] -= clothing_offset.mV[VZ]; +					LLVector4a clothing_offset = mMorphData->mCoords[vert]; +					clothing_offset.mul(lastMaskWeight); +					LLVector4a* clothing_weight = &clothing_weights[out_vert]; +					LLVector4a t; +					t.setSub(*clothing_weight, clothing_offset); +					clothing_weight->setSelectWithMask(clothing_mask, t, *clothing_weight);  				}  			}  		} @@ -654,7 +683,7 @@ LLPolyVertexMask::~LLPolyVertexMask()  //-----------------------------------------------------------------------------  // generateMask()  //----------------------------------------------------------------------------- -void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights) +void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights)  {  // RN debug output that uses Image Debugger (http://www.cs.unc.edu/~baxter/projects/imdebug/)  //	BOOL debugImg = FALSE;  @@ -698,7 +727,7 @@ void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height,  		if (clothing_weights)  		{ -			clothing_weights[vertIndex].mV[VW] = mWeights[index]; +			clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index];  		}  	}  	mWeightsGenerated = TRUE; diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h index 8a024f2e9e..46e23b7792 100644 --- a/indra/newview/llpolymorph.h +++ b/indra/newview/llpolymorph.h @@ -58,14 +58,14 @@ public:  	U32					mNumIndices;  	U32*				mVertexIndices;  	U32					mCurrentIndex; -	LLVector3*			mCoords; -	LLVector3*			mNormals; -	LLVector3*			mBinormals; +	LLVector4a*			mCoords; +	LLVector4a*			mNormals; +	LLVector4a*			mBinormals;  	LLVector2*			mTexCoords;  	F32					mTotalDistortion;	// vertex distortion summed over entire morph  	F32					mMaxDistortion;		// maximum single vertex distortion in a given morph -	LLVector3			mAvgDistortion;		// average vertex distortion, to infer directionality of the morph +	LLVector4a			mAvgDistortion;		// average vertex distortion, to infer directionality of the morph  	LLPolyMeshSharedData*	mMesh;  }; @@ -78,7 +78,7 @@ public:  	LLPolyVertexMask(LLPolyMorphData* morph_data);  	~LLPolyVertexMask(); -	void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights); +	void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights);  	F32* getMorphMaskWeights(); @@ -157,11 +157,11 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion(); -	/*virtual*/ const LLVector3&	getAvgDistortion(); +	/*virtual*/ const LLVector4a&	getAvgDistortion();  	/*virtual*/ F32					getMaxDistortion(); -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh); +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh); +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);  	void	applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert);  	void	addPendingMorphMask() { mNumMorphMasksPending++; } diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index 1ce05da849..92c2863ffd 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -352,7 +352,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)  		getChildView("BtnCreator")->setEnabled(FALSE);  		getChildView("LabelCreatorTitle")->setEnabled(FALSE);  		getChildView("LabelCreatorName")->setEnabled(FALSE); -		getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown")); +		getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown_multiple"));  	}  	//////////////// diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 45ef8f1a6d..78c905f6ff 100755..100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -68,6 +68,7 @@ const F32 SG_OCCLUSION_FUDGE = 0.25f;  #define assert_states_valid(x)  #endif +extern bool gShiftFrame;  static U32 sZombieGroups = 0;  U32 LLSpatialGroup::sNodeCount = 0; @@ -542,7 +543,7 @@ void LLSpatialGroup::validate()  	validateDrawMap(); -	for (element_iter i = getData().begin(); i != getData().end(); ++i) +	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		sg_assert(drawable->getSpatialGroup() == this); @@ -759,7 +760,7 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma  {	  	const OctreeNode* node = mOctreeNode; -	if (node->getData().empty()) +	if (node->isEmpty())  	{	//don't do anything if there are no objects  		if (empty && mOctreeNode->getParent())  		{	//only root is allowed to be empty @@ -776,14 +777,14 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma  		clearState(OBJECT_DIRTY);  		//initialize bounding box to first element -		OctreeNode::const_element_iter i = node->getData().begin(); +		OctreeNode::const_element_iter i = node->getDataBegin();  		LLDrawable* drawablep = *i;  		const LLVector4a* minMax = drawablep->getSpatialExtents();  		newMin = minMax[0];  		newMax = minMax[1]; -		for (++i; i != node->getData().end(); ++i) +		for (++i; i != node->getDataEnd(); ++i)  		{  			drawablep = *i;  			minMax = drawablep->getSpatialExtents(); @@ -924,7 +925,10 @@ void LLSpatialGroup::shift(const LLVector4a &offset)  	mObjectExtents[0].add(offset);  	mObjectExtents[1].add(offset); -	//if (!mSpatialPartition->mRenderByGroup) +	if (!mSpatialPartition->mRenderByGroup &&  +		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TREE && +		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TERRAIN && +		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_BRIDGE)  	{  		setState(GEOM_DIRTY);  		gPipeline.markRebuild(this, TRUE); @@ -1241,13 +1245,18 @@ void LLSpatialGroup::updateDistance(LLCamera &camera)  		return;  	} +	if (gShiftFrame) +	{ +		return; +	} +  #if !LL_RELEASE_FOR_DOWNLOAD  	if (isState(LLSpatialGroup::OBJECT_DIRTY))  	{  		llerrs << "Spatial group dirty on distance update." << llendl;  	}  #endif -	if (!getData().empty()) +	if (!isEmpty())  	{  		mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() :  						(F32) mOctreeNode->getSize().getLength3().getF32(); @@ -1398,7 +1407,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)  	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);  	setState(DEAD); -	for (element_iter i = getData().begin(); i != getData().end(); ++i) +	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		if (drawable->getSpatialGroup() == this) @@ -1485,7 +1494,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion)  	} -	for (LLSpatialGroup::element_iter i = getData().begin(); i != getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		for (S32 j = 0; j < drawable->getNumFaces(); j++) @@ -1841,12 +1850,14 @@ BOOL LLSpatialPartition::remove(LLDrawable *drawablep, LLSpatialGroup *curp)  {  	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION); -	drawablep->setSpatialGroup(NULL); -  	if (!curp->removeObject(drawablep))  	{  		OCT_ERRS << "Failed to remove drawable from octree!" << llendl;  	} +	else +	{ +		drawablep->setSpatialGroup(NULL); +	}  	assert_octree_valid(mOctree); @@ -2117,7 +2128,7 @@ public:  	virtual void processGroup(LLSpatialGroup* group)  	{ -		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->getData().empty()) +		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->isEmpty())  		if (mRes < 2)  		{ @@ -2184,7 +2195,7 @@ public:  	{  		LLSpatialGroup::OctreeNode* branch = group->mOctreeNode; -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -2308,7 +2319,7 @@ public:  		LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);  		group->destroyGL(); -		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i;  			if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup) @@ -2618,7 +2629,7 @@ void renderOctree(LLSpatialGroup* group)  			gGL.flush();  			glLineWidth(1.f);  			gGL.flush(); -			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  			{  				LLDrawable* drawable = *i;  				if (!group->mSpatialPartition->isBridge()) @@ -2664,7 +2675,7 @@ void renderOctree(LLSpatialGroup* group)  	}  	else  	{ -		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty()  +		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty()   			&& group->mSpatialPartition->mRenderByGroup)  		{  			col.setVec(0.8f, 0.4f, 0.1f, 0.1f); @@ -2732,7 +2743,7 @@ void renderVisibility(LLSpatialGroup* group, LLCamera* camera)  	glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);  	BOOL render_objects = (!LLPipeline::sUseOcclusion || !group->isOcclusionState(LLSpatialGroup::OCCLUDED)) && group->isVisible() && -							!group->getData().empty(); +							!group->isEmpty();  	if (render_objects)  	{ @@ -3463,7 +3474,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)  void renderPhysicsShapes(LLSpatialGroup* group)  { -	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		LLVOVolume* volume = drawable->getVOVolume(); @@ -3812,7 +3823,7 @@ public:  		LLVector3 center, size; -		if (branch->getData().empty()) +		if (branch->isEmpty())  		{  			gGL.diffuseColor3f(1.f,0.2f,0.f);  			center.set(branch->getCenter().getF32ptr()); @@ -3848,8 +3859,8 @@ public:  			}  			gGL.begin(LLRender::TRIANGLES); -			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin(); -					iter != branch->getData().end(); +			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin(); +					iter != branch->getDataEnd();  					++iter)  			{  				const LLVolumeTriangle* tri = *iter; @@ -4086,7 +4097,7 @@ public:  		if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))  		{ -			if (!group->getData().empty()) +			if (!group->isEmpty())  			{  				gGL.diffuseColor3f(0,0,1);  				drawBoxOutline(group->mObjectBounds[0], @@ -4094,7 +4105,7 @@ public:  			}  		} -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -4180,7 +4191,7 @@ public:  						{  							if (index < 255)  							{ -								if (facep->mDrawInfo->mTextureList.size() <= index) +								if (facep->mDrawInfo->mTextureList.size()<= index)  								{  									llerrs << "Face texture index out of bounds." << llendl;  								} @@ -4283,7 +4294,7 @@ public:  			return;  		} -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			LLDrawable* drawable = *i; @@ -4507,7 +4518,7 @@ public:  	virtual void visit(const LLSpatialGroup::OctreeNode* branch)   	{	 -		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i) +		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)  		{  			check(*i);  		} @@ -4693,28 +4704,62 @@ LLVertexBuffer* LLGeometryManager::createVertexBuffer(U32 type_mask, U32 usage)  LLCullResult::LLCullResult()   { +	mVisibleGroupsAllocated = 0; +	mAlphaGroupsAllocated = 0; +	mOcclusionGroupsAllocated = 0; +	mDrawableGroupsAllocated = 0; +	mVisibleListAllocated = 0; +	mVisibleBridgeAllocated = 0; + +	mVisibleGroups = NULL; +	mVisibleGroupsEnd = NULL; +	mAlphaGroups = NULL; +	mAlphaGroupsEnd = NULL; +	mOcclusionGroups = NULL; +	mOcclusionGroupsEnd = NULL; +	mDrawableGroups = NULL; +	mDrawableGroupsEnd = NULL; +	mVisibleList = NULL; +	mVisibleListEnd = NULL; +	mVisibleBridge = NULL; +	mVisibleBridgeEnd = NULL; + +	for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) +	{ +		mRenderMap[i] = NULL; +		mRenderMapEnd[i] = NULL; +		mRenderMapAllocated[i] = 0; +	} +  	clear();  } +void LLCullResult::pushBack(void**& head, U32& count, void* val) +{ +	count++; +	head = (void**) realloc((void*) head, sizeof(void*) * count); +	head[count-1] = val; +} +  void LLCullResult::clear()  {  	mVisibleGroupsSize = 0; -	mVisibleGroupsEnd = mVisibleGroups.begin(); +	mVisibleGroupsEnd = mVisibleGroups;  	mAlphaGroupsSize = 0; -	mAlphaGroupsEnd = mAlphaGroups.begin(); +	mAlphaGroupsEnd = mAlphaGroups;  	mOcclusionGroupsSize = 0; -	mOcclusionGroupsEnd = mOcclusionGroups.begin(); +	mOcclusionGroupsEnd = mOcclusionGroups;  	mDrawableGroupsSize = 0; -	mDrawableGroupsEnd = mDrawableGroups.begin(); +	mDrawableGroupsEnd = mDrawableGroups;  	mVisibleListSize = 0; -	mVisibleListEnd = mVisibleList.begin(); +	mVisibleListEnd = mVisibleList;  	mVisibleBridgeSize = 0; -	mVisibleBridgeEnd = mVisibleBridge.begin(); +	mVisibleBridgeEnd = mVisibleBridge;  	for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++) @@ -4724,176 +4769,176 @@ void LLCullResult::clear()  			mRenderMap[i][j] = 0;  		}  		mRenderMapSize[i] = 0; -		mRenderMapEnd[i] = mRenderMap[i].begin(); +		mRenderMapEnd[i] = mRenderMap[i];  	}  } -LLCullResult::sg_list_t::iterator LLCullResult::beginVisibleGroups() +LLCullResult::sg_iterator LLCullResult::beginVisibleGroups()  { -	return mVisibleGroups.begin(); +	return mVisibleGroups;  } -LLCullResult::sg_list_t::iterator LLCullResult::endVisibleGroups() +LLCullResult::sg_iterator LLCullResult::endVisibleGroups()  {  	return mVisibleGroupsEnd;  } -LLCullResult::sg_list_t::iterator LLCullResult::beginAlphaGroups() +LLCullResult::sg_iterator LLCullResult::beginAlphaGroups()  { -	return mAlphaGroups.begin(); +	return mAlphaGroups;  } -LLCullResult::sg_list_t::iterator LLCullResult::endAlphaGroups() +LLCullResult::sg_iterator LLCullResult::endAlphaGroups()  {  	return mAlphaGroupsEnd;  } -LLCullResult::sg_list_t::iterator LLCullResult::beginOcclusionGroups() +LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups()  { -	return mOcclusionGroups.begin(); +	return mOcclusionGroups;  } -LLCullResult::sg_list_t::iterator LLCullResult::endOcclusionGroups() +LLCullResult::sg_iterator LLCullResult::endOcclusionGroups()  {  	return mOcclusionGroupsEnd;  } -LLCullResult::sg_list_t::iterator LLCullResult::beginDrawableGroups() +LLCullResult::sg_iterator LLCullResult::beginDrawableGroups()  { -	return mDrawableGroups.begin(); +	return mDrawableGroups;  } -LLCullResult::sg_list_t::iterator LLCullResult::endDrawableGroups() +LLCullResult::sg_iterator LLCullResult::endDrawableGroups()  {  	return mDrawableGroupsEnd;  } -LLCullResult::drawable_list_t::iterator LLCullResult::beginVisibleList() +LLCullResult::drawable_iterator LLCullResult::beginVisibleList()  { -	return mVisibleList.begin(); +	return mVisibleList;  } -LLCullResult::drawable_list_t::iterator LLCullResult::endVisibleList() +LLCullResult::drawable_iterator LLCullResult::endVisibleList()  {  	return mVisibleListEnd;  } -LLCullResult::bridge_list_t::iterator LLCullResult::beginVisibleBridge() +LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge()  { -	return mVisibleBridge.begin(); +	return mVisibleBridge;  } -LLCullResult::bridge_list_t::iterator LLCullResult::endVisibleBridge() +LLCullResult::bridge_iterator LLCullResult::endVisibleBridge()  {  	return mVisibleBridgeEnd;  } -LLCullResult::drawinfo_list_t::iterator LLCullResult::beginRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type)  { -	return mRenderMap[type].begin(); +	return mRenderMap[type];  } -LLCullResult::drawinfo_list_t::iterator LLCullResult::endRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type)  {  	return mRenderMapEnd[type];  }  void LLCullResult::pushVisibleGroup(LLSpatialGroup* group)  { -	if (mVisibleGroupsSize < mVisibleGroups.size()) +	if (mVisibleGroupsSize < mVisibleGroupsAllocated)  	{  		mVisibleGroups[mVisibleGroupsSize] = group;  	}  	else  	{ -		mVisibleGroups.push_back(group); +		pushBack((void**&) mVisibleGroups, mVisibleGroupsAllocated, (void*) group);  	}  	++mVisibleGroupsSize; -	mVisibleGroupsEnd = mVisibleGroups.begin()+mVisibleGroupsSize; +	mVisibleGroupsEnd = mVisibleGroups+mVisibleGroupsSize;  }  void LLCullResult::pushAlphaGroup(LLSpatialGroup* group)  { -	if (mAlphaGroupsSize < mAlphaGroups.size()) +	if (mAlphaGroupsSize < mAlphaGroupsAllocated)  	{  		mAlphaGroups[mAlphaGroupsSize] = group;  	}  	else  	{ -		mAlphaGroups.push_back(group); +		pushBack((void**&) mAlphaGroups, mAlphaGroupsAllocated, (void*) group);  	}  	++mAlphaGroupsSize; -	mAlphaGroupsEnd = mAlphaGroups.begin()+mAlphaGroupsSize; +	mAlphaGroupsEnd = mAlphaGroups+mAlphaGroupsSize;  }  void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group)  { -	if (mOcclusionGroupsSize < mOcclusionGroups.size()) +	if (mOcclusionGroupsSize < mOcclusionGroupsAllocated)  	{  		mOcclusionGroups[mOcclusionGroupsSize] = group;  	}  	else  	{ -		mOcclusionGroups.push_back(group); +		pushBack((void**&) mOcclusionGroups, mOcclusionGroupsAllocated, (void*) group);  	}  	++mOcclusionGroupsSize; -	mOcclusionGroupsEnd = mOcclusionGroups.begin()+mOcclusionGroupsSize; +	mOcclusionGroupsEnd = mOcclusionGroups+mOcclusionGroupsSize;  }  void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)  { -	if (mDrawableGroupsSize < mDrawableGroups.size()) +	if (mDrawableGroupsSize < mDrawableGroupsAllocated)  	{  		mDrawableGroups[mDrawableGroupsSize] = group;  	}  	else  	{ -		mDrawableGroups.push_back(group); +		pushBack((void**&) mDrawableGroups, mDrawableGroupsAllocated, (void*) group);  	}  	++mDrawableGroupsSize; -	mDrawableGroupsEnd = mDrawableGroups.begin()+mDrawableGroupsSize; +	mDrawableGroupsEnd = mDrawableGroups+mDrawableGroupsSize;  }  void LLCullResult::pushDrawable(LLDrawable* drawable)  { -	if (mVisibleListSize < mVisibleList.size()) +	if (mVisibleListSize < mVisibleListAllocated)  	{  		mVisibleList[mVisibleListSize] = drawable;  	}  	else  	{ -		mVisibleList.push_back(drawable); +		pushBack((void**&) mVisibleList, mVisibleListAllocated, (void*) drawable);  	}  	++mVisibleListSize; -	mVisibleListEnd = mVisibleList.begin()+mVisibleListSize; +	mVisibleListEnd = mVisibleList+mVisibleListSize;  }  void LLCullResult::pushBridge(LLSpatialBridge* bridge)  { -	if (mVisibleBridgeSize < mVisibleBridge.size()) +	if (mVisibleBridgeSize < mVisibleBridgeAllocated)  	{  		mVisibleBridge[mVisibleBridgeSize] = bridge;  	}  	else  	{ -		mVisibleBridge.push_back(bridge); +		pushBack((void**&) mVisibleBridge, mVisibleBridgeAllocated, (void*) bridge);  	}  	++mVisibleBridgeSize; -	mVisibleBridgeEnd = mVisibleBridge.begin()+mVisibleBridgeSize; +	mVisibleBridgeEnd = mVisibleBridge+mVisibleBridgeSize;  }  void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info)  { -	if (mRenderMapSize[type] < mRenderMap[type].size()) +	if (mRenderMapSize[type] < mRenderMapAllocated[type])  	{  		mRenderMap[type][mRenderMapSize[type]] = draw_info;  	}  	else  	{ -		mRenderMap[type].push_back(draw_info); +		pushBack((void**&) mRenderMap[type], mRenderMapAllocated[type], (void*) draw_info);  	}  	++mRenderMapSize[type]; -	mRenderMapEnd[type] = mRenderMap[type].begin() + mRenderMapSize[type]; +	mRenderMapEnd[type] = mRenderMap[type] + mRenderMapSize[type];  } diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 7968c28900..f050df2b39 100755..100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -345,8 +345,13 @@ public:  	void dirtyGeom() { setState(GEOM_DIRTY); }  	void dirtyMesh() { setState(MESH_DIRTY); } + +	//octree wrappers to make code more readable  	element_list& getData() { return mOctreeNode->getData(); } +	element_iter getDataBegin() { return mOctreeNode->getDataBegin(); } +	element_iter getDataEnd() { return mOctreeNode->getDataEnd(); }  	U32 getElementCount() const { return mOctreeNode->getElementCount(); } +	bool isEmpty() const { return mOctreeNode->isEmpty(); }  	void drawObjectBox(LLColor4 col); @@ -562,34 +567,39 @@ class LLCullResult  public:  	LLCullResult(); -	typedef std::vector<LLSpatialGroup*> sg_list_t; -	typedef std::vector<LLDrawable*> drawable_list_t; -	typedef std::vector<LLSpatialBridge*> bridge_list_t; -	typedef std::vector<LLDrawInfo*> drawinfo_list_t; +	typedef LLSpatialGroup** sg_list_t; +	typedef LLDrawable** drawable_list_t; +	typedef LLSpatialBridge** bridge_list_t; +	typedef LLDrawInfo** drawinfo_list_t; + +	typedef LLSpatialGroup** sg_iterator; +	typedef LLSpatialBridge** bridge_iterator; +	typedef LLDrawInfo** drawinfo_iterator; +	typedef LLDrawable** drawable_iterator;  	void clear(); -	sg_list_t::iterator beginVisibleGroups(); -	sg_list_t::iterator endVisibleGroups(); +	sg_iterator beginVisibleGroups(); +	sg_iterator endVisibleGroups(); -	sg_list_t::iterator beginAlphaGroups(); -	sg_list_t::iterator endAlphaGroups(); +	sg_iterator beginAlphaGroups(); +	sg_iterator endAlphaGroups();  	bool hasOcclusionGroups() { return mOcclusionGroupsSize > 0; } -	sg_list_t::iterator beginOcclusionGroups(); -	sg_list_t::iterator endOcclusionGroups(); +	sg_iterator beginOcclusionGroups(); +	sg_iterator endOcclusionGroups(); -	sg_list_t::iterator beginDrawableGroups(); -	sg_list_t::iterator endDrawableGroups(); +	sg_iterator beginDrawableGroups(); +	sg_iterator endDrawableGroups(); -	drawable_list_t::iterator beginVisibleList(); -	drawable_list_t::iterator endVisibleList(); +	drawable_iterator beginVisibleList(); +	drawable_iterator endVisibleList(); -	bridge_list_t::iterator beginVisibleBridge(); -	bridge_list_t::iterator endVisibleBridge(); +	bridge_iterator beginVisibleBridge(); +	bridge_iterator endVisibleBridge(); -	drawinfo_list_t::iterator beginRenderMap(U32 type); -	drawinfo_list_t::iterator endRenderMap(U32 type); +	drawinfo_iterator beginRenderMap(U32 type); +	drawinfo_iterator endRenderMap(U32 type);  	void pushVisibleGroup(LLSpatialGroup* group);  	void pushAlphaGroup(LLSpatialGroup* group); @@ -609,28 +619,41 @@ public:  	void assertDrawMapsEmpty();  private: + +	void pushBack(void** &head, U32& count, void* val); +  	U32					mVisibleGroupsSize;  	U32					mAlphaGroupsSize;  	U32					mOcclusionGroupsSize;  	U32					mDrawableGroupsSize;  	U32					mVisibleListSize;  	U32					mVisibleBridgeSize; + +	U32					mVisibleGroupsAllocated; +	U32					mAlphaGroupsAllocated; +	U32					mOcclusionGroupsAllocated; +	U32					mDrawableGroupsAllocated; +	U32					mVisibleListAllocated; +	U32					mVisibleBridgeAllocated; +  	U32					mRenderMapSize[LLRenderPass::NUM_RENDER_TYPES];  	sg_list_t			mVisibleGroups; -	sg_list_t::iterator mVisibleGroupsEnd; +	sg_iterator			mVisibleGroupsEnd;  	sg_list_t			mAlphaGroups; -	sg_list_t::iterator mAlphaGroupsEnd; +	sg_iterator			mAlphaGroupsEnd;  	sg_list_t			mOcclusionGroups; -	sg_list_t::iterator	mOcclusionGroupsEnd; +	sg_iterator			mOcclusionGroupsEnd;  	sg_list_t			mDrawableGroups; -	sg_list_t::iterator mDrawableGroupsEnd; +	sg_iterator			mDrawableGroupsEnd;  	drawable_list_t		mVisibleList; -	drawable_list_t::iterator mVisibleListEnd; +	drawable_iterator	mVisibleListEnd;  	bridge_list_t		mVisibleBridge; -	bridge_list_t::iterator mVisibleBridgeEnd; +	bridge_iterator		mVisibleBridgeEnd;  	drawinfo_list_t		mRenderMap[LLRenderPass::NUM_RENDER_TYPES]; -	drawinfo_list_t::iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES]; +	U32					mRenderMapAllocated[LLRenderPass::NUM_RENDER_TYPES]; +	drawinfo_iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES]; +  }; diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 66df7dae3e..230e871b49 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -56,6 +56,7 @@  #include "lldrawable.h"  extern LLPipeline gPipeline; +extern bool gShiftFrame;  LLColor4U MAX_WATER_COLOR(0, 48, 96, 240); @@ -294,7 +295,7 @@ void LLSurface::initTextures()  		mWaterObjp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, mRegionp);  		gPipeline.createObject(mWaterObjp);  		LLVector3d water_pos_global = from_region_handle(mRegionp->getHandle()); -		water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT); +		water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT);		// region doesn't have a valid water height yet  		mWaterObjp->setPositionGlobal(water_pos_global);  	}  } @@ -608,6 +609,11 @@ void LLSurface::moveZ(const S32 x, const S32 y, const F32 delta)  void LLSurface::updatePatchVisibilities(LLAgent &agent)   { +	if (gShiftFrame) +	{ +		return; +	} +  	LLVector3 pos_region = mRegionp->getPosRegionFromGlobal(gAgentCamera.getCameraPositionGlobal());  	LLSurfacePatch *patchp; diff --git a/indra/newview/llsurfacepatch.cpp b/indra/newview/llsurfacepatch.cpp index 5077c2c7e1..a9ba2bce9c 100644 --- a/indra/newview/llsurfacepatch.cpp +++ b/indra/newview/llsurfacepatch.cpp @@ -43,6 +43,7 @@  #include "lldrawpool.h"  #include "noise.h" +extern bool gShiftFrame;  extern U64 gFrameTime;  extern LLPipeline gPipeline; @@ -218,7 +219,7 @@ void LLSurfacePatch::eval(const U32 x, const U32 y, const U32 stride, LLVector3  	pos_agent.mV[VX] += x * mSurfacep->getMetersPerGrid();  	pos_agent.mV[VY] += y * mSurfacep->getMetersPerGrid();  	pos_agent.mV[VZ]  = *(mDataZ + point_offset); -	*vertex     = pos_agent; +	*vertex     = pos_agent-mVObjp->getRegion()->getOriginAgent();  	LLVector3 rel_pos = pos_agent - mSurfacep->getOriginAgent();  	LLVector3 tex_pos = rel_pos * (1.f/surface_stride); @@ -366,10 +367,13 @@ void LLSurfacePatch::updateCameraDistanceRegion(const LLVector3 &pos_region)  {  	if (LLPipeline::sDynamicLOD)  	{ -		LLVector3 dv = pos_region; -		dv -= mCenterRegion; -		mVisInfo.mDistance = llmax(0.f, (F32)(dv.magVec() - mRadius))/ -			llmax(LLVOSurfacePatch::sLODFactor, 0.1f); +		if (!gShiftFrame) +		{ +			LLVector3 dv = pos_region; +			dv -= mCenterRegion; +			mVisInfo.mDistance = llmax(0.f, (F32)(dv.magVec() - mRadius))/ +				llmax(LLVOSurfacePatch::sLODFactor, 0.1f); +		}  	}  	else  	{ diff --git a/indra/newview/lltexlayerparams.h b/indra/newview/lltexlayerparams.h index 74c22b0cdf..2c0da60b48 100644 --- a/indra/newview/lltexlayerparams.h +++ b/indra/newview/lltexlayerparams.h @@ -76,11 +76,11 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion()									{ return 1.f; } -	/*virtual*/ const LLVector3&	getAvgDistortion()										{ return mAvgDistortionVec; } +	/*virtual*/ const LLVector4a&	getAvgDistortion()										{ return mAvgDistortionVec; }  	/*virtual*/ F32					getMaxDistortion()										{ return 3.f; } -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector3(1.f, 1.f, 1.f);} -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;}; +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector4a(1.f, 1.f, 1.f);} +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;};  	// New functions  	BOOL					render( S32 x, S32 y, S32 width, S32 height ); @@ -94,7 +94,7 @@ private:  	LLPointer<LLImageRaw>	mStaticImageRaw;  	BOOL					mNeedsCreateTexture;  	BOOL					mStaticImageInvalid; -	LLVector3				mAvgDistortionVec; +	LLVector4a				mAvgDistortionVec;  	F32						mCachedEffectiveWeight;  public: @@ -155,18 +155,18 @@ public:  	// LLViewerVisualParam Virtual functions  	/*virtual*/ F32					getTotalDistortion()									{ return 1.f; } -	/*virtual*/ const LLVector3&	getAvgDistortion()										{ return mAvgDistortionVec; } +	/*virtual*/ const LLVector4a&	getAvgDistortion()										{ return mAvgDistortionVec; }  	/*virtual*/ F32					getMaxDistortion()										{ return 3.f; } -	/*virtual*/ LLVector3			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector3(1.f, 1.f, 1.f); } -	/*virtual*/ const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; -	/*virtual*/ const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;}; +	/*virtual*/ LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)	{ return LLVector4a(1.f, 1.f, 1.f); } +	/*virtual*/ const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return &mAvgDistortionVec;}; +	/*virtual*/ const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)	{ index = 0; poly_mesh = NULL; return NULL;};  	// New functions  	LLColor4				getNetColor() const;  protected:  	virtual void onGlobalColorChanged(bool upload_bake) {}  private: -	LLVector3				mAvgDistortionVec; +	LLVector4a				mAvgDistortionVec;  };  class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 7e6dfbc9d9..7e6dfbc9d9 100755..100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h index b857c7fe89..b857c7fe89 100755..100644 --- a/indra/newview/llviewercamera.h +++ b/indra/newview/llviewercamera.h diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 4571d08050..fc5a2809b8 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -79,6 +79,7 @@  #include "llpostprocess.h"  extern LLPointer<LLViewerTexture> gStartTexture; +extern bool gShiftFrame;  LLPointer<LLViewerTexture> gDisconnectedImagep = NULL; @@ -162,8 +163,11 @@ void display_startup()  	glClear(GL_DEPTH_BUFFER_BIT);  } +static LLFastTimer::DeclareTimer FTM_UPDATE_CAMERA("Update Camera"); +  void display_update_camera()  { +	LLFastTimer t(FTM_UPDATE_CAMERA);  	LLMemType mt_uc(LLMemType::MTYPE_DISPLAY_UPDATE_CAMERA);  	// TODO: cut draw distance down if customizing avatar?  	// TODO: cut draw distance on per-parcel basis? @@ -217,6 +221,11 @@ static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_CLASS("Class");  static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_BUMP("Bump");  static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_LIST("List");  static LLFastTimer::DeclareTimer FTM_IMAGE_UPDATE_DELETE("Delete"); +static LLFastTimer::DeclareTimer FTM_RESIZE_WINDOW("Resize Window"); +static LLFastTimer::DeclareTimer FTM_HUD_UPDATE("HUD Update"); +static LLFastTimer::DeclareTimer FTM_DISPLAY_UPDATE_GEOM("Update Geom"); +static LLFastTimer::DeclareTimer FTM_TEXTURE_UNBIND("Texture Unbind"); +static LLFastTimer::DeclareTimer FTM_TELEPORT_DISPLAY("Teleport Display");  // Paint the display!  void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) @@ -226,6 +235,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  	if (gWindowResized)  	{ //skip render on frames where window has been resized +		LLFastTimer t(FTM_RESIZE_WINDOW);  		gGL.flush();  		glClear(GL_COLOR_BUFFER_BIT);  		gViewerWindow->getWindow()->swapBuffers(); @@ -362,6 +372,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  	if (gTeleportDisplay)  	{ +		LLFastTimer t(FTM_TELEPORT_DISPLAY);  		LLAppViewer::instance()->pingMainloopTimeout("Display:Teleport");  		const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. @@ -590,6 +601,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		// *TODO: merge these two methods  		{ +			LLFastTimer t(FTM_HUD_UPDATE);  			LLMemType mt_uh(LLMemType::MTYPE_DISPLAY_UPDATE_HUD);  			LLHUDManager::getInstance()->updateEffects();  			LLHUDObject::updateAll(); @@ -597,6 +609,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		}  		{ +			LLFastTimer t(FTM_DISPLAY_UPDATE_GEOM);  			LLMemType mt_ug(LLMemType::MTYPE_DISPLAY_UPDATE_GEOM);  			const F32 max_geom_update_time = 0.005f*10.f*gFrameIntervalSeconds; // 50 ms/second update time  			gPipeline.createObjects(max_geom_update_time); @@ -606,6 +619,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		}  		gPipeline.updateGL(); +		  		stop_glerror();  		S32 water_clip = 0; @@ -937,14 +951,18 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  			stop_glerror();  		} -		for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) -		{ //dummy cleanup of any currently bound textures -			if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) -			{ -				gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); -				gGL.getTexUnit(i)->disable(); +		{ +			LLFastTimer t(FTM_TEXTURE_UNBIND); +			for (U32 i = 0; i < gGLManager.mNumTextureImageUnits; i++) +			{ //dummy cleanup of any currently bound textures +				if (gGL.getTexUnit(i)->getCurrType() != LLTexUnit::TT_NONE) +				{ +					gGL.getTexUnit(i)->unbind(gGL.getTexUnit(i)->getCurrType()); +					gGL.getTexUnit(i)->disable(); +				}  			}  		} +  		LLAppViewer::instance()->pingMainloopTimeout("Display:RenderFlush");		  		if (to_texture) @@ -1010,6 +1028,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  	display_stats();  	LLAppViewer::instance()->pingMainloopTimeout("Display:Done"); + +	gShiftFrame = false;  }  void render_hud_attachments() diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 5d1aa870a3..5d1aa870a3 100755..100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0baf119d70..376a135050 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -134,6 +134,7 @@ static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT	= 5;     // requests  static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL	= 10.0f; // seconds  extern BOOL gDebugClicks; +extern bool gShiftFrame;  // function prototypes  bool check_offer_throttle(const std::string& from_name, bool check_only); @@ -3930,6 +3931,7 @@ void process_avatar_init_complete(LLMessageSystem* msg, void**)  void process_agent_movement_complete(LLMessageSystem* msg, void**)  { +	gShiftFrame = true;  	gAgentMovementCompleted = true;  	LLUUID agent_id; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 67c87a6c63..c839e0d2f0 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -199,6 +199,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe  	mID(id),  	mLocalID(0),  	mTotalCRC(0), +	mListIndex(-1),  	mTEImages(NULL),  	mGLName(0),  	mbCanSelect(TRUE), @@ -2171,8 +2172,8 @@ BOOL LLViewerObject::isActive() const  BOOL LLViewerObject::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  { -	static LLFastTimer::DeclareTimer ftm("Viewer Object"); -	LLFastTimer t(ftm); +	//static LLFastTimer::DeclareTimer ftm("Viewer Object"); +	//LLFastTimer t(ftm);  	if (mDead)  	{ @@ -4824,9 +4825,11 @@ void LLViewerObject::deleteParticleSource()  // virtual  void LLViewerObject::updateDrawable(BOOL force_damped)  { -	if (mDrawable.notNull() &&  -		!mDrawable->isState(LLDrawable::ON_MOVE_LIST) && -		isChanged(MOVED)) +	if (!isChanged(MOVED)) +	{ //most common case, having an empty if case here makes for better branch prediction +	} +	else if (mDrawable.notNull() &&  +		!mDrawable->isState(LLDrawable::ON_MOVE_LIST))  	{  		BOOL damped_motion =   			!isChanged(SHIFTED) &&										// not shifted between regions this frame and... diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 409108266e..6785412c31 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -229,6 +229,8 @@ public:  	const LLUUID &getID() const						{ return mID; }  	U32 getLocalID() const							{ return mLocalID; }  	U32 getCRC() const								{ return mTotalCRC; } +	S32 getListIndex() const						{ return mListIndex; } +	void setListIndex(S32 idx)						{ mListIndex = idx; }  	virtual BOOL isFlexible() const					{ return FALSE; }  	virtual BOOL isSculpted() const 				{ return FALSE; } @@ -592,6 +594,9 @@ public:  	// Last total CRC received from sim, used for caching  	U32				mTotalCRC; +	// index into LLViewerObjectList::mActiveObjects or -1 if not in list +	S32				mListIndex; +  	LLPointer<LLViewerTexture> *mTEImages;  	// Selection, picking and rendering variables diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index beb68c1cbb..2fd8c87fc2 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -931,21 +931,30 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)  	LLViewerObject *objectp = NULL;	  	// Make a copy of the list in case something in idleUpdate() messes with it -	std::vector<LLViewerObject*> idle_list; -	 +	static std::vector<LLViewerObject*> idle_list; + +	U32 idle_count = 0; +		  	static LLFastTimer::DeclareTimer idle_copy("Idle Copy");  	{  		LLFastTimer t(idle_copy); -		idle_list.reserve( mActiveObjects.size() ); - - 		for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); +		 + 		for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();  			active_iter != mActiveObjects.end(); active_iter++)  		{  			objectp = *active_iter;  			if (objectp)  			{ -				idle_list.push_back( objectp ); +				if (idle_count >= idle_list.size()) +				{ +					idle_list.push_back( objectp ); +				} +				else +				{ +					idle_list[idle_count] = objectp; +				} +				++idle_count;  			}  			else  			{	// There shouldn't be any NULL pointers in the list, but they have caused @@ -955,10 +964,13 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)  		}  	} +	std::vector<LLViewerObject*>::iterator idle_end = idle_list.begin()+idle_count; +  	if (gSavedSettings.getBOOL("FreezeTime"))  	{ +		  		for (std::vector<LLViewerObject*>::iterator iter = idle_list.begin(); -			iter != idle_list.end(); iter++) +			iter != idle_end; iter++)  		{  			objectp = *iter;  			if (objectp->isAvatar()) @@ -970,17 +982,17 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)  	else  	{  		for (std::vector<LLViewerObject*>::iterator idle_iter = idle_list.begin(); -			idle_iter != idle_list.end(); idle_iter++) +			idle_iter != idle_end; idle_iter++)  		{  			objectp = *idle_iter; -			if (!objectp->idleUpdate(agent, world, frame_time)) +			if (objectp->idleUpdate(agent, world, frame_time))  			{ -				//  If Idle Update returns false, kill object! -				kill_list.push_back(objectp); +				num_active_objects++;				  			}  			else  			{ -				num_active_objects++; +				//  If Idle Update returns false, kill object! +				kill_list.push_back(objectp);  			}  		}  		for (std::vector<LLViewerObject*>::iterator kill_iter = kill_list.begin(); @@ -1218,7 +1230,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)  	{  		//llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << llendl;  		objectp->setOnActiveList(FALSE); -		mActiveObjects.erase(objectp); +		removeFromActiveList(objectp);  	}  	if (objectp->isOnMap()) @@ -1395,6 +1407,26 @@ void LLViewerObjectList::cleanDeadObjects(BOOL use_timer)  	mNumDeadObjects = 0;  } +void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) +{ +	S32 idx = objectp->getListIndex(); +	if (idx != -1) +	{ //remove by moving last element to this object's position +		llassert(mActiveObjects[idx] == objectp); +		 +		objectp->setListIndex(-1); + +		S32 last_index = mActiveObjects.size()-1; + +		if (idx != last_index) +		{ +			mActiveObjects[idx] = mActiveObjects[last_index]; +			mActiveObjects[idx]->setListIndex(idx); +			mActiveObjects.pop_back(); +		} +	} +} +  void LLViewerObjectList::updateActive(LLViewerObject *objectp)  {  	LLMemType mt(LLMemType::MTYPE_OBJECT); @@ -1409,13 +1441,29 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp)  		if (active)  		{  			//llinfos << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << llendl; -			mActiveObjects.insert(objectp); -			objectp->setOnActiveList(TRUE); +			S32 idx = objectp->getListIndex(); +			if (idx <= -1) +			{ +				mActiveObjects.push_back(objectp); +				objectp->setListIndex(mActiveObjects.size()-1); +				objectp->setOnActiveList(TRUE); +			} +			else +			{ +				llassert(idx < mActiveObjects.size()); +				llassert(mActiveObjects[idx] == objectp); + +				if (idx >= mActiveObjects.size() || +					mActiveObjects[idx] != objectp) +				{ +					llwarns << "Invalid object list index detected!" << llendl; +				} +			}  		}  		else  		{  			//llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << llendl; -			mActiveObjects.erase(objectp); +			removeFromActiveList(objectp);  			objectp->setOnActiveList(FALSE);  		}  	} @@ -1489,6 +1537,10 @@ void LLViewerObjectList::onPhysicsFlagsFetchFailure(const LLUUID& object_id)  	mPendingPhysicsFlags.erase(object_id);  } +static LLFastTimer::DeclareTimer FTM_SHIFT_OBJECTS("Shift Objects"); +static LLFastTimer::DeclareTimer FTM_PIPELINE_SHIFT("Pipeline Shift"); +static LLFastTimer::DeclareTimer FTM_REGION_SHIFT("Region Shift"); +  void LLViewerObjectList::shiftObjects(const LLVector3 &offset)  {  	// This is called when we shift our origin when we cross region boundaries... @@ -1500,6 +1552,8 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)  		return;  	} +	LLFastTimer t(FTM_SHIFT_OBJECTS); +  	LLViewerObject *objectp;  	for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter)  	{ @@ -1516,8 +1570,15 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)  		}  	} -	gPipeline.shiftObjects(offset); -	LLWorld::getInstance()->shiftRegions(offset); +	{ +		LLFastTimer t(FTM_PIPELINE_SHIFT); +		gPipeline.shiftObjects(offset); +	} + +	{ +		LLFastTimer t(FTM_REGION_SHIFT); +		LLWorld::getInstance()->shiftRegions(offset); +	}  }  void LLViewerObjectList::repartitionObjects() diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 64925f46ae..9936432a71 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -118,7 +118,9 @@ public:  	void dirtyAllObjectInventory(); +	void removeFromActiveList(LLViewerObject* objectp);  	void updateActive(LLViewerObject *objectp); +	  	void updateAvatarVisibility();  	// Selection related stuff @@ -197,7 +199,7 @@ protected:  	typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;  	vobj_list_t mObjects; -	std::set<LLPointer<LLViewerObject> > mActiveObjects; +	std::vector<LLPointer<LLViewerObject> > mActiveObjects;  	vobj_list_t mMapObjects; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index f3771e93d9..61ff2ee12e 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1486,7 +1486,8 @@ void LLViewerRegion::unpackRegionHandshake()  		// all of our terrain stuff, by  		if (compp->getParamsReady())  		{ -			getLand().dirtyAllPatches(); +			//this line creates frame stalls on region crossing and removing it appears to have no effect +			//getLand().dirtyAllPatches();  		}  		else  		{ diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h index dd7751acd7..3bc95cbfbf 100644 --- a/indra/newview/llviewervisualparam.h +++ b/indra/newview/llviewervisualparam.h @@ -83,11 +83,11 @@ public:  	// New Virtual functions  	virtual F32					getTotalDistortion() = 0; -	virtual const LLVector3&	getAvgDistortion() = 0; +	virtual const LLVector4a&	getAvgDistortion() = 0;  	virtual F32					getMaxDistortion() = 0; -	virtual LLVector3			getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0; -	virtual const LLVector3*	getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0; -	virtual const LLVector3*	getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0; +	virtual LLVector4a			getVertexDistortion(S32 index, LLPolyMesh *mesh) = 0; +	virtual const LLVector4a*	getFirstDistortion(U32 *index, LLPolyMesh **mesh) = 0; +	virtual const LLVector4a*	getNextDistortion(U32 *index, LLPolyMesh **mesh) = 0;  	// interface methods  	F32					getDisplayOrder() const		{ return getInfo()->mEditGroupDisplayOrder; } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 7afb135470..0de867388c 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4760,8 +4760,11 @@ void LLViewerWindow::requestResolutionUpdate()  	mResDirty = true;  } +static LLFastTimer::DeclareTimer FTM_WINDOW_CHECK_SETTINGS("Window Settings"); +  void LLViewerWindow::checkSettings()  { +	LLFastTimer t(FTM_WINDOW_CHECK_SETTINGS);  	if (mStatesDirty)  	{  		gGL.refreshState(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1b7009a5c2..05febdf93b 100755..100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -817,6 +817,7 @@ LLVOAvatar::~LLVOAvatar()  	lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;  	mRoot.removeAllChildren(); +	mJointMap.clear();  	deleteAndClearArray(mSkeleton);  	deleteAndClearArray(mCollisionVolumes); @@ -1459,8 +1460,6 @@ void LLVOAvatar::onShift(const LLVector4a& shift_vector)  	const LLVector3& shift = reinterpret_cast<const LLVector3&>(shift_vector);  	mLastAnimExtents[0] += shift;  	mLastAnimExtents[1] += shift; -	mNeedsImpostorUpdate = TRUE; -	mNeedsAnimUpdate = TRUE;  }  void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) @@ -1934,6 +1933,7 @@ void LLVOAvatar::buildCharacter()  	// remove all of mRoot's children  	//-------------------------------------------------------------------------  	mRoot.removeAllChildren(); +	mJointMap.clear();  	mIsBuilt = FALSE;  	//------------------------------------------------------------------------- @@ -2390,7 +2390,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid)  	}  } -static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Update Avatar"); +static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update");  static LLFastTimer::DeclareTimer FTM_JOINT_UPDATE("Update Joints");  //------------------------------------------------------------------------ @@ -5137,7 +5137,20 @@ const LLUUID& LLVOAvatar::getID() const  // RN: avatar joints are multi-rooted to include screen-based attachments  LLJoint *LLVOAvatar::getJoint( const std::string &name )  { -	LLJoint* jointp = mRoot.findJoint(name); +	joint_map_t::iterator iter = mJointMap.find(name); + +	LLJoint* jointp = NULL; + +	if (iter == mJointMap.end() || iter->second == NULL) +	{ //search for joint and cache found joint in lookup table +		jointp = mRoot.findJoint(name); +		mJointMap[name] = jointp; +	} +	else +	{ //return cached pointer +		jointp = iter->second; +	} +  	return jointp;  } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4081a1408d..f5692bb52f 100755..100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -366,6 +366,10 @@ public:  	LLVector3			mHeadOffset; // current head position  	LLViewerJoint		mRoot; + +	typedef std::map<std::string, LLJoint*> joint_map_t; +	joint_map_t			mJointMap; +  protected:  	static BOOL			parseSkeletonFile(const std::string& filename);  	void				buildCharacter(); diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 2b273e616c..2b273e616c 100755..100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 44968342bf..5ad9ccc9af 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -622,7 +622,7 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count  	mFaceList.clear();  	LLViewerCamera* camera = LLViewerCamera::getInstance(); -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawablep = *i; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index e21358b65a..9cce68fff6 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -52,8 +52,7 @@ LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;  S32 LLVOPartGroup::sVBSlotFree[];  S32* LLVOPartGroup::sVBSlotCursor = NULL; -//static -void LLVOPartGroup::restoreGL() +void LLVOPartGroup::initClass()  {  	for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)  	{ @@ -61,7 +60,11 @@ void LLVOPartGroup::restoreGL()  	}  	sVBSlotCursor = sVBSlotFree; +} +//static +void LLVOPartGroup::restoreGL() +{  	sVB = new LLVertexBuffer(VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);  	U32 count = LL_MAX_PARTICLE_COUNT;  	sVB->allocateBuffer(count*4, count*6, true); @@ -554,7 +557,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co  	mFaceList.clear();  	LLViewerCamera* camera = LLViewerCamera::getInstance(); -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawablep = *i; @@ -626,7 +629,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)  		LLFace* facep = *i;  		LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject(); -		if (facep->getIndicesStart() == 0xFFFFFFFF) +		if (!facep->isState(LLFace::PARTICLE))  		{ //set the indices of this face  			S32 idx = LLVOPartGroup::findAvailableVBSlot();  			if (idx >= 0) @@ -635,6 +638,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)  				facep->setIndicesIndex(idx*6);  				facep->setVertexBuffer(LLVOPartGroup::sVB);  				facep->setPoolType(LLDrawPool::POOL_ALPHA); +				facep->setState(LLFace::PARTICLE);  			}  			else  			{ diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h index 6160bceb24..43b2844f07 100644 --- a/indra/newview/llvopartgroup.h +++ b/indra/newview/llvopartgroup.h @@ -45,6 +45,7 @@ public:  	static S32 sVBSlotFree[LL_MAX_PARTICLE_COUNT];  	static S32* sVBSlotCursor; +	static void initClass();  	static void restoreGL();  	static void destroyGL();  	static S32 findAvailableVBSlot(); diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp index 3556bde9a8..337ddfb24d 100644 --- a/indra/newview/llvotree.cpp +++ b/indra/newview/llvotree.cpp @@ -374,7 +374,7 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  		// *TODO: I don't know what's so special about trees  		// that they don't get REBUILD_POSITION automatically  		// at a higher level. -		const LLVector3 &this_position = getPositionAgent(); +		const LLVector3 &this_position = getPositionRegion();  		if (this_position != mLastPosition)  		{  			gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION); @@ -843,10 +843,10 @@ void LLVOTree::updateMesh()  	LLMatrix4 matrix;  	// Translate to tree base  HACK - adjustment in Z plants tree underground -	const LLVector3 &pos_agent = getPositionAgent(); +	const LLVector3 &pos_region = getPositionRegion();  	//gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);  	LLMatrix4 trans_mat; -	trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); +	trans_mat.setTranslation(pos_region.mV[VX], pos_region.mV[VY], pos_region.mV[VZ] - 0.1f);  	trans_mat *= matrix;  	// Rotate to tree position and bend for current trunk/wind diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c4e7ea44b4..082818b112 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -639,8 +639,8 @@ BOOL LLVOVolume::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  {  	LLViewerObject::idleUpdate(agent, world, time); -	static LLFastTimer::DeclareTimer ftm("Volume Idle"); -	LLFastTimer t(ftm); +	//static LLFastTimer::DeclareTimer ftm("Volume Idle"); +	//LLFastTimer t(ftm);  	if (mDead || mDrawable.isNull())  	{ @@ -4232,7 +4232,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  		LLFastTimer t(FTM_REBUILD_VOLUME_FACE_LIST);  		//get all the faces into a list -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter; @@ -4638,7 +4638,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  	if (!LLPipeline::sDelayVBUpdate)  	{  		//drawables have been rebuilt, clear rebuild status -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter;  			drawablep->clearState(LLDrawable::REBUILD_ALL); @@ -4678,7 +4678,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  		std::set<LLVertexBuffer*> mapped_buffers; -		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  		{  			LLDrawable* drawablep = *drawable_iter; @@ -4702,8 +4702,14 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  						if (buff)  						{  							llassert(!face->isState(LLFace::RIGGED)); -							face->getGeometryVolume(*volume, face->getTEOffset(),  -								vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex()); + +							if (!face->getGeometryVolume(*volume, face->getTEOffset(),  +								vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex())) +							{ //something's gone wrong with the vertex buffer accounting, rebuild this group  +								group->dirtyGeom(); +								gPipeline.markRebuild(group, TRUE); +							} +  							if (buff->isLocked())  							{ @@ -4740,7 +4746,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)  		if(num_mapped_veretx_buffer != LLVertexBuffer::sMappedCount)   		{  			llwarns << "Not all mapped vertex buffers are unmapped!" << llendl ;  -			for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +			for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  			{  				LLDrawable* drawablep = *drawable_iter;  				for (S32 i = 0; i < drawablep->getNumFaces(); ++i) @@ -5037,8 +5043,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::  					llassert(!facep->isState(LLFace::RIGGED)); -					facep->getGeometryVolume(*volume, te_idx,  -						vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true); +					if (!facep->getGeometryVolume(*volume, te_idx,  +						vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true)) +					{ +						llwarns << "Failed to get geometry for face!" << llendl; +					}  					if (drawablep->isState(LLDrawable::ANIMATED_CHILD))  					{ @@ -5208,7 +5217,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun  	//for each drawable -	for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter) +	for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)  	{  		LLDrawable* drawablep = *drawable_iter; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index c4505b4bd8..5a0960204c 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -68,7 +68,7 @@ class LLVolumeInterface  public:  	virtual ~LLVolumeInterface() { }  	virtual LLVolumeInterfaceType getInterfaceType() const = 0; -	virtual BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0; +	virtual void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0;  	virtual BOOL doUpdateGeometry(LLDrawable *drawable) = 0;  	virtual LLVector3 getPivotPosition() const = 0;  	virtual void onSetVolume(const LLVolumeParams &volume_params, const S32 detail) = 0; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index b061c90d98..78ee3e4fd9 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -657,7 +657,10 @@ void LLWorld::updateRegions(F32 max_update_time)  		if (did_one && max_time <= 0.f)  			break;  		max_time = llmin(max_time, max_update_time*.1f); -		did_one |= regionp->idleUpdate(max_update_time); +		if (regionp->idleUpdate(max_update_time)) +		{ +			did_one = TRUE; +		}  	}  } @@ -837,6 +840,9 @@ void LLWorld::updateWaterObjects()  	}  	mHoleWaterObjects.clear(); +	// Use the water height of the region we're on for areas where there is no region +	F32 water_height = gAgent.getRegion()->getWaterHeight(); +  	// Now, get a list of the holes  	S32 x, y;  	for (x = min_x; x <= max_x; x += rwidth) @@ -845,12 +851,12 @@ void LLWorld::updateWaterObjects()  		{  			U64 region_handle = to_region_handle(x, y);  			if (!getRegionFromHandle(region_handle)) -			{ +			{	// No region at that area, so make water  				LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion());  				waterp->setUseTexture(FALSE);  				waterp->setPositionGlobal(LLVector3d(x + rwidth/2,  													 y + rwidth/2, -													 256.f+DEFAULT_WATER_HEIGHT)); +													 256.f + water_height));  				waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));  				gPipeline.createObject(waterp);  				mHoleWaterObjects.push_back(waterp); @@ -907,7 +913,7 @@ void LLWorld::updateWaterObjects()  		}  		waterp->setRegion(gAgent.getRegion()); -		LLVector3d water_pos(water_center_x, water_center_y, 256.f+DEFAULT_WATER_HEIGHT) ; +		LLVector3d water_pos(water_center_x, water_center_y, 256.f + water_height) ;  		LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);  		//stretch out to horizon diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 49c4f37871..a35cf98af5 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -117,6 +117,8 @@  //#define DEBUG_INDICES  #endif +bool gShiftFrame = false; +  //cached settings  BOOL LLPipeline::RenderAvatarVP;  BOOL LLPipeline::VertexShaderEnable; @@ -214,7 +216,7 @@ BOOL	gDebugPipeline = FALSE;  LLPipeline gPipeline;  const LLMatrix4* gGLLastMatrix = NULL; -LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Geometry"); +LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Render Geometry");  LLFastTimer::DeclareTimer FTM_RENDER_GRASS("Grass");  LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE("Invisible");  LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION("Occlusion"); @@ -231,8 +233,13 @@ LLFastTimer::DeclareTimer FTM_RENDER_BUMP("Bump");  LLFastTimer::DeclareTimer FTM_RENDER_FULLBRIGHT("Fullbright");  LLFastTimer::DeclareTimer FTM_RENDER_GLOW("Glow");  LLFastTimer::DeclareTimer FTM_GEO_UPDATE("Geo Update"); +LLFastTimer::DeclareTimer FTM_PIPELINE_CREATE("Pipeline Create");  LLFastTimer::DeclareTimer FTM_POOLRENDER("RenderPool");  LLFastTimer::DeclareTimer FTM_POOLS("Pools"); +LLFastTimer::DeclareTimer FTM_DEFERRED_POOLRENDER("RenderPool (Deferred)"); +LLFastTimer::DeclareTimer FTM_DEFERRED_POOLS("Pools (Deferred)"); +LLFastTimer::DeclareTimer FTM_POST_DEFERRED_POOLRENDER("RenderPool (Post)"); +LLFastTimer::DeclareTimer FTM_POST_DEFERRED_POOLS("Pools (Post)");  LLFastTimer::DeclareTimer FTM_RENDER_BLOOM_FBO("First FBO");  LLFastTimer::DeclareTimer FTM_STATESORT("Sort Draw State");  LLFastTimer::DeclareTimer FTM_PIPELINE("Pipeline"); @@ -1368,7 +1375,7 @@ public:  	{  		LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); -		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->getData().empty()) +		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())  		{  			for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)  			{ @@ -1677,7 +1684,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj)  void LLPipeline::createObjects(F32 max_dtime)  { -	LLFastTimer ftm(FTM_GEO_UPDATE); +	LLFastTimer ftm(FTM_PIPELINE_CREATE);  	LLMemType mt(LLMemType::MTYPE_PIPELINE_CREATE_OBJECTS);  	LLTimer update_timer; @@ -1973,7 +1980,7 @@ void LLPipeline::clearReferences()  void check_references(LLSpatialGroup* group, LLDrawable* drawable)  { -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		if (drawable == *i)  		{ @@ -1995,7 +2002,7 @@ void check_references(LLDrawable* drawable, LLFace* face)  void check_references(LLSpatialGroup* group, LLFace* face)  { -	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  	{  		LLDrawable* drawable = *i;  		check_references(drawable, face); @@ -2007,25 +2014,25 @@ void LLPipeline::checkReferences(LLFace* face)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, face);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, face);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, face);  		} -		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) +		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)  		{  			LLDrawable* drawable = *iter;  			check_references(drawable, face);	 @@ -2039,25 +2046,25 @@ void LLPipeline::checkReferences(LLDrawable* drawable)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, drawable);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, drawable);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, drawable);  		} -		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter) +		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)  		{  			if (drawable == *iter)  			{ @@ -2090,19 +2097,19 @@ void LLPipeline::checkReferences(LLDrawInfo* draw_info)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, draw_info);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, draw_info);  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			check_references(group, draw_info); @@ -2116,7 +2123,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)  #if 0  	if (sCull)  	{ -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  		{  			if (group == *iter)  			{ @@ -2124,7 +2131,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)  			}  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)  		{  			if (group == *iter)  			{ @@ -2132,7 +2139,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)  			}  		} -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  		{  			if (group == *iter)  			{ @@ -2371,7 +2378,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl  void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)  { -	if (group->getData().empty()) +	if (group->isEmpty())  	{   		return;  	} @@ -2474,7 +2481,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)  		}  		mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX); -		for (LLCullResult::sg_list_t::iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter) +		for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)  		{  			LLSpatialGroup* group = *iter;  			group->doOcclusion(&camera); @@ -2510,14 +2517,24 @@ BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority)  static LLFastTimer::DeclareTimer FTM_SEED_VBO_POOLS("Seed VBO Pool"); +static LLFastTimer::DeclareTimer FTM_UPDATE_GL("Update GL"); +  void LLPipeline::updateGL()  { -	while (!LLGLUpdate::sGLQ.empty())  	{ -		LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); -		glu->updateGL(); -		glu->mInQ = FALSE; -		LLGLUpdate::sGLQ.pop_front(); +		LLFastTimer t(FTM_UPDATE_GL); +		while (!LLGLUpdate::sGLQ.empty()) +		{ +			LLGLUpdate* glu = LLGLUpdate::sGLQ.front(); +			glu->updateGL(); +			glu->mInQ = FALSE; +			LLGLUpdate::sGLQ.pop_front(); +		} + +	{ //seed VBO Pools +		LLFastTimer t(FTM_SEED_VBO_POOLS); +		LLVertexBuffer::seedPools(); +	}  	}  	{ //seed VBO Pools @@ -2526,11 +2543,13 @@ void LLPipeline::updateGL()  	}  } +static LLFastTimer::DeclareTimer FTM_REBUILD_PRIORITY_GROUPS("Rebuild Priority Groups"); +  void LLPipeline::rebuildPriorityGroups()  { +	LLFastTimer t(FTM_REBUILD_PRIORITY_GROUPS);  	LLTimer update_timer;  	LLMemType mt(LLMemType::MTYPE_PIPELINE); -	  	assertInitialized();  	gMeshRepo.notifyLoadedMeshes(); @@ -2549,7 +2568,9 @@ void LLPipeline::rebuildPriorityGroups()  	mGroupQ1Locked = false;  } -		 + +static LLFastTimer::DeclareTimer FTM_REBUILD_GROUPS("Rebuild Groups"); +  void LLPipeline::rebuildGroups()  {  	if (mGroupQ2.empty()) @@ -2557,6 +2578,7 @@ void LLPipeline::rebuildGroups()  		return;  	} +	LLFastTimer t(FTM_REBUILD_GROUPS);  	mGroupQ2Locked = true;  	// Iterate through some drawables on the non-priority build queue  	S32 size = (S32) mGroupQ2.size(); @@ -2798,6 +2820,10 @@ void LLPipeline::markShift(LLDrawable *drawablep)  	}  } +static LLFastTimer::DeclareTimer FTM_SHIFT_DRAWABLE("Shift Drawable"); +static LLFastTimer::DeclareTimer FTM_SHIFT_OCTREE("Shift Octree"); +static LLFastTimer::DeclareTimer FTM_SHIFT_HUD("Shift HUD"); +  void LLPipeline::shiftObjects(const LLVector3 &offset)  {  	LLMemType mt(LLMemType::MTYPE_PIPELINE_SHIFT_OBJECTS); @@ -2810,35 +2836,46 @@ void LLPipeline::shiftObjects(const LLVector3 &offset)  	LLVector4a offseta;  	offseta.load3(offset.mV); -	for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin(); -		 iter != mShiftList.end(); iter++)  	{ -		LLDrawable *drawablep = *iter; -		if (drawablep->isDead()) +		LLFastTimer t(FTM_SHIFT_DRAWABLE); + +		for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin(); +			 iter != mShiftList.end(); iter++)  		{ -			continue; -		}	 -		drawablep->shiftPos(offseta);	 -		drawablep->clearState(LLDrawable::ON_SHIFT_LIST); +			LLDrawable *drawablep = *iter; +			if (drawablep->isDead()) +			{ +				continue; +			}	 +			drawablep->shiftPos(offseta);	 +			drawablep->clearState(LLDrawable::ON_SHIFT_LIST); +		} +		mShiftList.resize(0);  	} -	mShiftList.resize(0); -	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();  -			iter != LLWorld::getInstance()->getRegionList().end(); ++iter) +	  	{ -		LLViewerRegion* region = *iter; -		for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) +		LLFastTimer t(FTM_SHIFT_OCTREE); +		for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();  +				iter != LLWorld::getInstance()->getRegionList().end(); ++iter)  		{ -			LLSpatialPartition* part = region->getSpatialPartition(i); -			if (part) +			LLViewerRegion* region = *iter; +			for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)  			{ -				part->shift(offseta); +				LLSpatialPartition* part = region->getSpatialPartition(i); +				if (part) +				{ +					part->shift(offseta); +				}  			}  		}  	} -	LLHUDText::shiftAll(offset); -	LLHUDNameTag::shiftAll(offset); +	{ +		LLFastTimer t(FTM_SHIFT_HUD); +		LLHUDText::shiftAll(offset); +		LLHUDNameTag::shiftAll(offset); +	}  	display_update_camera();  } @@ -2871,8 +2908,10 @@ void LLPipeline::markPartitionMove(LLDrawable* drawable)  	}  } +static LLFastTimer::DeclareTimer FTM_PROCESS_PARTITIONQ("PartitionQ");  void LLPipeline::processPartitionQ()  { +	LLFastTimer t(FTM_PROCESS_PARTITIONQ);  	for (LLDrawable::drawable_list_t::iterator iter = mPartitionQ.begin(); iter != mPartitionQ.end(); ++iter)  	{  		LLDrawable* drawable = *iter; @@ -2988,7 +3027,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  	//LLVertexBuffer::unbind();  	grabReferences(result); -	for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter) +	for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)  	{  		LLSpatialGroup* group = *iter;  		group->checkOcclusion(); @@ -2999,7 +3038,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  		else  		{  			group->setVisible(); -			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  			{  				markVisible(*i, camera);  			} @@ -3014,9 +3053,9 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  	if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)  	{  		LLSpatialGroup* last_group = NULL; -		for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) +		for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)  		{ -			LLCullResult::bridge_list_t::iterator cur_iter = i; +			LLCullResult::bridge_iterator cur_iter = i;  			LLSpatialBridge* bridge = *cur_iter;  			LLSpatialGroup* group = bridge->getSpatialGroup(); @@ -3046,7 +3085,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  		}  	} -	for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter) +	for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)  	{  		LLSpatialGroup* group = *iter;  		group->checkOcclusion(); @@ -3068,7 +3107,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)  	{  		LLFastTimer ftm(FTM_STATESORT_DRAWABLE); -		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); +		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList();  			 iter != sCull->endVisibleList(); ++iter)  		{  			LLDrawable *drawablep = *iter; @@ -3087,7 +3126,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)  	LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);  	if (group->changeLOD())  	{ -		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) +		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)  		{  			LLDrawable* drawablep = *i;  			stateSort(drawablep, camera); @@ -3204,13 +3243,13 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)  } -void forAllDrawables(LLCullResult::sg_list_t::iterator begin,  -					 LLCullResult::sg_list_t::iterator end, +void forAllDrawables(LLCullResult::sg_iterator begin,  +					 LLCullResult::sg_iterator end,  					 void (*func)(LLDrawable*))  { -	for (LLCullResult::sg_list_t::iterator i = begin; i != end; ++i) +	for (LLCullResult::sg_iterator i = begin; i != end; ++i)  	{ -		for (LLSpatialGroup::element_iter j = (*i)->getData().begin(); j != (*i)->getData().end(); ++j) +		for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j)  		{  			func(*j);	  		} @@ -3412,7 +3451,7 @@ void LLPipeline::postSort(LLCamera& camera)  	llpushcallstacks ;  	//rebuild drawable geometry -	for (LLCullResult::sg_list_t::iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i) +	for (LLCullResult::sg_iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (!sUseOcclusion ||  @@ -3430,7 +3469,7 @@ void LLPipeline::postSort(LLCamera& camera)  	//build render map -	for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) +	for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (sUseOcclusion &&  @@ -4132,7 +4171,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)  	LLMemType mt_rgd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED);  	LLFastTimer t(FTM_RENDER_GEOMETRY); -	LLFastTimer t2(FTM_POOLS); +	LLFastTimer t2(FTM_DEFERRED_POOLS);  	LLGLEnable cull(GL_CULL_FACE); @@ -4174,7 +4213,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)  		pool_set_t::iterator iter2 = iter1;  		if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)  		{ -			LLFastTimer t(FTM_POOLRENDER); +			LLFastTimer t(FTM_DEFERRED_POOLRENDER);  			gGLLastMatrix = NULL;  			gGL.loadMatrix(gGLModelView); @@ -4227,7 +4266,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)  void LLPipeline::renderGeomPostDeferred(LLCamera& camera)  {  	LLMemType mt_rgpd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_POST_DEF); -	LLFastTimer t(FTM_POOLS); +	LLFastTimer t(FTM_POST_DEFERRED_POOLS);  	U32 cur_type = 0;  	LLGLEnable cull(GL_CULL_FACE); @@ -4261,7 +4300,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)  		pool_set_t::iterator iter2 = iter1;  		if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0)  		{ -			LLFastTimer t(FTM_POOLRENDER); +			LLFastTimer t(FTM_POST_DEFERRED_POOLRENDER);  			gGLLastMatrix = NULL;  			gGL.loadMatrix(gGLModelView); @@ -4451,7 +4490,7 @@ void LLPipeline::renderPhysicsDisplay()  		}  	} -	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) +	for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)  	{  		LLSpatialBridge* bridge = *i;  		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) @@ -4546,7 +4585,7 @@ void LLPipeline::renderDebug()  		}  	} -	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) +	for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)  	{  		LLSpatialBridge* bridge = *i;  		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) @@ -4798,8 +4837,11 @@ void LLPipeline::renderDebug()  	}  } +static LLFastTimer::DeclareTimer FTM_REBUILD_POOLS("Rebuild Pools"); +  void LLPipeline::rebuildPools()  { +	LLFastTimer t(FTM_REBUILD_POOLS);  	LLMemType mt(LLMemType::MTYPE_PIPELINE_REBUILD_POOLS);  	assertInitialized(); @@ -6358,13 +6400,16 @@ void LLPipeline::resetVertexBuffers()  	mResetVertexBuffers = true;  } +static LLFastTimer::DeclareTimer FTM_RESET_VB("Reset VB"); +  void LLPipeline::doResetVertexBuffers()  {  	if (!mResetVertexBuffers)  	{  		return;  	} -	 + +	LLFastTimer t(FTM_RESET_VB);  	mResetVertexBuffers = false;  	mCubeVB = NULL; @@ -8784,6 +8829,8 @@ void LLPipeline::generateHighlight(LLCamera& camera)  } +static LLFastTimer::DeclareTimer FTM_GEN_SUN_SHADOW("Gen Sun Shadow"); +  void LLPipeline::generateSunShadow(LLCamera& camera)  {  	if (!sRenderDeferred || RenderShadowDetail <= 0) @@ -8791,6 +8838,8 @@ void LLPipeline::generateSunShadow(LLCamera& camera)  		return;  	} +	LLFastTimer t(FTM_GEN_SUN_SHADOW); +  	BOOL skip_avatar_update = FALSE;  	if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson)  	{ @@ -9540,7 +9589,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)  void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture)  { -	for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) +	for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)  	{  		LLSpatialGroup* group = *i;  		if (!group->isDead() && @@ -9553,6 +9602,12 @@ void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL textu  	}  } +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_MARK_VISIBLE("Impostor Mark Visible"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_SETUP("Impostor Setup"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_BACKGROUND("Impostor Background"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_ALLOCATE("Impostor Allocate"); +static LLFastTimer::DeclareTimer FTM_IMPOSTOR_RESIZE("Impostor Resize"); +  void LLPipeline::generateImpostor(LLVOAvatar* avatar)  {  	LLMemType mt_gi(LLMemType::MTYPE_PIPELINE_GENERATE_IMPOSTOR); @@ -9608,101 +9663,114 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	sImpostorRender = TRUE;  	LLViewerCamera* viewer_camera = LLViewerCamera::getInstance(); -	markVisible(avatar->mDrawable, *viewer_camera); -	LLVOAvatar::sUseImpostors = FALSE; -	LLVOAvatar::attachment_map_t::iterator iter; -	for (iter = avatar->mAttachmentPoints.begin(); -		iter != avatar->mAttachmentPoints.end(); -		++iter)  	{ -		LLViewerJointAttachment *attachment = iter->second; -		for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); -			 attachment_iter != attachment->mAttachedObjects.end(); -			 ++attachment_iter) +		LLFastTimer t(FTM_IMPOSTOR_MARK_VISIBLE); +		markVisible(avatar->mDrawable, *viewer_camera); +		LLVOAvatar::sUseImpostors = FALSE; + +		LLVOAvatar::attachment_map_t::iterator iter; +		for (iter = avatar->mAttachmentPoints.begin(); +			iter != avatar->mAttachmentPoints.end(); +			++iter)  		{ -			if (LLViewerObject* attached_object = (*attachment_iter)) +			LLViewerJointAttachment *attachment = iter->second; +			for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); +				 attachment_iter != attachment->mAttachedObjects.end(); +				 ++attachment_iter)  			{ -				markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera); +				if (LLViewerObject* attached_object = (*attachment_iter)) +				{ +					markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera); +				}  			}  		}  	}  	stateSort(*LLViewerCamera::getInstance(), result); -	const LLVector4a* ext = avatar->mDrawable->getSpatialExtents(); -	LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); -  	LLCamera camera = *viewer_camera; - -	camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis()); -	  	LLVector2 tdim; +	U32 resY = 0; +	U32 resX = 0; +	{ +		LLFastTimer t(FTM_IMPOSTOR_SETUP); +		const LLVector4a* ext = avatar->mDrawable->getSpatialExtents(); +		LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); -	LLVector4a half_height; -	half_height.setSub(ext[1], ext[0]); -	half_height.mul(0.5f); +		camera.lookAt(viewer_camera->getOrigin(), pos, viewer_camera->getUpAxis()); +	 +		LLVector4a half_height; +		half_height.setSub(ext[1], ext[0]); +		half_height.mul(0.5f); -	LLVector4a left; -	left.load3(camera.getLeftAxis().mV); -	left.mul(left); -	left.normalize3fast(); +		LLVector4a left; +		left.load3(camera.getLeftAxis().mV); +		left.mul(left); +		left.normalize3fast(); -	LLVector4a up; -	up.load3(camera.getUpAxis().mV); -	up.mul(up); -	up.normalize3fast(); +		LLVector4a up; +		up.load3(camera.getUpAxis().mV); +		up.mul(up); +		up.normalize3fast(); -	tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); -	tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); +		tdim.mV[0] = fabsf(half_height.dot3(left).getF32()); +		tdim.mV[1] = fabsf(half_height.dot3(up).getF32()); -	gGL.matrixMode(LLRender::MM_PROJECTION); -	gGL.pushMatrix(); +		gGL.matrixMode(LLRender::MM_PROJECTION); +		gGL.pushMatrix(); -	F32 distance = (pos-camera.getOrigin()).length(); -	F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; -	F32 aspect = tdim.mV[0]/tdim.mV[1]; -	glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); -	glh_set_current_projection(persp); -	gGL.loadMatrix(persp.m); +		F32 distance = (pos-camera.getOrigin()).length(); +		F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; +		F32 aspect = tdim.mV[0]/tdim.mV[1]; +		glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); +		glh_set_current_projection(persp); +		gGL.loadMatrix(persp.m); -	gGL.matrixMode(LLRender::MM_MODELVIEW); -	gGL.pushMatrix(); -	glh::matrix4f mat; -	camera.getOpenGLTransform(mat.m); +		gGL.matrixMode(LLRender::MM_MODELVIEW); +		gGL.pushMatrix(); +		glh::matrix4f mat; +		camera.getOpenGLTransform(mat.m); -	mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat; +		mat = glh::matrix4f((GLfloat*) OGL_TO_CFR_ROTATION) * mat; -	gGL.loadMatrix(mat.m); -	glh_set_current_modelview(mat); +		gGL.loadMatrix(mat.m); +		glh_set_current_modelview(mat); -	glClearColor(0.0f,0.0f,0.0f,0.0f); -	gGL.setColorMask(true, true); +		glClearColor(0.0f,0.0f,0.0f,0.0f); +		gGL.setColorMask(true, true); -	// get the number of pixels per angle -	F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); +		// get the number of pixels per angle +		F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView()); -	//get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) -	U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); -	U32 resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512); +		//get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) +		resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); +		resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512); -	if (!avatar->mImpostor.isComplete() || resX != avatar->mImpostor.getWidth() || -		resY != avatar->mImpostor.getHeight()) -	{ -		avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE); +		if (!avatar->mImpostor.isComplete()) +		{ +			LLFastTimer t(FTM_IMPOSTOR_ALLOCATE); +			avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE); + +			if (LLPipeline::sRenderDeferred) +			{ +				addDeferredAttachments(avatar->mImpostor); +			} -		if (LLPipeline::sRenderDeferred) +			gGL.getTexUnit(0)->bind(&avatar->mImpostor); +			gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); +			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); +		} +		else if(resX != avatar->mImpostor.getWidth() || +			resY != avatar->mImpostor.getHeight())  		{ -			addDeferredAttachments(avatar->mImpostor); +			LLFastTimer t(FTM_IMPOSTOR_RESIZE); +			avatar->mImpostor.resize(resX,resY,GL_RGBA);  		} -		 -		gGL.getTexUnit(0)->bind(&avatar->mImpostor); -		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); -		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); -	} -	avatar->mImpostor.bindTarget(); +		avatar->mImpostor.bindTarget(); +	}  	if (LLPipeline::sRenderDeferred)  	{ @@ -9719,6 +9787,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	}  	{ //create alpha mask based on depth buffer (grey out if muted) +		LLFastTimer t(FTM_IMPOSTOR_BACKGROUND);  		if (LLPipeline::sRenderDeferred)  		{  			GLuint buff = GL_COLOR_ATTACHMENT0; @@ -9804,22 +9873,22 @@ BOOL LLPipeline::hasRenderBatches(const U32 type) const  	return sCull->getRenderMapSize(type) > 0;  } -LLCullResult::drawinfo_list_t::iterator LLPipeline::beginRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLPipeline::beginRenderMap(U32 type)  {  	return sCull->beginRenderMap(type);  } -LLCullResult::drawinfo_list_t::iterator LLPipeline::endRenderMap(U32 type) +LLCullResult::drawinfo_iterator LLPipeline::endRenderMap(U32 type)  {  	return sCull->endRenderMap(type);  } -LLCullResult::sg_list_t::iterator LLPipeline::beginAlphaGroups() +LLCullResult::sg_iterator LLPipeline::beginAlphaGroups()  {  	return sCull->beginAlphaGroups();  } -LLCullResult::sg_list_t::iterator LLPipeline::endAlphaGroups() +LLCullResult::sg_iterator LLPipeline::endAlphaGroups()  {  	return sCull->endAlphaGroups();  } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 6ae482fa06..efc94315d7 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -294,10 +294,10 @@ public:  	void setLight(LLDrawable *drawablep, BOOL is_light);  	BOOL hasRenderBatches(const U32 type) const; -	LLCullResult::drawinfo_list_t::iterator beginRenderMap(U32 type); -	LLCullResult::drawinfo_list_t::iterator endRenderMap(U32 type); -	LLCullResult::sg_list_t::iterator beginAlphaGroups(); -	LLCullResult::sg_list_t::iterator endAlphaGroups(); +	LLCullResult::drawinfo_iterator beginRenderMap(U32 type); +	LLCullResult::drawinfo_iterator endRenderMap(U32 type); +	LLCullResult::sg_iterator beginAlphaGroups(); +	LLCullResult::sg_iterator endAlphaGroups();  	void addTrianglesDrawn(S32 index_count, U32 render_type = LLRender::TRIANGLES); diff --git a/indra/newview/skins/default/xui/de/menu_viewer.xml b/indra/newview/skins/default/xui/de/menu_viewer.xml index 856f91e214..c4c4defab9 100644 --- a/indra/newview/skins/default/xui/de/menu_viewer.xml +++ b/indra/newview/skins/default/xui/de/menu_viewer.xml @@ -21,7 +21,6 @@  			<menu_item_call label="Beschäftigt" name="Set Busy"/>  		</menu>  		<menu_item_call label="L$ kaufen..." name="Buy and Sell L$"/> -		<menu_item_call label="Händler-Outbox..." name="MerchantOutbox"/>  		<menu_item_call label="Kontoübersicht..." name="Manage My Account">  			<menu_item_call.on_click name="ManageMyAccount_url" parameter="WebLaunchJoinNow,http://secondlife.com/account/index.php?lang=de"/>  		</menu_item_call> diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml index 6021ba0a5a..2e29c61cb2 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml @@ -134,6 +134,16 @@       top_delta="-25"       name="Pipette"       width="28" /> +   <check_box +     follows="left|bottom" +     height="20" +     initial_value="true" +     label="Live Preview" +     layout="topleft" +     left="4" +     name="apply_immediate_check" +     top="262" +     width="120" />     <text       follows="left|bottom"       height="20" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 91b4d38e97..e0ae009a02 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7490,6 +7490,18 @@ We cannot display a preview of this texture because it is no-copy and/or no-tran    <notification     icon="alertmodal.tga" +   name="LivePreviewUnavailable" +   type="alert"> +    +We cannot display a preview of this texture because it is no-copy and/or no-transfer. +  <usetemplate +    ignoretext="Warn me that Live Preview mode is not available for no-copy and/or no-transfer textures" +    name="okignore" +    yestext="OK"/> +  </notification> + +  <notification +   icon="alertmodal.tga"     name="ConfirmLeaveCall"     type="alert">  Are you sure you want to leave this call? diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml index 54a312bd59..c5dfb703e5 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml @@ -11,6 +11,10 @@  		 name="unknown">          (unknown)  	</panel.string> +    <panel.string +         name="unknown_multiple"> +        (unknown / multiple) +    </panel.string>  	<panel.string  		 name="public">          (public) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index d1c952ac3b..d1c952ac3b 100755..100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py | 
