From 973e99622e88714a59056200e74fcbf56bbe6884 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 21 Oct 2011 11:05:49 -0500
Subject: [PATCH] SH-2240 Make OSX never attempt to use GLSL 1.30 or later

---
 indra/llrender/llshadermgr.cpp | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 0a99c66d09a..326c938e8e2 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -566,13 +566,20 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 	GLcharARB* text[4096];
 	GLuint count = 0;
 
-	if (gGLManager.mGLVersion < 2.1f)
+	F32 version = gGLManager.mGLVersion;
+
+//hack to never use GLSL > 1.20 on OSX
+#if LL_DARWIN
+	version = llmin(version, 2.9f);
+#endif
+
+	if (version < 2.1f)
 	{
 		text[count++] = strdup("#version 110\n");
 		text[count++] = strdup("#define ATTRIBUTE attribute\n");
 		text[count++] = strdup("#define VARYING varying\n");
 	}
-	else if (gGLManager.mGLVersion < 3.f)
+	else if (version < 3.f)
 	{
 		//set version to 1.20
 		text[count++] = strdup("#version 120\n");
@@ -583,7 +590,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 	}
 	else
 	{  
-		if (gGLManager.mGLVersion < 4.f)
+		if (version < 4.f)
 		{
 			//set version to 1.30
 			text[count++] = strdup("#version 130\n");
-- 
GitLab