From ffc33a1cc5b96d9ae6de7f447c09de3ae8174fbc Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Mon, 15 Oct 2012 16:46:42 -0700
Subject: MAINT-1598 Edit Linked Parts isn't returning creator/owner * Show
 creator, owner and group information when only selecting a single prim   in a
 linkset. reviewed with Simon

---
 indra/newview/llpanelpermissions.cpp |   2 +-
 indra/newview/llselectmgr.cpp        | 301 +++++++++++++++++------------------
 indra/newview/llselectmgr.h          |   6 +
 3 files changed, 156 insertions(+), 153 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 51ab7649a4..e641370d2e 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -425,7 +425,7 @@ void LLPanelPermissions::refresh()
 		}
 	}
 	
-	getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
+	getChildView("button set group")->setEnabled(root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
 
 	getChildView("Name:")->setEnabled(TRUE);
 	LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name");
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 13845c3b38..9c4c594280 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2941,116 +2941,148 @@ BOOL LLSelectMgr::selectGetRootsCopy()
 	return TRUE;
 }
 
-//-----------------------------------------------------------------------------
-// selectGetCreator()
-// Creator information only applies to root objects.
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
+struct LLSelectGetFirstTest
 {
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
+	LLSelectGetFirstTest() : mIdentical(true), mFirst(true)	{ }
+	virtual ~LLSelectGetFirstTest() { }
+
+	// returns false to break out of the iteration.
+	bool checkMatchingNode(LLSelectNode* node)
 	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
+		if (!node || !node->mValid)
 		{
-			return FALSE;
+			return false;
 		}
 
-		if (first)
+		if (mFirst)
 		{
-			first_id = node->mPermissions->getCreator();
-			first = FALSE;
+			mFirstValue = getValueFromNode(node);
+			mFirst = false;
 		}
 		else
 		{
-			if ( !(first_id == node->mPermissions->getCreator() ) )
+			if ( mFirstValue != getValueFromNode(node) )
+			{
+				mIdentical = false;
+				// stop testing once we know not all selected are identical.
+				return false;
+			}
+		}
+		// continue testing.
+		return true;
+	}
+
+	bool mIdentical;
+	LLUUID mFirstValue;
+
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node) = 0;
+
+private:
+	bool mFirst;
+};
+
+void LLSelectMgr::getFirst(LLSelectGetFirstTest* test)
+{
+	if (gSavedSettings.getBOOL("EditLinkedParts"))
+	{
+		for (LLObjectSelection::valid_iterator iter = getSelection()->valid_begin();
+			iter != getSelection()->valid_end(); ++iter )
+		{
+			if (!test->checkMatchingNode(*iter))
 			{
-				identical = FALSE;
 				break;
 			}
 		}
 	}
-	if (first_id.isNull())
+	else
+	{
+		for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
+			iter != getSelection()->root_object_end(); ++iter )
+		{
+			if (!test->checkMatchingNode(*iter))
+			{
+				break;
+			}
+		}
+	}
+}
+
+//-----------------------------------------------------------------------------
+// selectGetCreator()
+// Creator information only applies to roots unless editing linked parts.
+//-----------------------------------------------------------------------------
+struct LLSelectGetFirstCreator : public LLSelectGetFirstTest
+{
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+	{
+		return node->mPermissions->getCreator();
+	}
+};
+
+BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
+{
+	LLSelectGetFirstCreator test;
+	getFirst(&test);
+
+	if (test.mFirstValue.isNull())
 	{
 		name = LLTrans::getString("AvatarNameNobody");
 		return FALSE;
 	}
 	
-	result_id = first_id;
+	result_id = test.mFirstValue;
 	
-	if (identical)
+	if (test.mIdentical)
 	{
-		name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+		name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
 	}
 	else
 	{
 		name = LLTrans::getString("AvatarNameMultiple");
 	}
 
-	return identical;
+	return test.mIdentical;
 }
 
-
 //-----------------------------------------------------------------------------
 // selectGetOwner()
-// Owner information only applies to roots.
+// Owner information only applies to roots unless editing linked parts.
 //-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
+struct LLSelectGetFirstOwner : public LLSelectGetFirstTest
 {
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	BOOL first_group_owned = FALSE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
 	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-		
-		if (first)
-		{
-			node->mPermissions->getOwnership(first_id, first_group_owned);
-			first = FALSE;
-		}
-		else
-		{
-			LLUUID owner_id;
-			BOOL is_group_owned = FALSE;
-			if (!(node->mPermissions->getOwnership(owner_id, is_group_owned))
-				|| owner_id != first_id || is_group_owned != first_group_owned)
-			{
-				identical = FALSE;
-				break;
-			}
-		}
+		// Don't use 'getOwnership' since we return a reference, not a copy.
+		// Will return LLUUID::null if unowned (which is not allowed and should never happen.)
+		return node->mPermissions->isGroupOwned() ? node->mPermissions->getGroup() : node->mPermissions->getOwner();
 	}
-	if (first_id.isNull())
+};
+
+BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
+{
+	LLSelectGetFirstOwner test;
+	getFirst(&test);
+
+	if (test.mFirstValue.isNull())
 	{
 		return FALSE;
 	}
 
-	result_id = first_id;
+	result_id = test.mFirstValue;
 	
-	if (identical)
+	if (test.mIdentical)
 	{
-		BOOL public_owner = (first_id.isNull() && !first_group_owned);
-		if (first_group_owned)
+		bool group_owned = selectIsGroupOwned();
+		if (group_owned)
 		{
-			name = LLSLURL("group", first_id, "inspect").getSLURLString();
-		}
-		else if(!public_owner)
-		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+			name = LLSLURL("group", test.mFirstValue, "inspect").getSLURLString();
 		}
 		else
 		{
-			name = LLTrans::getString("AvatarNameNobody");
+			name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
 		}
 	}
 	else
@@ -3058,131 +3090,92 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
 		name = LLTrans::getString("AvatarNameMultiple");
 	}
 
-	return identical;
+	return test.mIdentical;
 }
 
-
 //-----------------------------------------------------------------------------
 // selectGetLastOwner()
-// Owner information only applies to roots.
+// Owner information only applies to roots unless editing linked parts.
 //-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
+struct LLSelectGetFirstLastOwner : public LLSelectGetFirstTest
 {
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
 	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-
-		if (first)
-		{
-			first_id = node->mPermissions->getLastOwner();
-			first = FALSE;
-		}
-		else
-		{
-			if ( !(first_id == node->mPermissions->getLastOwner() ) )
-			{
-				identical = FALSE;
-				break;
-			}
-		}
+		return node->mPermissions->getLastOwner();
 	}
-	if (first_id.isNull())
+};
+
+BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
+{
+	LLSelectGetFirstLastOwner test;
+	getFirst(&test);
+
+	if (test.mFirstValue.isNull())
 	{
 		return FALSE;
 	}
 
-	result_id = first_id;
+	result_id = test.mFirstValue;
 	
-	if (identical)
+	if (test.mIdentical)
 	{
-		BOOL public_owner = (first_id.isNull());
-		if(!public_owner)
-		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
-		}
-		else
-		{
-			name.assign("Public or Group");
-		}
+		name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
 	}
 	else
 	{
 		name.assign( "" );
 	}
 
-	return identical;
+	return test.mIdentical;
 }
 
-
 //-----------------------------------------------------------------------------
 // selectGetGroup()
-// Group information only applies to roots.
+// Group information only applies to roots unless editing linked parts.
 //-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetGroup(LLUUID& result_id)
+struct LLSelectGetFirstGroup : public LLSelectGetFirstTest
 {
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
 	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-
-		if (first)
-		{
-			first_id = node->mPermissions->getGroup();
-			first = FALSE;
-		}
-		else
-		{
-			if ( !(first_id == node->mPermissions->getGroup() ) )
-			{
-				identical = FALSE;
-				break;
-			}
-		}
+		return node->mPermissions->getGroup();
 	}
+};
 
-	result_id = first_id;
+BOOL LLSelectMgr::selectGetGroup(LLUUID& result_id)
+{
+	LLSelectGetFirstGroup test;
+	getFirst(&test);
 
-	return identical;
+	result_id = test.mFirstValue;
+	return test.mIdentical;
 }
 
 //-----------------------------------------------------------------------------
 // selectIsGroupOwned()
-// Only operates on root nodes.  
-// Returns TRUE if all have valid data and they are all group owned.
+// Only operates on root nodes unless editing linked parts.  
+// Returns TRUE if the first selected is group owned.
 //-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectIsGroupOwned()
+struct LLSelectGetFirstGroupOwner : public LLSelectGetFirstTest
 {
-	BOOL found_one = FALSE;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
 	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
+		if (node->mPermissions->isGroupOwned())
 		{
-			return FALSE;
-		}
-		found_one = TRUE;
-		if (!node->mPermissions->isGroupOwned())
-		{
-			return FALSE;
+			return node->mPermissions->getGroup();
 		}
-	}	
-	return found_one ? TRUE : FALSE;
+		return LLUUID::null;
+	}
+};
+
+BOOL LLSelectMgr::selectIsGroupOwned()
+{
+	LLSelectGetFirstGroupOwner test;
+	getFirst(&test);
+
+	return test.mFirstValue.notNull() ? TRUE : FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -4987,7 +4980,11 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data
 		} func(id);
 		LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
 
-		if (node)
+		if (!node)
+		{
+			llwarns << "Couldn't find object " << id << " selected." << llendl;
+		}
+		else
 		{
 			if (node->mInventorySerial != inv_serial)
 			{
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index ecbb20df1b..9257ee9eeb 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -343,6 +343,9 @@ typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
 extern template class LLSelectMgr* LLSingleton<class LLSelectMgr>::getInstance();
 #endif
 
+// For use with getFirstTest()
+struct LLSelectGetFirstTest;
+
 class LLSelectMgr : public LLEditMenuHandler, public LLSingleton<LLSelectMgr>
 {
 public:
@@ -745,6 +748,9 @@ private:
 	static void packGodlikeHead(void* user_data);
 	static bool confirmDelete(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle handle);
 
+	// Get the first ID that matches test and whether or not all ids are identical in selected objects.
+	void getFirst(LLSelectGetFirstTest* test);
+
 public:
 	// Observer/callback support for when object selection changes or
 	// properties are received/updated
-- 
cgit v1.2.3


From ec125540c4dccc8f1ff64018364a6a2235b9e8d0 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Tue, 16 Oct 2012 16:25:01 -0500
Subject: MAINT-643 Fix for incorrect lighting and colors in preview displays.

---
 .../shaders/class1/objects/previewF.glsl           | 41 ++++++++++++++++++++++
 .../shaders/class1/objects/previewV.glsl           |  6 ++--
 indra/newview/llfloaterimagepreview.cpp            |  4 ++-
 indra/newview/llfloatermodelpreview.cpp            | 12 +++----
 indra/newview/llviewershadermgr.cpp                |  6 ++--
 5 files changed, 57 insertions(+), 12 deletions(-)
 create mode 100644 indra/newview/app_settings/shaders/class1/objects/previewF.glsl

(limited to 'indra')

diff --git a/indra/newview/app_settings/shaders/class1/objects/previewF.glsl b/indra/newview/app_settings/shaders/class1/objects/previewF.glsl
new file mode 100644
index 0000000000..284da3d0ac
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/objects/previewF.glsl
@@ -0,0 +1,41 @@
+/** 
+ * @file previewF.glsl
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform sampler2D diffuseMap;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+void main()
+{
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
+	frag_color = color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index 5dcfa87066..a4cc6a9c99 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -32,6 +32,8 @@ ATTRIBUTE vec3 position;
 ATTRIBUTE vec3 normal;
 ATTRIBUTE vec2 texcoord0;
 
+uniform vec4 color;
+
 VARYING vec4 vertex_color;
 VARYING vec2 vary_texcoord0;
 
@@ -50,8 +52,8 @@ void main()
 
 	calcAtmospherics(pos.xyz);
 
-	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
-	vertex_color = color;
+	vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.));
+	vertex_color = col;
 
 	
 }
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index 6b2492d927..2575f6f817 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -901,11 +901,13 @@ BOOL LLImagePreviewSculpted::render()
 	{
 		gObjectPreviewProgram.bind();
 	}
+	gPipeline.enableLightsPreview();
+
 	gGL.pushMatrix();
 	const F32 SCALE = 1.25f;
 	gGL.scalef(SCALE, SCALE, SCALE);
 	const F32 BRIGHTNESS = 0.9f;
-	gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
+	gGL.diffuseColor3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
 
 	mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
 	mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0);
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 449173f9b4..e501fcaa90 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -5087,6 +5087,11 @@ BOOL LLModelPreview::render()
 		refresh();
 	}
 
+	if (use_shaders)
+	{
+		gObjectPreviewProgram.bind();
+	}
+
 	gGL.loadIdentity();
 	gPipeline.enableLightsPreview();
 
@@ -5112,11 +5117,6 @@ BOOL LLModelPreview::render()
 
 	const U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
 
-	if (use_shaders)
-	{
-		gObjectPreviewProgram.bind();
-	}
-
 	LLGLEnable normalize(GL_NORMALIZE);
 
 	if (!mBaseModel.empty() && mVertexBuffer[5].empty())
@@ -5305,7 +5305,7 @@ BOOL LLModelPreview::render()
 											hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 128));
 										}
 
-										glColor4ubv(hull_colors[i].mV);
+										gGL.diffuseColor4ubv(hull_colors[i].mV);
 										LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals);
 
 										if (explode > 0.f)
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 4b0e0598f6..142cb2090d 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2026,15 +2026,15 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 	{
 		gObjectPreviewProgram.mName = "Simple Shader";
 		gObjectPreviewProgram.mFeatures.calculatesLighting = true;
-		gObjectPreviewProgram.mFeatures.calculatesAtmospherics = true;
+		gObjectPreviewProgram.mFeatures.calculatesAtmospherics = false;
 		gObjectPreviewProgram.mFeatures.hasGamma = true;
-		gObjectPreviewProgram.mFeatures.hasAtmospherics = true;
+		gObjectPreviewProgram.mFeatures.hasAtmospherics = false;
 		gObjectPreviewProgram.mFeatures.hasLighting = true;
 		gObjectPreviewProgram.mFeatures.mIndexedTextureChannels = 0;
 		gObjectPreviewProgram.mFeatures.disableTextureIndex = true;
 		gObjectPreviewProgram.mShaderFiles.clear();
 		gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewV.glsl", GL_VERTEX_SHADER_ARB));
-		gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/simpleF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gObjectPreviewProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
 		success = gObjectPreviewProgram.createShader(NULL, NULL);
 	}
-- 
cgit v1.2.3


From b19a5c192fbbfb2e94c8dacc9db6808f47bbfd07 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Tue, 16 Oct 2012 17:27:03 -0500
Subject: MAINT-1404 Fix for child objects not appearing to move when editing
 until deselecting.

---
 indra/newview/llmanip.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index 6e0f360cbc..9ec5d7c20c 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -72,7 +72,6 @@ void LLManip::rebuild(LLViewerObject* vobj)
 	LLDrawable* drawablep = vobj->mDrawable;
 	if (drawablep && drawablep->getVOVolume())
 	{
-		
 		gPipeline.markRebuild(drawablep,LLDrawable::REBUILD_VOLUME, TRUE);
 		drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
 		drawablep->updateMove();
@@ -82,6 +81,14 @@ void LLManip::rebuild(LLViewerObject* vobj)
 			group->dirtyGeom();
 			gPipeline.markRebuild(group, TRUE);
 		}
+
+		LLViewerObject::const_child_list_t& child_list = vobj->getChildren();
+		for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(), endIter = child_list.end();
+			 iter != endIter; ++iter)
+		{
+			LLViewerObject* child = *iter;
+			rebuild(child);
+		}
 	}
 }
 
-- 
cgit v1.2.3


From 161c848e3d78a1ec6265b33b3d9f999dd11126f9 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 17 Oct 2012 13:29:15 -0500
Subject: MAINT-643 Cleanup some shader compilation errors when atmospheric
 shaders are enabled.

---
 .../shaders/class1/objects/previewV.glsl           | 22 ++++++++++++++--------
 indra/newview/pipeline.cpp                         |  6 +++---
 2 files changed, 17 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index a4cc6a9c99..f2db314201 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -23,6 +23,9 @@
  * $/LicenseInfo$
  */
 
+float calcDirectionalLight(vec3 n, vec3 l);
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
+
 uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
@@ -37,9 +40,10 @@ uniform vec4 color;
 VARYING vec4 vertex_color;
 VARYING vec2 vary_texcoord0;
 
-
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
-void calcAtmospherics(vec3 inPositionEye);
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
 
 void main()
 {
@@ -47,13 +51,15 @@ void main()
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-		
+	
 	vec3 norm = normalize(normal_matrix * normal);
 
-	calcAtmospherics(pos.xyz);
+	vec4 col = vec4(0,0,0,1);
 
-	vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.));
+	// Collect normal lights (need to be divided by two, as we later multiply by 2)
+	col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
+		
 	vertex_color = col;
-
-	
 }
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 38e6b84f44..eb4f440951 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6045,7 +6045,7 @@ void LLPipeline::enableLightsPreview()
 	
 	LLVector4 light_pos(dir0, 0.0f);
 
-	LLLightState* light = gGL.getLight(0);
+	LLLightState* light = gGL.getLight(1);
 
 	light->enable();
 	light->setPosition(light_pos);
@@ -6057,7 +6057,7 @@ void LLPipeline::enableLightsPreview()
 
 	light_pos = LLVector4(dir1, 0.f);
 
-	light = gGL.getLight(1);
+	light = gGL.getLight(2);
 	light->enable();
 	light->setPosition(light_pos);
 	light->setDiffuse(diffuse1);
@@ -6067,7 +6067,7 @@ void LLPipeline::enableLightsPreview()
 	light->setSpotCutoff(180.f);
 
 	light_pos = LLVector4(dir2, 0.f);
-	light = gGL.getLight(2);
+	light = gGL.getLight(3);
 	light->enable();
 	light->setPosition(light_pos);
 	light->setDiffuse(diffuse2);
-- 
cgit v1.2.3


From 378e9528d440470aab819be46392cec8b3a44563 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 17 Oct 2012 15:33:01 -0500
Subject: MAINT-873 Fix for inability to upload meshes on some systems.

---
 indra/newview/llmeshrepository.cpp | 33 ++++++++++++++++++++++++++++-----
 indra/newview/llmeshrepository.h   |  3 +++
 2 files changed, 31 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index bc7f522848..57a5569dd7 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -361,7 +361,20 @@ public:
 		mModelData(model_data),
 		mObserverHandle(observer_handle)
 	{
+		if (mThread)
+		{
+			mThread->startRequest();
+		}
+	}
+
+	~LLWholeModelFeeResponder()
+	{
+		if (mThread)
+		{
+			mThread->stopRequest();
+		}
 	}
+
 	virtual void completed(U32 status,
 						   const std::string& reason,
 						   const LLSD& content)
@@ -372,7 +385,6 @@ public:
 			cc = llsd_from_file("fake_upload_error.xml");
 		}
 			
-		mThread->mPendingUploads--;
 		dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num));
 
 		LLWholeModelFeeObserver* observer = mObserverHandle.get();
@@ -415,7 +427,20 @@ public:
 		mModelData(model_data),
 		mObserverHandle(observer_handle)
 	{
+		if (mThread)
+		{
+			mThread->startRequest();
+		}
+	}
+
+	~LLWholeModelUploadResponder()
+	{
+		if (mThread)
+		{
+			mThread->stopRequest();
+		}
 	}
+
 	virtual void completed(U32 status,
 						   const std::string& reason,
 						   const LLSD& content)
@@ -426,7 +451,6 @@ public:
 			cc = llsd_from_file("fake_upload_error.xml");
 		}
 
-		mThread->mPendingUploads--;
 		dump_llsd_to_file(cc,make_dump_name("whole_model_upload_response_",dump_num));
 		
 		LLWholeModelUploadObserver* observer = mObserverHandle.get();
@@ -1620,7 +1644,7 @@ void LLMeshUploadThread::doWholeModelUpload()
 			mCurlRequest->process();
 			//sleep for 10ms to prevent eating a whole core
 			apr_sleep(10000);
-		} while (!LLAppViewer::isQuitting() && mCurlRequest->getQueued() > 0);
+		} while (!LLAppViewer::isQuitting() && mPendingUploads > 0);
 	}
 
 	delete mCurlRequest;
@@ -1642,7 +1666,6 @@ void LLMeshUploadThread::requestWholeModelFee()
 	wholeModelToLLSD(model_data,false);
 	dump_llsd_to_file(model_data,make_dump_name("whole_model_fee_request_",dump_num));
 
-	mPendingUploads++;
 	LLCurlRequest::headers_t headers;
 
 	{
@@ -1659,7 +1682,7 @@ void LLMeshUploadThread::requestWholeModelFee()
 		mCurlRequest->process();
 		//sleep for 10ms to prevent eating a whole core
 		apr_sleep(10000);
-	} while (!LLApp::isQuitting() && mCurlRequest->getQueued() > 0);
+	} while (!LLApp::isQuitting() && mPendingUploads > 0);
 
 	delete mCurlRequest;
 	mCurlRequest = NULL;
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index da81bb057b..6e301c26a2 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -405,6 +405,9 @@ public:
 					   LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
 	~LLMeshUploadThread();
 
+	void startRequest() { ++mPendingUploads; }
+	void stopRequest() { --mPendingUploads; }
+
 	bool finished() { return mFinished; }
 	virtual void run();
 	void preStart();
-- 
cgit v1.2.3


From 9d701e563b90a70794fccc28bdfb8edb5b0abfeb Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Wed, 17 Oct 2012 14:05:14 -0700
Subject: MAINT-1742 Child object does not update position while selected.
 reviewed with Davep

---
 indra/newview/lldrawable.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index cdf6460408..05ae336bc5 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -547,6 +547,10 @@ F32 LLDrawable::updateXform(BOOL undamped)
 			}
 		}
 	}
+	else if (!damped && isVisible())
+	{
+		dist_squared = dist_vec_squared(old_pos, target_pos);
+	}
 
 	LLVector3 vec = mCurrentScale-target_scale;
 	
-- 
cgit v1.2.3


From ab38c854c34ada4fc166487b980fa2137badfdb9 Mon Sep 17 00:00:00 2001
From: "simon@Simon-PC.lindenlab.com" <simon@Simon-PC.lindenlab.com>
Date: Wed, 17 Oct 2012 16:43:56 -0700
Subject: MAINT-1724 : Viewer crashes while attempt to open '+ inventory'
 floater that already opened in separated floater.  Changed to non-tearable
 menu. Reviewed by Kelly

---
 indra/newview/skins/default/xui/en/menu_inventory_add.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/menu_inventory_add.xml b/indra/newview/skins/default/xui/en/menu_inventory_add.xml
index e91f5af3d5..29720a680b 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory_add.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory_add.xml
@@ -3,7 +3,7 @@
  layout="topleft"
  left="0"
  mouse_opaque="false"
- can_tear_off="true"
+ can_tear_off="false"
  name="menu_inventory_add"
  visible="false">
             <menu
-- 
cgit v1.2.3


From 9cc1dfd4e6f3859e690da578adde057ec9a82e18 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Thu, 18 Oct 2012 18:58:55 +0300
Subject: MAINT-1303 FIXED Hide menus and buttons after exiting mouselook if
 'Hide all controls' is switched on.

---
 indra/newview/app_settings/settings.xml | 12 +++++++++++
 indra/newview/llagentcamera.cpp         |  6 ++++++
 indra/newview/llviewermenu.cpp          | 37 ++++++++++++++++++---------------
 3 files changed, 38 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 7497a273ea..0dd997a51a 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -14059,5 +14059,17 @@
         <real>1.0</real>
       </array>
     </map>
+    
+    <key>HideUIControls</key>
+    <map>
+      <key>Comment</key>
+      <string>Hide all menu items and buttons</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
 </map>
 </llsd>
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 751b73e1eb..9025c7af8b 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -35,6 +35,7 @@
 #include "llfloaterreg.h"
 #include "llhudmanager.h"
 #include "lljoystickbutton.h"
+#include "llmoveview.h"
 #include "llselectmgr.h"
 #include "llsmoothstep.h"
 #include "lltoolmgr.h"
@@ -2113,6 +2114,11 @@ void LLAgentCamera::changeCameraToDefault()
 	{
 		changeCameraToThirdPerson();
 	}
+	if (gSavedSettings.getBOOL("HideUIControls"))
+	{
+		gViewerWindow->setUIVisibility(false);
+		LLPanelStandStopFlying::getInstance()->setVisible(false);
+	}
 }
 
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 21a96a4e07..9d79d99204 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -3908,25 +3908,27 @@ class LLViewToggleUI : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-		LLNotification::Params params("ConfirmHideUI");
-		params.functor.function(boost::bind(&LLViewToggleUI::confirm, this, _1, _2));
-		LLSD substitutions;
+		if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
+		{
+			LLNotification::Params params("ConfirmHideUI");
+			params.functor.function(boost::bind(&LLViewToggleUI::confirm, this, _1, _2));
+			LLSD substitutions;
 #if LL_DARWIN
-		substitutions["SHORTCUT"] = "Cmd+Shift+U";
+			substitutions["SHORTCUT"] = "Cmd+Shift+U";
 #else
-		substitutions["SHORTCUT"] = "Ctrl+Shift+U";
+			substitutions["SHORTCUT"] = "Ctrl+Shift+U";
 #endif
-		params.substitutions = substitutions;
-		if (gViewerWindow->getUIVisibility())
-		{
-			// hiding, so show notification
-			LLNotifications::instance().add(params);
-		}
-		else
-		{
-			LLNotifications::instance().forceResponse(params, 0);
+			params.substitutions = substitutions;
+			if (!gSavedSettings.getBOOL("HideUIControls"))
+			{
+				// hiding, so show notification
+				LLNotifications::instance().add(params);
+			}
+			else
+			{
+				LLNotifications::instance().forceResponse(params, 0);
+			}
 		}
-
 		return true;
 	}
 
@@ -3936,8 +3938,9 @@ class LLViewToggleUI : public view_listener_t
 
 		if (option == 0) // OK
 		{
-			gViewerWindow->setUIVisibility(!gViewerWindow->getUIVisibility());
-			LLPanelStandStopFlying::getInstance()->setVisible(gViewerWindow->getUIVisibility());
+			gViewerWindow->setUIVisibility(gSavedSettings.getBOOL("HideUIControls"));
+			LLPanelStandStopFlying::getInstance()->setVisible(gSavedSettings.getBOOL("HideUIControls"));
+			gSavedSettings.setBOOL("HideUIControls",!gSavedSettings.getBOOL("HideUIControls"));
 		}
 	}
 };
-- 
cgit v1.2.3


From 48b2dbcd65e72994054b9e525c0e45e346a981fb Mon Sep 17 00:00:00 2001
From: voidpointer <none@none>
Date: Thu, 18 Oct 2012 15:11:22 -0700
Subject: MAINT-1615 - Something invisible pushes avatars around on Dore

---
 indra/newview/skins/default/xui/en/notifications.xml | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 232ed2dcb4..c32e23d553 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -9960,5 +9960,12 @@ Inventory creation on in-world object failed.
 An internal error prevented us from properly updating your viewer.  The L$ balance or parcel holdings displayed in your viewer may not reflect your actual balance on the servers.
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="LargePrimAgentIntersect"
+   type="notify">
+   <tag>fail</tag>
+Cannot create large prims that intersect other players.  Please re-try when other players have moved.
+  </notification>
 
 </notifications>
-- 
cgit v1.2.3


From 10697d59b6082a6e472cf80063ef767cad73bc75 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Tue, 23 Oct 2012 13:35:11 -0500
Subject: MAINT-1567 Fix for incorrect triangle and hull counts in mesh
 importer.

Reviewed by VoidPointer
---
 indra/newview/llfloatermodelpreview.cpp | 123 ++++++++++++++++++++------------
 1 file changed, 76 insertions(+), 47 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index e501fcaa90..6d0d9f67d5 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -3884,15 +3884,30 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 
 	U32 triangle_count = 0;
 
-	for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter)
+	U32 instanced_triangle_count = 0;
+
+	//get the triangle count for the whole scene
+	for (LLModelLoader::scene::iterator iter = mBaseScene.begin(), endIter = mBaseScene.end(); iter != endIter; ++iter)
 	{
-		LLModel* mdl = *iter;
-		for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i)
+		for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance)
 		{
-			triangle_count += mdl->getVolumeFace(i).mNumIndices/3;
+			LLModel* mdl = instance->mModel;
+			if (mdl)
+			{
+				instanced_triangle_count += mdl->getNumTriangles();
+			}
 		}
 	}
 
+	//get the triangle count for the non-instanced set of models
+	for (U32 i = 0; i < mBaseModel.size(); ++i)
+	{
+		triangle_count += mBaseModel[i]->getNumTriangles();
+	}
+	
+	//get ratio of uninstanced triangles to instanced triangles
+	F32 triangle_ratio = (F32) triangle_count / (F32) instanced_triangle_count;
+
 	U32 base_triangle_count = triangle_count;
 
 	U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
@@ -3926,6 +3941,8 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 		if (which_lod > -1 && which_lod < NUM_LOD)
 		{
 			limit = mFMP->childGetValue("lod_triangle_limit_" + lod_name[which_lod]).asInteger();
+			//convert from "scene wide" to "non-instanced" triangle limit
+			limit *= triangle_ratio;
 		}
 	}
 	else
@@ -4031,7 +4048,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 		U32 actual_verts = 0;
 		U32 submeshes = 0;
 
-		mRequestedTriangleCount[lod] = triangle_count;
+		mRequestedTriangleCount[lod] = triangle_count/triangle_ratio;
 		mRequestedErrorThreshold[lod] = lod_error_threshold;
 
 		glodGroupParameteri(mGroup, GLOD_ADAPT_MODE, lod_mode);
@@ -4213,28 +4230,36 @@ void LLModelPreview::updateStatusMessages()
 		//initialize total for this lod to 0
 		total_tris[lod] = total_verts[lod] = total_submeshes[lod] = 0;
 
-		for (U32 i = 0; i < mModel[lod].size(); ++i)
-		{ //for each model in the lod
-			S32 cur_tris = 0;
-			S32 cur_verts = 0;
-			S32 cur_submeshes = mModel[lod][i]->getNumVolumeFaces();
-
-			for (S32 j = 0; j < cur_submeshes; ++j)
-			{ //for each submesh (face), add triangles and vertices to current total
-				const LLVolumeFace& face = mModel[lod][i]->getVolumeFace(j);
-				cur_tris += face.mNumIndices/3;
-				cur_verts += face.mNumVertices;
-			}
+		for (LLModelLoader::scene::iterator iter = mScene[lod].begin(), endIter = mScene[lod].end(); iter != endIter; ++iter)
+		{
+			for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance)
+			{
+				LLModel* model = instance->mModel;
+				if (model)
+				{
+					 //for each model in the lod
+					S32 cur_tris = 0;
+					S32 cur_verts = 0;
+					S32 cur_submeshes = model->getNumVolumeFaces();
+
+					for (S32 j = 0; j < cur_submeshes; ++j)
+					{ //for each submesh (face), add triangles and vertices to current total
+						const LLVolumeFace& face = model->getVolumeFace(j);
+						cur_tris += face.mNumIndices/3;
+						cur_verts += face.mNumVertices;
+					}
 
-			//add this model to the lod total
-			total_tris[lod] += cur_tris;
-			total_verts[lod] += cur_verts;
-			total_submeshes[lod] += cur_submeshes;
+					//add this model to the lod total
+					total_tris[lod] += cur_tris;
+					total_verts[lod] += cur_verts;
+					total_submeshes[lod] += cur_submeshes;
 
-			//store this model's counts to asset data
-			tris[lod].push_back(cur_tris);
-			verts[lod].push_back(cur_verts);
-			submeshes[lod].push_back(cur_submeshes);
+					//store this model's counts to asset data
+					tris[lod].push_back(cur_tris);
+					verts[lod].push_back(cur_verts);
+					submeshes[lod].push_back(cur_submeshes);
+				}
+			}
 		}
 	}
 
@@ -4411,34 +4436,38 @@ void LLModelPreview::updateStatusMessages()
 	}
 	
 	//add up physics triangles etc
-	S32 start = 0;
-	S32 end = mModel[LLModel::LOD_PHYSICS].size();
-
 	S32 phys_tris = 0;
 	S32 phys_hulls = 0;
 	S32 phys_points = 0;
 
-	for (S32 i = start; i < end; ++i)
-	{ //add up hulls and points and triangles for selected mesh(es)
-		LLModel* model = mModel[LLModel::LOD_PHYSICS][i];
-		S32 cur_submeshes = model->getNumVolumeFaces();
-
-		LLModel::convex_hull_decomposition& decomp = model->mPhysics.mHull;
-
-		if (!decomp.empty())
+	//get the triangle count for the whole scene
+	for (LLModelLoader::scene::iterator iter = mScene[LLModel::LOD_PHYSICS].begin(), endIter = mScene[LLModel::LOD_PHYSICS].end(); iter != endIter; ++iter)
+	{
+		for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance)
 		{
-			phys_hulls += decomp.size();
-			for (U32 i = 0; i < decomp.size(); ++i)
+			LLModel* model = instance->mModel;
+			if (model)
 			{
-				phys_points += decomp[i].size();
-			}
-		}
-		else
-		{ //choose physics shape OR decomposition, can't use both
-			for (S32 j = 0; j < cur_submeshes; ++j)
-			{ //for each submesh (face), add triangles and vertices to current total
-				const LLVolumeFace& face = model->getVolumeFace(j);
-				phys_tris += face.mNumIndices/3;
+				S32 cur_submeshes = model->getNumVolumeFaces();
+
+				LLModel::convex_hull_decomposition& decomp = model->mPhysics.mHull;
+
+				if (!decomp.empty())
+				{
+					phys_hulls += decomp.size();
+					for (U32 i = 0; i < decomp.size(); ++i)
+					{
+						phys_points += decomp[i].size();
+					}
+				}
+				else
+				{ //choose physics shape OR decomposition, can't use both
+					for (S32 j = 0; j < cur_submeshes; ++j)
+					{ //for each submesh (face), add triangles and vertices to current total
+						const LLVolumeFace& face = model->getVolumeFace(j);
+						phys_tris += face.mNumIndices/3;
+					}
+				}
 			}
 		}
 	}
-- 
cgit v1.2.3


From 8039c4583e68b7090fffea28b388fffd61d4b443 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Tue, 23 Oct 2012 14:31:34 -0500
Subject: MAINT-1567 cleanup some gcc warnings

---
 indra/newview/llfloatermodelpreview.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 6d0d9f67d5..ea839e6f5a 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -3942,7 +3942,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 		{
 			limit = mFMP->childGetValue("lod_triangle_limit_" + lod_name[which_lod]).asInteger();
 			//convert from "scene wide" to "non-instanced" triangle limit
-			limit *= triangle_ratio;
+			limit = (S32) ( (F32) limit*triangle_ratio );
 		}
 	}
 	else
@@ -4048,7 +4048,7 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 		U32 actual_verts = 0;
 		U32 submeshes = 0;
 
-		mRequestedTriangleCount[lod] = triangle_count/triangle_ratio;
+		mRequestedTriangleCount[lod] = (S32) ( (F32) triangle_count / triangle_ratio );
 		mRequestedErrorThreshold[lod] = lod_error_threshold;
 
 		glodGroupParameteri(mGroup, GLOD_ADAPT_MODE, lod_mode);
-- 
cgit v1.2.3


From 9b8cd0e923440d6c37f9b97aef29edec6ac09dbc Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Tue, 23 Oct 2012 17:31:44 -0500
Subject: MAINT-1579 Fix for diffuse color being ignored in mesh import preview
 render.

---
 indra/newview/app_settings/shaders/class1/objects/previewV.glsl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index f2db314201..da3387e7a5 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -61,5 +61,5 @@ void main()
 	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
 	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
 		
-	vertex_color = col;
+	vertex_color = col*color;
 }
-- 
cgit v1.2.3


From d41eaa2e3d9eeaeb06a593d9e3dcbdd4174cecea Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Thu, 25 Oct 2012 09:54:04 -0700
Subject: MAINT-1743 "Use Selection for Grid" does not change the grid ruler to
 "Reference"  in the tools floater Reviewed with Simon.

---
 indra/newview/llfloatertools.cpp | 11 +++++++++++
 indra/newview/llfloatertools.h   |  2 ++
 indra/newview/llselectmgr.cpp    |  3 ---
 indra/newview/llselectmgr.h      |  2 --
 indra/newview/llviewermenu.cpp   |  1 +
 5 files changed, 14 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 48484786f6..1eb7f4469a 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -1055,6 +1055,17 @@ void commit_grid_mode(LLUICtrl *ctrl)
 	LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
 }
 
+// static
+void LLFloaterTools::setGridMode(S32 mode)
+{
+	LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build");
+	if (!tools_floater || !tools_floater->mComboGridMode)
+	{
+		return;
+	}
+
+	tools_floater->mComboGridMode->setCurrentByIndex(mode);
+}
 
 void LLFloaterTools::onClickGridOptions()
 {
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index 7a19d093a4..ecb0092a6f 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -107,6 +107,8 @@ public:
 	bool selectedMediaEditable();
 	void updateLandImpacts();
 
+	static void setGridMode(S32 mode);
+
 private:
 	void refresh();
 	void refreshMedia();
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 9c4c594280..343316d30a 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -211,7 +211,6 @@ LLSelectMgr::LLSelectMgr()
 
 	mGridMode = GRID_MODE_WORLD;
 	gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD);
-	mGridValid = FALSE;
 
 	mSelectedObjects = new LLObjectSelection();
 	mHoverObjects = new LLObjectSelection();
@@ -1170,7 +1169,6 @@ void LLSelectMgr::setGridMode(EGridMode mode)
 	mGridMode = mode;
 	gSavedSettings.setS32("GridMode", mode);
 	updateSelectionCenter();
-	mGridValid = FALSE;
 }
 
 void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &scale)
@@ -1271,7 +1269,6 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
 	origin = mGridOrigin;
 	rotation = mGridRotation;
 	scale = mGridScale;
-	mGridValid = TRUE;
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index 9257ee9eeb..cc78e35869 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -769,8 +769,6 @@ private:
 	LLVector3				mGridOrigin;
 	LLVector3				mGridScale;
 	EGridMode				mGridMode;
-	BOOL					mGridValid;
-
 
 	BOOL					mTEMode;			// render te
 	LLVector3d				mSelectionCenterGlobal;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 9d79d99204..c66fbb006b 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -7477,6 +7477,7 @@ class LLToolsUseSelectionForGrid : public view_listener_t
 		} func;
 		LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func);
 		LLSelectMgr::getInstance()->setGridMode(GRID_MODE_REF_OBJECT);
+		LLFloaterTools::setGridMode((S32)GRID_MODE_REF_OBJECT);
 		return true;
 	}
 };
-- 
cgit v1.2.3


From b014d949d7a294068dfe2367faee8f2006ec22af Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Thu, 25 Oct 2012 10:53:58 -0700
Subject: MAINT-1275 [SECURITY] Web session tokens saved in SecondLife.log
 reviewed with Simon

---
 indra/newview/llviewermedia.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 1eb4bedfaf..ec48fa553b 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -316,9 +316,13 @@ public:
 	/* virtual */ void completedHeader(U32 status, const std::string& reason, const LLSD& content)
 	{
 		LL_WARNS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL;
-		LL_WARNS("MediaAuth") << content << LL_ENDL;
+
+		LLSD stripped_content = content;
+		stripped_content.erase("set-cookie");
+		LL_WARNS("MediaAuth") << stripped_content << LL_ENDL;
 
 		std::string cookie = content["set-cookie"].asString();
+		LL_DEBUGS("MediaAuth") << "cookie = " << cookie << LL_ENDL;
 
 		LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, mHost);
 
-- 
cgit v1.2.3


From 002634a41bcaa29fbc8ed6a20ef60230185bf1a2 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 26 Oct 2012 11:17:06 -0500
Subject: MAINT-1311 Add some logging and assertions to help track down mesh
 loading errors.

---
 indra/newview/llmeshrepository.cpp | 60 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 58 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 57a5569dd7..4cd50ecd15 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -204,15 +204,18 @@ class LLMeshHeaderResponder : public LLCurl::Responder
 {
 public:
 	LLVolumeParams mMeshParams;
-	
+	bool mProcessed;
+
 	LLMeshHeaderResponder(const LLVolumeParams& mesh_params)
 		: mMeshParams(mesh_params)
 	{
 		LLMeshRepoThread::sActiveHeaderRequests++;
+		mProcessed = false;
 	}
 
 	~LLMeshHeaderResponder()
 	{
+		llassert(mProcessed);
 		LLMeshRepoThread::sActiveHeaderRequests--;
 	}
 
@@ -229,15 +232,18 @@ public:
 	S32 mLOD;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshLODResponder(const LLVolumeParams& mesh_params, S32 lod, U32 offset, U32 requested_bytes)
 		: mMeshParams(mesh_params), mLOD(lod), mOffset(offset), mRequestedBytes(requested_bytes)
 	{
 		LLMeshRepoThread::sActiveLODRequests++;
+		mProcessed = false;
 	}
 
 	~LLMeshLODResponder()
 	{
+		llassert(mProcessed);
 		LLMeshRepoThread::sActiveLODRequests--;
 	}
 
@@ -253,10 +259,17 @@ public:
 	LLUUID mMeshID;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshSkinInfoResponder(const LLUUID& id, U32 offset, U32 size)
 		: mMeshID(id), mRequestedBytes(size), mOffset(offset)
 	{
+		mProcessed = false;
+	}
+
+	~LLMeshSkinInfoResponder()
+	{
+		llassert(mProcessed);
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
@@ -271,10 +284,17 @@ public:
 	LLUUID mMeshID;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshDecompositionResponder(const LLUUID& id, U32 offset, U32 size)
 		: mMeshID(id), mRequestedBytes(size), mOffset(offset)
 	{
+		mProcessed = false;
+	}
+
+	~LLMeshDecompositionResponder()
+	{
+		llassert(mProcessed);
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
@@ -289,10 +309,17 @@ public:
 	LLUUID mMeshID;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshPhysicsShapeResponder(const LLUUID& id, U32 offset, U32 size)
 		: mMeshID(id), mRequestedBytes(size), mOffset(offset)
 	{
+		mProcessed = false;
+	}
+
+	~LLMeshPhysicsShapeResponder()
+	{
+		llassert(mProcessed);
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
@@ -1819,6 +1846,7 @@ void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason,
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
 
 	S32 data_size = buffer->countAfter(channels.in(), NULL);
 
@@ -1831,11 +1859,13 @@ void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason,
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshLOD(mMeshParams, mLOD);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
@@ -1874,6 +1904,8 @@ void LLMeshSkinInfoResponder::completedRaw(U32 status, const std::string& reason
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+
 	S32 data_size = buffer->countAfter(channels.in(), NULL);
 
 	if (status < 200 || status > 400)
@@ -1885,11 +1917,13 @@ void LLMeshSkinInfoResponder::completedRaw(U32 status, const std::string& reason
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshSkinInfo(mMeshID);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
@@ -1928,6 +1962,8 @@ void LLMeshDecompositionResponder::completedRaw(U32 status, const std::string& r
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+
 	S32 data_size = buffer->countAfter(channels.in(), NULL);
 
 	if (status < 200 || status > 400)
@@ -1939,11 +1975,13 @@ void LLMeshDecompositionResponder::completedRaw(U32 status, const std::string& r
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshDecomposition(mMeshID);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
@@ -1982,6 +2020,8 @@ void LLMeshPhysicsShapeResponder::completedRaw(U32 status, const std::string& re
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+
 	S32 data_size = buffer->countAfter(channels.in(), NULL);
 
 	if (status < 200 || status > 400)
@@ -1993,11 +2033,13 @@ void LLMeshPhysicsShapeResponder::completedRaw(U32 status, const std::string& re
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshPhysicsShape(mMeshID);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
@@ -2036,6 +2078,8 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+
 	if (status < 200 || status > 400)
 	{
 		//llwarns
@@ -2048,8 +2092,12 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
 		// TODO*: Add maximum retry logic, exponential backoff
 		// and (somewhat more optional than the others) retries
 		// again after some set period of time
+
+		llassert(status == 503 || status == 499);
+
 		if (status == 503 || status == 499)
 		{ //retry
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			LLMeshRepoThread::HeaderRequest req(mMeshParams);
 			LLMutexLock lock(gMeshRepo.mThread->mMutex);
@@ -2057,6 +2105,10 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
 
 			return;
 		}
+		else
+		{
+			llwarns << "Unhandled status." << llendl;
+		}
 	}
 
 	S32 data_size = buffer->countAfter(channels.in(), NULL);
@@ -2071,7 +2123,11 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason,
 
 	LLMeshRepository::sBytesReceived += llmin(data_size, 4096);
 
-	if (!gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size))
+	bool success = gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size);
+	
+	llassert(success);
+
+	if (!success)
 	{
 		llwarns
 			<< "Unable to parse mesh header: "
-- 
cgit v1.2.3


From 58a73b4fc1e39df13c3c11a6f286cdeeace26c4f Mon Sep 17 00:00:00 2001
From: "simon@Simon-PC.lindenlab.com" <simon@Simon-PC.lindenlab.com>
Date: Mon, 29 Oct 2012 13:10:37 -0700
Subject: MAINT-1791 : Parcel media clear list crash.  Reviewed by Kelly

---
 indra/llmessage/llurlrequest.cpp    | 7 +++++--
 indra/newview/llfloaterurlentry.cpp | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 5831c3c1c1..227efdb07a 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -356,7 +356,8 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
 			}
 		}
 
-		while(1)
+		bool keep_looping = true;
+		while(keep_looping)
 		{
 			CURLcode result;
 
@@ -408,8 +409,9 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
 				case CURLE_FAILED_INIT:
 				case CURLE_COULDNT_CONNECT:
 					status = STATUS_NO_CONNECTION;
+					keep_looping = false;
 					break;
-				default:
+				default:			// CURLE_URL_MALFORMAT
 					llwarns << "URLRequest Error: " << result
 							<< ", "
 							<< LLCurl::strerror(result)
@@ -417,6 +419,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl(
 							<< (mDetail->mURL.empty() ? "<EMPTY URL>" : mDetail->mURL)
 							<< llendl;
 					status = STATUS_ERROR;
+					keep_looping = false;
 					break;
 			}
 		}
diff --git a/indra/newview/llfloaterurlentry.cpp b/indra/newview/llfloaterurlentry.cpp
index 151cd2a1cd..e85d849c9a 100644
--- a/indra/newview/llfloaterurlentry.cpp
+++ b/indra/newview/llfloaterurlentry.cpp
@@ -219,7 +219,8 @@ void LLFloaterURLEntry::onBtnOK( void* userdata )
 	}
 
 	// Discover the MIME type only for "http" scheme.
-	if(scheme == "http" || scheme == "https")
+	if(!media_url.empty() && 
+	   (scheme == "http" || scheme == "https"))
 	{
 		LLHTTPClient::getHeaderOnly( media_url,
 			new LLMediaTypeResponder(self->getHandle()));
-- 
cgit v1.2.3


From 2126cdb9a25da4dcc4c81659038b85bcff17c4ee Mon Sep 17 00:00:00 2001
From: "simon@Simon-PC.lindenlab.com" <simon@Simon-PC.lindenlab.com>
Date: Wed, 31 Oct 2012 15:05:52 -0700
Subject: MAINT-1560 : Make Slow Motion Animations affect all avatars.  Added
 new menu. Reviewed by Kelly

---
 indra/llcharacter/llmotioncontroller.cpp           |  3 +-
 indra/llcharacter/llmotioncontroller.h             |  6 ++-
 indra/newview/llviewermenu.cpp                     | 53 ++++++++++++++++++++++
 indra/newview/skins/default/xui/en/menu_viewer.xml | 44 ++++++++++++++----
 4 files changed, 94 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp
index 829dda9993..e9fb91ad73 100644
--- a/indra/llcharacter/llmotioncontroller.cpp
+++ b/indra/llcharacter/llmotioncontroller.cpp
@@ -42,6 +42,7 @@ const U32 MAX_MOTION_INSTANCES = 32;
 //-----------------------------------------------------------------------------
 // Constants and statics
 //-----------------------------------------------------------------------------
+F32 LLMotionController::sCurrentTimeFactor = 1.f;
 LLMotionRegistry LLMotionController::sRegistry;
 
 //-----------------------------------------------------------------------------
@@ -125,7 +126,7 @@ LLMotion *LLMotionRegistry::createMotion( const LLUUID &id )
 // Class Constructor
 //-----------------------------------------------------------------------------
 LLMotionController::LLMotionController()
-	: mTimeFactor(1.f),
+	: mTimeFactor(sCurrentTimeFactor),
 	  mCharacter(NULL),
 	  mAnimTime(0.f),
 	  mPrevTimerElapsed(0.f),
diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h
index b996f708d2..52eaf557b1 100644
--- a/indra/llcharacter/llmotioncontroller.h
+++ b/indra/llcharacter/llmotioncontroller.h
@@ -168,6 +168,9 @@ public:
 
 	const LLFrameTimer& getFrameTimer() { return mTimer; }
 
+	static F32	getCurrentTimeFactor()				{ return sCurrentTimeFactor;	};
+	static void setCurrentTimeFactor(F32 factor)	{ sCurrentTimeFactor = factor;	};
+
 protected:
 	// internal operations act on motion instances directly
 	// as there can be duplicate motions per id during blending overlap
@@ -187,7 +190,8 @@ protected:
 	void deactivateStoppedMotions();
 
 protected:
-	F32					mTimeFactor;
+	F32					mTimeFactor;			// 1.f for normal speed
+	static F32			sCurrentTimeFactor;		// Value to use for initialization
 	static LLMotionRegistry	sRegistry;
 	LLPoseBlender		mPoseBlender;
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index c66fbb006b..d69acbbd07 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -1638,6 +1638,54 @@ class LLAdvancedForceParamsToDefault : public view_listener_t
 };
 
 
+//////////////////////////
+//   ANIMATION SPEED    //
+//////////////////////////
+
+// Utility function to set all AV time factors to the same global value
+static void set_all_animation_time_factors(F32	time_factor)
+{
+	LLMotionController::setCurrentTimeFactor(time_factor);
+	for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+		iter != LLCharacter::sInstances.end(); ++iter)
+	{
+		(*iter)->setAnimTimeFactor(time_factor);
+	}
+}
+
+class LLAdvancedAnimTenFaster : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		//llinfos << "LLAdvancedAnimTenFaster" << llendl;
+		F32 time_factor = LLMotionController::getCurrentTimeFactor();
+		time_factor = llmin(time_factor + 0.1f, 2.f);	// Upper limit is 200% speed
+		set_all_animation_time_factors(time_factor);
+		return true;
+	}
+};
+
+class LLAdvancedAnimTenSlower : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		//llinfos << "LLAdvancedAnimTenSlower" << llendl;
+		F32 time_factor = LLMotionController::getCurrentTimeFactor();
+		time_factor = llmax(time_factor - 0.1f, 0.1f);	// Lower limit is at 10% of normal speed
+		set_all_animation_time_factors(time_factor);
+		return true;
+	}
+};
+
+class LLAdvancedAnimResetAll : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		set_all_animation_time_factors(1.f);
+		return true;
+	}
+};
+
 
 //////////////////////////
 // RELOAD VERTEX SHADER //
@@ -8407,6 +8455,11 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLAdvancedTestMale(), "Advanced.TestMale");
 	view_listener_t::addMenu(new LLAdvancedTestFemale(), "Advanced.TestFemale");
 	
+	// Advanced > Character > Animation Speed
+	view_listener_t::addMenu(new LLAdvancedAnimTenFaster(), "Advanced.AnimTenFaster");
+	view_listener_t::addMenu(new LLAdvancedAnimTenSlower(), "Advanced.AnimTenSlower");
+	view_listener_t::addMenu(new LLAdvancedAnimResetAll(), "Advanced.AnimResetAll");
+
 	// Advanced > Character (toplevel)
 	view_listener_t::addMenu(new LLAdvancedForceParamsToDefault(), "Advanced.ForceParamsToDefault");
 	view_listener_t::addMenu(new LLAdvancedReloadVertexShader(), "Advanced.ReloadVertexShader");
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 59d268c53a..0fc1982a86 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -3178,6 +3178,40 @@
                      parameter="AllowSelectAvatar" />
                 </menu_item_check>
             </menu>
+            <menu
+             create_jump_keys="true"
+             label="Animation Speed"
+             name="Animation Speed"
+             tear_off="true">
+                <menu_item_call
+                 label="All Animations 10% Faster"
+                 name="All Animations 10 Faster">
+                    <menu_item_call.on_click
+                     function="Advanced.AnimTenFaster" />
+                </menu_item_call>
+                <menu_item_call
+                 label="All Animations 10% Slower"
+                 name="All Animations 10 Slower">
+                    <menu_item_call.on_click
+                     function="Advanced.AnimTenSlower" />
+                </menu_item_call>
+                <menu_item_call
+                 label="Reset All Animation Speed"
+                 name="Reset All Animation Speed">
+                    <menu_item_call.on_click
+                     function="Advanced.AnimResetAll" />
+                </menu_item_call>
+				<menu_item_check
+				 label="Slow Motion Animations"
+				 name="Slow Motion Animations">
+					<menu_item_check.on_check
+					 function="CheckControl"
+					 parameter="SlowMotionAnimation" />
+					<menu_item_check.on_click
+					 function="ToggleControl"
+					 parameter="SlowMotionAnimation" />
+				</menu_item_check>
+            </menu>
             <menu_item_call
              label="Force Params to Default"
              name="Force Params to Default">
@@ -3194,16 +3228,6 @@
                  function="Advanced.ToggleAnimationInfo"
                  parameter="" />
             </menu_item_check>
-            <menu_item_check
-             label="Slow Motion Animations"
-             name="Slow Motion Animations">
-                <menu_item_check.on_check
-                 function="CheckControl"
-                 parameter="SlowMotionAnimation" />
-                <menu_item_check.on_click
-                 function="ToggleControl"
-                 parameter="SlowMotionAnimation" />
-            </menu_item_check>
             <menu_item_check
              label="Show Look At"
              name="Show Look At">
-- 
cgit v1.2.3


From 460002b134d1bd0f12e20ebdc8fecd1958cdb59f Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Thu, 8 Nov 2012 13:54:28 -0600
Subject: MAINT-1311 Followup on logging and assertions of mesh loading errors

---
 indra/newview/llmeshrepository.cpp | 64 ++++++++++++++++++++++++++++++++++----
 indra/newview/llmeshrepository.h   |  6 ++++
 2 files changed, 64 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 4cd50ecd15..4345434f65 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -209,14 +209,23 @@ public:
 	LLMeshHeaderResponder(const LLVolumeParams& mesh_params)
 		: mMeshParams(mesh_params)
 	{
-		LLMeshRepoThread::sActiveHeaderRequests++;
+		LLMeshRepoThread::incActiveHeaderRequests();
 		mProcessed = false;
 	}
 
 	~LLMeshHeaderResponder()
 	{
-		llassert(mProcessed);
-		LLMeshRepoThread::sActiveHeaderRequests--;
+		if (!mProcessed && !LLApp::isQuitting())
+		{ //something went wrong, retry
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
+			LLMeshRepository::sHTTPRetryCount++;
+			LLMeshRepoThread::HeaderRequest req(mMeshParams);
+			LLMutexLock lock(gMeshRepo.mThread->mMutex);
+			gMeshRepo.mThread->mHeaderReqQ.push(req);
+
+		}
+
+		LLMeshRepoThread::decActiveHeaderRequests();
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
@@ -237,14 +246,19 @@ public:
 	LLMeshLODResponder(const LLVolumeParams& mesh_params, S32 lod, U32 offset, U32 requested_bytes)
 		: mMeshParams(mesh_params), mLOD(lod), mOffset(offset), mRequestedBytes(requested_bytes)
 	{
-		LLMeshRepoThread::sActiveLODRequests++;
+		LLMeshRepoThread::incActiveLODRequests();
 		mProcessed = false;
 	}
 
 	~LLMeshLODResponder()
 	{
-		llassert(mProcessed);
-		LLMeshRepoThread::sActiveLODRequests--;
+		if (!mProcessed && !LLApp::isQuitting())
+		{
+			llwarns << "Killed without being processed, retrying." << llendl;
+			LLMeshRepository::sHTTPRetryCount++;
+			gMeshRepo.mThread->lockAndLoadMeshLOD(mMeshParams, mLOD);
+		}
+		LLMeshRepoThread::decActiveLODRequests();
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
@@ -665,6 +679,16 @@ void LLMeshRepoThread::loadMeshPhysicsShape(const LLUUID& mesh_id)
 	mPhysicsShapeRequests.insert(mesh_id);
 }
 
+void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
+{
+	if (!LLAppViewer::isQuitting())
+	{
+		LLMutexLock lock(mSignal);
+		loadMeshLOD(mesh_params, lod);
+	}
+}
+
+
 
 void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
 { //protected by mSignal, no locking needed here
@@ -972,6 +996,34 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
 	return ret;
 }
 
+//static
+void LLMeshRepoThread::incActiveLODRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	++LLMeshRepoThread::sActiveLODRequests;
+}
+
+//static
+void LLMeshRepoThread::decActiveLODRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	--LLMeshRepoThread::sActiveLODRequests;
+}
+
+//static
+void LLMeshRepoThread::incActiveHeaderRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	++LLMeshRepoThread::sActiveHeaderRequests;
+}
+
+//static
+void LLMeshRepoThread::decActiveHeaderRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	--LLMeshRepoThread::sActiveHeaderRequests;
+}
+
 //return false if failed to get header
 bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count)
 {
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index 6e301c26a2..8eaf691d6f 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -322,7 +322,9 @@ public:
 
 	virtual void run();
 
+	void lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
 	void loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
+
 	bool fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count);
 	bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U32& count);
 	bool headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size);
@@ -351,6 +353,10 @@ public:
 	//  (should hold onto mesh_id and try again later if header info does not exist)
 	bool fetchMeshPhysicsShape(const LLUUID& mesh_id);
 
+	static void incActiveLODRequests();
+	static void decActiveLODRequests();
+	static void incActiveHeaderRequests();
+	static void decActiveHeaderRequests();
 
 };
 
-- 
cgit v1.2.3


From a1d60fc2193a70044d9cc689cffcadbf40743336 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 9 Nov 2012 14:43:25 -0600
Subject: MAINT-1311 Thread safe handling of retries on mesh loading failures.

---
 indra/newview/llmeshrepository.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 4345434f65..5a29bb9e7b 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -683,7 +683,6 @@ void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32
 {
 	if (!LLAppViewer::isQuitting())
 	{
-		LLMutexLock lock(mSignal);
 		loadMeshLOD(mesh_params, lod);
 	}
 }
@@ -691,14 +690,13 @@ void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32
 
 
 void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
-{ //protected by mSignal, no locking needed here
-
+{ //could be called from any thread
+	LLMutexLock lock(mMutex);
 	mesh_header_map::iterator iter = mMeshHeader.find(mesh_params.getSculptID());
 	if (iter != mMeshHeader.end())
 	{ //if we have the header, request LOD byte range
 		LODRequest req(mesh_params, lod);
 		{
-			LLMutexLock lock(mMutex);
 			mLODReqQ.push(req);
 			LLMeshRepository::sLODProcessing++;
 		}
@@ -716,7 +714,6 @@ void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
 		}
 		else
 		{ //if no header request is pending, fetch header
-			LLMutexLock lock(mMutex);
 			mHeaderReqQ.push(req);
 			mPendingLOD[mesh_params].push_back(lod);
 		}
-- 
cgit v1.2.3


From a567c425cab9b7aff8acee11aaf3470187675271 Mon Sep 17 00:00:00 2001
From: Maestro Linden <maestro@lindenlab.com>
Date: Wed, 14 Nov 2012 02:24:58 +0000
Subject: MAINT-536 MAINT-1913 Added missing URL scheme filtering to the Linux
 viewer, changed URL scheme whitelist. Reviewed by Callum.

---
 indra/llwindow/llwindow.cpp    |  7 ++++---
 indra/llwindow/llwindow.h      |  2 +-
 indra/llwindow/llwindowsdl.cpp | 17 +++++++++++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 5b7424acbb..93b9d36939 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -50,14 +50,15 @@ LLSplashScreen *gSplashScreenp = NULL;
 BOOL gDebugClicks = FALSE;
 BOOL gDebugWindowProc = FALSE;
 
-const S32 gURLProtocolWhitelistCount = 3;
-const std::string gURLProtocolWhitelist[] = { "file:", "http:", "https:" };
+const S32 gURLProtocolWhitelistCount = 4;
+const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:" };
 
 // CP: added a handler list - this is what's used to open the protocol and is based on registry entry
 //	   only meaningful difference currently is that file: protocols are opened using http:
 //	   since no protocol handler exists in registry for file:
 //     Important - these lists should match - protocol to handler
-const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };	
+// Maestro: This list isn't referenced anywhere that I could find
+//const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };	
 
 
 S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 4da87f4e06..e9147d552e 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -280,7 +280,7 @@ extern BOOL gDebugWindowProc;
 // Protocols, like "http" and "https" we support in URLs
 extern const S32 gURLProtocolWhitelistCount;
 extern const std::string gURLProtocolWhitelist[];
-extern const std::string gURLProtocolWhitelistHandler[];
+//extern const std::string gURLProtocolWhitelistHandler[];
 
 void simpleEscapeString ( std::string& stringIn  );
 
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 3bf4a48cb6..5afe0b0953 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -2516,6 +2516,23 @@ void exec_cmd(const std::string& cmd, const std::string& arg)
 // Must begin with protocol identifier.
 void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
 {
+	bool found = false;
+	S32 i;
+	for (i = 0; i < gURLProtocolWhitelistCount; i++)
+	{
+		if (escaped_url.find(gURLProtocolWhitelist[i]) != std::string::npos)
+		{
+			found = true;
+			break;
+		}
+	}
+
+	if (!found)
+	{
+		llwarns << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << llendl;
+		return;
+	}
+
 	llinfos << "spawn_web_browser: " << escaped_url << llendl;
 	
 #if LL_LINUX || LL_SOLARIS
-- 
cgit v1.2.3


From ace013d26ce1cf972d991dedcfce1c5ef3c6e499 Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Fri, 16 Nov 2012 16:22:17 -0800
Subject: MAINT-1942 Increase maximum animation length from 30 seconds to 60
 seconds reviewed with Simon

---
 indra/llcharacter/llbvhconsts.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llcharacter/llbvhconsts.h b/indra/llcharacter/llbvhconsts.h
index d363a6e595..b06c279b8f 100644
--- a/indra/llcharacter/llbvhconsts.h
+++ b/indra/llcharacter/llbvhconsts.h
@@ -27,7 +27,7 @@
 #ifndef LL_LLBVHCONSTS_H
 #define LL_LLBVHCONSTS_H
 
-const F32 MAX_ANIM_DURATION = 30.f;
+const F32 MAX_ANIM_DURATION = 60.f;
 
 typedef enum e_constraint_type
 	{
-- 
cgit v1.2.3


From 7491fbd677148e38898bb1a39d00ffd15e803ed4 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 19 Nov 2012 17:40:43 -0600
Subject: MAINT-1841 Use NVAPI to force NVIDIA GPU power management mode to
 prefer max performance

Reviewed by Simon.
---
 indra/cmake/NVAPI.cmake            |  17 +++++
 indra/newview/CMakeLists.txt       |   2 +
 indra/newview/llappviewerwin32.cpp | 123 +++++++++++++++++++++++++++++++++++++
 3 files changed, 142 insertions(+)
 create mode 100644 indra/cmake/NVAPI.cmake

(limited to 'indra')

diff --git a/indra/cmake/NVAPI.cmake b/indra/cmake/NVAPI.cmake
new file mode 100644
index 0000000000..78989c408f
--- /dev/null
+++ b/indra/cmake/NVAPI.cmake
@@ -0,0 +1,17 @@
+# -*- cmake -*-
+include(Prebuilt)
+
+set(NVAPI ON CACHE BOOL "Use NVAPI.")
+
+if (NVAPI)
+  use_prebuilt_binary(nvapi)
+  
+  if (WINDOWS)
+    set(NVAPI_LIBRARY nvapi)
+  else (WINDOWS)
+    set(NVAPI_LIBRARY "")
+  endif (WINDOWS)
+else (NVAPI)
+  set(NVAPI_LIBRARY "")
+endif (NVAPI)
+
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 89def532c9..6d8b04c9f3 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -34,6 +34,7 @@ include(LLXML)
 include(LScript)
 include(Linking)
 include(NDOF)
+include(NVAPI)
 include(GooglePerfTools)
 include(TemplateCheck)
 include(UI)
@@ -1812,6 +1813,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${LLMATH_LIBRARIES}
     ${LLCOMMON_LIBRARIES}
     ${NDOF_LIBRARY}
+    ${NVAPI_LIBRARY}
     ${HUNSPELL_LIBRARY}
     ${viewer_LIBRARIES}
     ${BOOST_PROGRAM_OPTIONS_LIBRARY}
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 510ec47a31..23eb558755 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -46,6 +46,11 @@
 #include "llviewercontrol.h"
 #include "lldxhardware.h"
 
+#include "nvapi/nvapi.h"
+#include "nvapi/NvApiDriverSettings.h"
+
+#include <stdlib.h>
+
 #include "llweb.h"
 #include "llsecondlifeurls.h"
 
@@ -60,6 +65,7 @@
 #include "llwindebug.h"
 #endif
 
+
 // *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib
 // The lib was compiled under VS2005 - in VS2003 we need to remap assert
 #ifdef LL_DEBUG
@@ -75,6 +81,20 @@ extern "C" {
 
 const std::string LLAppViewerWin32::sWindowClass = "Second Life";
 
+/*
+    This function is used to print to the command line a text message 
+    describing the nvapi error and quits
+*/
+void nvapi_error(NvAPI_Status status)
+{
+    NvAPI_ShortString szDesc = {0};
+	NvAPI_GetErrorMessage(status, szDesc);
+	llwarns << szDesc << llendl;
+
+	//should always trigger when asserts are enabled
+	llassert(status == NVAPI_OK);
+}
+
 // Create app mutex creates a unique global windows object. 
 // If the object can be created it returns true, otherwise
 // it returns false. The false result can be used to determine 
@@ -96,6 +116,79 @@ bool create_app_mutex()
 	return result;
 }
 
+void ll_nvapi_init(NvDRSSessionHandle hSession)
+{
+	// (2) load all the system settings into the session
+	NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession);
+	if (status != NVAPI_OK) 
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	NvAPI_UnicodeString profile_name;
+	std::string app_name = LLTrans::getString("APP_NAME");
+	llutf16string w_app_name = utf8str_to_utf16str(app_name);
+	wsprintf(profile_name, L"%s", w_app_name.c_str());
+	status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name);
+	if (status != NVAPI_OK)
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	// (3) Obtain the current profile. 
+	NvDRSProfileHandle hProfile = 0;
+	status = NvAPI_DRS_GetCurrentGlobalProfile(hSession, &hProfile);
+	if (status != NVAPI_OK) 
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	// load settings for querying 
+	status = NvAPI_DRS_LoadSettings(hSession);
+	if (status != NVAPI_OK)
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	//get the preferred power management mode for Second Life
+	NVDRS_SETTING drsSetting = {0};
+	drsSetting.version = NVDRS_SETTING_VER;
+	status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
+	if (status == NVAPI_SETTING_NOT_FOUND)
+	{ //only override if the user hasn't specifically set this setting
+		// (4) Specify that we want the VSYNC disabled setting
+		// first we fill the NVDRS_SETTING struct, then we call the function
+		drsSetting.version = NVDRS_SETTING_VER;
+		drsSetting.settingId = PREFERRED_PSTATE_ID;
+		drsSetting.settingType = NVDRS_DWORD_TYPE;
+		drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX;
+		status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
+		if (status != NVAPI_OK) 
+		{
+			nvapi_error(status);
+			return;
+		}
+	}
+	else if (status != NVAPI_OK)
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	
+
+	// (5) Now we apply (or save) our changes to the system
+	status = NvAPI_DRS_SaveSettings(hSession);
+	if (status != NVAPI_OK) 
+	{
+		nvapi_error(status);
+	}
+}
+
 //#define DEBUGGING_SEH_FILTER 1
 #if DEBUGGING_SEH_FILTER
 #	define WINMAIN DebuggingWinMain
@@ -165,6 +258,27 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 		return -1;
 	}
 	
+	NvAPI_Status status;
+    
+	// Initialize NVAPI
+	status = NvAPI_Initialize();
+	NvDRSSessionHandle hSession = 0;
+
+    if (status == NVAPI_OK) 
+	{
+		// Create the session handle to access driver settings
+		status = NvAPI_DRS_CreateSession(&hSession);
+		if (status != NVAPI_OK) 
+		{
+			nvapi_error(status);
+		}
+		else
+		{
+			//override driver setting as needed
+			ll_nvapi_init(hSession);
+		}
+	}
+
 	// Have to wait until after logging is initialized to display LFH info
 	if (num_heaps > 0)
 	{
@@ -232,6 +346,15 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
 		LLAppViewer::sUpdaterInfo = NULL ;
 	}
 
+
+
+	// (NVAPI) (6) We clean up. This is analogous to doing a free()
+	if (hSession)
+	{
+		NvAPI_DRS_DestroySession(hSession);
+		hSession = 0;
+	}
+	
 	return 0;
 }
 
-- 
cgit v1.2.3


From f5b4a0af6415711f4950ad9ef288490caee5cf4f Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 19 Nov 2012 18:30:13 -0600
Subject: MAINT-1841 Fix for mac/linux build

---
 indra/cmake/NVAPI.cmake | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/NVAPI.cmake b/indra/cmake/NVAPI.cmake
index 78989c408f..105f442a30 100644
--- a/indra/cmake/NVAPI.cmake
+++ b/indra/cmake/NVAPI.cmake
@@ -4,9 +4,8 @@ include(Prebuilt)
 set(NVAPI ON CACHE BOOL "Use NVAPI.")
 
 if (NVAPI)
-  use_prebuilt_binary(nvapi)
-  
   if (WINDOWS)
+    use_prebuilt_binary(nvapi)
     set(NVAPI_LIBRARY nvapi)
   else (WINDOWS)
     set(NVAPI_LIBRARY "")
-- 
cgit v1.2.3


From 8db983fb8095f25873b8317fd1f4764abce4a31b Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Tue, 20 Nov 2012 16:50:23 -0600
Subject: MAINT-1270 Fix for flexi prims showing up as discs when first
 loading.

Reviewed by Stinson.
---
 indra/newview/llflexibleobject.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp
index a37e27363f..ade469e50d 100644
--- a/indra/newview/llflexibleobject.cpp
+++ b/indra/newview/llflexibleobject.cpp
@@ -66,7 +66,7 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD
 	mSimulateRes = 0;
 	mFrameNum = 0;
 	mCollisionSphereRadius = 0.f;
-	mRenderRes = 1;
+	mRenderRes = -1;
 	
 	if(mVO->mDrawable.notNull())
 	{
@@ -350,16 +350,17 @@ void LLVolumeImplFlexible::doIdleUpdate()
 		{
 			bool visible = drawablep->isVisible();
 
-			if ((mSimulateRes == 0) && visible)
+			if (mRenderRes == -1)
 			{
 				updateRenderRes();
 				gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE);
+				sUpdateDelay[mInstanceIndex] = 0;
 			}
 			else
 			{
 				F32 pixel_area = mVO->getPixelArea();
 
-				U32 update_period = (U32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f)))+1;
+				U32 update_period = (U32) (llmax((S32) (LLViewerCamera::getInstance()->getScreenPixelArea()*0.01f/(pixel_area*(sUpdateFactor+1.f))),0)+1);
 
 				if	(visible)
 				{
@@ -639,6 +640,7 @@ void LLVolumeImplFlexible::doFlexibleUpdate()
 	mSection[i].mdPosition = (mSection[i].mPosition - mSection[i-1].mPosition) * inv_section_length;
 
 	// Create points
+	llassert(mRenderRes > -1)
 	S32 num_render_sections = 1<<mRenderRes;
 	if (path->getPathLength() != num_render_sections+1)
 	{
-- 
cgit v1.2.3


From 0820124beedfc5d220eafc0cb865988f68864c4c Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 21 Nov 2012 16:15:35 -0600
Subject: MAINT-1950 Fix for offscreen objects not getting rebuilt sometimes.

---
 indra/newview/lldrawable.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 3cfcd88f04..b7270e696e 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -547,7 +547,7 @@ F32 LLDrawable::updateXform(BOOL undamped)
 			}
 		}
 	}
-	else if (!damped && isVisible())
+	else
 	{
 		dist_squared = dist_vec_squared(old_pos, target_pos);
 	}
-- 
cgit v1.2.3


From 4aa818055e04739dd0177b9e06e6edea62bf0981 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 26 Nov 2012 13:22:25 -0600
Subject: MAINT-1950 Add hashmarks to detail slider and put "Ultra" back in
 setGraphicsLevel

Reviewed by Simon
---
 indra/newview/llfeaturemanager.cpp                 |  4 +-
 .../default/xui/en/panel_preferences_graphics1.xml | 43 ++++++++++++++++++----
 2 files changed, 38 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 6f11d4d4ca..b211027d54 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -720,7 +720,9 @@ void LLFeatureManager::setGraphicsLevel(S32 level, bool skipFeatures)
 			maskFeatures("High");
 			maskFeatures("Class5");
 			break;
-		
+		case 6:
+			maskFeatures("Ultra");
+			break;
 		default:
 			maskFeatures("Low");
 			maskFeatures("Class0");
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index f7666bdc4c..849f3ef73d 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -55,30 +55,57 @@
      name="LowGraphicsDivet"
      top_delta="-2"
      width="2" />
+  <icon
+     color="0.12 0.12 0.12 1"
+     height="14"
+     image_name="Rounded_Square"
+     layout="topleft"
+     left_pad="41"
+     name="LowMidraphicsDivet"
+     top_delta="-2"
+     width="2" />
     <icon
      color="0.12 0.12 0.12 1"
      height="14"
      image_name="Rounded_Square"
      layout="topleft"
-     left_pad="83"
+     left_pad="41"
      name="MidGraphicsDivet"
      top_delta="0"
      width="2" />
+  <icon
+     color="0.12 0.12 0.12 1"
+     height="14"
+     image_name="Rounded_Square"
+     layout="topleft"
+     left_pad="41"
+     name="MidHighGraphicsDivet"
+     top_delta="0"
+     width="2" />
     <icon
      color="0.12 0.12 0.12 1"
      height="14"
      image_name="Rounded_Square"
      layout="topleft"
-     left_pad="85"
+     left_pad="41"
      name="HighGraphicsDivet"
      top_delta="0"
      width="2" />
+  <icon
+     color="0.12 0.12 0.12 1"
+     height="14"
+     image_name="Rounded_Square"
+     layout="topleft"
+     left_pad="41"
+     name="HighUltraGraphicsDivet"
+     top_delta="0"
+     width="2" />
     <icon
      color="0.12 0.12 0.12 1"
      height="14"
      image_name="Rounded_Square"
      layout="topleft"
-     left_pad="83"
+     left_pad="41"
      name="UltraGraphicsDivet"
      top_delta="0"
      width="2" />
@@ -91,7 +118,7 @@
      initial_value="0"
      layout="topleft"
      left="120"
-     max_val="3"
+     max_val="6"
      name="QualityPerformanceSelection"
      show_text="false"
      top_delta="-2"
@@ -120,12 +147,12 @@
      height="12"
      layout="topleft"
      left_delta="87"
-     name="ShadersPrefText2"
+     name="ShadersPrefText3"
      top_delta="0"
      width="80">
         Mid
     </text>
-    <text
+  <text
      type="string"
      length="1"
      follows="left|top"
@@ -136,8 +163,8 @@
      name="ShadersPrefText3"
      top_delta="0"
      width="80">
-        High
-    </text>
+      High
+  </text>
     <text
      type="string"
      length="1"
-- 
cgit v1.2.3


From e81a3453401a3d69fabb1278ec81dddfb4c3cc43 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 26 Nov 2012 14:02:32 -0600
Subject: MAINT-1953 Add NVIDIA GT 230 to gpu table

---
 indra/newview/gpu_table.txt | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra')

diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt
index 5e8189caa5..21c3cff952 100644
--- a/indra/newview/gpu_table.txt
+++ b/indra/newview/gpu_table.txt
@@ -375,6 +375,7 @@ NVIDIA GTS 150							.*NVIDIA .*GTS *15.*					2	1	0	0
 NVIDIA 205								.*NVIDIA .*GeForce 205.*				2	1	1	3.3
 NVIDIA 210								.*NVIDIA .*GeForce 210.*				3	1	1	3.3
 NVIDIA GT 220							.*NVIDIA .*GT *22.*						2	1	1	3.3
+NVIDIA GT 230							.*NVIDIA .*GT *23.*						2	1	1	3.3
 NVIDIA GTS 240							.*NVIDIA .*GTS *24.*					4	1	1	3.3
 NVIDIA GTS 250							.*NVIDIA .*GTS *25.*					4	1	1	3.3
 NVIDIA GTX 260							.*NVIDIA .*GTX *26.*					4	1	1	3.3
-- 
cgit v1.2.3


From 3df1e46588c7bada79e8ee537607282fd3cdcc9f Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 26 Nov 2012 17:10:22 -0600
Subject: MAINT-1958 Fix for crash on OSX when resizing window with deferred
 rendering enabled.

Reviewed by VoidPointer
---
 indra/newview/app_settings/settings.xml | 12 ++++++++
 indra/newview/llfloaterpreference.cpp   |  5 +++-
 indra/newview/pipeline.cpp              | 51 ++++++++++++++++++++++++++-------
 indra/newview/pipeline.h                |  4 +++
 4 files changed, 60 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 93362e2a55..2e91d10cd3 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -14082,5 +14082,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+
+  <key>SimulateFBOFailure</key>
+  <map>
+    <key>Comment</key>
+    <string>[DEBUG] Make allocateScreenBuffer return false.  Used to test error handling.</string>
+    <key>Persist</key>
+    <integer>0</integer>
+    <key>Type</key>
+    <string>Boolean</string>
+    <key>Value</key>
+    <integer>0</integer>
+  </map>
 </map>
 </llsd>
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 5752f839ce..542e96cf16 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -750,7 +750,10 @@ void LLFloaterPreference::onClose(bool app_quitting)
 {
 	gSavedSettings.setS32("LastPrefTab", getChild<LLTabContainer>("pref core")->getCurrentPanelIndex());
 	LLPanelLogin::setAlwaysRefresh(false);
-	cancel();
+	if (!app_quitting)
+	{
+		cancel();
+	}
 }
 
 void LLFloaterPreference::onOpenHardwareSettings()
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 9685e45348..2bcbc0b083 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -761,7 +761,16 @@ void LLPipeline::resizeScreenTexture()
 		GLuint resX = gViewerWindow->getWorldViewWidthRaw();
 		GLuint resY = gViewerWindow->getWorldViewHeightRaw();
 	
-		allocateScreenBuffer(resX,resY);
+		if (!allocateScreenBuffer(resX,resY))
+		{ //FAILSAFE: screen buffer allocation failed, disable deferred rendering if it's enabled
+			//NOTE: if the session closes successfully after this call, deferred rendering will be 
+			// disabled on future sessions
+			if (LLPipeline::sRenderDeferred)
+			{
+				gSavedSettings.setBOOL("RenderDeferred", FALSE);
+				LLPipeline::refreshCachedSettings();
+			}
+		}
 	}
 }
 
@@ -779,15 +788,38 @@ void LLPipeline::allocatePhysicsBuffer()
 bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 {
 	refreshCachedSettings();
-	U32 samples = RenderFSAASamples;
+	
+	bool save_settings = sRenderDeferred;
+	if (save_settings)
+	{
+		// Set this flag in case we crash while resizing window or allocating space for deferred rendering targets
+		gSavedSettings.setBOOL("RenderInitError", TRUE);
+		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
+	}
+
+	bool ret = doAllocateScreenBuffer(resX, resY);
+
+	if (save_settings)
+	{
+		// don't disable shaders on next session
+		gSavedSettings.setBOOL("RenderInitError", FALSE);
+		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
+	}
+	
+	return ret;
+}
 
+
+bool LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
+{
 	//try to allocate screen buffers at requested resolution and samples
 	// - on failure, shrink number of samples and try again
 	// - if not multisampled, shrink resolution and try again (favor X resolution over Y)
 	// Make sure to call "releaseScreenBuffers" after each failure to cleanup the partially loaded state
 
-	bool ret = true;
+	U32 samples = RenderFSAASamples;
 
+	bool ret = true;
 	if (!allocateScreenBuffer(resX, resY, samples))
 	{
 		//failed to allocate at requested specification, return false
@@ -831,7 +863,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 	return ret;
 }
 
-
 bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 {
 	refreshCachedSettings();
@@ -858,10 +889,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 
 	if (LLPipeline::sRenderDeferred)
 	{
-		// Set this flag in case we crash while resizing window or allocating space for deferred rendering targets
-		gSavedSettings.setBOOL("RenderInitError", TRUE);
-		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
-
 		S32 shadow_detail = RenderShadowDetail;
 		BOOL ssao = RenderDeferredSSAO;
 		
@@ -926,9 +953,11 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
 			}
 		}
 
-		// don't disable shaders on next session
-		gSavedSettings.setBOOL("RenderInitError", FALSE);
-		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
+		//HACK make screenbuffer allocations start failing after 30 seconds
+		if (gSavedSettings.getBOOL("SimulateFBOFailure"))
+		{
+			return false;
+		}
 	}
 	else
 	{
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index c38e7fbdc1..e5a11d5fc6 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -122,6 +122,10 @@ public:
 	//allocate the largest screen buffer possible up to resX, resY
 	//returns true if full size buffer allocated, false if some other size is allocated
 	bool allocateScreenBuffer(U32 resX, U32 resY);
+private:
+	//implementation of above, wrapped for easy error handling
+	bool doAllocateScreenBuffer(U32 resX, U32 resY);
+public:
 
 	//attempt to allocate screen buffers at resX, resY
 	//returns true if allocation successful, false otherwise
-- 
cgit v1.2.3


From fe2f9e12f7a4722c71437e6d0c66325b1b58d711 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Mon, 26 Nov 2012 17:27:25 -0700
Subject: fix for MAINT-1955: Viewer crashes while login after clearing cache

---
 indra/newview/lltexturecache.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index a61e2d5c86..2d463f0afa 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1861,7 +1861,12 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
 
 		mFastCachep->seek(APR_SET, offset);		
 	
-		llassert_always(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) == TEXTURE_FAST_CACHE_ENTRY_OVERHEAD);
+		if(mFastCachep->read(head, TEXTURE_FAST_CACHE_ENTRY_OVERHEAD) != TEXTURE_FAST_CACHE_ENTRY_OVERHEAD)
+		{
+			//cache corrupted or under thread race condition
+			closeFastCache(); 
+			return NULL;
+		}
 		
 		S32 image_size = head[0] * head[1] * head[2];
 		if(!image_size) //invalid
@@ -1872,7 +1877,13 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
 		discardlevel = head[3];
 		
 		data =  (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), image_size);
-		llassert_always(mFastCachep->read(data, image_size) == image_size);
+		if(mFastCachep->read(data, image_size) != image_size)
+		{
+			FREE_MEM(LLImageBase::getPrivatePool(), data);
+			closeFastCache();
+			return NULL;
+		}
+
 		closeFastCache();
 	}
 	LLPointer<LLImageRaw> raw = new LLImageRaw(data, head[0], head[1], head[2], true);
-- 
cgit v1.2.3


From e83700b56dcf2b0f392b49a79123b78bc7c8fbd9 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 30 Nov 2012 17:03:12 -0600
Subject: MAINT-1991 Attempt to mitigate crashes in GL drivers by encouraging
 people to update their drivers.

Reviewed by Simon
---
 indra/newview/llappviewer.cpp                      | 17 +++++++---
 indra/newview/llfeaturemanager.cpp                 | 11 +++++-
 indra/newview/llfeaturemanager.h                   |  5 ++-
 .../newview/skins/default/xui/en/notifications.xml | 39 ++++++++++++++++++++++
 4 files changed, 66 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index f203ac224b..1000c0e1e8 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1030,11 +1030,20 @@ bool LLAppViewer::init()
 	}
 
 #if LL_WINDOWS
-	if (gGLManager.mIsIntel && 
-		LLFeatureManager::getInstance()->getGPUClass() > 0 &&
-		gGLManager.mGLVersion <= 3.f)
+	if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())
 	{
-		LLNotificationsUtil::add("IntelOldDriver");
+		if (gGLManager.mIsIntel)
+		{
+			LLNotificationsUtil::add("IntelOldDriver");
+		}
+		else if (gGLManager.mIsNVIDIA)
+		{
+			LLNotificationsUtil::add("NVIDIAOldDriver");
+		}
+		else if (gGLManager.mIsATI)
+		{
+			LLNotificationsUtil::add("AMDOldDriver");
+		}
 	}
 #endif
 
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index b211027d54..564cb046ce 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -419,7 +419,7 @@ void LLFeatureManager::parseGPUTable(std::string filename)
 
 		// setup the tokenizer
 		std::string buf(buffer);
-		std::string cls, label, expr, supported;
+		std::string cls, label, expr, supported, stats_based, expected_gl_version;
 		boost_tokenizer tokens(buf, boost::char_separator<char>("\t\n"));
 		boost_tokenizer::iterator token_iter = tokens.begin();
 
@@ -440,6 +440,14 @@ void LLFeatureManager::parseGPUTable(std::string filename)
 		{
 			supported = *token_iter++;
 		}
+		if (token_iter != tokens.end())
+		{
+			stats_based = *token_iter++;
+		}
+		if (token_iter != tokens.end())
+		{
+			expected_gl_version = *token_iter++;
+		}
 
 		if (label.empty() || expr.empty() || cls.empty() || supported.empty())
 		{
@@ -469,6 +477,7 @@ void LLFeatureManager::parseGPUTable(std::string filename)
 			mGPUString = label;
 			mGPUClass = (EGPUClass) strtol(cls.c_str(), NULL, 10);
 			mGPUSupported = (BOOL) strtol(supported.c_str(), NULL, 10);
+			sscanf(expected_gl_version.c_str(), "%f", &mExpectedGLVersion);
 		}
 	}
 #if LL_EXPORT_GPU_TABLE
diff --git a/indra/newview/llfeaturemanager.h b/indra/newview/llfeaturemanager.h
index 6f9d2e49c6..ad72c16743 100644
--- a/indra/newview/llfeaturemanager.h
+++ b/indra/newview/llfeaturemanager.h
@@ -103,7 +103,8 @@ public:
 		mTableVersion(0),
 		mSafe(FALSE),
 		mGPUClass(GPU_CLASS_UNKNOWN),
-		mGPUSupported(FALSE)
+		mExpectedGLVersion(0.f),
+		mGPUSupported(FALSE)		
 	{
 	}
 	~LLFeatureManager() {cleanupFeatureTables();}
@@ -118,6 +119,7 @@ public:
 	EGPUClass getGPUClass() 			{ return mGPUClass; }
 	std::string& getGPUString() 		{ return mGPUString; }
 	BOOL isGPUSupported()				{ return mGPUSupported; }
+	F32 getExpectedGLVersion()			{ return mExpectedGLVersion; }
 	
 	void cleanupFeatureTables();
 
@@ -157,6 +159,7 @@ protected:
 	S32			mTableVersion;
 	BOOL		mSafe;					// Reinitialize everything to the "safe" mask
 	EGPUClass	mGPUClass;
+	F32			mExpectedGLVersion;		//expected GL version according to gpu table
 	std::string	mGPUString;
 	BOOL		mGPUSupported;
 };
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index c32e23d553..648a1895c4 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1291,6 +1291,45 @@ Visit [_URL] for more information?
     <tag>fail</tag>
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="AMDOldDriver"
+   type="alertmodal">
+    There is likely a newer driver for your graphics chip.  Updating graphics drivers can substantially improve performance.
+
+    Visit [_URL] to check for driver updates?
+    <tag>confirm</tag>
+    <url option="0" name="url">
+      http://support.amd.com/us/Pages/AMDSupportHub.aspx
+    </url>
+    <usetemplate
+     ignoretext="My graphics driver is out of date"
+     name="okcancelignore"
+     notext="No"
+     yestext="Yes"/>
+    <tag>fail</tag>
+  </notification>
+
+  <notification
+ icon="alertmodal.tga"
+ name="NVIDIAOldDriver"
+ type="alertmodal">
+    There is likely a newer driver for your graphics chip.  Updating graphics drivers can substantially improve performance.
+
+    Visit [_URL] to check for driver updates?
+    <tag>confirm</tag>
+    <url option="0" name="url">
+      http://www.nvidia.com/Download/index.aspx?lang=en-us
+    </url>
+    <usetemplate
+     ignoretext="My graphics driver is out of date"
+     name="okcancelignore"
+     notext="No"
+     yestext="Yes"/>
+    <tag>fail</tag>
+  </notification>
+
+
   <notification
    icon="alertmodal.tga"
    name="UnknownGPU"
-- 
cgit v1.2.3


From 28d8aade82627c2034b5f9e6b0972b250bd34cad Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Mon, 3 Dec 2012 13:18:46 -0800
Subject: MAINT-1748 Users have an ability to sell non existing objects from
 content of other object *  Keep the buy-contents floater subscribed to
 inventory changes on the object. reviewed with Simon

---
 indra/newview/llfloaterbuycontents.cpp | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index bca4b5e447..fffd724b22 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -80,6 +80,7 @@ BOOL LLFloaterBuyContents::postBuild()
 
 LLFloaterBuyContents::~LLFloaterBuyContents()
 {
+	removeVOInventoryListener();
 }
 
 
@@ -147,23 +148,26 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 		return;
 	}
 
-	if (!inv)
+	LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list");
+	if (!item_list)
 	{
-		llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged"
-			<< llendl;
 		removeVOInventoryListener();
 		return;
 	}
 
-	LLCtrlListInterface *item_list = childGetListInterface("item_list");
-	if (!item_list)
+	item_list->deleteAllItems();
+	
+	if (!inv)
 	{
-		removeVOInventoryListener();
+		llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged"
+			<< llendl;
+
 		return;
 	}
 
 	// default to turning off the buy button.
-	getChildView("buy_btn")->setEnabled(FALSE);
+	LLView* buy_btn = getChildView("buy_btn");
+	buy_btn->setEnabled(FALSE);
 
 	LLUUID owner_id;
 	BOOL is_group_owned;
@@ -204,7 +208,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 
 		// There will be at least one item shown in the display, so go
 		// ahead and enable the buy button.
-		getChildView("buy_btn")->setEnabled(TRUE);
+		buy_btn->setEnabled(TRUE);
 
 		// Create the line in the list
 		LLSD row;
@@ -255,8 +259,6 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 		getChildView("wear_check")->setEnabled(TRUE);
 		getChild<LLUICtrl>("wear_check")->setValue(LLSD(false) );
 	}
-	
-	removeVOInventoryListener();
 }
 
 
-- 
cgit v1.2.3


From e3b5d8b24ff7f79bd1aa422654fe50cf057ea00a Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Mon, 3 Dec 2012 21:34:36 -0700
Subject: more for MAINT-1955: Viewer crashes while login after clearing cache

---
 indra/newview/lltexturecache.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 2d463f0afa..305f6fca0f 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1937,7 +1937,11 @@ bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 dis
 		openFastCache();
 
 		mFastCachep->seek(APR_SET, offset);	
-		llassert_always(mFastCachep->write(mFastCachePadBuffer, TEXTURE_FAST_CACHE_ENTRY_SIZE) == TEXTURE_FAST_CACHE_ENTRY_SIZE);
+		
+		//no need to do this assertion check. When it fails, let it fail quietly.
+		//this failure could happen because other viewer removes the fast cache file when clearing cache.
+		//--> llassert_always(mFastCachep->write(mFastCachePadBuffer, TEXTURE_FAST_CACHE_ENTRY_SIZE) == TEXTURE_FAST_CACHE_ENTRY_SIZE);
+		mFastCachep->write(mFastCachePadBuffer, TEXTURE_FAST_CACHE_ENTRY_SIZE);
 
 		closeFastCache(true);
 	}
-- 
cgit v1.2.3


From 57db08d7927a4a93b8825405201e9e21efb8c756 Mon Sep 17 00:00:00 2001
From: "simon@Simon-PC.lindenlab.com" <simon@Simon-PC.lindenlab.com>
Date: Tue, 4 Dec 2012 17:45:19 -0800
Subject: Fix merge breakage

---
 indra/newview/CMakeLists.txt | 2 --
 indra/newview/pipeline.cpp   | 2 --
 2 files changed, 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index b97b3cc300..b569808a06 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -337,7 +337,6 @@ set(viewer_SOURCE_FILES
     llmarketplacenotifications.cpp
     llmediactrl.cpp
     llmediadataclient.cpp
-    llmemoryview.cpp
     llmenuoptionpathfindingrebakenavmesh.cpp
     llmeshrepository.cpp
     llmimetypes.cpp
@@ -914,7 +913,6 @@ set(viewer_HEADER_FILES
     llmarketplacenotifications.h
     llmediactrl.h
     llmediadataclient.h
-    llmemoryview.h
     llmenuoptionpathfindingrebakenavmesh.h
     llmeshrepository.h
     llmimetypes.h
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 579fc6d104..2bcbc0b083 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -861,8 +861,6 @@ bool LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
 	}
 
 	return ret;
-
-	return ret;
 }
 
 bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
-- 
cgit v1.2.3


From 88fe6da622eccd2ad2874bb59610932a982f7c9e Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Tue, 18 Dec 2012 11:44:20 -0800
Subject: FIX (SPECULATIVE) MAINT-1340 - Media Volume control broken on Vista+
 systems

---
 .../webkit/windows_volume_catcher.cpp              | 52 +++++++++++++++++-----
 1 file changed, 41 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/media_plugins/webkit/windows_volume_catcher.cpp b/indra/media_plugins/webkit/windows_volume_catcher.cpp
index 5fb84756ee..b0c3134eb0 100644
--- a/indra/media_plugins/webkit/windows_volume_catcher.cpp
+++ b/indra/media_plugins/webkit/windows_volume_catcher.cpp
@@ -48,18 +48,37 @@ private:
 	set_volume_func_t mSetVolumeFunc;
 	set_mute_func_t mSetMuteFunc;
 
+	// tests if running on Vista, 7, 8 + once in CTOR
+	bool isWindowsVistaOrHigher();
+
 	F32 	mVolume;
 	F32 	mPan;
+	bool mSystemIsVistaOrHigher;
 };
+
+bool VolumeCatcherImpl::isWindowsVistaOrHigher()
+{
+	OSVERSIONINFO osvi;
+	ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+	GetVersionEx(&osvi);
+	return osvi.dwMajorVersion >= 6;
+}
+
 VolumeCatcherImpl::VolumeCatcherImpl()
-:	mVolume(1.0f),	// default volume is max
-	mPan(0.f)		// default pan is centered
+:	mVolume(1.0f),			// default volume is max
+	mPan(0.f)				// default pan is centered
 {
-	HMODULE handle = ::LoadLibrary(L"winmm.dll");
-	if(handle)
+	mSystemIsVistaOrHigher = isWindowsVistaOrHigher();
+
+	if ( mSystemIsVistaOrHigher )
 	{
-		mSetVolumeFunc = (set_volume_func_t)::GetProcAddress(handle, "setPluginVolume");
-		mSetMuteFunc = (set_mute_func_t)::GetProcAddress(handle, "setPluginMute");
+		HMODULE handle = ::LoadLibrary(L"winmm.dll");
+		if(handle)
+		{
+			mSetVolumeFunc = (set_volume_func_t)::GetProcAddress(handle, "setPluginVolume");
+			mSetMuteFunc = (set_mute_func_t)::GetProcAddress(handle, "setPluginMute");
+		}
 	}
 }
 
@@ -67,18 +86,29 @@ VolumeCatcherImpl::~VolumeCatcherImpl()
 {
 }
 
-
 void VolumeCatcherImpl::setVolume(F32 volume)
 {
 	mVolume = volume;
 
-	if (mSetMuteFunc)
+	if ( mSystemIsVistaOrHigher )
 	{
-		mSetMuteFunc(volume == 0.f);
+		// set both left/right to same volume
+		// TODO: use pan value to set independently
+		DWORD left_channel  = (DWORD)(mVolume * 65535.0f);
+		DWORD right_channel =  (DWORD)(mVolume * 65535.0f);
+		DWORD hw_volume = left_channel << 16 | right_channel;
+		::waveOutSetVolume(NULL, hw_volume);
 	}
-	if (mSetVolumeFunc)
+	else
 	{
-		mSetVolumeFunc(mVolume);
+		if (mSetMuteFunc)
+		{
+			mSetMuteFunc(volume == 0.f);
+		}
+		if (mSetVolumeFunc)
+		{
+			mSetVolumeFunc(mVolume);
+		}
 	}
 }
 
-- 
cgit v1.2.3


From dda41e3458702bcd7e4d671613982ff2273a94f1 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 9 Jan 2013 12:08:31 -0600
Subject: Merge cleanup.

---
 indra/newview/llmeshrepository.h | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index 32a96a350f..4625d8edef 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -411,12 +411,9 @@ public:
 					   LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
 	~LLMeshUploadThread();
 
-	void startRequest() { ++mPendingUploads; }
+	void startRequest(); { ++mPendingUploads; }
 	void stopRequest() { --mPendingUploads; }
-
-	void startRequest() { ++mPendingUploads; }
-	void stopRequest() { --mPendingUploads; }
-
+		
 	bool finished() { return mFinished; }
 	virtual void run();
 	void preStart();
-- 
cgit v1.2.3


From 971e9bd203802420abcfa60d9303d89570900e3d Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 9 Jan 2013 12:41:57 -0600
Subject: More merge cleanup.

---
 indra/newview/llmeshrepository.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index 4625d8edef..8602271f84 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -411,7 +411,7 @@ public:
 					   LLHandle<LLWholeModelFeeObserver> fee_observer= (LLHandle<LLWholeModelFeeObserver>()), LLHandle<LLWholeModelUploadObserver> upload_observer = (LLHandle<LLWholeModelUploadObserver>()));
 	~LLMeshUploadThread();
 
-	void startRequest(); { ++mPendingUploads; }
+	void startRequest() { ++mPendingUploads; }
 	void stopRequest() { --mPendingUploads; }
 		
 	bool finished() { return mFinished; }
-- 
cgit v1.2.3


From 4a84c7c8e5212d71cbd254bced17f3474253b672 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 9 Jan 2013 13:20:41 -0600
Subject: More merge cleanup.

---
 indra/newview/llmeshrepository.cpp | 8 --------
 1 file changed, 8 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index e81c863608..09003e3e53 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -416,14 +416,6 @@ public:
 		}
 	}
 
-	~LLWholeModelFeeResponder()
-	{
-		if (mThread)
-		{
-			mThread->stopRequest();
-		}
-	}
-
 	virtual void completed(U32 status,
 						   const std::string& reason,
 						   const LLSD& content)
-- 
cgit v1.2.3


From b0c449d301299a4ba1b7d83e930f9df6b071b931 Mon Sep 17 00:00:00 2001
From: Baker Linden <baker@lindenlab.com>
Date: Wed, 9 Jan 2013 15:24:27 -0800
Subject: [MAINT-2185] Unable to upload terrain .raw files

- Fixed an issue where a slash was prepended to the beginning of the filename (which happened to be the full path)
---
 indra/llmessage/llxfermanager.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llmessage/llxfermanager.cpp b/indra/llmessage/llxfermanager.cpp
index b9cddc8e45..00b9d81611 100644
--- a/indra/llmessage/llxfermanager.cpp
+++ b/indra/llmessage/llxfermanager.cpp
@@ -886,8 +886,17 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
 				return;
 		}
 
-
-		std::string expanded_filename = gDirUtilp->getExpandedFilename( local_path, local_filename );
+		// If we want to use a special path (e.g. LL_PATH_CACHE), we want to make sure we create the
+		// proper expanded filename.
+		std::string expanded_filename;
+		if (local_path != LL_PATH_NONE)
+		{
+			expanded_filename = gDirUtilp->getExpandedFilename( local_path, local_filename );
+		}
+		else
+		{
+			expanded_filename = local_filename;
+		}
 		llinfos << "starting file transfer: " <<  expanded_filename << " to " << mesgsys->getSender() << llendl;
 
 		BOOL delete_local_on_completion = FALSE;
-- 
cgit v1.2.3


From 4cbef6d92877d99dc59ab88c22510d8611c31aa2 Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Thu, 10 Jan 2013 09:46:41 -0800
Subject: MAINT-2209 Parcel name not updating after teleport

---
 indra/newview/llviewerparcelmgr.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 7e524df3f6..33f632b25d 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1540,7 +1540,8 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
 	// Actually extract the data.
 	if (parcel)
 	{
-		if (parcel->getLocalID() != INVALID_PARCEL_ID
+		if (sequence_id == SELECTED_PARCEL_SEQ_ID
+			&& parcel->getLocalID() != INVALID_PARCEL_ID
 			&& parcel->getLocalID() != local_id)
 		{
 			// The parcel has a valid parcel ID but it doesn't match the parcel
-- 
cgit v1.2.3


From 627e531d333bcf9ed684883ad494a25b2c83af8e Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 11 Jan 2013 17:17:13 -0600
Subject: MAINT-417 Backed out changeset: 7273a1ac51e8

---
 indra/newview/llviewerkeyboard.cpp | 5 -----
 1 file changed, 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index f5d3341c66..1aa9fd8a45 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -160,11 +160,6 @@ void agent_push_backward( EKeystate s )
 		camera_move_backward(s);
 		return;
 	}
-	else if (gAgentAvatarp->isSitting())
-	{
-		gAgentCamera.changeCameraToThirdPerson();
-		return;
-	}
 	agent_push_forwardbackward(s, -1, LLAgent::DOUBLETAP_BACKWARD);
 }
 
-- 
cgit v1.2.3


From 90fb925d845a96f7dc5a8f9fa175ce9da3f75cce Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Fri, 11 Jan 2013 15:23:18 -0800
Subject: fix line endings

---
 indra/media_plugins/webkit/windows_volume_catcher.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

(limited to 'indra')

diff --git a/indra/media_plugins/webkit/windows_volume_catcher.cpp b/indra/media_plugins/webkit/windows_volume_catcher.cpp
index b0c3134eb0..957704da47 100644
--- a/indra/media_plugins/webkit/windows_volume_catcher.cpp
+++ b/indra/media_plugins/webkit/windows_volume_catcher.cpp
@@ -56,14 +56,14 @@ private:
 	bool mSystemIsVistaOrHigher;
 };
 
-bool VolumeCatcherImpl::isWindowsVistaOrHigher()
-{
-	OSVERSIONINFO osvi;
-	ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
-	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-	GetVersionEx(&osvi);
-	return osvi.dwMajorVersion >= 6;
-}
+bool VolumeCatcherImpl::isWindowsVistaOrHigher()
+{
+	OSVERSIONINFO osvi;
+	ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
+	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+	GetVersionEx(&osvi);
+	return osvi.dwMajorVersion >= 6;
+}
 
 VolumeCatcherImpl::VolumeCatcherImpl()
 :	mVolume(1.0f),			// default volume is max
-- 
cgit v1.2.3


From 622d4f39a50f07fe59bef2e7cdbacb3f8e837ee7 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Wed, 16 Jan 2013 15:20:32 -0600
Subject: MAINT-2242 Fix for shader compilation errors on Intel HD graphics
 chips.

---
 .../shaders/class1/objects/previewV.glsl           | 39 ++++++++++++++++++++--
 indra/newview/llviewershadermgr.cpp                |  7 ++--
 2 files changed, 40 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index da3387e7a5..7f3f84398b 100644
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -23,9 +23,6 @@
  * $/LicenseInfo$
  */
 
-float calcDirectionalLight(vec3 n, vec3 l);
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
-
 uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
@@ -45,6 +42,42 @@ uniform vec3 light_direction[8];
 uniform vec3 light_attenuation[8]; 
 uniform vec3 light_diffuse[8];
 
+//===================================================================================================
+//declare these here explicitly to separate them from atmospheric lighting elsewhere to work around
+//drivers that are picky about functions being declared but not defined even if they aren't called
+float calcDirectionalLight(vec3 n, vec3 l)
+{
+	float a = max(dot(n,l),0.0);
+	return a;
+}
+
+
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight)
+{
+	//get light vector
+	vec3 lv = lp.xyz-v;
+	
+	//get distance
+	float d = length(lv);
+	
+	//normalize light vector
+	lv *= 1.0/d;
+	
+	//distance attenuation
+	float da = clamp(1.0/(la * d), 0.0, 1.0);
+	
+	// spotlight coefficient.
+	float spot = max(dot(-ln, lv), is_pointlight);
+	da *= spot*spot; // GL_SPOT_EXPONENT=2
+
+	//angular attenuation
+	da *= calcDirectionalLight(n, lv);
+
+	return da;	
+}
+//====================================================================================================
+
+
 void main()
 {
 	//transform vertex
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 142cb2090d..ba9818946c 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2025,11 +2025,11 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 	if (success)
 	{
 		gObjectPreviewProgram.mName = "Simple Shader";
-		gObjectPreviewProgram.mFeatures.calculatesLighting = true;
+		gObjectPreviewProgram.mFeatures.calculatesLighting = false;
 		gObjectPreviewProgram.mFeatures.calculatesAtmospherics = false;
-		gObjectPreviewProgram.mFeatures.hasGamma = true;
+		gObjectPreviewProgram.mFeatures.hasGamma = false;
 		gObjectPreviewProgram.mFeatures.hasAtmospherics = false;
-		gObjectPreviewProgram.mFeatures.hasLighting = true;
+		gObjectPreviewProgram.mFeatures.hasLighting = false;
 		gObjectPreviewProgram.mFeatures.mIndexedTextureChannels = 0;
 		gObjectPreviewProgram.mFeatures.disableTextureIndex = true;
 		gObjectPreviewProgram.mShaderFiles.clear();
@@ -2037,6 +2037,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
 		gObjectPreviewProgram.mShaderFiles.push_back(make_pair("objects/previewF.glsl", GL_FRAGMENT_SHADER_ARB));
 		gObjectPreviewProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
 		success = gObjectPreviewProgram.createShader(NULL, NULL);
+		gObjectPreviewProgram.mFeatures.hasLighting = true;
 	}
 
 	if (success)
-- 
cgit v1.2.3


From 7ecfa28c431a3599a99e92775d963241e1b943c0 Mon Sep 17 00:00:00 2001
From: Kelly Washington <kelly@lindenlab.com>
Date: Wed, 16 Jan 2013 15:21:11 -0800
Subject: MAINT-2247 Child object does not update rotation while selected.

---
 indra/newview/lldrawable.cpp | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index b7270e696e..647c3355ca 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -550,6 +550,8 @@ F32 LLDrawable::updateXform(BOOL undamped)
 	else
 	{
 		dist_squared = dist_vec_squared(old_pos, target_pos);
+		dist_squared += (1.f - dot(old_rot, target_rot)) * 10.f;
+		dist_squared += dist_vec_squared(old_scale, target_scale);
 	}
 
 	LLVector3 vec = mCurrentScale-target_scale;
-- 
cgit v1.2.3