From fa74313e7db1132cd76313864d72aac27902a126 Mon Sep 17 00:00:00 2001
From: Graham Linden <graham@lindenlab.com>
Date: Tue, 23 Jul 2013 04:52:59 -0700
Subject: [PATCH] NORSPEC-314 WIP make work-around easier to flip and add 9800M
 as an evil mac

---
 indra/llrender/llgl.cpp            |  3 ++-
 indra/newview/lldrawpoolsimple.cpp | 40 +++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 088ba95b750..351fd98ceda 100755
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -647,7 +647,8 @@ bool LLGLManager::initGL()
 		}
 #if LL_DARWIN
 		else if ((mGLRenderer.find("9400M") != std::string::npos)
-			  || (mGLRenderer.find("9600M") != std::string::npos))
+			  || (mGLRenderer.find("9600M") != std::string::npos)
+			  || (mGLRenderer.find("9800M") != std::string::npos))
 		{
 			mIsMobileGF = TRUE;
 		}
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index d51b84cfbce..06e8a3537ac 100755
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -37,6 +37,7 @@
 #include "llviewershadermgr.h"
 #include "llrender.h"
 
+#define GE_FORCE_WORKAROUND LL_DARWIN
 
 static LLGLSLShader* simple_shader = NULL;
 static LLGLSLShader* fullbright_shader = NULL;
@@ -654,7 +655,20 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
 		gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f);
 	} 
 	else 
-	{
+	{	
+
+#if GE_FORCE_WORKAROUND
+		// Work-around until we can figure out why the right shader causes
+		// the GeForce driver to go tango uniform on OS X 10.6.8 only
+		//
+		if (gGLManager.mIsMobileGF)
+		{
+			gObjectFullbrightAlphaMaskProgram.bind();
+			gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
+			return;
+		}
+#endif
+
 		if (LLPipeline::sUnderWaterRender)
 		{
 			gDeferredFullbrightAlphaMaskWaterProgram.bind();
@@ -665,7 +679,6 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass)
 			gDeferredFullbrightAlphaMaskProgram.bind();
 			gDeferredFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
 		}
-		
 	}
 }
 
@@ -685,11 +698,26 @@ void LLDrawPoolFullbrightAlphaMask::endPostDeferredPass(S32 pass)
 	}
 	else
 	{
-#if LL_DARWIN
-		gObjectFullbrightAlphaMaskProgram.unbind();
-#else
-		gDeferredFullbrightAlphaMaskProgram.unbind();
+
+#if GE_FORCE_WORKAROUND
+		// Work-around until we can figure out why the right shader causes
+		// the GeForce driver to go tango uniform on OS X 10.6.8 only
+		//
+		if (gGLManager.mIsMobileGF)
+		{
+			gObjectFullbrightAlphaMaskProgram.unbind();
+		}
+		else
 #endif
+		if (LLPipeline::sUnderWaterRender)
+		{
+			gDeferredFullbrightAlphaMaskWaterProgram.unbind();
+		}
+		else
+		{
+			gDeferredFullbrightAlphaMaskProgram.unbind();
+		}
+
 	}
 	LLRenderPass::endRenderPass(pass);
 }
-- 
GitLab