From 4268700fcf981dbe48baa56b1f8ca1509fdb2e31 Mon Sep 17 00:00:00 2001
From: Leslie Linden <leslie@lindenlab.com>
Date: Thu, 12 May 2011 13:30:47 -0700
Subject: [PATCH] SH-1521 update -- Lighting and Shadows grayed out on mac

* Disabled SSAO on macs with 8 or less texture units.
* Slight cleanup of sunlight fragment shaders to remove unused texture units.

Reviewed by davep
---
 .../app_settings/shaders/class1/deferred/sunLightSSAOF.glsl  | 2 --
 .../app_settings/shaders/class2/deferred/sunLightF.glsl      | 3 ---
 .../app_settings/shaders/class2/deferred/sunLightSSAOF.glsl  | 2 --
 indra/newview/featuretable_mac.txt                           | 5 ++++-
 indra/newview/llfeaturemanager.cpp                           | 4 ++++
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
index 25ff958107f..cd91351ad41 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl
@@ -15,8 +15,6 @@ uniform sampler2DRect depthMap;
 uniform sampler2DRect normalMap;
 uniform sampler2D noiseMap;
 
-uniform sampler2D		lightFunc;
-
 
 // Inputs
 uniform mat4 shadow_matrix[6];
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index 26bc83e0d49..4369b3b34ff 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -19,9 +19,6 @@ uniform sampler2DRectShadow shadowMap2;
 uniform sampler2DRectShadow shadowMap3;
 uniform sampler2DShadow shadowMap4;
 uniform sampler2DShadow shadowMap5;
-uniform sampler2D noiseMap;
-
-uniform sampler2D		lightFunc;
 
 
 // Inputs
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 08b16d787fd..847b36b1ace 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -21,8 +21,6 @@ uniform sampler2DShadow shadowMap4;
 uniform sampler2DShadow shadowMap5;
 uniform sampler2D noiseMap;
 
-uniform sampler2D		lightFunc;
-
 // Inputs
 uniform mat4 shadow_matrix[6];
 uniform vec4 shadow_clip;
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index c9ab003112c..c075c660f32 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -1,4 +1,4 @@
-version 22
+version 23
 
 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences
 // Should be combined into one table
@@ -278,6 +278,9 @@ RenderObjectBump			0	0
 list OpenGLPre15
 RenderVBOEnable				1	0
 
+list TexUnit8orLess
+RenderDeferredSSAO			0	0
+
 list Intel
 RenderAnisotropic			1	0
 RenderLocalLights			1	0
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index 9f0b34becc5..524d2d74ef3 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -753,6 +753,10 @@ void LLFeatureManager::applyBaseMasks()
 	{
 		maskFeatures("OpenGLPre30");
 	}
+	if (gGLManager.mNumTextureUnits <= 8)
+	{
+		maskFeatures("TexUnit8orLess");
+	}
 
 	// now mask by gpu string
 	// Replaces ' ' with '_' in mGPUString to deal with inability for parser to handle spaces
-- 
GitLab