From 8675ed0491efee860ac1b2d1d5fe88d150768217 Mon Sep 17 00:00:00 2001
From: Graham Linden <graham@lindenlab.com>
Date: Mon, 19 Aug 2013 16:04:28 -0700
Subject: [PATCH] Fix merge regressions from missed changes to LoD updates

---
 indra/llrender/llvertexbuffer.cpp  | 28 ----------------------------
 indra/newview/lldrawpoolalpha.cpp  |  3 +--
 indra/newview/lldrawpoolavatar.cpp | 10 ++++++++++
 indra/newview/llvovolume.cpp       |  7 +++++++
 4 files changed, 18 insertions(+), 30 deletions(-)

diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index fd7b8469283..6a7cec3bada 100755
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -2209,39 +2209,11 @@ void LLVertexBuffer::bindForFeedback(U32 channel, U32 type, U32 index, U32 count
 #endif
 }
 
-void DumpComponents(U32 mask)
-{
-	llinfos <<
-	((mask & LLVertexBuffer::MAP_VERTEX)		? "vertex:"		: " ") <<
-	((mask & LLVertexBuffer::MAP_NORMAL)		? "norms:"		: " ") <<
-	((mask & LLVertexBuffer::MAP_TEXCOORD0)	? "TC0:"		: " ") <<
-	((mask & LLVertexBuffer::MAP_TEXCOORD1)	? "TC1:"		: " ") <<
-	((mask & LLVertexBuffer::MAP_TEXCOORD2)	? "TC2:"		: " ") <<
-	((mask & LLVertexBuffer::MAP_TEXCOORD3)	? "TC3:"		: " ") <<
-	((mask & LLVertexBuffer::MAP_COLOR)		? "color:"		: " ") <<
-	((mask & LLVertexBuffer::MAP_EMISSIVE)	? "emissive:"	: " ") <<
-	((mask & LLVertexBuffer::MAP_TANGENT)	? "tangents"	: " ") << llendl;
-}
-
 // Set for rendering
 void LLVertexBuffer::setBuffer(U32 data_mask)
 {
 	flush();
 
-	if((getTypeMask() & data_mask) != data_mask)
-	{
-		if (gDebugGL)
-		{			
-			// Dump info about what was missing
-			//
-			DumpComponents(data_mask & ~getTypeMask());
-			llwarns << "Missing VB stream components. ^^" << llendl;
-		}
-		// Make sure we don't write checks we can't cash below...
-		//
-		data_mask = (data_mask & getTypeMask());
-	}
-	
 	//set up pointers if the data mask is different ...
 	bool setup = (sLastMask != data_mask);
 
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 500fad4f786..e4ebfea665f 100755
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -399,7 +399,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
 				// Fix for bug - NORSPEC-271
 				// If the face is more than 90% transparent, then don't update the Depth buffer for Dof
 				// We don't want the nearly invisible objects to cause of DoF effects
-				if(pass == 1)
+				if(pass == 1 && !LLPipeline::sImpostorRender)
 				{
 					LLFace*	face = params.mFace;
 					if(face)
@@ -577,7 +577,6 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
 				
 				// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow).  Interleaving these state-changing calls could be expensive, but glow must be drawn Z-sorted with alpha.
 				if (current_shader && 
-                    !LLPipeline::sImpostorRender &&
 					draw_glow_for_this_partition &&
 					params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
 				{
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 120920a4b02..66bbc6819b4 100755
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -136,6 +136,16 @@ void LLDrawPoolAvatar::prerender()
 	{
 		sBufferUsage = GL_STREAM_DRAW_ARB;
 	}
+
+	if (!mDrawFace.empty())
+	{
+		const LLFace *facep = mDrawFace[0];
+		if (facep && facep->getDrawable())
+		{
+			LLVOAvatar* avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get();
+			updateRiggedVertexBuffers(avatarp);
+		}
+	}
 }
 
 LLMatrix4& LLDrawPoolAvatar::getModelView()
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 33b26494de9..6b3611b7965 100755
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -4863,7 +4863,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
 
 			if (is_rigged)
 			{
+				if (!drawablep->isState(LLDrawable::RIGGED))
+				{
 				drawablep->setState(LLDrawable::RIGGED);
+
+					//first time this is drawable is being marked as rigged,
+					// do another LoD update to use avatar bounding box
+					vobj->updateLOD();
+				}
 			}
 			else
 			{
-- 
GitLab