From 38f62f5ceed5ec7a9c5bcfd8afe443475b343b08 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Thu, 30 May 2013 17:44:05 -0500
Subject: [PATCH] Fix for some objects not rendering underwater with advanced
 lighting enabled

---
 .../class1/lighting/lightFullbrightWaterAlphaMaskF.glsl       | 4 +++-
 .../shaders/class1/lighting/lightWaterAlphaMaskF.glsl         | 4 +++-
 .../class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl       | 4 +++-
 indra/newview/lldrawpoolalpha.cpp                             | 4 ++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
index 9c82056fd7f..6dd3bb937f1 100755
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
@@ -41,7 +41,9 @@ VARYING vec2 vary_texcoord0;
 
 void fullbright_lighting_water()
 {
-	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+
+	color.rgb *= vertex_color.rgb;
 
 	if (color.a < minimum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
index b68240ba0d6..3426fea52fa 100755
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
@@ -39,7 +39,9 @@ VARYING vec2 vary_texcoord0;
 
 void default_lighting_water()
 {
-	vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
+	vec4 color = diffuseLookup(vary_texcoord0.xy);
+
+	color.rgb *= vertex_color.rgb;
 
 	if (color.a < minimum_alpha)
 	{
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl
index da3b20012d8..d9faa9b3142 100755
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl
@@ -41,7 +41,9 @@ VARYING vec2 vary_texcoord0;
 
 void default_lighting_water()
 {
-	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
+
+	color.rgb *= vertex_color.rgb;
 
 	if (color.a < minimum_alpha)
 	{
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 90474ea6f62..d305126a756 100755
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -144,8 +144,8 @@ void LLDrawPoolAlpha::beginRenderPass(S32 pass)
 	
 	if (LLPipeline::sUnderWaterRender)
 	{
-		simple_shader = &gObjectSimpleWaterAlphaMaskProgram;
-		fullbright_shader = &gObjectFullbrightWaterAlphaMaskProgram;
+		simple_shader = &gObjectSimpleWaterProgram;
+		fullbright_shader = &gObjectFullbrightWaterProgram;
 		emissive_shader = &gObjectEmissiveWaterProgram;
 	}
 	else
-- 
GitLab