From f964e51fc98ed9b31cb9b3e4dad2ccde14de777b Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Mon, 15 Apr 2013 15:31:57 -0500
Subject: [PATCH] Fix for mac build

---
 indra/llrender/llglslshader.cpp | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 2c6bcdfe004..191c9862f08 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -110,6 +110,14 @@ void LLGLSLShader::initProfile()
 }
 
 
+struct LLGLSLShaderCompareTimeElapsed
+{
+		bool operator()(const LLGLSLShader* const& lhs, const LLGLSLShader* const& rhs)
+		{
+			return lhs->mTimeElapsed < rhs->mTimeElapsed;
+		}
+};
+
 //static
 void LLGLSLShader::finishProfile()
 {
@@ -122,15 +130,7 @@ void LLGLSLShader::finishProfile()
 		sorted.push_back(*iter);
 	}
 
-	struct comp_func
-	{
-		bool operator()(const LLGLSLShader* const& lhs, const LLGLSLShader* const& rhs)
-		{
-			return lhs->mTimeElapsed < rhs->mTimeElapsed;
-		}
-	} func;
-
-	std::sort(sorted.begin(), sorted.end(), func);
+	std::sort(sorted.begin(), sorted.end(), LLGLSLShaderCompareTimeElapsed());
 
 	for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter)
 	{
@@ -205,6 +205,7 @@ void LLGLSLShader::stopProfile(U32 count, U32 mode)
 
 void LLGLSLShader::placeProfileQuery()
 {
+#if !LL_DARWIN
 	if (mTimerQuery == 0)
 	{
 		glGenQueriesARB(1, &mTimerQuery);
@@ -212,10 +213,12 @@ void LLGLSLShader::placeProfileQuery()
 
 	glBeginQueryARB(GL_SAMPLES_PASSED, 1);
 	glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery);
+#endif
 }
 
 void LLGLSLShader::readProfileQuery(U32 count, U32 mode)
 {
+#if !LL_DARWIN
 	glEndQueryARB(GL_TIME_ELAPSED);
 	glEndQueryARB(GL_SAMPLES_PASSED);
 	
@@ -245,6 +248,7 @@ void LLGLSLShader::readProfileQuery(U32 count, U32 mode)
 
 	sTotalDrawCalls++;
 	mDrawCalls++;
+#endif
 }
 
 
@@ -512,6 +516,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
 
 
 	glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name);
+#if !LL_DARWIN
 	if (size > 0)
 	{
 		switch(type)
@@ -553,6 +558,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<string> * uniforms)
 		}
 		mTotalUniformSize += size;
 	}
+#endif
 
 	S32 location = glGetUniformLocationARB(mProgramObject, name);
 	if (location != -1)
-- 
GitLab