From a766e26db46c7c054bae1021470dbe365f2a3cb3 Mon Sep 17 00:00:00 2001
From: William Todd Stinson <stinson@lindenlab.com>
Date: Mon, 10 Sep 2012 10:37:02 -0700
Subject: Backing out the changes contributing to DRTVWR-167 and DRTVWR-179
 from the repository.

---
 indra/newview/CMakeLists.txt                       |    8 +-
 indra/newview/llappviewer.cpp                      |    4 -
 indra/newview/llappviewerwin32.cpp                 |    2 -
 indra/newview/lldrawable.cpp                       |   52 +-
 indra/newview/lldrawable.h                         |   23 +-
 indra/newview/lldrawpool.cpp                       |   44 +-
 indra/newview/lldrawpool.h                         |    4 +
 indra/newview/lldrawpoolalpha.cpp                  |   10 +-
 indra/newview/lldrawpoolavatar.cpp                 |   78 +-
 indra/newview/lldrawpoolbump.cpp                   |   12 +-
 indra/newview/lldrawpoolterrain.cpp                |   28 -
 indra/newview/lldrawpoolterrain.h                  |    1 -
 indra/newview/lldrawpooltree.cpp                   |   15 -
 indra/newview/lldriverparam.cpp                    |   26 +-
 indra/newview/lldriverparam.h                      |   10 +-
 indra/newview/lldynamictexture.h                   |   12 +-
 indra/newview/llface.cpp                           |   46 +-
 indra/newview/llface.h                             |   12 -
 indra/newview/llflexibleobject.cpp                 |  130 +--
 indra/newview/llflexibleobject.h                   |    5 +-
 indra/newview/llfloaterbuycontents.cpp             |    4 +-
 indra/newview/llfloaterland.cpp                    |   17 +-
 indra/newview/llfloatermodelpreview.cpp            |    3 +-
 indra/newview/llfolderview.cpp                     |    3 +-
 indra/newview/llpanelmarketplaceinbox.cpp          |    8 +-
 indra/newview/llphysicsmotion.cpp                  |   77 +-
 indra/newview/llpolymesh.cpp                       |  210 ++--
 indra/newview/llpolymesh.h                         |   52 +-
 indra/newview/llpolymorph.cpp                      |  165 ++-
 indra/newview/llpolymorph.h                        |   18 +-
 indra/newview/llsidepaneliteminfo.cpp              |    2 +-
 indra/newview/llspatialpartition.cpp               |  196 ++--
 indra/newview/llspatialpartition.h                 |  109 +-
 indra/newview/llsurface.cpp                        |    8 +-
 indra/newview/llsurfacepatch.cpp                   |   14 +-
 indra/newview/lltexlayerparams.h                   |   20 +-
 indra/newview/llviewercamera.h                     |   13 +-
 indra/newview/llviewerdisplay.cpp                  |   32 +-
 indra/newview/llviewerjointmesh.cpp                |    6 +-
 indra/newview/llviewermenu.cpp                     |   12 +-
 indra/newview/llviewermessage.cpp                  |    2 -
 indra/newview/llviewerobject.cpp                   |   15 +-
 indra/newview/llviewerobject.h                     |    7 +-
 indra/newview/llviewerobjectlist.cpp               |   97 +-
 indra/newview/llviewerobjectlist.h                 |    4 +-
 indra/newview/llviewerregion.cpp                   |    3 +-
 indra/newview/llviewervisualparam.h                |    8 +-
 indra/newview/llviewerwindow.cpp                   |    3 -
 indra/newview/llvoavatar.cpp                       |   23 +-
 indra/newview/llvoavatar.h                         |   16 +-
 indra/newview/llvoavatarself.h                     |   10 -
 indra/newview/llvograss.cpp                        |    2 +-
 indra/newview/llvopartgroup.cpp                    |   12 +-
 indra/newview/llvopartgroup.h                      |    1 -
 indra/newview/llvotree.cpp                         |    6 +-
 indra/newview/llvovolume.cpp                       |   43 +-
 indra/newview/llvovolume.h                         |    3 +-
 indra/newview/llworld.cpp                          |   14 +-
 indra/newview/pipeline.cpp                         |  357 +++----
 indra/newview/pipeline.h                           |    8 +-
 indra/newview/skins/default/xui/de/menu_viewer.xml |    1 +
 .../skins/default/xui/en/floater_texture_ctrl.xml  |   10 -
 .../newview/skins/default/xui/en/notifications.xml |   12 -
 .../skins/default/xui/en/sidepanel_item_info.xml   |    4 -
 .../skins/default/xui/en/sidepanel_task_info.xml   | 1088 ++++++++++----------
 indra/newview/viewer_manifest.py                   |    1 -
 66 files changed, 1329 insertions(+), 1912 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 3cd03f8641..c0a252637f 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1564,7 +1564,9 @@ set(PACKAGE ON CACHE BOOL
 if (WINDOWS)
     set_target_properties(${VIEWER_BINARY_NAME}
         PROPERTIES
-        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS ${TCMALLOC_LINK_FLAGS}"
+        # *TODO -reenable this once we get server usage sorted out
+        #LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:\"__tcmalloc\""
+        LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:WINDOWS /INCLUDE:__tcmalloc "
         LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO"
         LINK_FLAGS_RELEASE "/FORCE:MULTIPLE /MAP\"secondlife-bin.MAP\" /OPT:REF"
         )
@@ -1583,7 +1585,7 @@ if (WINDOWS)
     # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py
     # and have the build deps get tracked *please* tell me about it.
 
-    if(USE_TCMALLOC)
+    if(USE_GOOGLE_PERFTOOLS)
       # Configure a var for tcmalloc location, if used.
       # Note the need to specify multiple names explicitly.
       set(GOOGLE_PERF_TOOLS_SOURCE
@@ -1591,7 +1593,7 @@ if (WINDOWS)
         ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
         ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
         )
-     endif(USE_TCMALLOC)
+     endif(USE_GOOGLE_PERFTOOLS)
 
 
     set(COPY_INPUT_DEPENDENCIES
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index cb69048c60..e8934d9a9e 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -89,7 +89,6 @@
 #include "lllogininstance.h"
 #include "llprogressview.h"
 #include "llvocache.h"
-#include "llvopartgroup.h"
 #include "llweb.h"
 #include "llsecondlifeurls.h"
 #include "llupdaterservice.h"
@@ -680,9 +679,6 @@ 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..bad60a9757 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -130,8 +130,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 	// This results in a 2-3x improvement in opening a new Inventory window (which uses a large numebr of allocations)
 	// Note: This won't work when running from the debugger unless the _NO_DEBUG_HEAP environment variable is set to 1
 
-	// Enable to get mem debugging within visual studio.
-	//_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
 	_CrtSetDbgFlag(0); // default, just making explicit
 	
 	ULONG ulEnableLFH = 2;
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 89a2e9f407..108ec92f6d 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -57,8 +57,6 @@ const F32 MIN_SHADOW_CASTER_RADIUS = 2.0f;
 
 static LLFastTimer::DeclareTimer FTM_CULL_REBOUND("Cull Rebound");
 
-extern bool gShiftFrame;
-
 
 ////////////////////////
 //
@@ -110,8 +108,6 @@ void LLDrawable::init()
 	
 	mGeneration = -1;
 	mBinRadius = 1.f;
-	mBinIndex = -1;
-
 	mSpatialBridge = NULL;
 }
 
@@ -718,11 +714,6 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update)
 		return;
 	}
 
-	if (gShiftFrame)
-	{
-		return;
-	}
-
 	//switch LOD with the spatial group to avoid artifacts
 	//LLSpatialGroup* sg = getSpatialGroup();
 
@@ -820,19 +811,14 @@ 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();
-
-		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)
+		if (!volume)
 		{
 			gPipeline.markRebuild(this, LLDrawable::REBUILD_ALL, TRUE);
 		}
@@ -846,7 +832,7 @@ void LLDrawable::shiftPos(const LLVector4a &shift_vector)
 				facep->mExtents[0].add(shift_vector);
 				facep->mExtents[1].add(shift_vector);
 			
-				if (rebuild && facep->hasGeometry())
+				if (!volume && facep->hasGeometry())
 				{
 					facep->clearVertexBuffer();
 				}
@@ -957,12 +943,6 @@ 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))
@@ -985,8 +965,6 @@ void LLDrawable::setSpatialGroup(LLSpatialGroup *groupp)
 	}
 
 	mSpatialGroupp = groupp;
-
-	llassert((mSpatialGroupp == NULL) ? getBinIndex() == -1 : getBinIndex() != -1);
 }
 
 LLSpatialPartition* LLDrawable::getSpatialPartition()
@@ -1109,8 +1087,6 @@ LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 dat
 	mDrawable = root;
 	root->setSpatialBridge(this);
 	
-	mBinIndex = -1;
-
 	mRenderType = mDrawable->mRenderType;
 	mDrawableType = mDrawable->mRenderType;
 	
@@ -1414,11 +1390,6 @@ void LLSpatialBridge::updateDistance(LLCamera& camera_in, bool force_update)
 		markDead();
 		return;
 	}
-	
-	if (gShiftFrame)
-	{
-		return;
-	}
 
 	if (mDrawable->getVObj())
 	{
@@ -1497,13 +1468,7 @@ void LLSpatialBridge::cleanupReferences()
 	LLDrawable::cleanupReferences();
 	if (mDrawable)
 	{
-		LLSpatialGroup* group = mDrawable->getSpatialGroup();
-		if (group)
-		{
-			group->mOctreeNode->remove(mDrawable);
-			mDrawable->setSpatialGroup(NULL);
-		}
-		
+		mDrawable->setSpatialGroup(NULL);
 		if (mDrawable->getVObj())
 		{
 			LLViewerObject::const_child_list_t& child_list = mDrawable->getVObj()->getChildren();
@@ -1514,12 +1479,7 @@ void LLSpatialBridge::cleanupReferences()
 				LLDrawable* drawable = child->mDrawable;					
 				if (drawable)
 				{
-					LLSpatialGroup* group = drawable->getSpatialGroup();
-					if (group)
-					{
-						group->mOctreeNode->remove(drawable);
-						drawable->setSpatialGroup(NULL);
-					}
+					drawable->setSpatialGroup(NULL);
 				}
 			}
 		}
diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h
index 960c64fa9e..e2064b79f8 100644
--- a/indra/newview/lldrawable.h
+++ b/indra/newview/lldrawable.h
@@ -59,7 +59,6 @@ class LLViewerTexture;
 const U32 SILHOUETTE_HIGHLIGHT = 0;
 
 // All data for new renderer goes into this class.
-LL_ALIGN_PREFIX(16)
 class LLDrawable : public LLRefCount
 {
 public:
@@ -76,16 +75,6 @@ public:
 
 	static void initClass();
 
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	LLDrawable()				{ init(); }
 	MEM_TYPE_NEW(LLMemType::MTYPE_DRAWABLE);
 	
@@ -120,9 +109,6 @@ 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; }
 
@@ -208,7 +194,7 @@ public:
 	S32 findReferences(LLDrawable *drawablep); // Not const because of @#$! iterators...
 
 	void setSpatialGroup(LLSpatialGroup *groupp);
-	LLSpatialGroup *getSpatialGroup() const;
+	LLSpatialGroup *getSpatialGroup() const			{ return mSpatialGroupp; }
 	LLSpatialPartition* getSpatialPartition();
 	
 	// Statics
@@ -295,8 +281,8 @@ public:
 	} EDrawableFlags;
 
 private: //aligned members
-	LL_ALIGN_16(LLVector4a		mExtents[2]);
-	LL_ALIGN_16(LLVector4a		mPositionGroup);
+	LLVector4a		mExtents[2];
+	LLVector4a		mPositionGroup;
 	
 public:
 	LLXformMatrix       mXform;
@@ -329,7 +315,6 @@ private:
 	mutable U32		mVisible;
 	F32				mRadius;
 	F32				mBinRadius;
-	mutable S32		mBinIndex;
 	S32				mGeneration;
 	
 	LLVector3		mCurrentScale;
@@ -338,7 +323,7 @@ private:
 
 	static U32 sNumZombieDrawables;
 	static LLDynamicArrayPtr<LLPointer<LLDrawable> > sDeadList;
-} LL_ALIGN_POSTFIX(16);
+};
 
 
 inline LLFace* LLDrawable::getFace(const S32 i) const
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 013c698445..81f4e3d48f 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -254,6 +254,48 @@ 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);
@@ -401,7 +443,7 @@ void LLRenderPass::renderTexture(U32 type, U32 mask)
 
 void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)
 {
-	for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i)	
+	for (LLCullResult::drawinfo_list_t::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 ab9bb9e611..977acf7aec 100644
--- a/indra/newview/lldrawpool.h
+++ b/indra/newview/lldrawpool.h
@@ -190,6 +190,10 @@ 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 b4f6bf9383..5f2a982ed3 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_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
+	for (LLCullResult::sg_list_t::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_iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
+	for (LLCullResult::sg_list_t::iterator i = gPipeline.beginAlphaGroups(); i != gPipeline.endAlphaGroups(); ++i)
 	{
 		LLSpatialGroup* group = *i;
 		llassert(group);
@@ -411,12 +411,6 @@ 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 730ad1a364..ace3a20bbb 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -1036,13 +1036,9 @@ 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++)
@@ -1199,6 +1195,15 @@ 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);
@@ -1214,8 +1219,20 @@ 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;
 	}
 	
@@ -1413,7 +1430,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
 
 void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
 {
-	if (avatar->isSelf() && !gAgent.needsRenderAvatar())
+	if (avatar->isSelf() && !gAgent.needsRenderAvatar() || !gMeshRepo.meshRezEnabled())
 	{
 		return;
 	}
@@ -1542,12 +1559,8 @@ 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)
 	{
@@ -1619,56 +1632,17 @@ void LLDrawPoolAvatar::renderRiggedFullbrightShiny(LLVOAvatar* avatar)
 
 void LLDrawPoolAvatar::renderRiggedAlpha(LLVOAvatar* avatar)
 {
-	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);
-	}
+	renderRigged(avatar, RIGGED_ALPHA);
 }
 
 void LLDrawPoolAvatar::renderRiggedFullbrightAlpha(LLVOAvatar* avatar)
 {
-	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);
-	}
+	renderRigged(avatar, RIGGED_FULLBRIGHT_ALPHA);
 }
 
 void LLDrawPoolAvatar::renderRiggedGlow(LLVOAvatar* avatar)
 {
-	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);
-	}
+	renderRigged(avatar, RIGGED_GLOW, true);
 }
 
 
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index a264eae302..6f71e6ebc8 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_iterator begin = gPipeline.beginRenderMap(type);
-	LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
+	LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type);
+	LLCullResult::drawinfo_list_t::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_iterator i = begin; i != end; ++i)	
+	for (LLCullResult::drawinfo_list_t::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_iterator begin = gPipeline.beginRenderMap(type);
-	LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
+	LLCullResult::drawinfo_list_t::iterator begin = gPipeline.beginRenderMap(type);
+	LLCullResult::drawinfo_list_t::iterator end = gPipeline.endRenderMap(type);
 
-	for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)	
+	for (LLCullResult::drawinfo_list_t::iterator i = begin; i != end; ++i)	
 	{
 		LLDrawInfo& params = **i;
 
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 7fc78fb382..b95d8296fa 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -294,34 +294,6 @@ 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 2163d087e1..283ed87f1a 100644
--- a/indra/newview/lldrawpoolterrain.h
+++ b/indra/newview/lldrawpoolterrain.h
@@ -83,7 +83,6 @@ 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 83f04e45a8..3165a3516c 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -37,7 +37,6 @@
 #include "llviewershadermgr.h"
 #include "llrender.h"
 #include "llviewercontrol.h"
-#include "llviewerregion.h"
 
 S32 LLDrawPoolTree::sDiffTex = 0;
 static LLGLSLShader* shader = NULL;
@@ -105,22 +104,8 @@ 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 885cae1737..64eb11fc9b 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -155,7 +155,6 @@ LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) :
 	mAvatarp(avatarp), 
 	mWearablep(NULL)
 {
-	mDefaultVec.clear();
 }
 
 LLDriverParam::LLDriverParam(LLWearable *wearablep) : 
@@ -163,7 +162,6 @@ LLDriverParam::LLDriverParam(LLWearable *wearablep) :
 	mAvatarp(NULL), 
 	mWearablep(wearablep)
 {
-	mDefaultVec.clear();
 }
 
 LLDriverParam::~LLDriverParam()
@@ -343,19 +341,18 @@ F32	LLDriverParam::getTotalDistortion()
 	return sum; 
 }
 
-const LLVector4a	&LLDriverParam::getAvgDistortion()	
+const LLVector3	&LLDriverParam::getAvgDistortion()	
 {
 	// It's not actually correct to take the average of averages, but it good enough here.
-	LLVector4a sum;
-	sum.clear();
+	LLVector3 sum;
 	S32 count = 0;
 	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
 	{
 		LLDrivenEntry* driven = &(*iter);
-		sum.add(driven->mParam->getAvgDistortion());
+		sum += driven->mParam->getAvgDistortion();
 		count++;
 	}
-	sum.mul( 1.f/(F32)count);
+	sum /= (F32)count;
 
 	mDefaultVec = sum;
 	return mDefaultVec; 
@@ -378,22 +375,21 @@ F32	LLDriverParam::getMaxDistortion()
 }
 
 
-LLVector4a	LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
+LLVector3	LLDriverParam::getVertexDistortion(S32 index, LLPolyMesh *poly_mesh)
 {
-	LLVector4a sum;
-	sum.clear();
+	LLVector3 sum;
 	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
 	{
 		LLDrivenEntry* driven = &(*iter);
-		sum.add(driven->mParam->getVertexDistortion( index, poly_mesh ));
+		sum += driven->mParam->getVertexDistortion( index, poly_mesh );
 	}
 	return sum;
 }
 
-const LLVector4a*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
+const LLVector3*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
 {
 	mCurrentDistortionParam = NULL;
-	const LLVector4a* v = NULL;
+	const LLVector3* v = NULL;
 	for( entry_list_t::iterator iter = mDriven.begin(); iter != mDriven.end(); iter++ )
 	{
 		LLDrivenEntry* driven = &(*iter);
@@ -408,7 +404,7 @@ const LLVector4a*	LLDriverParam::getFirstDistortion(U32 *index, LLPolyMesh **pol
 	return v;
 };
 
-const LLVector4a*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
+const LLVector3*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
 {
 	llassert( mCurrentDistortionParam );
 	if( !mCurrentDistortionParam )
@@ -436,7 +432,7 @@ const LLVector4a*	LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly
 	}
 
 	// We're already in the middle of a param's distortions, so get the next one.
-	const LLVector4a* v = driven->mParam->getNextDistortion( index, poly_mesh );
+	const LLVector3* 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 7a4d711d4e..fb1b44458c 100644
--- a/indra/newview/lldriverparam.h
+++ b/indra/newview/lldriverparam.h
@@ -105,18 +105,18 @@ public:
 	
 	// LLViewerVisualParam Virtual functions
 	/*virtual*/ F32					getTotalDistortion();
-	/*virtual*/ const LLVector4a&	getAvgDistortion();
+	/*virtual*/ const LLVector3&	getAvgDistortion();
 	/*virtual*/ F32					getMaxDistortion();
-	/*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);
+	/*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);
 
 protected:
 	F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
 	void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
 
 
-	LLVector4a	mDefaultVec; // temp holder
+	LLVector3	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..e18090545d 100644
--- a/indra/newview/lldynamictexture.h
+++ b/indra/newview/lldynamictexture.h
@@ -36,16 +36,6 @@
 class LLViewerDynamicTexture : public LLViewerTexture
 {
 public:
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	enum
 	{
 		LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
@@ -95,7 +85,7 @@ protected:
 protected:
 	BOOL mClamp;
 	LLCoordGL mOrigin;
-	LL_ALIGN_16(LLCamera mCamera);
+	LLCamera mCamera;
 	
 	typedef std::set<LLViewerDynamicTexture*> instance_list_t;
 	static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 8d0664770b..373b1930f5 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -163,10 +163,16 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp)
 	mGeomCount		= 0;
 	mGeomIndex		= 0;
 	mIndicesCount	= 0;
-
-	//special value to indicate uninitialized position
-	mIndicesIndex	= 0xFFFFFFFF;
-
+	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;
 	mTexture		= NULL;
 	mTEOffset		= -1;
 	mTextureIndex = 255;
@@ -201,10 +207,13 @@ void LLFace::destroy()
 		mTexture->removeFace(this) ;
 	}
 	
-	if (isState(LLFace::PARTICLE))
+	if (mDrawablep.notNull() &&
+		(mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_PARTICLES ||
+		mDrawablep->getRenderType() == LLPipeline::RENDER_TYPE_HUD_PARTICLES) &&
+		mIndicesIndex != 0xFFFFFFFF)
 	{
 		LLVOPartGroup::freeVBSlot(getGeomIndex()/4);
-		clearState(LLFace::PARTICLE);
+		mIndicesIndex = 0xFFFFFFFF;
 	}
 
 	if (mDrawPoolp)
@@ -1198,25 +1207,19 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 	{
 		if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())
 		{
-			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;
-			}
+			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())
 		{
-			if (gDebugGL)
-			{
-				llwarns << "Vertex buffer overflow!" << llendl;
-			}
+			llwarns << "Vertex buffer overflow!" << llendl;
 			return FALSE;
 		}
 	}
@@ -1648,8 +1651,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
 						if (!do_xform)
 						{
 							LLFastTimer t(FTM_FACE_TEX_QUICK_NO_XFORM);
-							S32 tc_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF;
-							LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, tc_size);
+							LLVector4a::memcpyNonAliased16((F32*) tex_coords.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32));
 						}
 						else
 						{
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index efc3424858..76ea5c853a 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -59,17 +59,6 @@ class LLFace
 {
 public:
 
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
-
 	LLFace(const LLFace& rhs)
 	{
 		*this = rhs;
@@ -90,7 +79,6 @@ 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 9745bb6d64..3d64ceb71d 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,28 +255,50 @@ void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, cons
 {
 }
 
-
-void LLVolumeImplFlexible::updateRenderRes()
+//---------------------------------------------------------------------------------
+// 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)
 {
-	LLDrawable* drawablep = mVO->mDrawable;
+	if (mVO->mDrawable.isNull())
+	{
+		// Don't do anything until we have a drawable
+		return FALSE; // (we are not initialized or updated)
+	}
 
-	S32 new_res = mAttributes->getSimulateLOD();
+	BOOL force_update = mSimulateRes == 0 ? TRUE : FALSE;
 
-#if 1 //optimal approximation of previous behavior that doesn't rely on atan2
-	F32 app_angle = mVO->getScale().mV[2]/drawablep->mDistanceWRTCamera;
+	//flexible objects never go static
+	mVO->mDrawable->mQuietCount = 0;
+	if (!mVO->mDrawable->isRoot())
+	{
+		LLViewerObject* parent = (LLViewerObject*) mVO->getParent();
+		parent->mDrawable->mQuietCount = 0;
+	}
+
+	LLFastTimer ftm(FTM_FLEXIBLE_UPDATE);
+		
+	S32 new_res = mAttributes->getSimulateLOD();
 
-	// Rendering sections increases with visible angle on the screen
-	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);
+	F32 app_angle = llround((F32) atan2( mVO->getScale().mV[2]*2.f, mVO->mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f);
 
- 	// Rendering sections increases with visible angle on the screen
+	// 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);
-		
+	if (mRenderRes > FLEXIBLE_OBJECT_MAX_SECTIONS)
+	{
+		mRenderRes = FLEXIBLE_OBJECT_MAX_SECTIONS;
+	}
+
+
+	// Bottom cap at 1/4 the original number of sections
+	if (mRenderRes < mAttributes->getSimulateLOD()-1)
+	{
+		mRenderRes = mAttributes->getSimulateLOD()-1;
+	}
 	// Throttle back simulation of segments we're not rendering
 	if (mRenderRes < new_res)
 	{
@@ -289,65 +311,43 @@ void LLVolumeImplFlexible::updateRenderRes()
 		setAttributesOfAllSections();
 		mInitialized = TRUE;
 	}
-}
-//---------------------------------------------------------------------------------
-// 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 (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))
+	{
+		return FALSE; // (we are not initialized or updated)
+	}
+
+	bool visible = mVO->mDrawable->isVisible();
 
-	if (drawablep)
+	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)
 	{
-		//LLFastTimer ftm(FTM_FLEXIBLE_UPDATE);
+		U32 id;
+		F32 pixel_area = mVO->getPixelArea();
 
-		//flexible objects never go static
-		drawablep->mQuietCount = 0;
-		if (!drawablep->isRoot())
+		if (mVO->isRootEdit())
 		{
-			LLViewerObject* parent = (LLViewerObject*) mVO->getParent();
-			parent->mDrawable->mQuietCount = 0;
+			id = mID;
 		}
-
-		if (gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE))
+		else
 		{
-			bool visible = drawablep->isVisible();
-
-			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 (mVO->isRootEdit())
-				{
-					id = mID;
-				}
-				else
-				{
-					LLVOVolume* parent = (LLVOVolume*) mVO->getParent();
-					id = parent->getVolumeInterfaceID();
-				}
+			LLVOVolume* parent = (LLVOVolume*) mVO->getParent();
+			id = parent->getVolumeInterfaceID();
+		}
 
-				U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1;
+		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);
-				}
-			}
+		if ((LLDrawable::getCurrentFrame()+id)%update_period == 0)
+		{
+			gPipeline.markRebuild(mVO->mDrawable, LLDrawable::REBUILD_POSITION, FALSE);
 		}
 	}
+	
+	return force_update;
 }
 
 inline S32 log2(S32 x)
diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h
index 56d579d86f..371d6a0773 100644
--- a/indra/newview/llflexibleobject.h
+++ b/indra/newview/llflexibleobject.h
@@ -78,8 +78,7 @@ class LLVolumeImplFlexible : public LLVolumeInterface
 		LLVector3 getFramePosition() const;
 		LLQuaternion getFrameRotation() const;
 		LLVolumeInterfaceType getInterfaceType() const		{ return INTERFACE_FLEXIBLE; }
-		void updateRenderRes();
-		void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
+		BOOL doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
 		BOOL doUpdateGeometry(LLDrawable *drawable);
 		LLVector3 getPivotPosition() const;
 		void onSetVolume(const LLVolumeParams &volume_params, const S32 detail);
@@ -129,7 +128,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 809d344d01..bca4b5e447 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 df8ecb6fd9..61da99fe3a 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,16 +2226,11 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)
 	LLViewerRegion* region;
 	region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
 
-	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;
-		}
+	if (!allow_other_scripts && region && region->getAllowDamage())
+	{
+
+		LLNotificationsUtil::add("UnableToDisableOutsideScripts");
+		return;
 	}
 
 	// Push data into current parcel
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index a071f338ba..3fe535cbe8 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -4774,8 +4774,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
 			if (vf.mTexCoords)
 			{
 				vb->getTexCoord0Strider(tc_strider);
-				S32 tex_size = (num_vertices*2*sizeof(F32)+0xF) & ~0xF;
-				LLVector4a::memcpyNonAliased16((F32*) tc_strider.get(), (F32*) vf.mTexCoords, tex_size);
+				LLVector4a::memcpyNonAliased16((F32*) tc_strider.get(), (F32*) vf.mTexCoords, num_vertices*2*sizeof(F32));
 			}
 			
 			if (vf.mNormals)
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index d4080ab3f7..8e540a0cc8 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -2234,12 +2234,11 @@ void LLFolderView::doIdle()
 		mDebugFilters = debug_filters;
 		arrangeAll();
 	}
-
 	BOOL filter_modified_and_active = mFilter->isModified() && mFilter->isNotDefault();
 	mNeedsAutoSelect = filter_modified_and_active &&
 						!(gFocusMgr.childHasKeyboardFocus(this) || gFocusMgr.getMouseCapture());
 	mFilter->clearModified();
-			
+
 	// filter to determine visibility before arranging
 	filterFromRoot();
 
diff --git a/indra/newview/llpanelmarketplaceinbox.cpp b/indra/newview/llpanelmarketplaceinbox.cpp
index 66c9c323cb..5d75375847 100644
--- a/indra/newview/llpanelmarketplaceinbox.cpp
+++ b/indra/newview/llpanelmarketplaceinbox.cpp
@@ -115,8 +115,8 @@ void LLPanelMarketplaceInbox::onFocusReceived()
 	if (sidepanel_inventory)
 	{
 		sidepanel_inventory->clearSelections(true, false);
-	}
-
+		}
+	
 	gSavedPerAccountSettings.setU32("LastInventoryInboxActivity", time_corrected());
 }
 
@@ -168,8 +168,8 @@ U32 LLPanelMarketplaceInbox::getFreshItemCount() const
 				if (inbox_item_view && inbox_item_view->isFresh())
 				{
 					fresh_item_count++;
-				}
-			}
+		}
+	}
 		}
 	}
 
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index cb6989c9dd..e124916c48 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -67,19 +67,6 @@ 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
@@ -111,11 +98,6 @@ public:
                 mPositionLastUpdate_local(0)
         {
                 mJointState = new LLJointState;
-
-				for (U32 i = 0; i < NUM_PARAMS; ++i)
-				{
-					mParamCache[i] = NULL;
-				}
         }
 
         BOOL initialize();
@@ -129,43 +111,16 @@ public:
                 return mJointState;
         }
 protected:
-
-		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]);
+        F32 getParamValue(const std::string& controller_key)
+        {
+                const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key);
                 if (entry == mParamControllers.end())
                 {
-                        return sDefaultController[controller_key[param]];
+                        return sDefaultController[controller_key];
                 }
                 const std::string& param_name = (*entry).second.c_str();
-                mParamCache[param] = mCharacter->getVisualParam(param_name.c_str());
-			}
-				
-			if (mParamCache[param])
-			{
-				return mParamCache[param]->getWeight();
-			}
-			else
-			{
-				return sDefaultController[controller_key[param]];
-			}
-		}
-
-        
+                return mCharacter->getVisualParamWeight(param_name.c_str());
+        }
         void setParamValue(LLViewerVisualParam *param,
                            const F32 new_value_local,
                                                    F32 behavior_maxeffect);
@@ -195,8 +150,6 @@ private:
 
         F32 mLastTime;
         
-		LLVisualParam* mParamCache[NUM_PARAMS];
-
         static default_controller_map_t sDefaultController;
 };
 
@@ -474,6 +427,7 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
         return TRUE;
 }
 
+
 // Return TRUE if character has to update visual params.
 BOOL LLPhysicsMotion::onUpdate(F32 time)
 {
@@ -517,16 +471,15 @@ 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);
-		F32 behavior_maxeffect = getParamValue(MAX_EFFECT);
-		
-		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");
+        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 70f3b5335e..450f9b2be7 100644
--- a/indra/newview/llpolymesh.cpp
+++ b/indra/newview/llpolymesh.cpp
@@ -129,22 +129,22 @@ void LLPolyMeshSharedData::freeMeshData()
         {
                 mNumVertices = 0;
 
-                ll_aligned_free_16(mBaseCoords);
+                delete [] mBaseCoords;
                 mBaseCoords = NULL;
 
-                ll_aligned_free_16(mBaseNormals);
+                delete [] mBaseNormals;
                 mBaseNormals = NULL;
 
-                ll_aligned_free_16(mBaseBinormals);
+                delete [] mBaseBinormals;
                 mBaseBinormals = NULL;
 
-                ll_aligned_free_16(mTexCoords);
+                delete [] mTexCoords;
                 mTexCoords = NULL;
 
-                ll_aligned_free_16(mDetailTexCoords);
+                delete [] mDetailTexCoords;
                 mDetailTexCoords = NULL;
 
-                ll_aligned_free_16(mWeights);
+                delete [] mWeights;
                 mWeights = NULL;
         }
 
@@ -229,19 +229,15 @@ U32 LLPolyMeshSharedData::getNumKB()
 BOOL LLPolyMeshSharedData::allocateVertexData( U32 numVertices )
 {
         U32 i;
-        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));
+        mBaseCoords = new LLVector3[ numVertices ];
+        mBaseNormals = new LLVector3[ numVertices ];
+        mBaseBinormals = new LLVector3[ numVertices ];
+        mTexCoords = new LLVector2[ numVertices ];
+        mDetailTexCoords = new LLVector2[ numVertices ];
+        mWeights = new F32[ numVertices ];
         for (i = 0; i < numVertices; i++)
         {
-			mBaseCoords[i].clear();
-			mBaseNormals[i].clear();
-			mBaseBinormals[i].clear();
-			mTexCoords[i].clear();
-            mWeights[i] = 0.f;
+                mWeights[i] = 0.f;
         }
         mNumVertices = numVertices;
         return TRUE;
@@ -412,47 +408,39 @@ BOOL LLPolyMeshSharedData::loadMesh( const std::string& fileName )
 
                         allocateVertexData( numVertices );      
 
-						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;
-							}
-						}
+                        //----------------------------------------------------------------
+                        // 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;
+                        }
+
 
                         //----------------------------------------------------------------
                         // TexCoords
@@ -779,28 +767,21 @@ LLPolyMesh::LLPolyMesh(LLPolyMeshSharedData *shared_data, LLPolyMesh *reference_
 	{
 		// Allocate memory without initializing every vector
 		// NOTE: This makes asusmptions about the size of LLVector[234]
-		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
-
+		int nverts = mSharedData->mNumVertices;
+		int nfloats = nverts * (2*4 + 3*3 + 2 + 4);
 		//use 16 byte aligned vertex data to make LLPolyMesh SSE friendly
 		mVertexData = (F32*) ll_aligned_malloc_16(nfloats*4);
-		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; 
+		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; 
 		initializeForMorph();
 	}
 }
@@ -925,7 +906,7 @@ void LLPolyMesh::dumpDiagInfo()
 //-----------------------------------------------------------------------------
 // getWritableCoords()
 //-----------------------------------------------------------------------------
-LLVector4a *LLPolyMesh::getWritableCoords()
+LLVector4 *LLPolyMesh::getWritableCoords()
 {
         return mCoords;
 }
@@ -933,7 +914,7 @@ LLVector4a *LLPolyMesh::getWritableCoords()
 //-----------------------------------------------------------------------------
 // getWritableNormals()
 //-----------------------------------------------------------------------------
-LLVector4a *LLPolyMesh::getWritableNormals()
+LLVector4 *LLPolyMesh::getWritableNormals()
 {
         return mNormals;
 }
@@ -941,7 +922,7 @@ LLVector4a *LLPolyMesh::getWritableNormals()
 //-----------------------------------------------------------------------------
 // getWritableBinormals()
 //-----------------------------------------------------------------------------
-LLVector4a *LLPolyMesh::getWritableBinormals()
+LLVector3 *LLPolyMesh::getWritableBinormals()
 {
         return mBinormals;
 }
@@ -950,7 +931,7 @@ LLVector4a *LLPolyMesh::getWritableBinormals()
 //-----------------------------------------------------------------------------
 // getWritableClothingWeights()
 //-----------------------------------------------------------------------------
-LLVector4a       *LLPolyMesh::getWritableClothingWeights()
+LLVector4       *LLPolyMesh::getWritableClothingWeights()
 {
         return mClothingWeights;
 }
@@ -966,7 +947,7 @@ LLVector2       *LLPolyMesh::getWritableTexCoords()
 //-----------------------------------------------------------------------------
 // getScaledNormals()
 //-----------------------------------------------------------------------------
-LLVector4a *LLPolyMesh::getScaledNormals()
+LLVector3 *LLPolyMesh::getScaledNormals()
 {
         return mScaledNormals;
 }
@@ -974,7 +955,7 @@ LLVector4a *LLPolyMesh::getScaledNormals()
 //-----------------------------------------------------------------------------
 // getScaledBinormals()
 //-----------------------------------------------------------------------------
-LLVector4a *LLPolyMesh::getScaledBinormals()
+LLVector3 *LLPolyMesh::getScaledBinormals()
 {
         return mScaledBinormals;
 }
@@ -985,17 +966,17 @@ LLVector4a *LLPolyMesh::getScaledBinormals()
 //-----------------------------------------------------------------------------
 void LLPolyMesh::initializeForMorph()
 {
-    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)
+    for (U32 i = 0; i < mSharedData->mNumVertices; ++i)
 	{
-		mClothingWeights[i].clear();
+		mCoords[i] = LLVector4(mSharedData->mBaseCoords[i]);
+		mNormals[i] = LLVector4(mSharedData->mBaseNormals[i]);
 	}
+
+	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);
 }
 
 //-----------------------------------------------------------------------------
@@ -1117,7 +1098,7 @@ BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
 LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp)
 {
         mAvatar = avatarp;
-        mDefaultVec.splat(0.001f);
+        mDefaultVec.setVec(0.001f, 0.001f, 0.001f);
 }
 
 //-----------------------------------------------------------------------------
@@ -1190,12 +1171,8 @@ 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;
@@ -1251,14 +1228,11 @@ 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] = dir;
-                cloned_morph_data->mNormals[v].clear();
-                cloned_morph_data->mBinormals[v].clear();
+                cloned_morph_data->mCoords[v] = direction;
+                cloned_morph_data->mNormals[v] = LLVector3(0,0,0);
+                cloned_morph_data->mBinormals[v] = LLVector3(0,0,0);
         }
         return cloned_morph_data;
 }
@@ -1269,27 +1243,17 @@ 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++)
         {
-            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);
-			}
+                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;
+                }
         }
         return cloned_morph_data;
 }
diff --git a/indra/newview/llpolymesh.h b/indra/newview/llpolymesh.h
index ffb11a3f7e..ba2bf85570 100644
--- a/indra/newview/llpolymesh.h
+++ b/indra/newview/llpolymesh.h
@@ -73,9 +73,9 @@ private:
 							
 	// vertex data			
 	S32						mNumVertices;
-	LLVector4a				*mBaseCoords;
-	LLVector4a				*mBaseNormals;
-	LLVector4a				*mBaseBinormals;
+	LLVector3				*mBaseCoords;
+	LLVector3				*mBaseNormals;
+	LLVector3				*mBaseBinormals;
 	LLVector2				*mTexCoords;
 	LLVector2				*mDetailTexCoords;
 	F32						*mWeights;
@@ -217,41 +217,41 @@ public:
 	}
 
 	// Get coords
-	const LLVector4a	*getCoords() const{
+	const LLVector4	*getCoords() const{
 		return mCoords;
 	}
 
 	// non const version
-	LLVector4a *getWritableCoords();
+	LLVector4 *getWritableCoords();
 
 	// Get normals
-	const LLVector4a	*getNormals() const{ 
+	const LLVector4	*getNormals() const{ 
 		return mNormals; 
 	}
 
 	// Get normals
-	const LLVector4a	*getBinormals() const{ 
+	const LLVector3	*getBinormals() const{ 
 		return mBinormals; 
 	}
 
 	// Get base mesh normals
-	const LLVector4a *getBaseNormals() const{
+	const LLVector3 *getBaseNormals() const{
 		llassert(mSharedData);
 		return mSharedData->mBaseNormals;
 	}
 
 	// Get base mesh normals
-	const LLVector4a *getBaseBinormals() const{
+	const LLVector3 *getBaseBinormals() const{
 		llassert(mSharedData);
 		return mSharedData->mBaseBinormals;
 	}
 
 	// intermediate morphed normals and output normals
-	LLVector4a *getWritableNormals();
-	LLVector4a *getScaledNormals();
+	LLVector4 *getWritableNormals();
+	LLVector3 *getScaledNormals();
 
-	LLVector4a *getWritableBinormals();
-	LLVector4a *getScaledBinormals();
+	LLVector3 *getWritableBinormals();
+	LLVector3 *getScaledBinormals();
 
 	// Get texCoords
 	const LLVector2	*getTexCoords() const { 
@@ -275,9 +275,9 @@ public:
 
 	F32			*getWritableWeights() const;
 
-	LLVector4a	*getWritableClothingWeights();
+	LLVector4	*getWritableClothingWeights();
 
-	const LLVector4a		*getClothingWeights()
+	const LLVector4		*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)
-	LLVector4a				*mCoords;
+	LLVector4				*mCoords;
 	// deformed normals (resulting from application of morph targets)
-	LLVector4a				*mScaledNormals;
+	LLVector3				*mScaledNormals;
 	// output normals (after normalization)
-	LLVector4a				*mNormals;
+	LLVector4				*mNormals;
 	// deformed binormals (resulting from application of morph targets)
-	LLVector4a				*mScaledBinormals;
+	LLVector3				*mScaledBinormals;
 	// output binormals (after normalization)
-	LLVector4a				*mBinormals;
+	LLVector3				*mBinormals;
 	// weight values that mark verts as clothing/skin
-	LLVector4a				*mClothingWeights;
+	LLVector4				*mClothingWeights;
 	// output texture coordinates
 	LLVector2				*mTexCoords;
 	
@@ -419,17 +419,17 @@ public:
 	
 	// LLViewerVisualParam Virtual functions
 	/*virtual*/ F32					getTotalDistortion() { return 0.1f; }
-	/*virtual*/ const LLVector4a&	getAvgDistortion()	{ return mDefaultVec; }
+	/*virtual*/ const LLVector3&	getAvgDistortion()	{ return mDefaultVec; }
 	/*virtual*/ F32					getMaxDistortion() { return 0.1f; }
-	/*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;};
+	/*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;};
 
 protected:
 	typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
 	joint_vec_map_t mJointScales;
 	joint_vec_map_t mJointOffsets;
-	LLVector4a	mDefaultVec;
+	LLVector3	mDefaultVec;
 	// Backlink only; don't make this an LLPointer.
 	LLVOAvatar *mAvatar;
 };
diff --git a/indra/newview/llpolymorph.cpp b/indra/newview/llpolymorph.cpp
index d25d1420ee..cefd7df3fe 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.clear();
+	mAvgDistortion.zeroVec();
 	mMaxDistortion = 0.f;
 	mVertexIndices = NULL;
 	mCoords = NULL;
@@ -73,9 +73,9 @@ LLPolyMorphData::LLPolyMorphData(const LLPolyMorphData &rhs) :
 {
 	const S32 numVertices = mNumIndices;
 
-	mCoords = new LLVector4a[numVertices];
-	mNormals = new LLVector4a[numVertices];
-	mBinormals = new LLVector4a[numVertices];
+	mCoords = new LLVector3[numVertices];
+	mNormals = new LLVector3[numVertices];
+	mBinormals = new LLVector3[numVertices];
 	mTexCoords = new LLVector2[numVertices];
 	mVertexIndices = new U32[numVertices];
 	
@@ -121,16 +121,16 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
 	//-------------------------------------------------------------------------
 	// allocate vertices
 	//-------------------------------------------------------------------------
-	mCoords = new LLVector4a[numVertices];
-	mNormals = new LLVector4a[numVertices];
-	mBinormals = new LLVector4a[numVertices];
+	mCoords = new LLVector3[numVertices];
+	mNormals = new LLVector3[numVertices];
+	mBinormals = new LLVector3[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.clear();
+	mAvgDistortion.zeroVec();
 	mMesh = mesh;
 
 	//-------------------------------------------------------------------------
@@ -152,36 +152,36 @@ BOOL LLPolyMorphData::loadBinary(LLFILE *fp, LLPolyMeshSharedData *mesh)
 		}
 
 
-		numRead = fread(&mCoords[v], sizeof(F32), 3, fp);
-		llendianswizzle(&mCoords[v], sizeof(F32), 3);
+		numRead = fread(&mCoords[v].mV, sizeof(F32), 3, fp);
+		llendianswizzle(&mCoords[v].mV, sizeof(F32), 3);
 		if (numRead != 3)
 		{
 			llwarns << "Can't read morph target vertex coordinates" << llendl;
 			return FALSE;
 		}
 
-		F32 magnitude = mCoords[v].getLength3().getF32();
+		F32 magnitude = mCoords[v].magVec();
 		
 		mTotalDistortion += magnitude;
-		LLVector4a t;
-		t.setAbs(mCoords[v]);
-		mAvgDistortion.add(t);
+		mAvgDistortion.mV[VX] += fabs(mCoords[v].mV[VX]);
+		mAvgDistortion.mV[VY] += fabs(mCoords[v].mV[VY]);
+		mAvgDistortion.mV[VZ] += fabs(mCoords[v].mV[VZ]);
 		
 		if (magnitude > mMaxDistortion)
 		{
 			mMaxDistortion = magnitude;
 		}
 
-		numRead = fread(&mNormals[v], sizeof(F32), 3, fp);
-		llendianswizzle(&mNormals[v], sizeof(F32), 3);
+		numRead = fread(&mNormals[v].mV, sizeof(F32), 3, fp);
+		llendianswizzle(&mNormals[v].mV, sizeof(F32), 3);
 		if (numRead != 3)
 		{
 			llwarns << "Can't read morph target normal" << llendl;
 			return FALSE;
 		}
 
-		numRead = fread(&mBinormals[v], sizeof(F32), 3, fp);
-		llendianswizzle(&mBinormals[v], sizeof(F32), 3);
+		numRead = fread(&mBinormals[v].mV, sizeof(F32), 3, fp);
+		llendianswizzle(&mBinormals[v].mV, 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.mul(1.f/(F32)mNumIndices);
-	mAvgDistortion.normalize3fast();
+	mAvgDistortion = mAvgDistortion * (1.f/(F32)mNumIndices);
+	mAvgDistortion.normVec();
 
 	return TRUE;
 }
@@ -367,9 +367,9 @@ BOOL LLPolyMorphTarget::parseData(LLXmlTreeNode* node)
 //-----------------------------------------------------------------------------
 // getVertexDistortion()
 //-----------------------------------------------------------------------------
-LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh)
+LLVector3 LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMesh *mesh)
 {
-	if (!mMorphData || mMesh != mesh) return LLVector4a::getZero();
+	if (!mMorphData || mMesh != mesh) return LLVector3::zero;
 
 	for(U32 index = 0; index < mMorphData->mNumIndices; index++)
 	{
@@ -379,17 +379,17 @@ LLVector4a LLPolyMorphTarget::getVertexDistortion(S32 requested_index, LLPolyMes
 		}
 	}
 
-	return LLVector4a::getZero();
+	return LLVector3::zero;
 }
 
 //-----------------------------------------------------------------------------
 // getFirstDistortion()
 //-----------------------------------------------------------------------------
-const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
+const LLVector3 *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh)
 {
-	if (!mMorphData) return &LLVector4a::getZero();
+	if (!mMorphData) return &LLVector3::zero;
 
-	LLVector4a* resultVec;
+	LLVector3* resultVec;
 	mMorphData->mCurrentIndex = 0;
 	if (mMorphData->mNumIndices)
 	{
@@ -411,11 +411,11 @@ const LLVector4a *LLPolyMorphTarget::getFirstDistortion(U32 *index, LLPolyMesh *
 //-----------------------------------------------------------------------------
 // getNextDistortion()
 //-----------------------------------------------------------------------------
-const LLVector4a *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
+const LLVector3 *LLPolyMorphTarget::getNextDistortion(U32 *index, LLPolyMesh **poly_mesh)
 {
-	if (!mMorphData) return &LLVector4a::getZero();
+	if (!mMorphData) return &LLVector3::zero;
 
-	LLVector4a* resultVec;
+	LLVector3* resultVec;
 	mMorphData->mCurrentIndex++;
 	if (mMorphData->mCurrentIndex < mMorphData->mNumIndices)
 	{
@@ -451,7 +451,7 @@ F32	LLPolyMorphTarget::getTotalDistortion()
 //-----------------------------------------------------------------------------
 // getAvgDistortion()
 //-----------------------------------------------------------------------------
-const LLVector4a& LLPolyMorphTarget::getAvgDistortion()	
+const LLVector3& LLPolyMorphTarget::getAvgDistortion()	
 {
 	if (mMorphData) 
 	{
@@ -459,7 +459,7 @@ const LLVector4a& LLPolyMorphTarget::getAvgDistortion()
 	}
 	else 
 	{
-		return LLVector4a::getZero();
+		return LLVector3::zero;
 	}
 }
 
@@ -481,8 +481,6 @@ F32	LLPolyMorphTarget::getMaxDistortion()
 //-----------------------------------------------------------------------------
 // apply()
 //-----------------------------------------------------------------------------
-static LLFastTimer::DeclareTimer FTM_APPLY_MORPH_TARGET("Apply Morph");
-
 void LLPolyMorphTarget::apply( ESex avatar_sex )
 {
 	if (!mMorphData || mNumMorphMasksPending > 0)
@@ -490,8 +488,6 @@ 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.
@@ -512,15 +508,15 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
 	if (delta_weight != 0.f)
 	{
 		llassert(!mMesh->isLOD());
-		LLVector4a *coords = mMesh->getWritableCoords();
+		LLVector4 *coords = mMesh->getWritableCoords();
 
-		LLVector4a *scaled_normals = mMesh->getScaledNormals();
-		LLVector4a *normals = mMesh->getWritableNormals();
+		LLVector3 *scaled_normals = mMesh->getScaledNormals();
+		LLVector4 *normals = mMesh->getWritableNormals();
 
-		LLVector4a *scaled_binormals = mMesh->getScaledBinormals();
-		LLVector4a *binormals = mMesh->getWritableBinormals();
+		LLVector3 *scaled_binormals = mMesh->getScaledBinormals();
+		LLVector3 *binormals = mMesh->getWritableBinormals();
 
-		LLVector4a *clothing_weights = mMesh->getWritableClothingWeights();
+		LLVector4 *clothing_weights = mMesh->getWritableClothingWeights();
 		LLVector2 *tex_coords = mMesh->getWritableTexCoords();
 
 		F32 *maskWeightArray = (mVertMask) ? mVertMask->getMorphMaskWeights() : NULL;
@@ -535,38 +531,31 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
 				maskWeight = maskWeightArray[vert_index_morph];
 			}
 
-
-			LLVector4a pos = mMorphData->mCoords[vert_index_morph];
-			pos.mul(delta_weight*maskWeight);
-			coords[vert_index_mesh].add(pos);
+			coords[vert_index_mesh] += LLVector4(mMorphData->mCoords[vert_index_morph] * delta_weight * maskWeight);
 
 			if (getInfo()->mIsClothingMorph && clothing_weights)
 			{
-				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;
+				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;
 			}
 
 			// calculate new normals based on half angles
-			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;
+			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);
 
 			// calculate new binormals
-			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();
-			
+			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;
+
 			tex_coords[vert_index_mesh] += mMorphData->mTexCoords[vert_index_morph] * delta_weight * maskWeight;
 		}
 
@@ -593,7 +582,7 @@ void LLPolyMorphTarget::apply( ESex avatar_sex )
 //-----------------------------------------------------------------------------
 void	LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert)
 {
-	LLVector4a *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL;
+	LLVector4 *clothing_weights = getInfo()->mIsClothingMorph ? mMesh->getWritableClothingWeights() : NULL;
 
 	if (!mVertMask)
 	{
@@ -607,47 +596,29 @@ void	LLPolyMorphTarget::applyMask(U8 *maskTextureData, S32 width, S32 height, S3
 
 		if (maskWeights)
 		{
-			LLVector4a *coords = mMesh->getWritableCoords();
-			LLVector4a *scaled_normals = mMesh->getScaledNormals();
-			LLVector4a *scaled_binormals = mMesh->getScaledBinormals();
+			LLVector4 *coords = mMesh->getWritableCoords();
+			LLVector3 *scaled_normals = mMesh->getScaledNormals();
+			LLVector3 *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
-				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);
-
+				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;
 				tex_coords[out_vert] -= mMorphData->mTexCoords[vert] * lastMaskWeight;
 
 				if (clothing_weights)
 				{
-					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);
+					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];
 				}
 			}
 		}
@@ -683,7 +654,7 @@ LLPolyVertexMask::~LLPolyVertexMask()
 //-----------------------------------------------------------------------------
 // generateMask()
 //-----------------------------------------------------------------------------
-void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4a *clothing_weights)
+void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights)
 {
 // RN debug output that uses Image Debugger (http://www.cs.unc.edu/~baxter/projects/imdebug/)
 //	BOOL debugImg = FALSE; 
@@ -727,7 +698,7 @@ void LLPolyVertexMask::generateMask(U8 *maskTextureData, S32 width, S32 height,
 
 		if (clothing_weights)
 		{
-			clothing_weights[vertIndex].getF32ptr()[VW] = mWeights[index];
+			clothing_weights[vertIndex].mV[VW] = mWeights[index];
 		}
 	}
 	mWeightsGenerated = TRUE;
diff --git a/indra/newview/llpolymorph.h b/indra/newview/llpolymorph.h
index 46e23b7792..8a024f2e9e 100644
--- a/indra/newview/llpolymorph.h
+++ b/indra/newview/llpolymorph.h
@@ -58,14 +58,14 @@ public:
 	U32					mNumIndices;
 	U32*				mVertexIndices;
 	U32					mCurrentIndex;
-	LLVector4a*			mCoords;
-	LLVector4a*			mNormals;
-	LLVector4a*			mBinormals;
+	LLVector3*			mCoords;
+	LLVector3*			mNormals;
+	LLVector3*			mBinormals;
 	LLVector2*			mTexCoords;
 
 	F32					mTotalDistortion;	// vertex distortion summed over entire morph
 	F32					mMaxDistortion;		// maximum single vertex distortion in a given morph
-	LLVector4a			mAvgDistortion;		// average vertex distortion, to infer directionality of the morph
+	LLVector3			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, LLVector4a *clothing_weights);
+	void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights);
 	F32* getMorphMaskWeights();
 
 
@@ -157,11 +157,11 @@ public:
 	
 	// LLViewerVisualParam Virtual functions
 	/*virtual*/ F32					getTotalDistortion();
-	/*virtual*/ const LLVector4a&	getAvgDistortion();
+	/*virtual*/ const LLVector3&	getAvgDistortion();
 	/*virtual*/ F32					getMaxDistortion();
-	/*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);
+	/*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);
 
 	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 92c2863ffd..1ce05da849 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_multiple"));
+		getChild<LLUICtrl>("LabelCreatorName")->setValue(getString("unknown"));
 	}
 
 	////////////////
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 78c905f6ff..325a2d3004 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -68,7 +68,6 @@ const F32 SG_OCCLUSION_FUDGE = 0.25f;
 #define assert_states_valid(x)
 #endif
 
-extern bool gShiftFrame;
 
 static U32 sZombieGroups = 0;
 U32 LLSpatialGroup::sNodeCount = 0;
@@ -530,7 +529,6 @@ void LLSpatialGroup::setVisible()
 
 void LLSpatialGroup::validate()
 {
-	ll_assert_aligned(this,64);
 #if LL_OCTREE_PARANOIA_CHECK
 
 	sg_assert(!isState(DIRTY));
@@ -543,7 +541,7 @@ void LLSpatialGroup::validate()
 
 	validateDrawMap();
 
-	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+	for (element_iter i = getData().begin(); i != getData().end(); ++i)
 	{
 		LLDrawable* drawable = *i;
 		sg_assert(drawable->getSpatialGroup() == this);
@@ -760,7 +758,7 @@ BOOL LLSpatialGroup::boundObjects(BOOL empty, LLVector4a& minOut, LLVector4a& ma
 {	
 	const OctreeNode* node = mOctreeNode;
 
-	if (node->isEmpty())
+	if (node->getData().empty())
 	{	//don't do anything if there are no objects
 		if (empty && mOctreeNode->getParent())
 		{	//only root is allowed to be empty
@@ -777,14 +775,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->getDataBegin();
+		OctreeNode::const_element_iter i = node->getData().begin();
 		LLDrawable* drawablep = *i;
 		const LLVector4a* minMax = drawablep->getSpatialExtents();
 
 		newMin = minMax[0];
 		newMax = minMax[1];
 
-		for (++i; i != node->getDataEnd(); ++i)
+		for (++i; i != node->getData().end(); ++i)
 		{
 			drawablep = *i;
 			minMax = drawablep->getSpatialExtents();
@@ -925,10 +923,7 @@ void LLSpatialGroup::shift(const LLVector4a &offset)
 	mObjectExtents[0].add(offset);
 	mObjectExtents[1].add(offset);
 
-	if (!mSpatialPartition->mRenderByGroup && 
-		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TREE &&
-		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_TERRAIN &&
-		mSpatialPartition->mPartitionType != LLViewerRegion::PARTITION_BRIDGE)
+	//if (!mSpatialPartition->mRenderByGroup)
 	{
 		setState(GEOM_DIRTY);
 		gPipeline.markRebuild(this, TRUE);
@@ -1200,8 +1195,6 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) :
 	mCurUpdatingSlotp(NULL),
 	mCurUpdatingTexture (NULL)
 {
-	ll_assert_aligned(this,16);
-	
 	sNodeCount++;
 	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);
 
@@ -1245,18 +1238,13 @@ 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 (!isEmpty())
+	if (!getData().empty())
 	{
 		mRadius = mSpatialPartition->mRenderByGroup ? mObjectBounds[1].getLength3().getF32() :
 						(F32) mOctreeNode->getSize().getLength3().getF32();
@@ -1407,7 +1395,7 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)
 	LLMemType mt(LLMemType::MTYPE_SPACE_PARTITION);
 	setState(DEAD);
 	
-	for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+	for (element_iter i = getData().begin(); i != getData().end(); ++i)
 	{
 		LLDrawable* drawable = *i;
 		if (drawable->getSpatialGroup() == this)
@@ -1494,7 +1482,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion)
 	}
 
 
-	for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+	for (LLSpatialGroup::element_iter i = getData().begin(); i != getData().end(); ++i)
 	{
 		LLDrawable* drawable = *i;
 		for (S32 j = 0; j < drawable->getNumFaces(); j++)
@@ -1850,14 +1838,12 @@ 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);
 	
@@ -2128,7 +2114,7 @@ public:
 
 	virtual void processGroup(LLSpatialGroup* group)
 	{
-		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->isEmpty())
+		llassert(!group->isState(LLSpatialGroup::DIRTY) && !group->getData().empty())
 		
 		if (mRes < 2)
 		{
@@ -2195,7 +2181,7 @@ public:
 	{
 		LLSpatialGroup::OctreeNode* branch = group->mOctreeNode;
 
-		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i)
 		{
 			LLDrawable* drawable = *i;
 			
@@ -2319,7 +2305,7 @@ public:
 		LLSpatialGroup* group = (LLSpatialGroup*) state->getListener(0);
 		group->destroyGL();
 
-		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 		{
 			LLDrawable* drawable = *i;
 			if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup)
@@ -2629,7 +2615,7 @@ void renderOctree(LLSpatialGroup* group)
 			gGL.flush();
 			glLineWidth(1.f);
 			gGL.flush();
-			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 			{
 				LLDrawable* drawable = *i;
 				if (!group->mSpatialPartition->isBridge())
@@ -2675,7 +2661,7 @@ void renderOctree(LLSpatialGroup* group)
 	}
 	else
 	{
-		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty() 
+		if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->getData().empty() 
 			&& group->mSpatialPartition->mRenderByGroup)
 		{
 			col.setVec(0.8f, 0.4f, 0.1f, 0.1f);
@@ -2743,7 +2729,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->isEmpty();
+							!group->getData().empty();
 
 	if (render_objects)
 	{
@@ -3474,7 +3460,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
 
 void renderPhysicsShapes(LLSpatialGroup* group)
 {
-	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+	for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 	{
 		LLDrawable* drawable = *i;
 		LLVOVolume* volume = drawable->getVOVolume();
@@ -3823,7 +3809,7 @@ public:
 
 		LLVector3 center, size;
 		
-		if (branch->isEmpty())
+		if (branch->getData().empty())
 		{
 			gGL.diffuseColor3f(1.f,0.2f,0.f);
 			center.set(branch->getCenter().getF32ptr());
@@ -3859,8 +3845,8 @@ public:
 			}
 
 			gGL.begin(LLRender::TRIANGLES);
-			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getDataBegin();
-					iter != branch->getDataEnd();
+			for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin();
+					iter != branch->getData().end();
 					++iter)
 			{
 				const LLVolumeTriangle* tri = *iter;
@@ -4097,7 +4083,7 @@ public:
 
 		if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_BBOXES))
 		{
-			if (!group->isEmpty())
+			if (!group->getData().empty())
 			{
 				gGL.diffuseColor3f(0,0,1);
 				drawBoxOutline(group->mObjectBounds[0],
@@ -4105,7 +4091,7 @@ public:
 			}
 		}
 
-		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i)
 		{
 			LLDrawable* drawable = *i;
 					
@@ -4191,7 +4177,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;
 								}
@@ -4294,7 +4280,7 @@ public:
 			return;
 		}
 
-		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i)
 		{
 			LLDrawable* drawable = *i;
 						
@@ -4518,7 +4504,7 @@ public:
 	
 	virtual void visit(const LLSpatialGroup::OctreeNode* branch) 
 	{	
-		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getDataBegin(); i != branch->getDataEnd(); ++i)
+		for (LLSpatialGroup::OctreeNode::const_element_iter i = branch->getData().begin(); i != branch->getData().end(); ++i)
 		{
 			check(*i);
 		}
@@ -4704,62 +4690,28 @@ 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;
+	mVisibleGroupsEnd = mVisibleGroups.begin();
 
 	mAlphaGroupsSize = 0;
-	mAlphaGroupsEnd = mAlphaGroups;
+	mAlphaGroupsEnd = mAlphaGroups.begin();
 
 	mOcclusionGroupsSize = 0;
-	mOcclusionGroupsEnd = mOcclusionGroups;
+	mOcclusionGroupsEnd = mOcclusionGroups.begin();
 
 	mDrawableGroupsSize = 0;
-	mDrawableGroupsEnd = mDrawableGroups;
+	mDrawableGroupsEnd = mDrawableGroups.begin();
 
 	mVisibleListSize = 0;
-	mVisibleListEnd = mVisibleList;
+	mVisibleListEnd = mVisibleList.begin();
 
 	mVisibleBridgeSize = 0;
-	mVisibleBridgeEnd = mVisibleBridge;
+	mVisibleBridgeEnd = mVisibleBridge.begin();
 
 
 	for (U32 i = 0; i < LLRenderPass::NUM_RENDER_TYPES; i++)
@@ -4769,176 +4721,176 @@ void LLCullResult::clear()
 			mRenderMap[i][j] = 0;
 		}
 		mRenderMapSize[i] = 0;
-		mRenderMapEnd[i] = mRenderMap[i];
+		mRenderMapEnd[i] = mRenderMap[i].begin();
 	}
 }
 
-LLCullResult::sg_iterator LLCullResult::beginVisibleGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::beginVisibleGroups()
 {
-	return mVisibleGroups;
+	return mVisibleGroups.begin();
 }
 
-LLCullResult::sg_iterator LLCullResult::endVisibleGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::endVisibleGroups()
 {
 	return mVisibleGroupsEnd;
 }
 
-LLCullResult::sg_iterator LLCullResult::beginAlphaGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::beginAlphaGroups()
 {
-	return mAlphaGroups;
+	return mAlphaGroups.begin();
 }
 
-LLCullResult::sg_iterator LLCullResult::endAlphaGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::endAlphaGroups()
 {
 	return mAlphaGroupsEnd;
 }
 
-LLCullResult::sg_iterator LLCullResult::beginOcclusionGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::beginOcclusionGroups()
 {
-	return mOcclusionGroups;
+	return mOcclusionGroups.begin();
 }
 
-LLCullResult::sg_iterator LLCullResult::endOcclusionGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::endOcclusionGroups()
 {
 	return mOcclusionGroupsEnd;
 }
 
-LLCullResult::sg_iterator LLCullResult::beginDrawableGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::beginDrawableGroups()
 {
-	return mDrawableGroups;
+	return mDrawableGroups.begin();
 }
 
-LLCullResult::sg_iterator LLCullResult::endDrawableGroups()
+LLCullResult::sg_list_t::iterator LLCullResult::endDrawableGroups()
 {
 	return mDrawableGroupsEnd;
 }
 
-LLCullResult::drawable_iterator LLCullResult::beginVisibleList()
+LLCullResult::drawable_list_t::iterator LLCullResult::beginVisibleList()
 {
-	return mVisibleList;
+	return mVisibleList.begin();
 }
 
-LLCullResult::drawable_iterator LLCullResult::endVisibleList()
+LLCullResult::drawable_list_t::iterator LLCullResult::endVisibleList()
 {
 	return mVisibleListEnd;
 }
 
-LLCullResult::bridge_iterator LLCullResult::beginVisibleBridge()
+LLCullResult::bridge_list_t::iterator LLCullResult::beginVisibleBridge()
 {
-	return mVisibleBridge;
+	return mVisibleBridge.begin();
 }
 
-LLCullResult::bridge_iterator LLCullResult::endVisibleBridge()
+LLCullResult::bridge_list_t::iterator LLCullResult::endVisibleBridge()
 {
 	return mVisibleBridgeEnd;
 }
 
-LLCullResult::drawinfo_iterator LLCullResult::beginRenderMap(U32 type)
+LLCullResult::drawinfo_list_t::iterator LLCullResult::beginRenderMap(U32 type)
 {
-	return mRenderMap[type];
+	return mRenderMap[type].begin();
 }
 
-LLCullResult::drawinfo_iterator LLCullResult::endRenderMap(U32 type)
+LLCullResult::drawinfo_list_t::iterator LLCullResult::endRenderMap(U32 type)
 {
 	return mRenderMapEnd[type];
 }
 
 void LLCullResult::pushVisibleGroup(LLSpatialGroup* group)
 {
-	if (mVisibleGroupsSize < mVisibleGroupsAllocated)
+	if (mVisibleGroupsSize < mVisibleGroups.size())
 	{
 		mVisibleGroups[mVisibleGroupsSize] = group;
 	}
 	else
 	{
-		pushBack((void**&) mVisibleGroups, mVisibleGroupsAllocated, (void*) group);
+		mVisibleGroups.push_back(group);
 	}
 	++mVisibleGroupsSize;
-	mVisibleGroupsEnd = mVisibleGroups+mVisibleGroupsSize;
+	mVisibleGroupsEnd = mVisibleGroups.begin()+mVisibleGroupsSize;
 }
 
 void LLCullResult::pushAlphaGroup(LLSpatialGroup* group)
 {
-	if (mAlphaGroupsSize < mAlphaGroupsAllocated)
+	if (mAlphaGroupsSize < mAlphaGroups.size())
 	{
 		mAlphaGroups[mAlphaGroupsSize] = group;
 	}
 	else
 	{
-		pushBack((void**&) mAlphaGroups, mAlphaGroupsAllocated, (void*) group);
+		mAlphaGroups.push_back(group);
 	}
 	++mAlphaGroupsSize;
-	mAlphaGroupsEnd = mAlphaGroups+mAlphaGroupsSize;
+	mAlphaGroupsEnd = mAlphaGroups.begin()+mAlphaGroupsSize;
 }
 
 void LLCullResult::pushOcclusionGroup(LLSpatialGroup* group)
 {
-	if (mOcclusionGroupsSize < mOcclusionGroupsAllocated)
+	if (mOcclusionGroupsSize < mOcclusionGroups.size())
 	{
 		mOcclusionGroups[mOcclusionGroupsSize] = group;
 	}
 	else
 	{
-		pushBack((void**&) mOcclusionGroups, mOcclusionGroupsAllocated, (void*) group);
+		mOcclusionGroups.push_back(group);
 	}
 	++mOcclusionGroupsSize;
-	mOcclusionGroupsEnd = mOcclusionGroups+mOcclusionGroupsSize;
+	mOcclusionGroupsEnd = mOcclusionGroups.begin()+mOcclusionGroupsSize;
 }
 
 void LLCullResult::pushDrawableGroup(LLSpatialGroup* group)
 {
-	if (mDrawableGroupsSize < mDrawableGroupsAllocated)
+	if (mDrawableGroupsSize < mDrawableGroups.size())
 	{
 		mDrawableGroups[mDrawableGroupsSize] = group;
 	}
 	else
 	{
-		pushBack((void**&) mDrawableGroups, mDrawableGroupsAllocated, (void*) group);
+		mDrawableGroups.push_back(group);
 	}
 	++mDrawableGroupsSize;
-	mDrawableGroupsEnd = mDrawableGroups+mDrawableGroupsSize;
+	mDrawableGroupsEnd = mDrawableGroups.begin()+mDrawableGroupsSize;
 }
 
 void LLCullResult::pushDrawable(LLDrawable* drawable)
 {
-	if (mVisibleListSize < mVisibleListAllocated)
+	if (mVisibleListSize < mVisibleList.size())
 	{
 		mVisibleList[mVisibleListSize] = drawable;
 	}
 	else
 	{
-		pushBack((void**&) mVisibleList, mVisibleListAllocated, (void*) drawable);
+		mVisibleList.push_back(drawable);
 	}
 	++mVisibleListSize;
-	mVisibleListEnd = mVisibleList+mVisibleListSize;
+	mVisibleListEnd = mVisibleList.begin()+mVisibleListSize;
 }
 
 void LLCullResult::pushBridge(LLSpatialBridge* bridge)
 {
-	if (mVisibleBridgeSize < mVisibleBridgeAllocated)
+	if (mVisibleBridgeSize < mVisibleBridge.size())
 	{
 		mVisibleBridge[mVisibleBridgeSize] = bridge;
 	}
 	else
 	{
-		pushBack((void**&) mVisibleBridge, mVisibleBridgeAllocated, (void*) bridge);
+		mVisibleBridge.push_back(bridge);
 	}
 	++mVisibleBridgeSize;
-	mVisibleBridgeEnd = mVisibleBridge+mVisibleBridgeSize;
+	mVisibleBridgeEnd = mVisibleBridge.begin()+mVisibleBridgeSize;
 }
 
 void LLCullResult::pushDrawInfo(U32 type, LLDrawInfo* draw_info)
 {
-	if (mRenderMapSize[type] < mRenderMapAllocated[type])
+	if (mRenderMapSize[type] < mRenderMap[type].size())
 	{
 		mRenderMap[type][mRenderMapSize[type]] = draw_info;
 	}
 	else
 	{
-		pushBack((void**&) mRenderMap[type], mRenderMapAllocated[type], (void*) draw_info);
+		mRenderMap[type].push_back(draw_info);
 	}
 	++mRenderMapSize[type];
-	mRenderMapEnd[type] = mRenderMap[type] + mRenderMapSize[type];
+	mRenderMapEnd[type] = mRenderMap[type].begin() + mRenderMapSize[type];
 }
 
 
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index f050df2b39..f0e4f15a83 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -68,16 +68,6 @@ protected:
 	~LLDrawInfo();	
 	
 public:
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 
 	LLDrawInfo(const LLDrawInfo& rhs)
 	{
@@ -116,7 +106,7 @@ public:
 	F32 mPartSize;
 	F32 mVSize;
 	LLSpatialGroup* mGroup;
-	LL_ALIGN_16(LLFace* mFace); //associated face
+	LLFace* mFace; //associated face
 	F32 mDistance;
 	U32 mDrawMode;
 
@@ -191,7 +181,7 @@ public:
 	};
 };
 
-LL_ALIGN_PREFIX(16)
+LL_ALIGN_PREFIX(64)
 class LLSpatialGroup : public LLOctreeListener<LLDrawable>
 {
 	friend class LLSpatialPartition;
@@ -203,16 +193,6 @@ public:
 		*this = rhs;
 	}
 
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	const LLSpatialGroup& operator=(const LLSpatialGroup& rhs)
 	{
 		llerrs << "Illegal operation!" << llendl;
@@ -345,13 +325,8 @@ 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);
 
@@ -395,12 +370,12 @@ public:
 		V4_COUNT = 10
 	} eV4Index;
 
-	LL_ALIGN_16(LLVector4a mBounds[2]); // bounding box (center, size) of this node and all its children (tight fit to objects)
-	LL_ALIGN_16(LLVector4a mExtents[2]); // extents (min, max) of this node and all its children
-	LL_ALIGN_16(LLVector4a mObjectExtents[2]); // extents (min, max) of objects in this node
-	LL_ALIGN_16(LLVector4a mObjectBounds[2]); // bounding box (center, size) of objects in this node
-	LL_ALIGN_16(LLVector4a mViewAngle);
-	LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);
+	LLVector4a mBounds[2]; // bounding box (center, size) of this node and all its children (tight fit to objects)
+	LLVector4a mExtents[2]; // extents (min, max) of this node and all its children
+	LLVector4a mObjectExtents[2]; // extents (min, max) of objects in this node
+	LLVector4a mObjectBounds[2]; // bounding box (center, size) of objects in this node
+	LLVector4a mViewAngle;
+	LLVector4a mLastUpdateViewAngle;
 
 	F32 mObjectBoxSize; //cached mObjectBounds[1].getLength3()
 		
@@ -567,39 +542,34 @@ class LLCullResult
 public:
 	LLCullResult();
 
-	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;
+	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;
 
 	void clear();
 	
-	sg_iterator beginVisibleGroups();
-	sg_iterator endVisibleGroups();
+	sg_list_t::iterator beginVisibleGroups();
+	sg_list_t::iterator endVisibleGroups();
 
-	sg_iterator beginAlphaGroups();
-	sg_iterator endAlphaGroups();
+	sg_list_t::iterator beginAlphaGroups();
+	sg_list_t::iterator endAlphaGroups();
 
 	bool hasOcclusionGroups() { return mOcclusionGroupsSize > 0; }
-	sg_iterator beginOcclusionGroups();
-	sg_iterator endOcclusionGroups();
+	sg_list_t::iterator beginOcclusionGroups();
+	sg_list_t::iterator endOcclusionGroups();
 
-	sg_iterator beginDrawableGroups();
-	sg_iterator endDrawableGroups();
+	sg_list_t::iterator beginDrawableGroups();
+	sg_list_t::iterator endDrawableGroups();
 
-	drawable_iterator beginVisibleList();
-	drawable_iterator endVisibleList();
+	drawable_list_t::iterator beginVisibleList();
+	drawable_list_t::iterator endVisibleList();
 
-	bridge_iterator beginVisibleBridge();
-	bridge_iterator endVisibleBridge();
+	bridge_list_t::iterator beginVisibleBridge();
+	bridge_list_t::iterator endVisibleBridge();
 
-	drawinfo_iterator beginRenderMap(U32 type);
-	drawinfo_iterator endRenderMap(U32 type);
+	drawinfo_list_t::iterator beginRenderMap(U32 type);
+	drawinfo_list_t::iterator endRenderMap(U32 type);
 
 	void pushVisibleGroup(LLSpatialGroup* group);
 	void pushAlphaGroup(LLSpatialGroup* group);
@@ -619,41 +589,28 @@ 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_iterator			mVisibleGroupsEnd;
+	sg_list_t::iterator mVisibleGroupsEnd;
 	sg_list_t			mAlphaGroups;
-	sg_iterator			mAlphaGroupsEnd;
+	sg_list_t::iterator mAlphaGroupsEnd;
 	sg_list_t			mOcclusionGroups;
-	sg_iterator			mOcclusionGroupsEnd;
+	sg_list_t::iterator	mOcclusionGroupsEnd;
 	sg_list_t			mDrawableGroups;
-	sg_iterator			mDrawableGroupsEnd;
+	sg_list_t::iterator mDrawableGroupsEnd;
 	drawable_list_t		mVisibleList;
-	drawable_iterator	mVisibleListEnd;
+	drawable_list_t::iterator mVisibleListEnd;
 	bridge_list_t		mVisibleBridge;
-	bridge_iterator		mVisibleBridgeEnd;
+	bridge_list_t::iterator mVisibleBridgeEnd;
 	drawinfo_list_t		mRenderMap[LLRenderPass::NUM_RENDER_TYPES];
-	U32					mRenderMapAllocated[LLRenderPass::NUM_RENDER_TYPES];
-	drawinfo_iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES];
-
+	drawinfo_list_t::iterator mRenderMapEnd[LLRenderPass::NUM_RENDER_TYPES];
 };
 
 
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index f64a72a616..65393cc168 100644
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -56,7 +56,6 @@
 #include "lldrawable.h"
 
 extern LLPipeline gPipeline;
-extern bool gShiftFrame;
 
 LLColor4U MAX_WATER_COLOR(0, 48, 96, 240);
 
@@ -295,7 +294,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);		// region doesn't have a valid water height yet
+		water_pos_global += LLVector3d(128.0, 128.0, DEFAULT_WATER_HEIGHT);
 		mWaterObjp->setPositionGlobal(water_pos_global);
 	}
 }
@@ -622,11 +621,6 @@ 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 a9ba2bce9c..5077c2c7e1 100644
--- a/indra/newview/llsurfacepatch.cpp
+++ b/indra/newview/llsurfacepatch.cpp
@@ -43,7 +43,6 @@
 #include "lldrawpool.h"
 #include "noise.h"
 
-extern bool gShiftFrame;
 extern U64 gFrameTime;
 extern LLPipeline gPipeline;
 
@@ -219,7 +218,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-mVObjp->getRegion()->getOriginAgent();
+	*vertex     = pos_agent;
 
 	LLVector3 rel_pos = pos_agent - mSurfacep->getOriginAgent();
 	LLVector3 tex_pos = rel_pos * (1.f/surface_stride);
@@ -367,13 +366,10 @@ void LLSurfacePatch::updateCameraDistanceRegion(const LLVector3 &pos_region)
 {
 	if (LLPipeline::sDynamicLOD)
 	{
-		if (!gShiftFrame)
-		{
-			LLVector3 dv = pos_region;
-			dv -= mCenterRegion;
-			mVisInfo.mDistance = llmax(0.f, (F32)(dv.magVec() - mRadius))/
-				llmax(LLVOSurfacePatch::sLODFactor, 0.1f);
-		}
+		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 2c0da60b48..74c22b0cdf 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 LLVector4a&	getAvgDistortion()										{ return mAvgDistortionVec; }
+	/*virtual*/ const LLVector3&	getAvgDistortion()										{ return mAvgDistortionVec; }
 	/*virtual*/ F32					getMaxDistortion()										{ return 3.f; }
-	/*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;};
+	/*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;};
 
 	// New functions
 	BOOL					render( S32 x, S32 y, S32 width, S32 height );
@@ -94,7 +94,7 @@ private:
 	LLPointer<LLImageRaw>	mStaticImageRaw;
 	BOOL					mNeedsCreateTexture;
 	BOOL					mStaticImageInvalid;
-	LLVector4a				mAvgDistortionVec;
+	LLVector3				mAvgDistortionVec;
 	F32						mCachedEffectiveWeight;
 
 public:
@@ -155,18 +155,18 @@ public:
 
 	// LLViewerVisualParam Virtual functions
 	/*virtual*/ F32					getTotalDistortion()									{ return 1.f; }
-	/*virtual*/ const LLVector4a&	getAvgDistortion()										{ return mAvgDistortionVec; }
+	/*virtual*/ const LLVector3&	getAvgDistortion()										{ return mAvgDistortionVec; }
 	/*virtual*/ F32					getMaxDistortion()										{ return 3.f; }
-	/*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;};
+	/*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;};
 
 	// New functions
 	LLColor4				getNetColor() const;
 protected:
 	virtual void onGlobalColorChanged(bool upload_bake) {}
 private:
-	LLVector4a				mAvgDistortionVec;
+	LLVector3				mAvgDistortionVec;
 };
 
 class LLTexLayerParamColorInfo : public LLViewerVisualParamInfo
diff --git a/indra/newview/llviewercamera.h b/indra/newview/llviewercamera.h
index b857c7fe89..184033de42 100644
--- a/indra/newview/llviewercamera.h
+++ b/indra/newview/llviewercamera.h
@@ -51,19 +51,9 @@ const BOOL NOT_FOR_SELECTION = FALSE;
 extern template class LLViewerCamera* LLSingleton<class LLViewerCamera>::getInstance();
 #endif
 
-LL_ALIGN_PREFIX(16)
 class LLViewerCamera : public LLCamera, public LLSingleton<LLViewerCamera>
 {
 public:
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
 
 	typedef enum
 	{
@@ -147,7 +137,6 @@ protected:
 	S16					mZoomSubregion;
 
 public:
-} LL_ALIGN_POSTFIX(16);
-
+};
 
 #endif // LL_LLVIEWERCAMERA_H
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index d58ee05fb6..9ef012ece1 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -79,7 +79,6 @@
 #include "llpostprocess.h"
 
 extern LLPointer<LLViewerTexture> gStartTexture;
-extern bool gShiftFrame;
 
 LLPointer<LLViewerTexture> gDisconnectedImagep = NULL;
 
@@ -163,11 +162,8 @@ 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?
@@ -221,11 +217,6 @@ 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)
@@ -235,7 +226,6 @@ 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();
@@ -372,7 +362,6 @@ 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.
 
@@ -602,7 +591,6 @@ 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();
@@ -610,7 +598,6 @@ 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);
@@ -620,7 +607,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		}
 
 		gPipeline.updateGL();
-		
 		stop_glerror();
 
 		S32 water_clip = 0;
@@ -952,18 +938,14 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 			stop_glerror();
 		}
 
-		{
-			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();
-				}
+		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)
@@ -1029,8 +1011,6 @@ 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..f029ae5302 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -729,10 +729,8 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_w
 				F32* vw = (F32*) vertex_weightsp.get();
 				F32* cw = (F32*) clothing_weightsp.get();	
 
-				S32 tc_size = (num_verts*2*sizeof(F32)+0xF) & ~0xF;
-				LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), tc_size);
-				S32 vw_size = (num_verts*sizeof(F32)+0xF) & ~0xF;	
-				LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), vw_size);	
+				LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), num_verts*2*sizeof(F32));
+				LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), num_verts*sizeof(F32));	
 				LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4*sizeof(F32));	
 			}
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 01a54509ef..d11e7e32c7 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5134,12 +5134,6 @@ class LLEditDelete : public view_listener_t
 	}
 };
 
-bool enable_object_return()
-{
-	return (!LLSelectMgr::getInstance()->getSelection()->isEmpty() &&
-		(gAgent.isGodlike() || can_derez(DRD_RETURN_TO_OWNER)));
-}
-
 void handle_spellcheck_replace_with_suggestion(const LLUICtrl* ctrl, const LLSD& param)
 {
 	const LLContextMenu* menu = dynamic_cast<const LLContextMenu*>(ctrl->getParent());
@@ -5212,6 +5206,12 @@ bool enable_spellcheck_add_to_ignore(const LLUICtrl* ctrl)
 	return (spellcheck_handler) && (spellcheck_handler->canAddToIgnore());
 }
 
+bool enable_object_return()
+{
+	return (!LLSelectMgr::getInstance()->getSelection()->isEmpty() &&
+		(gAgent.isGodlike() || can_derez(DRD_RETURN_TO_OWNER)));
+}
+
 bool enable_object_delete()
 {
 	bool new_value = 
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 903f4437a7..7d7d1f3047 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -134,7 +134,6 @@ 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);
@@ -3931,7 +3930,6 @@ 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 6c4e70add0..572003d2ce 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -199,7 +199,6 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mID(id),
 	mLocalID(0),
 	mTotalCRC(0),
-	mListIndex(-1),
 	mTEImages(NULL),
 	mGLName(0),
 	mbCanSelect(TRUE),
@@ -2180,8 +2179,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)
 	{
@@ -4182,7 +4181,7 @@ S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, LLHost hos
 	return retval;
 }
 
-
+//virtual
 void LLViewerObject::changeTEImage(S32 index, LLViewerTexture* new_image) 
 {
 	if(index < 0 || index >= getNumTEs())
@@ -4801,11 +4800,9 @@ void LLViewerObject::deleteParticleSource()
 // virtual
 void LLViewerObject::updateDrawable(BOOL force_damped)
 {
-	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))
+	if (mDrawable.notNull() && 
+		!mDrawable->isState(LLDrawable::ON_MOVE_LIST) &&
+		isChanged(MOVED))
 	{
 		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 05d017dee3..83e34dc6ca 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -232,8 +232,6 @@ 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; }
@@ -336,7 +334,7 @@ public:
 	/*virtual*/ S32     setTEGlow(const U8 te, const F32 glow);
 	/*virtual*/	BOOL	setMaterial(const U8 material);
 	virtual		void	setTEImage(const U8 te, LLViewerTexture *imagep); // Not derived from LLPrimitive
-	void                changeTEImage(S32 index, LLViewerTexture* new_image)  ;
+	virtual     void    changeTEImage(S32 index, LLViewerTexture* new_image)  ;
 	LLViewerTexture		*getTEImage(const U8 te) const;
 	
 	void fitFaceTexture(const U8 face);
@@ -608,9 +606,6 @@ 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 ea20950b36..28298cedf9 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -914,30 +914,21 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	LLViewerObject *objectp = NULL;	
 	
 	// Make a copy of the list in case something in idleUpdate() messes with it
-	static std::vector<LLViewerObject*> idle_list;
-
-	U32 idle_count = 0;
-		
+	std::vector<LLViewerObject*> idle_list;
+	
 	static LLFastTimer::DeclareTimer idle_copy("Idle Copy");
 
 	{
 		LLFastTimer t(idle_copy);
-		
- 		for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
+		idle_list.reserve( mActiveObjects.size() );
+
+ 		for (std::set<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin();
 			active_iter != mActiveObjects.end(); active_iter++)
 		{
 			objectp = *active_iter;
 			if (objectp)
 			{
-				if (idle_count >= idle_list.size())
-				{
-					idle_list.push_back( objectp );
-				}
-				else
-				{
-					idle_list[idle_count] = objectp;
-				}
-				++idle_count;
+				idle_list.push_back( objectp );
 			}
 			else
 			{	// There shouldn't be any NULL pointers in the list, but they have caused
@@ -947,13 +938,10 @@ 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_end; iter++)
+			iter != idle_list.end(); iter++)
 		{
 			objectp = *iter;
 			if (objectp->isAvatar())
@@ -965,17 +953,17 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world)
 	else
 	{
 		for (std::vector<LLViewerObject*>::iterator idle_iter = idle_list.begin();
-			idle_iter != idle_end; idle_iter++)
+			idle_iter != idle_list.end(); idle_iter++)
 		{
 			objectp = *idle_iter;
-			if (objectp->idleUpdate(agent, world, frame_time))
+			if (!objectp->idleUpdate(agent, world, frame_time))
 			{
-				num_active_objects++;				
+				//  If Idle Update returns false, kill object!
+				kill_list.push_back(objectp);
 			}
 			else
 			{
-				//  If Idle Update returns false, kill object!
-				kill_list.push_back(objectp);
+				num_active_objects++;
 			}
 		}
 		for (std::vector<LLViewerObject*>::iterator kill_iter = kill_list.begin();
@@ -1213,7 +1201,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
 	{
 		//llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << llendl;
 		objectp->setOnActiveList(FALSE);
-		removeFromActiveList(objectp);
+		mActiveObjects.erase(objectp);
 	}
 
 	if (objectp->isOnMap())
@@ -1390,26 +1378,6 @@ 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);
@@ -1424,29 +1392,13 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp)
 		if (active)
 		{
 			//llinfos << "Adding " << objectp->mID << " " << objectp->getPCodeString() << " to active list." << llendl;
-			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;
-				}
-			}
+			mActiveObjects.insert(objectp);
+			objectp->setOnActiveList(TRUE);
 		}
 		else
 		{
 			//llinfos << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << llendl;
-			removeFromActiveList(objectp);
+			mActiveObjects.erase(objectp);
 			objectp->setOnActiveList(FALSE);
 		}
 	}
@@ -1520,10 +1472,6 @@ 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...
@@ -1535,8 +1483,6 @@ 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)
 	{
@@ -1553,15 +1499,8 @@ void LLViewerObjectList::shiftObjects(const LLVector3 &offset)
 		}
 	}
 
-	{
-		LLFastTimer t(FTM_PIPELINE_SHIFT);
-		gPipeline.shiftObjects(offset);
-	}
-
-	{
-		LLFastTimer t(FTM_REGION_SHIFT);
-		LLWorld::getInstance()->shiftRegions(offset);
-	}
+	gPipeline.shiftObjects(offset);
+	LLWorld::getInstance()->shiftRegions(offset);
 }
 
 void LLViewerObjectList::repartitionObjects()
diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h
index 9936432a71..64925f46ae 100644
--- a/indra/newview/llviewerobjectlist.h
+++ b/indra/newview/llviewerobjectlist.h
@@ -118,9 +118,7 @@ public:
 
 	void dirtyAllObjectInventory();
 
-	void removeFromActiveList(LLViewerObject* objectp);
 	void updateActive(LLViewerObject *objectp);
-	
 	void updateAvatarVisibility();
 
 	// Selection related stuff
@@ -199,7 +197,7 @@ protected:
 	typedef std::vector<LLPointer<LLViewerObject> > vobj_list_t;
 
 	vobj_list_t mObjects;
-	std::vector<LLPointer<LLViewerObject> > mActiveObjects;
+	std::set<LLPointer<LLViewerObject> > mActiveObjects;
 
 	vobj_list_t mMapObjects;
 
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 05c7ef5381..493195aaa3 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1487,8 +1487,7 @@ void LLViewerRegion::unpackRegionHandshake()
 		// all of our terrain stuff, by
 		if (compp->getParamsReady())
 		{
-			//this line creates frame stalls on region crossing and removing it appears to have no effect
-			//getLand().dirtyAllPatches();
+			getLand().dirtyAllPatches();
 		}
 		else
 		{
diff --git a/indra/newview/llviewervisualparam.h b/indra/newview/llviewervisualparam.h
index 3bc95cbfbf..dd7751acd7 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 LLVector4a&	getAvgDistortion() = 0;
+	virtual const LLVector3&	getAvgDistortion() = 0;
 	virtual F32					getMaxDistortion() = 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;
+	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;
 	
 	// interface methods
 	F32					getDisplayOrder() const		{ return getInfo()->mEditGroupDisplayOrder; }
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index af2eec9ba8..30bb787fa7 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -4768,11 +4768,8 @@ 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 05febdf93b..33dc12c473 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -817,7 +817,6 @@ LLVOAvatar::~LLVOAvatar()
 	lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;
 
 	mRoot.removeAllChildren();
-	mJointMap.clear();
 
 	deleteAndClearArray(mSkeleton);
 	deleteAndClearArray(mCollisionVolumes);
@@ -1460,6 +1459,8 @@ 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)
@@ -1933,7 +1934,6 @@ 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("Avatar Update");
+static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Update Avatar");
 static LLFastTimer::DeclareTimer FTM_JOINT_UPDATE("Update Joints");
 
 //------------------------------------------------------------------------
@@ -2692,7 +2692,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
 
 	if (isImpostor() && !mNeedsImpostorUpdate)
 	{
-		LL_ALIGN_16(LLVector4a ext[2]);
+		LLVector4a ext[2];
 		F32 distance;
 		LLVector3 angle;
 
@@ -5137,20 +5137,7 @@ const LLUUID& LLVOAvatar::getID() const
 // RN: avatar joints are multi-rooted to include screen-based attachments
 LLJoint *LLVOAvatar::getJoint( const std::string &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;
-	}
-
+	LLJoint* jointp = mRoot.findJoint(name);
 	return jointp;
 }
 
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index f5692bb52f..6fb56a4c0b 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -93,16 +93,6 @@ protected:
  **/
 
 public:
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 	virtual void		markDead();
 	static void			initClass(); // Initialize data that's only init'd once per class.
@@ -225,7 +215,7 @@ public:
 	bool isBuilt() const { return mIsBuilt; }
 
 private: //aligned members
-	LL_ALIGN_16(LLVector4a	mImpostorExtents[2]);
+	LLVector4a	mImpostorExtents[2];
 
 private:
 	BOOL			mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients
@@ -366,10 +356,6 @@ 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..543891ca63 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -49,16 +49,6 @@ class LLVOAvatarSelf :
  **/
 
 public:
-	void* operator new(size_t size)
-	{
-		return ll_aligned_malloc_16(size);
-	}
-
-	void operator delete(void* ptr)
-	{
-		ll_aligned_free_16(ptr);
-	}
-
 	LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 	virtual 				~LLVOAvatarSelf();
 	virtual void			markDead();
diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp
index 5ad9ccc9af..44968342bf 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->getDataBegin(); i != group->getDataEnd(); ++i)
+	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 	{
 		LLDrawable* drawablep = *i;
 		
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 9cce68fff6..e21358b65a 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -52,7 +52,8 @@ LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;
 S32 LLVOPartGroup::sVBSlotFree[];
 S32* LLVOPartGroup::sVBSlotCursor = NULL;
 
-void LLVOPartGroup::initClass()
+//static
+void LLVOPartGroup::restoreGL()
 {
 	for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)
 	{
@@ -60,11 +61,7 @@ void LLVOPartGroup::initClass()
 	}
 
 	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);
@@ -557,7 +554,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co
 	mFaceList.clear();
 
 	LLViewerCamera* camera = LLViewerCamera::getInstance();
-	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 	{
 		LLDrawable* drawablep = *i;
 		
@@ -629,7 +626,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
 		LLFace* facep = *i;
 		LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
 
-		if (!facep->isState(LLFace::PARTICLE))
+		if (facep->getIndicesStart() == 0xFFFFFFFF)
 		{ //set the indices of this face
 			S32 idx = LLVOPartGroup::findAvailableVBSlot();
 			if (idx >= 0)
@@ -638,7 +635,6 @@ 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 43b2844f07..6160bceb24 100644
--- a/indra/newview/llvopartgroup.h
+++ b/indra/newview/llvopartgroup.h
@@ -45,7 +45,6 @@ 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 337ddfb24d..3556bde9a8 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 = getPositionRegion();
+		const LLVector3 &this_position = getPositionAgent();
 		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_region = getPositionRegion();
+	const LLVector3 &pos_agent = getPositionAgent();
 	//gGL.translatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f);
 	LLMatrix4 trans_mat;
-	trans_mat.setTranslation(pos_region.mV[VX], pos_region.mV[VY], pos_region.mV[VZ] - 0.1f);
+	trans_mat.setTranslation(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.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 a656179c8f..0abe73d55e 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())
 	{
@@ -1842,6 +1842,18 @@ void LLVOVolume::setNumTEs(const U8 num_tes)
 	return ;
 }
 
+//virtual     
+void LLVOVolume::changeTEImage(S32 index, LLViewerTexture* imagep)
+{
+	BOOL changed = (mTEImages[index] != imagep);
+	LLViewerObject::changeTEImage(index, imagep);
+	if (changed)
+	{
+		gPipeline.markTextured(mDrawable);
+		mFaceMappingChanged = TRUE;
+	}
+}
+
 void LLVOVolume::setTEImage(const U8 te, LLViewerTexture *imagep)
 {
 	BOOL changed = (mTEImages[te] != imagep);
@@ -4239,7 +4251,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->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
+		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
 		{
 			LLDrawable* drawablep = *drawable_iter;
 		
@@ -4645,7 +4657,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 	if (!LLPipeline::sDelayVBUpdate)
 	{
 		//drawables have been rebuilt, clear rebuild status
-		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
+		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
 		{
 			LLDrawable* drawablep = *drawable_iter;
 			drawablep->clearState(LLDrawable::REBUILD_ALL);
@@ -4685,7 +4697,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 		
 		std::set<LLVertexBuffer*> mapped_buffers;
 
-		for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
+		for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
 		{
 			LLDrawable* drawablep = *drawable_iter;
 
@@ -4709,14 +4721,8 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
 						if (buff)
 						{
 							llassert(!face->isState(LLFace::RIGGED));
-
-							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);
-							}
-
+							face->getGeometryVolume(*volume, face->getTEOffset(), 
+								vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), face->getGeomIndex());
 
 							if (buff->isLocked())
 							{
@@ -4753,7 +4759,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->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
+			for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
 			{
 				LLDrawable* drawablep = *drawable_iter;
 				for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
@@ -5050,11 +5056,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
 
 					llassert(!facep->isState(LLFace::RIGGED));
 
-					if (!facep->getGeometryVolume(*volume, te_idx, 
-						vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true))
-					{
-						llwarns << "Failed to get geometry for face!" << llendl;
-					}
+					facep->getGeometryVolume(*volume, te_idx, 
+						vobj->getRelativeXform(), vobj->getRelativeXformInvTrans(), index_offset,true);
 
 					if (drawablep->isState(LLDrawable::ANIMATED_CHILD))
 					{
@@ -5224,7 +5227,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun
 
 	//for each drawable
 
-	for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
+	for (LLSpatialGroup::element_iter drawable_iter = group->getData().begin(); drawable_iter != group->getData().end(); ++drawable_iter)
 	{
 		LLDrawable* drawablep = *drawable_iter;
 		
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 8cb69930be..25fe085421 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 void doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) = 0;
+	virtual BOOL 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;
@@ -174,6 +174,7 @@ public:
 
 	/*virtual*/ void	setScale(const LLVector3 &scale, BOOL damped);
 
+	/*virtual*/ void    changeTEImage(S32 index, LLViewerTexture* new_image)  ;
 	/*virtual*/ void	setNumTEs(const U8 num_tes);
 	/*virtual*/ void	setTEImage(const U8 te, LLViewerTexture *imagep);
 	/*virtual*/ S32		setTETexture(const U8 te, const LLUUID &uuid);
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 78ee3e4fd9..b061c90d98 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -657,10 +657,7 @@ void LLWorld::updateRegions(F32 max_update_time)
 		if (did_one && max_time <= 0.f)
 			break;
 		max_time = llmin(max_time, max_update_time*.1f);
-		if (regionp->idleUpdate(max_update_time))
-		{
-			did_one = TRUE;
-		}
+		did_one |= regionp->idleUpdate(max_update_time);
 	}
 }
 
@@ -840,9 +837,6 @@ 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)
@@ -851,12 +845,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 + water_height));
+													 256.f+DEFAULT_WATER_HEIGHT));
 				waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));
 				gPipeline.createObject(waterp);
 				mHoleWaterObjects.push_back(waterp);
@@ -913,7 +907,7 @@ void LLWorld::updateWaterObjects()
 		}
 
 		waterp->setRegion(gAgent.getRegion());
-		LLVector3d water_pos(water_center_x, water_center_y, 256.f + water_height) ;
+		LLVector3d water_pos(water_center_x, water_center_y, 256.f+DEFAULT_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 7140515e46..f01626c0fc 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -120,8 +120,6 @@
 //#define DEBUG_INDICES
 #endif
 
-bool gShiftFrame = false;
-
 //cached settings
 BOOL LLPipeline::RenderAvatarVP;
 BOOL LLPipeline::VertexShaderEnable;
@@ -219,7 +217,7 @@ BOOL	gDebugPipeline = FALSE;
 LLPipeline gPipeline;
 const LLMatrix4* gGLLastMatrix = NULL;
 
-LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Render Geometry");
+LLFastTimer::DeclareTimer FTM_RENDER_GEOMETRY("Geometry");
 LLFastTimer::DeclareTimer FTM_RENDER_GRASS("Grass");
 LLFastTimer::DeclareTimer FTM_RENDER_INVISIBLE("Invisible");
 LLFastTimer::DeclareTimer FTM_RENDER_OCCLUSION("Occlusion");
@@ -236,13 +234,8 @@ 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");
@@ -1378,7 +1371,7 @@ public:
 	{
 		LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0);
 
-		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->isEmpty())
+		if (!group->isState(LLSpatialGroup::GEOM_DIRTY) && !group->getData().empty())
 		{
 			for (LLSpatialGroup::draw_map_t::iterator i = group->mDrawMap.begin(); i != group->mDrawMap.end(); ++i)
 			{
@@ -1687,7 +1680,7 @@ U32 LLPipeline::addObject(LLViewerObject *vobj)
 
 void LLPipeline::createObjects(F32 max_dtime)
 {
-	LLFastTimer ftm(FTM_PIPELINE_CREATE);
+	LLFastTimer ftm(FTM_GEO_UPDATE);
 	LLMemType mt(LLMemType::MTYPE_PIPELINE_CREATE_OBJECTS);
 
 	LLTimer update_timer;
@@ -1983,7 +1976,7 @@ void LLPipeline::clearReferences()
 
 void check_references(LLSpatialGroup* group, LLDrawable* drawable)
 {
-	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 	{
 		if (drawable == *i)
 		{
@@ -2005,7 +1998,7 @@ void check_references(LLDrawable* drawable, LLFace* face)
 
 void check_references(LLSpatialGroup* group, LLFace* face)
 {
-	for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+	for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 	{
 		LLDrawable* drawable = *i;
 		check_references(drawable, face);
@@ -2017,25 +2010,25 @@ void LLPipeline::checkReferences(LLFace* face)
 #if 0
 	if (sCull)
 	{
-		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, face);
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, face);
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, face);
 		}
 
-		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
+		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
 		{
 			LLDrawable* drawable = *iter;
 			check_references(drawable, face);	
@@ -2049,25 +2042,25 @@ void LLPipeline::checkReferences(LLDrawable* drawable)
 #if 0
 	if (sCull)
 	{
-		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, drawable);
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, drawable);
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, drawable);
 		}
 
-		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
+		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList(); iter != sCull->endVisibleList(); ++iter)
 		{
 			if (drawable == *iter)
 			{
@@ -2100,19 +2093,19 @@ void LLPipeline::checkReferences(LLDrawInfo* draw_info)
 #if 0
 	if (sCull)
 	{
-		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, draw_info);
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, draw_info);
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			check_references(group, draw_info);
@@ -2126,7 +2119,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)
 #if 0
 	if (sCull)
 	{
-		for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
 		{
 			if (group == *iter)
 			{
@@ -2134,7 +2127,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)
 			}
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginAlphaGroups(); iter != sCull->endAlphaGroups(); ++iter)
 		{
 			if (group == *iter)
 			{
@@ -2142,7 +2135,7 @@ void LLPipeline::checkReferences(LLSpatialGroup* group)
 			}
 		}
 
-		for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
 		{
 			if (group == *iter)
 			{
@@ -2298,7 +2291,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
 		bound_shader = true;
 		gOcclusionCubeProgram.bind();
 	}
-
+	
 	if (sUseOcclusion > 1)
 	{
 		if (mCubeVB.isNull())
@@ -2381,7 +2374,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
 
 void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera)
 {
-	if (group->isEmpty())
+	if (group->getData().empty())
 	{ 
 		return;
 	}
@@ -2476,7 +2469,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)
 			{
 				gOcclusionCubeProgram.bind();
 			}
-			}
+		}
 
 		if (mCubeVB.isNull())
 		{ //cube VB will be used for issuing occlusion queries
@@ -2484,7 +2477,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)
 		}
 		mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
 
-		for (LLCullResult::sg_iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)
+		for (LLCullResult::sg_list_t::iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)
 		{
 			LLSpatialGroup* group = *iter;
 			group->doOcclusion(&camera);
@@ -2520,24 +2513,14 @@ 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())
 	{
-		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();
-	}
+		LLGLUpdate* glu = LLGLUpdate::sGLQ.front();
+		glu->updateGL();
+		glu->mInQ = FALSE;
+		LLGLUpdate::sGLQ.pop_front();
 	}
 
 	{ //seed VBO Pools
@@ -2546,13 +2529,11 @@ 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();
@@ -2571,9 +2552,7 @@ void LLPipeline::rebuildPriorityGroups()
 	mGroupQ1Locked = false;
 
 }
-
-static LLFastTimer::DeclareTimer FTM_REBUILD_GROUPS("Rebuild Groups");
-
+		
 void LLPipeline::rebuildGroups()
 {
 	if (mGroupQ2.empty())
@@ -2581,7 +2560,6 @@ 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();
@@ -2825,10 +2803,6 @@ 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);
@@ -2841,46 +2815,35 @@ 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++)
 	{
-		LLFastTimer t(FTM_SHIFT_DRAWABLE);
-
-		for (LLDrawable::drawable_vector_t::iterator iter = mShiftList.begin();
-			 iter != mShiftList.end(); iter++)
+		LLDrawable *drawablep = *iter;
+		if (drawablep->isDead())
 		{
-			LLDrawable *drawablep = *iter;
-			if (drawablep->isDead())
-			{
-				continue;
-			}	
-			drawablep->shiftPos(offseta);	
-			drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
-		}
-		mShiftList.resize(0);
+			continue;
+		}	
+		drawablep->shiftPos(offseta);	
+		drawablep->clearState(LLDrawable::ON_SHIFT_LIST);
 	}
+	mShiftList.resize(0);
 
-	
+	for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); 
+			iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
 	{
-		LLFastTimer t(FTM_SHIFT_OCTREE);
-		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++)
 		{
-			LLViewerRegion* region = *iter;
-			for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
+			LLSpatialPartition* part = region->getSpatialPartition(i);
+			if (part)
 			{
-				LLSpatialPartition* part = region->getSpatialPartition(i);
-				if (part)
-				{
-					part->shift(offseta);
-				}
+				part->shift(offseta);
 			}
 		}
 	}
 
-	{
-		LLFastTimer t(FTM_SHIFT_HUD);
-		LLHUDText::shiftAll(offset);
-		LLHUDNameTag::shiftAll(offset);
-	}
+	LLHUDText::shiftAll(offset);
+	LLHUDNameTag::shiftAll(offset);
 	display_update_camera();
 }
 
@@ -2913,10 +2876,8 @@ 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;
@@ -3032,7 +2993,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 	//LLVertexBuffer::unbind();
 
 	grabReferences(result);
-	for (LLCullResult::sg_iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
+	for (LLCullResult::sg_list_t::iterator iter = sCull->beginDrawableGroups(); iter != sCull->endDrawableGroups(); ++iter)
 	{
 		LLSpatialGroup* group = *iter;
 		group->checkOcclusion();
@@ -3043,7 +3004,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 		else
 		{
 			group->setVisible();
-			for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+			for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 			{
 				markVisible(*i, camera);
 			}
@@ -3058,9 +3019,9 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 	if (LLViewerCamera::sCurCameraID == LLViewerCamera::CAMERA_WORLD)
 	{
 		LLSpatialGroup* last_group = NULL;
-		for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
+		for (LLCullResult::bridge_list_t::iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
 		{
-			LLCullResult::bridge_iterator cur_iter = i;
+			LLCullResult::bridge_list_t::iterator cur_iter = i;
 			LLSpatialBridge* bridge = *cur_iter;
 			LLSpatialGroup* group = bridge->getSpatialGroup();
 
@@ -3090,7 +3051,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 		}
 	}
 
-	for (LLCullResult::sg_iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
+	for (LLCullResult::sg_list_t::iterator iter = sCull->beginVisibleGroups(); iter != sCull->endVisibleGroups(); ++iter)
 	{
 		LLSpatialGroup* group = *iter;
 		group->checkOcclusion();
@@ -3112,7 +3073,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 	
 	{
 		LLFastTimer ftm(FTM_STATESORT_DRAWABLE);
-		for (LLCullResult::drawable_iterator iter = sCull->beginVisibleList();
+		for (LLCullResult::drawable_list_t::iterator iter = sCull->beginVisibleList();
 			 iter != sCull->endVisibleList(); ++iter)
 		{
 			LLDrawable *drawablep = *iter;
@@ -3131,7 +3092,7 @@ void LLPipeline::stateSort(LLSpatialGroup* group, LLCamera& camera)
 	LLMemType mt(LLMemType::MTYPE_PIPELINE_STATE_SORT);
 	if (group->changeLOD())
 	{
-		for (LLSpatialGroup::element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i)
+		for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i)
 		{
 			LLDrawable* drawablep = *i;
 			stateSort(drawablep, camera);
@@ -3248,13 +3209,13 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera)
 }
 
 
-void forAllDrawables(LLCullResult::sg_iterator begin, 
-					 LLCullResult::sg_iterator end,
+void forAllDrawables(LLCullResult::sg_list_t::iterator begin, 
+					 LLCullResult::sg_list_t::iterator end,
 					 void (*func)(LLDrawable*))
 {
-	for (LLCullResult::sg_iterator i = begin; i != end; ++i)
+	for (LLCullResult::sg_list_t::iterator i = begin; i != end; ++i)
 	{
-		for (LLSpatialGroup::element_iter j = (*i)->getDataBegin(); j != (*i)->getDataEnd(); ++j)
+		for (LLSpatialGroup::element_iter j = (*i)->getData().begin(); j != (*i)->getData().end(); ++j)
 		{
 			func(*j);	
 		}
@@ -3321,11 +3282,11 @@ void renderScriptedTouchBeacons(LLDrawable* drawablep)
 				if (facep)
 				{
 					gPipeline.mHighlightFaces.push_back(facep);
-				}
 			}
 		}
 	}
 }
+}
 
 void renderPhysicalBeacons(LLDrawable* drawablep)
 {
@@ -3350,11 +3311,11 @@ void renderPhysicalBeacons(LLDrawable* drawablep)
 				if (facep)
 				{
 					gPipeline.mHighlightFaces.push_back(facep);
-				}
 			}
 		}
 	}
 }
+}
 
 void renderMOAPBeacons(LLDrawable* drawablep)
 {
@@ -3390,11 +3351,11 @@ void renderMOAPBeacons(LLDrawable* drawablep)
 				if (facep)
 				{
 					gPipeline.mHighlightFaces.push_back(facep);
-				}
 			}
 		}
 	}
 }
+}
 
 void renderParticleBeacons(LLDrawable* drawablep)
 {
@@ -3419,11 +3380,11 @@ void renderParticleBeacons(LLDrawable* drawablep)
 				if (facep)
 				{
 					gPipeline.mHighlightFaces.push_back(facep);
-				}
 			}
 		}
 	}
 }
+}
 
 void renderSoundHighlights(LLDrawable* drawablep)
 {
@@ -3441,11 +3402,11 @@ void renderSoundHighlights(LLDrawable* drawablep)
 				if (facep)
 				{
 					gPipeline.mHighlightFaces.push_back(facep);
-				}
 			}
 		}
 	}
 }
+}
 
 void LLPipeline::postSort(LLCamera& camera)
 {
@@ -3456,7 +3417,7 @@ void LLPipeline::postSort(LLCamera& camera)
 
 	llpushcallstacks ;
 	//rebuild drawable geometry
-	for (LLCullResult::sg_iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i)
+	for (LLCullResult::sg_list_t::iterator i = sCull->beginDrawableGroups(); i != sCull->endDrawableGroups(); ++i)
 	{
 		LLSpatialGroup* group = *i;
 		if (!sUseOcclusion || 
@@ -3474,7 +3435,7 @@ void LLPipeline::postSort(LLCamera& camera)
 
 
 	//build render map
-	for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
+	for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
 	{
 		LLSpatialGroup* group = *i;
 		if (sUseOcclusion && 
@@ -3658,7 +3619,7 @@ void LLPipeline::postSort(LLCamera& camera)
 						if (facep)
 						{
 							gPipeline.mSelectedFaces.push_back(facep);
-						}
+					}
 					}
 					return true;
 				}
@@ -4177,7 +4138,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 	LLMemType mt_rgd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_DEFFERRED);
 	LLFastTimer t(FTM_RENDER_GEOMETRY);
 
-	LLFastTimer t2(FTM_DEFERRED_POOLS);
+	LLFastTimer t2(FTM_POOLS);
 
 	LLGLEnable cull(GL_CULL_FACE);
 
@@ -4219,7 +4180,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 		pool_set_t::iterator iter2 = iter1;
 		if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)
 		{
-			LLFastTimer t(FTM_DEFERRED_POOLRENDER);
+			LLFastTimer t(FTM_POOLRENDER);
 
 			gGLLastMatrix = NULL;
 			gGL.loadMatrix(gGLModelView);
@@ -4272,7 +4233,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
 void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
 {
 	LLMemType mt_rgpd(LLMemType::MTYPE_PIPELINE_RENDER_GEOM_POST_DEF);
-	LLFastTimer t(FTM_POST_DEFERRED_POOLS);
+	LLFastTimer t(FTM_POOLS);
 	U32 cur_type = 0;
 
 	LLGLEnable cull(GL_CULL_FACE);
@@ -4306,7 +4267,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
 		pool_set_t::iterator iter2 = iter1;
 		if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0)
 		{
-			LLFastTimer t(FTM_POST_DEFERRED_POOLRENDER);
+			LLFastTimer t(FTM_POOLRENDER);
 
 			gGLLastMatrix = NULL;
 			gGL.loadMatrix(gGLModelView);
@@ -4496,7 +4457,7 @@ void LLPipeline::renderPhysicsDisplay()
 		}
 	}
 
-	for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
+	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
 	{
 		LLSpatialBridge* bridge = *i;
 		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
@@ -4918,7 +4879,7 @@ void LLPipeline::renderDebug()
 		}
 	}
 
-	for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
+	for (LLCullResult::bridge_list_t::const_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i)
 	{
 		LLSpatialBridge* bridge = *i;
 		if (!bridge->isDead() && hasRenderType(bridge->mDrawableType))
@@ -5170,11 +5131,8 @@ 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();
@@ -6733,16 +6691,13 @@ 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;
@@ -9167,8 +9122,6 @@ void LLPipeline::generateHighlight(LLCamera& camera)
 }
 
 
-static LLFastTimer::DeclareTimer FTM_GEN_SUN_SHADOW("Gen Sun Shadow");
-
 void LLPipeline::generateSunShadow(LLCamera& camera)
 {
 	if (!sRenderDeferred || RenderShadowDetail <= 0)
@@ -9176,8 +9129,6 @@ 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)
 	{
@@ -9927,7 +9878,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 
 void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture)
 {
-	for (LLCullResult::sg_iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
+	for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)
 	{
 		LLSpatialGroup* group = *i;
 		if (!group->isDead() &&
@@ -9940,12 +9891,6 @@ 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);
@@ -10001,115 +9946,102 @@ 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)
 	{
-		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)
+		LLViewerJointAttachment *attachment = iter->second;
+		for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+			 attachment_iter != attachment->mAttachedObjects.end();
+			 ++attachment_iter)
 		{
-			LLViewerJointAttachment *attachment = iter->second;
-			for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
-				 attachment_iter != attachment->mAttachedObjects.end();
-				 ++attachment_iter)
+			if (LLViewerObject* attached_object = (*attachment_iter))
 			{
-				if (LLViewerObject* attached_object = (*attachment_iter))
-				{
-					markVisible(attached_object->mDrawable->getSpatialBridge(), *viewer_camera);
-				}
+				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());
 
-		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 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 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);
+	// get the number of pixels per angle
+	F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView());
 
-		if (!avatar->mImpostor.isComplete())
-		{
-			LLFastTimer t(FTM_IMPOSTOR_ALLOCATE);
-			avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE);
+	//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);
 
-			if (LLPipeline::sRenderDeferred)
-			{
-				addDeferredAttachments(avatar->mImpostor);
-			}
+	if (!avatar->mImpostor.isComplete() || resX != avatar->mImpostor.getWidth() ||
+		resY != avatar->mImpostor.getHeight())
+	{
+		avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE);
 		
-			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())
+		if (LLPipeline::sRenderDeferred)
 		{
-			LLFastTimer t(FTM_IMPOSTOR_RESIZE);
-			avatar->mImpostor.resize(resX,resY,GL_RGBA);
+			addDeferredAttachments(avatar->mImpostor);
 		}
-
-		avatar->mImpostor.bindTarget();
+		
+		gGL.getTexUnit(0)->bind(&avatar->mImpostor);
+		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 	}
 
+	avatar->mImpostor.bindTarget();
+
 	if (LLPipeline::sRenderDeferred)
 	{
 		avatar->mImpostor.clear();
@@ -10125,7 +10057,6 @@ 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;
@@ -10211,22 +10142,22 @@ BOOL LLPipeline::hasRenderBatches(const U32 type) const
 	return sCull->getRenderMapSize(type) > 0;
 }
 
-LLCullResult::drawinfo_iterator LLPipeline::beginRenderMap(U32 type)
+LLCullResult::drawinfo_list_t::iterator LLPipeline::beginRenderMap(U32 type)
 {
 	return sCull->beginRenderMap(type);
 }
 
-LLCullResult::drawinfo_iterator LLPipeline::endRenderMap(U32 type)
+LLCullResult::drawinfo_list_t::iterator LLPipeline::endRenderMap(U32 type)
 {
 	return sCull->endRenderMap(type);
 }
 
-LLCullResult::sg_iterator LLPipeline::beginAlphaGroups()
+LLCullResult::sg_list_t::iterator LLPipeline::beginAlphaGroups()
 {
 	return sCull->beginAlphaGroups();
 }
 
-LLCullResult::sg_iterator LLPipeline::endAlphaGroups()
+LLCullResult::sg_list_t::iterator LLPipeline::endAlphaGroups()
 {
 	return sCull->endAlphaGroups();
 }
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 368be1c14d..ef1fd3279d 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_iterator beginRenderMap(U32 type);
-	LLCullResult::drawinfo_iterator endRenderMap(U32 type);
-	LLCullResult::sg_iterator beginAlphaGroups();
-	LLCullResult::sg_iterator endAlphaGroups();
+	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();
 	
 
 	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 c4c4defab9..856f91e214 100644
--- a/indra/newview/skins/default/xui/de/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/de/menu_viewer.xml
@@ -21,6 +21,7 @@
 			<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 2e29c61cb2..6021ba0a5a 100644
--- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
+++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml
@@ -134,16 +134,6 @@
      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 ae5278b7ec..c785cee856 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -7569,18 +7569,6 @@ You locally updated a [RESOLUTION] baked texture for '[BODYREGION]' after [TIME]
    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="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"
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 c5dfb703e5..54a312bd59 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
@@ -11,10 +11,6 @@
 		 name="unknown">
         (unknown)
 	</panel.string>
-    <panel.string
-         name="unknown_multiple">
-        (unknown / multiple)
-    </panel.string>
 	<panel.string
 		 name="public">
         (public)
diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
index e9a787cef0..e69a17e037 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
@@ -1,36 +1,36 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
-    height="570"
-    layout="topleft"
-    name="object properties"
-    help_topic="object_properties"
-    title="Object Profile"
-    width="333">
-  <panel.string
-      name="text deed continued">
-    Deed
-  </panel.string>
-  <panel.string
-      name="text deed">
-    Deed
-  </panel.string>
-  <panel.string
-      name="text modify info 1">
-    You can modify this object
-  </panel.string>
-  <panel.string
-      name="text modify info 2">
-    You can modify these objects
-  </panel.string>
-  <panel.string
-      name="text modify info 3">
-    You can't modify this object
-  </panel.string>
-  <panel.string
-      name="text modify info 4">
-    You can't modify these objects
-  </panel.string>
-  <panel.string
+	 height="570"
+	 layout="topleft"
+	 name="object properties"
+	 help_topic="object_properties"
+	 title="Object Profile"
+	 width="333">
+	 <panel.string
+	  name="text deed continued">
+		Deed
+	 </panel.string>
+	<panel.string
+	 name="text deed">
+		Deed
+	</panel.string>
+            <panel.string
+             name="text modify info 1">
+                You can modify this object
+            </panel.string>
+            <panel.string
+             name="text modify info 2">
+                You can modify these objects
+            </panel.string>
+            <panel.string
+             name="text modify info 3">
+                You can't modify this object
+            </panel.string>
+            <panel.string
+             name="text modify info 4">
+                You can't modify these objects
+            </panel.string>
+            <panel.string
       name="text modify info 5">
     You can't modify this object across a region boundary
   </panel.string>
@@ -39,399 +39,399 @@
     You can't modify these objects across a region boundary
   </panel.string>
   <panel.string
-      name="text modify warning">
-    This object has linked parts
-  </panel.string>
-  <panel.string
-      name="Cost Default">
-    Price: L$
-  </panel.string>
-  <panel.string
-      name="Cost Total">
-    Total Price: L$
-  </panel.string>
-  <panel.string
-      name="Cost Per Unit">
-    Price Per: L$
-  </panel.string>
-  <panel.string
-      name="Cost Mixed">
-    Mixed Price
-  </panel.string>
-  <panel.string
-      name="Sale Mixed">
-    Mixed Sale
-  </panel.string>
-  <button
-      follows="top|left"
-      height="24"
-      image_hover_unselected="BackButton_Over"
-      image_pressed="BackButton_Press"
-      image_unselected="BackButton_Off"
-      layout="topleft"
-      left="8"
-      name="back_btn"
-      tab_stop="false"
-      top="0"
-      width="30"
-      use_draw_context_alpha="false" />
-  <text
-      follows="top|left|right"
-      font="SansSerifHuge"
-      height="26"
-      layout="topleft"
-      left_pad="10"
-      name="title"
-      text_color="LtGray"
-      top="0"
-      use_ellipses="true"
-      value="Object Profile"
-      width="290" />
-  <text
-      follows="top|left"
-      height="13"
-      layout="topleft"
-      left="45"
-      name="where"
-      text_color="LtGray_50"
-      value="(Inworld)"
-      width="150" />
-  <panel
-      follows="all"
-      height="490"
-      label=""
-      layout="topleft"
-      left="10"
-      help_topic=""
-      name="properties_panel"
-      top="45"
-      width="313"
-      background_visible="true"
-      bg_alpha_color="DkGray2">
-    <text
-        type="string"
-        length="1"
-        follows="left|top"
-        height="10"
-        layout="topleft"
-        left="5"
-        name="Name:"
-        top="10"
-        width="78">
-      Name:
-    </text>
-    <line_editor
-        border_style="line"
-        border_thickness="1"
-        follows="left|top|right"
-        height="20"
-        layout="topleft"
-        left_delta="78"
-        max_length_bytes="63"
-        name="Object Name"
-        top_delta="0"
-        width="225" />
-    <text
-        type="string"
-        length="1"
-        follows="left|top"
-        height="10"
-        layout="topleft"
-        left="5"
-        name="Description:"
-        top_pad="10"
-        width="78">
-      Description:
-    </text>
-    <line_editor
-        border_style="line"
-        border_thickness="1"
-        follows="left|top|right"
-        height="23"
-        layout="topleft"
-        name="Object Description"
-        select_on_focus="true"
-        left_delta="78"
-        max_length_bytes="127"
-        top_delta="-5"
-        width="225"/>
-    <text
-        type="string"
-        length="1"
-        follows="left|top"
-        height="23"
-        layout="topleft"
-        left="5"
-        name="CreatorNameLabel"
-        top_pad="12"
-        width="78">
-      Creator:
-    </text>
-    <text
-        type="string"
-        follows="left|right|top"
-        font="SansSerifSmall"
-        height="15"
-        layout="topleft"
-        left_pad="0"
-        name="Creator Name"
-        top_delta="0"
-        translate="false"
-        use_ellipses="true" 
-        width="225">
-      TestString PleaseIgnore
-    </text>
-    <text
-        type="string"
-        length="1"
-        follows="left|top"
-        height="23"
-        layout="topleft"
-        left="5"
-        name="Owner:"
-        top_pad="15"
-        width="78">
-      Owner:
-    </text>
-    <text
-        type="string"
-        follows="left|right|top"
-        font="SansSerifSmall"
-        height="15"
-        layout="topleft"
-        left_pad="0"
-        name="Owner Name"
-        top_delta="0"
-        translate="false"
-        use_ellipses="true" 
-        width="225">
-      TestString PleaseIgnore
-    </text>
-    <text
-        type="string"
-        length="1"
-        follows="left|top"
-        height="23"
-        layout="topleft"
-        left="5"
-        name="Group_label"
-        top_pad="15"
-        width="78">
-      Group:
-    </text>
+             name="text modify warning">
+                This object has linked parts
+            </panel.string>
+            <panel.string
+             name="Cost Default">
+                Price: L$
+            </panel.string>
+            <panel.string
+             name="Cost Total">
+                Total Price: L$
+            </panel.string>
+            <panel.string
+             name="Cost Per Unit">
+                Price Per: L$
+            </panel.string>
+            <panel.string
+             name="Cost Mixed">
+                Mixed Price
+            </panel.string>
+            <panel.string
+             name="Sale Mixed">
+                Mixed Sale
+            </panel.string>
     <button
-        follows="top|left"
-        height="10"
-        image_disabled="Activate_Checkmark"
-        image_selected="Activate_Checkmark"
-        image_unselected="Activate_Checkmark"
-        image_color="White_50"
-        layout="topleft"
-        left_pad="0"
-        top_delta="0"
-        name="button set group"
-        tab_stop="false"
-        tool_tip="Choose a group to share this object's permissions"
-        width="10" />
-    <name_box
-        follows="left|top"
-        height="18"
-        initial_value="Loading..."
-        layout="topleft"
-        left_pad="5"
-        top_delta="-1"
-        name="Group Name Proxy"
-        width="150" />
-    <button
-        follows="top|left"
-        height="23"
-        label="Deed"
-        label_selected="Deed"
-        layout="topleft"
-        name="button deed"
-        top_pad="0"
-        left="81"
-        tool_tip="Deeding gives this item away with next owner permissions. Group shared objects can be deeded by a group officer."
-        width="100" />
-    <text
-        type="string"
-        length="1"
-        follows="left|top"
-        height="9"
-        layout="topleft"
-        top_pad="5"
-        left="5"
-        name="label click action"
-        width="280">
-      Click to:
-    </text>
-    <combo_box
-        follows="left|top"
-        height="23"
-        layout="topleft"
-        name="clickaction"
-        width="168"
-        left="81">
-      <combo_box.item
-          label="Touch  (default)"
-          name="Touch/grab(default)"
+     follows="top|left"
+     height="24"
+     image_hover_unselected="BackButton_Over"
+     image_pressed="BackButton_Press"
+     image_unselected="BackButton_Off"
+     layout="topleft"
+     left="8"
+     name="back_btn"
+     tab_stop="false"
+     top="0"
+     width="30"
+     use_draw_context_alpha="false" />
+        <text
+     follows="top|left|right"
+     font="SansSerifHuge"
+     height="26"
+     layout="topleft"
+     left_pad="10"
+     name="title"
+     text_color="LtGray"
+     top="0"
+     use_ellipses="true"
+     value="Object Profile"
+     width="290" />
+	    <text
+     follows="top|left"
+     height="13"
+     layout="topleft"
+     left="45"
+     name="where"
+     text_color="LtGray_50"
+     value="(Inworld)"
+     width="150" />
+	<panel
+         follows="all"
+         height="490"
+         label=""
+         layout="topleft"
+         left="10"
+         help_topic=""
+         name="properties_panel"
+         top="45"
+         width="313"
+   background_visible="true"
+   bg_alpha_color="DkGray2">
+	    	    <text
+		     type="string"
+		     length="1"
+		     follows="left|top"
+		     height="10"
+		     layout="topleft"
+		     left="5"
+             name="Name:"
+		     top="10"
+		     width="78">
+	        Name:
+	    </text>
+	    <line_editor
+		     border_style="line"
+		     border_thickness="1"
+	    	 follows="left|top|right"
+		     height="20"
+		     layout="topleft"
+	    	 left_delta="78"
+		     max_length_bytes="63"
+             name="Object Name"
+	    	 top_delta="0"
+		     width="225" />
+	    <text
+	    type="string"
+	    length="1"
+	    follows="left|top"
+	    height="10"
+	    layout="topleft"
+	    left="5"
+             name="Description:"
+	    top_pad="10"
+	    width="78">
+	        Description:
+	    </text>
+            <line_editor
+	     border_style="line"
+    	     border_thickness="1"
+             follows="left|top|right"
+             height="23"
+             layout="topleft"
+             name="Object Description"
+             select_on_focus="true"
+    		 left_delta="78"
+		     max_length_bytes="127"
+	    	 top_delta="-5"
+	    	 width="225"/>
+	    <text
+		     type="string"
+		     length="1"
+		     follows="left|top"
+		     height="23"
+		     layout="topleft"
+    		 left="5"
+		 name="CreatorNameLabel"
+		  top_pad="12"
+		     width="78">
+	        Creator:
+    	</text>
+	    <text
+		     type="string"
+     follows="left|right|top"
+     font="SansSerifSmall"
+     height="15"
+     layout="topleft"
+     left_pad="0"
+             name="Creator Name"
+		     top_delta="0"
+		     translate="false"
+         use_ellipses="true" 
+		     width="225">
+	        TestString PleaseIgnore
+	     </text>
+	    <text
+			 type="string"
+			 length="1"
+			 follows="left|top"
+			 height="23"
+			layout="topleft"
+			left="5"
+			name="Owner:"
+			top_pad="15"
+			 width="78">
+			    Owner:
+	     </text>
+	     <text
+			    type="string"
+			    follows="left|right|top"
+			    font="SansSerifSmall"
+			    height="15"
+			    layout="topleft"
+			    left_pad="0"
+			    name="Owner Name"
+			    top_delta="0"
+			    translate="false"
+          use_ellipses="true" 
+			    width="225">
+			    TestString PleaseIgnore
+	     </text>
+	    	    <text
+			 type="string"
+			 length="1"
+			 follows="left|top"
+			 height="23"
+			 layout="topleft"
+			 left="5"
+			name="Group_label"
+			top_pad="15"
+			width="78">
+			    Group:
+	     </text>
+      		<button
+			 follows="top|left"
+			 height="10"
+			 image_disabled="Activate_Checkmark"
+			 image_selected="Activate_Checkmark"
+			 image_unselected="Activate_Checkmark"
+			 image_color="White_50"
+			 layout="topleft"
+			 left_pad="0"
+			 top_delta="0"
+			 name="button set group"
+			 tab_stop="false"
+			 tool_tip="Choose a group to share this object's permissions"
+			 width="10" />
+            <name_box
+             follows="left|top"
+             height="18"
+             initial_value="Loading..."
+             layout="topleft"
+             left_pad="5"
+             top_delta="-1"
+             name="Group Name Proxy"
+             width="150" />
+            <button
+             follows="top|left"
+             height="23"
+             label="Deed"
+             label_selected="Deed"
+             layout="topleft"
+             name="button deed"
+             top_pad="0"
+             left="81"
+             tool_tip="Deeding gives this item away with next owner permissions. Group shared objects can be deeded by a group officer."
+             width="100" />
+            <text
+             type="string"
+             length="1"
+             follows="left|top"
+             height="9"
+             layout="topleft"
+             top_pad="5"
+             left="5"
+             name="label click action"
+             width="280">
+                Click to:
+            </text>
+            <combo_box
+             follows="left|top"
+             height="23"
+             layout="topleft"
+             name="clickaction"
+             width="168"
+             left="81">
+                <combo_box.item
+                 label="Touch  (default)"
+                 name="Touch/grab(default)"
           value="Touch" />
-      <combo_box.item
-          label="Sit on object"
-          name="Sitonobject"
+                <combo_box.item
+                 label="Sit on object"
+                 name="Sitonobject"
           value="Sit" />
-      <combo_box.item
-          label="Buy object"
-          name="Buyobject"
+                <combo_box.item
+                 label="Buy object"
+                 name="Buyobject"
           value="Buy" />
-      <combo_box.item
-          label="Pay object"
-          name="Payobject"
+                <combo_box.item
+                 label="Pay object"
+                 name="Payobject"
           value="Pay" />
-      <combo_box.item
-          label="Open"
-          name="Open"
-          value="Open" />
-    </combo_box>
-    <panel
-        border="false"
-        follows="left|top"
-        layout="topleft"
-        mouse_opaque="false"
-        background_visible="true"
-        bg_alpha_color="DkGray"
-        name="perms_inv"
-        left="0"
-        top_pad="15"
-        height="135"
-        width="313">
-      <text
-          type="string"
-          length="1"
+                <combo_box.item
+                 label="Open"
+                 name="Open"
+                 value="Open" />
+            </combo_box>
+	 <panel
+         border="false"
+         follows="left|top"
+         layout="topleft"
+         mouse_opaque="false"
+         background_visible="true"
+         bg_alpha_color="DkGray"
+         name="perms_inv"
+         left="0"
+         top_pad="15"
+         height="135"
+         width="313">
+	  <text
+             type="string"
+             length="1"
           left="5"
-          top_pad="15"
-          text_color="EmphasisColor"
-          height="15"
-          follows="left|top|right"
-          layout="topleft"
-          name="perm_modify"
-          width="310">
-        You can modify this object
-      </text>
-      <text
-          type="string"
-          length="1"
-          follows="left|top"
-          height="16"
-          layout="topleft"
-          left="10"
-          name="Anyone can:"
-          top_pad="8"
-          width="100">
-        Anyone:
-      </text>
-      <check_box
-          height="18"
-          label="Copy"
-          layout="topleft"
-          left_pad="0"
-          name="checkbox allow everyone copy"
-          top_delta="-2"
-          width="90" />
-      <check_box
-          height="18"
-          label="Move"
-          layout="topleft"
-          name="checkbox allow everyone move"
-          left_pad="0"
-          width="150" />
-      <text
-          type="string"
-          length="1"
-          follows="left|top"
-          height="16"
-          layout="topleft"
-          left="10"
-          name="GroupLabel"
-          top_pad="8"
-          width="100">
-        Group:
-      </text>
-      <check_box
-          height="18"
-          label="Share"
-          layout="topleft"
-          left_pad="90"
-          top_delta="-2"
-          name="checkbox share with group"
-          tool_tip="Allow all members of the set group to share your modify permissions for this object. You must Deed to enable role restrictions."
-          width="150" />
-      <text
-          type="string"
-          length="1"
-          follows="left|top"
-          height="16"
-          layout="topleft"
-          left="10"
-          name="NextOwnerLabel"
-          top_pad="8"
-          width="200"
-          word_wrap="true">
-        Next owner:
-      </text>
-      <check_box
-          height="18"
-          label="Modify"
-          layout="topleft"
-          left="20"
-          top_pad="0"
-          name="checkbox next owner can modify"
-          width="90" />
-      <check_box
-          height="18"
-          label="Copy"
-          layout="topleft"
-          left_pad="0"
-          name="checkbox next owner can copy"
-          width="90" />
-      <check_box
-          height="18"
-          label="Transfer"
-          layout="topleft"
-          left_pad="0"
-          name="checkbox next owner can transfer"
-          tool_tip="Next owner can give away or resell this object"
-          width="106" />
-    </panel>
-    <check_box
-        height="23"
-        label="For Sale"
-        layout="topleft"
-        left="20"
-        name="checkbox for sale"
-        top_pad="10"
-        width="100" />
-    <combo_box
-        height="23"
-        left_pad="0"
-        layout="topleft"
-        follows="left|top"
-        name="sale type"
-        width="170">
-      <combo_box.item
-          name="Copy"
-          label="Copy"
-          value="2" />
-      <combo_box.item
-          name="Contents"
-          label="Contents"
-          value="3" />
-      <combo_box.item
-          name="Original"
-          label="Original"
-          value="1" />
-    </combo_box>
-    <spinner
+             top_pad="15"
+             text_color="EmphasisColor"
+	     height="15"
+             follows="left|top|right"
+             layout="topleft"
+             name="perm_modify"
+             width="310">
+                You can modify this object
+            </text>
+	  	    <text
+			 type="string"
+			 length="1"
+			 follows="left|top"
+			 height="16"
+			 layout="topleft"
+			 left="10"
+               name="Anyone can:"
+			 top_pad="8"
+			 width="100">
+			Anyone:
+	    </text>
+	    <check_box
+			 height="18"
+			 label="Copy"
+			 layout="topleft"
+			 left_pad="0"
+             name="checkbox allow everyone copy"
+			 top_delta="-2"
+			 width="90" />
+	    <check_box
+             height="18"
+             label="Move"
+             layout="topleft"
+             name="checkbox allow everyone move"
+			 left_pad="0"
+             width="150" />
+	       	<text
+			 type="string"
+			 length="1"
+			 follows="left|top"
+			 height="16"
+			 layout="topleft"
+			 left="10"
+			 name="GroupLabel"
+			 top_pad="8"
+			 width="100">
+			Group:
+    	</text>
+			    <check_box
+			 height="18"
+			 label="Share"
+			 layout="topleft"
+			 left_pad="90"
+			 top_delta="-2"
+             name="checkbox share with group"
+			 tool_tip="Allow all members of the set group to share your modify permissions for this object. You must Deed to enable role restrictions."
+			 width="150" />
+	    	    <text
+			 type="string"
+			 length="1"
+			 follows="left|top"
+			 height="16"
+			 layout="topleft"
+			 left="10"
+			 name="NextOwnerLabel"
+			 top_pad="8"
+			 width="200"
+			 word_wrap="true">
+			Next owner:
+	    </text>
+	    <check_box
+			 height="18"
+			 label="Modify"
+			 layout="topleft"
+			 left="20"
+			 top_pad="0"
+             name="checkbox next owner can modify"
+			 width="90" />
+	    <check_box
+			 height="18"
+			 label="Copy"
+			 layout="topleft"
+			 left_pad="0"
+             name="checkbox next owner can copy"
+			 width="90" />
+	    <check_box
+			 height="18"
+			 label="Transfer"
+			 layout="topleft"
+			 left_pad="0"
+             name="checkbox next owner can transfer"
+			 tool_tip="Next owner can give away or resell this object"
+			 width="106" />
+	    </panel>
+	    <check_box
+			 height="23"
+			 label="For Sale"
+			 layout="topleft"
+			 left="20"
+             name="checkbox for sale"
+			 top_pad="10"
+			 width="100" />
+		<combo_box
+			 height="23"
+			 left_pad="0"
+			 layout="topleft"
+			 follows="left|top"
+            name="sale type"
+			 width="170">
+        <combo_box.item
+           name="Copy"
+           label="Copy"
+           value="2" />
+        <combo_box.item
+           name="Contents"
+           label="Contents"
+           value="3" />
+        <combo_box.item
+           name="Original"
+           label="Original"
+           value="1" />
+	    </combo_box>
+		<spinner
         follows="left|top"
         decimal_digits="0"
         increment="1"
@@ -445,17 +445,17 @@
         min_val="1"
         height="20"
         max_val="999999999" />
-    <check_box
-        height="20"
-        width="110"
-        top_pad="6"
-        label="Show in search"
-        layout="topleft"
-        left="120"
-        name="search_check"
-        tool_tip="Let people see this object in search results" />
-    <text
-        type="string"
+      <check_box
+	   height="20"
+	   width="110"
+	   top_pad="6"
+	   label="Show in search"
+       layout="topleft"
+	   left="120"
+       name="search_check"
+       tool_tip="Let people see this object in search results" />
+            <text
+             type="string"
         follows="left|top"
         name="pathfinding_attributes_label"
         top_pad="6"
@@ -466,7 +466,7 @@
     <text
         type="string"
         follows="left|top"
-        text_color="EmphasisColor"
+             text_color="EmphasisColor"
         name="pathfinding_attributes_value"
         width="130"
         word_wrap="false"
@@ -475,120 +475,120 @@
     <text
         type="string"
         text_color="EmphasisColor"
-        length="1"
+             length="1"
         top_pad="10"
-        follows="left|top"
-        layout="topleft"
-        left="10"
-        name="B:"
-        height="10"
-        width="50">
-      B:
-    </text>
-    <text
-        type="string"
-        text_color="White"
-        length="1"
-        follows="left|top"
-        layout="topleft"
-        left_pad="0"
-        name="O:"
-        height="10"
-        width="50">
-      O:
-    </text>
-    <text
-        type="string"
-        text_color="EmphasisColor"
-        length="1"
-        follows="left|top"
-        layout="topleft"
-        left_pad="0"
-        name="G:"
-        height="10"
-        width="50">
-      G:
-    </text>
-    <text
-        type="string"
-        text_color="White"
-        length="1"
-        follows="left|top"
-        left_pad="0"
-        layout="topleft"
-        name="E:"
-        height="10"
-        width="50">
-      E:
-    </text>
-    <text
-        type="string"
-        text_color="EmphasisColor"
-        length="1"
-        follows="left|top"
-        layout="topleft"
-        left_pad="0"
-        name="N:"
-        height="10"
-        width="50">
-      N:
-    </text>
-    <text
-        type="string"
-        text_color="White"
-        length="1"
-        follows="left|top"
-        layout="topleft"
-        left_pad="0"
-        name="F:"
-        height="10"
-        width="50">
-      F:
-    </text>
-  </panel>
-  <panel
-      height="25"
-      layout="bottomright"
-      name="button_panel"
-      left="5"
-      bottom="5"
-      width="313">
-    <button
-        follows="bottom|left"
-        height="23"
-        label="Open"
-        layout="topleft"
-        left="5"
-        name="open_btn"
-        top="0"
-        width="73" />
-    <button
-        follows="bottom|left"
-        height="23"
-        label="Pay"
-        layout="topleft"
-        left_pad="5"
-        name="pay_btn"
-        top="0"
-        width="73" />
-    <button
-        follows="bottom|left"
-        height="23"
-        label="Buy"
-        layout="topleft"
-        left_pad="5"
-        name="buy_btn"
-        top="0"
-        width="73" />
-    <button
-        follows="bottom|left"
-        height="23"
-        label="Details"
-        layout="topleft"
-        left_pad="5"
-        name="details_btn"
-        top="0"
-        width="74" />
+             follows="left|top"
+             layout="topleft"
+             left="10"
+             name="B:"
+             height="10"
+             width="50">
+                B:
+            </text>
+            <text
+             type="string"
+             text_color="White"
+             length="1"
+             follows="left|top"
+             layout="topleft"
+             left_pad="0"
+             name="O:"
+             height="10"
+             width="50">
+                O:
+            </text>
+            <text
+             type="string"
+             text_color="EmphasisColor"
+             length="1"
+             follows="left|top"
+             layout="topleft"
+             left_pad="0"
+             name="G:"
+             height="10"
+             width="50">
+                G:
+            </text>
+            <text
+             type="string"
+             text_color="White"
+             length="1"
+             follows="left|top"
+             left_pad="0"
+             layout="topleft"
+             name="E:"
+             height="10"
+             width="50">
+                E:
+            </text>
+            <text
+             type="string"
+             text_color="EmphasisColor"
+             length="1"
+             follows="left|top"
+             layout="topleft"
+             left_pad="0"
+             name="N:"
+             height="10"
+             width="50">
+                N:
+            </text>
+            <text
+             type="string"
+             text_color="White"
+             length="1"
+             follows="left|top"
+             layout="topleft"
+             left_pad="0"
+             name="F:"
+             height="10"
+             width="50">
+                F:
+            </text>
+		</panel>
+    <panel
+		 height="25"
+		 layout="bottomright"
+		 name="button_panel"
+		 left="5"
+		 bottom="5"
+		 width="313">
+        <button
+		     follows="bottom|left"
+		     height="23"
+		     label="Open"
+		     layout="topleft"
+		     left="5"
+		     name="open_btn"
+		     top="0"
+		     width="73" />
+	    <button
+		     follows="bottom|left"
+		     height="23"
+		     label="Pay"
+		     layout="topleft"
+		     left_pad="5"
+		     name="pay_btn"
+		     top="0"
+		     width="73" />
+	    <button
+		     follows="bottom|left"
+		     height="23"
+		     label="Buy"
+		     layout="topleft"
+		     left_pad="5"
+		     name="buy_btn"
+		     top="0"
+		     width="73" />
+        <button
+		     follows="bottom|left"
+		     height="23"
+		     label="Details"
+		     layout="topleft"
+		     left_pad="5"
+		     name="details_btn"
+		     top="0"
+		     width="74" />
 
-  </panel>
+	</panel>
 </panel>
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index d1c952ac3b..7c6b5403e1 100644
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1062,7 +1062,6 @@ class Linux_i686Manifest(LinuxManifest):
             self.path("libalut.so")
             self.path("libopenal.so", "libopenal.so.1")
             self.path("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname
-
             # KLUDGE: As of 2012-04-11, the 'fontconfig' package installs
             # libfontconfig.so.1.4.4, along with symlinks libfontconfig.so.1
             # and libfontconfig.so. Before we added support for library-file
-- 
cgit v1.2.3