From ae31a6f4a7928e4f1be75451ec7dd16c5283ed5b Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Thu, 20 Oct 2011 15:14:16 -0500
Subject: [PATCH] SH-2240 GL 1.2 compatibility pass

---
 indra/newview/lldrawpoolbump.cpp | 16 ++++++++++++++--
 indra/newview/pipeline.cpp       |  1 +
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 610d3f9f997..774ca2e8e7e 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1453,6 +1453,13 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
 			}
 			else
 			{
+				if (!LLGLSLShader::sNoFixedFunction)
+				{
+					gGL.getTexUnit(1)->activate();
+					gGL.matrixMode(LLRender::MM_TEXTURE);
+					gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
+				}
+
 				gGL.getTexUnit(0)->activate();
 				gGL.matrixMode(LLRender::MM_TEXTURE);
 				gGL.loadMatrix((GLfloat*) params.mTextureMatrix->mMatrix);
@@ -1494,9 +1501,14 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
 		}
 		else
 		{
-			gGL.getTexUnit(1)->activate();
-			gGL.loadIdentity();
+			if (!LLGLSLShader::sNoFixedFunction)
+			{
+				gGL.getTexUnit(1)->activate();
+				gGL.matrixMode(LLRender::MM_TEXTURE);
+				gGL.loadIdentity();
+			}
 			gGL.getTexUnit(0)->activate();
+			gGL.matrixMode(LLRender::MM_TEXTURE);
 		}
 		gGL.loadIdentity();
 		gGL.matrixMode(LLRender::MM_MODELVIEW);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index acd708e800a..cef4c649d70 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -5090,6 +5090,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 	// Ambient
 	if (!LLGLSLShader::sNoFixedFunction)
 	{
+		gGL.syncMatrices();
 		LLColor4 ambient = gSky.getTotalAmbientColor();
 		gGL.setAmbientLightColor(ambient);
 	}
-- 
GitLab