From 5cc716dbf9470f7be454588b5402408bafa225bb Mon Sep 17 00:00:00 2001
From: ruslantproductengine <ruslantproductengine@lindenlab.com>
Date: Mon, 12 Dec 2016 18:24:46 +0200
Subject: [PATCH] MAINT-6125 - Mesh avatar deforms constantly MAINT-6910 -
 [MAINT-RC] Some mesh turns invisible when camera is moved on the Maint-RC
 viewer only - caused by fix for MAINT-6125.

Commulative fix.
Fixed for booth ticket's in indra/newview/llvovolume.cpp
Remained fixed, it's a small code improvements which is not related to
MAINT-6125, MAINT-6910
---
 indra/llrender/llvertexbuffer.cpp  | 2 +-
 indra/newview/lldrawable.cpp       | 4 +---
 indra/newview/llmaniptranslate.cpp | 4 ++--
 indra/newview/llvieweroctree.cpp   | 2 +-
 indra/newview/llvovolume.cpp       | 8 ++++++--
 indra/newview/pipeline.cpp         | 2 +-
 6 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 31dffdd5453..1c325f5e5df 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -509,7 +509,7 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
 				}
 			}
 		
-			U32 map_tc[] = 
+			static const U32 map_tc[] = 
 			{
 				MAP_TEXCOORD1,
 				MAP_TEXCOORD2,
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index f956023358e..3bb2c45a243 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -979,9 +979,7 @@ void LLDrawable::updateSpatialExtents()
 	if (mVObjp)
 	{
 		const LLVector4a* exts = getSpatialExtents();
-		LLVector4a extents[2];
-		extents[0] = exts[0];
-		extents[1] = exts[1];
+		LLVector4a extents[2] = { exts[0], exts[1] };
 
 		mVObjp->updateSpatialExtents(extents[0], extents[1]);
 		setSpatialExtents(extents[0], extents[1]);
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 3975d3980b1..f3e00fa9c6f 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1638,8 +1638,8 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
 	LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
 
 	
-	U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_ALPHA, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY };
-	U32 num_types = LL_ARRAY_SIZE(types);
+	static const U32 types[] = { LLRenderPass::PASS_SIMPLE, LLRenderPass::PASS_ALPHA, LLRenderPass::PASS_FULLBRIGHT, LLRenderPass::PASS_SHINY };
+	static const U32 num_types = LL_ARRAY_SIZE(types);
 
 	GLuint stencil_mask = 0xFFFFFFFF;
 	//stencil in volumes
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index 023f1b92ba5..5f0e21db71c 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -465,7 +465,7 @@ LLViewerOctreeGroup::LLViewerOctreeGroup(OctreeNode* node)
 {
 	LLVector4a tmp;
 	tmp.splat(0.f);
-	mExtents[0] = mExtents[1] = mObjectBounds[0] = mObjectBounds[0] = mObjectBounds[1] = 
+	mExtents[0] = mExtents[1] = mObjectBounds[0] = mObjectBounds[1] =
 		mObjectExtents[0] = mObjectExtents[1] = tmp;
 	
 	mBounds[0] = node->getCenter();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 217b8bfbc2c..8b25cfaa580 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1485,7 +1485,6 @@ BOOL LLVOVolume::genBBoxes(BOOL force_global)
 		res &= face->genVolumeBBoxes(*volume, i,
 										mRelativeXform, 
 										(mVolumeImpl && mVolumeImpl->isVolumeGlobal()) || force_global);
-		
 		if (rebuild)
 		{
 			if (i == 0)
@@ -1761,6 +1760,11 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable)
 		dirtySpatialGroup(drawable->isState(LLDrawable::IN_REBUILD_Q1));
 		compiled = TRUE;
 		lodOrSculptChanged(drawable, compiled);
+		
+		if(drawable->isState(LLDrawable::REBUILD_RIGGED | LLDrawable::RIGGED)) 
+		{
+			updateRiggedVolume(false);
+		}
 		genBBoxes(FALSE);
 	}
 	// it has its own drawable (it's moved) or it has changed UVs or it has changed xforms from global<->local
@@ -4210,7 +4214,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons
 
 			LLVector4a* pos = dst_face.mPositions;
 
-			if( pos && weight && dst_face.mExtents )
+			if (pos && dst_face.mExtents)
 			{
 				LL_RECORD_BLOCK_TIME(FTM_SKIN_RIGGED);
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 32285d2784b..dddf586f620 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -10120,7 +10120,7 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
 	}
 	LLPipeline::sShadowRender = TRUE;
 	
-	U32 types[] = { 
+	static const U32 types[] = { 
 		LLRenderPass::PASS_SIMPLE, 
 		LLRenderPass::PASS_FULLBRIGHT, 
 		LLRenderPass::PASS_SHINY, 
-- 
GitLab