summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
authorGraham Madarasz (Graham Linden) <graham@lindenlab.com>2013-04-11 11:57:50 -0700
committerGraham Madarasz (Graham Linden) <graham@lindenlab.com>2013-04-11 11:57:50 -0700
commit19430bfce05748c363bb83c7e78e605ee6af3b14 (patch)
tree8e231bb114b251658e12d62c89f114936f05e876 /indra/newview/app_settings/shaders/class1
parent35400fb415d296ab0fde9e2775a98f15041985e0 (diff)
NORSPEC-98 fix? for mac shader compiler crasher
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl11
2 files changed, 19 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 4ef69824a1..d6baec0ee0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -105,7 +105,10 @@ void main()
vec4 diff= diffuseLookup(vary_texcoord0.xy);
- vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col;
+ vec3 n = vary_norm;
+ vec3 l = light_position[0].xyz;
+ vec3 dlight = calcDirectionalLight(n, l);
+ dlight = dlight * vary_directional.rgb * vary_pointlight_col;
vec4 col = vec4(vary_ambient + dlight, vertex_color.a);
vec4 color = diff * col;
@@ -115,11 +118,17 @@ void main()
color.rgb = scaleSoftClip(color.rgb);
vec3 light_col = vec3(0,0,0);
- for (int i = 2; i < 8; i++)
- {
- light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
- }
-
+#define LIGHT_LOOP(i) \
+ light_col += light_diffuse[i].rgb * calcPointLightOrSpotLight(pos.xyz, vary_norm, light_position[i], light_direction[i], light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z);
+
+ LIGHT_LOOP(1)
+ LIGHT_LOOP(2)
+ LIGHT_LOOP(3)
+ LIGHT_LOOP(4)
+ LIGHT_LOOP(5)
+ LIGHT_LOOP(6)
+ LIGHT_LOOP(7)
+
color.rgb += diff.rgb * vary_pointlight_col * light_col;
frag_color = color;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
index 07a7ee4e1a..eff7b91a88 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl
@@ -55,12 +55,6 @@ uniform vec4 light_position[8];
uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
-#if 0
-uniform vec4 light_position[1];
-uniform vec3 light_direction[1];
-uniform vec3 light_attenuation[1];
-uniform vec3 light_diffuse[1];
-#endif
float calcDirectionalLight(vec3 n, vec3 l)
{
@@ -120,7 +114,10 @@ void main()
vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy);
- vec3 dlight = calcDirectionalLight(vary_norm, light_position[0].xyz) * vary_directional.rgb * vary_pointlight_col;
+ vec3 n = vary_norm;
+ vec3 l = light_position[0].xyz;
+ vec3 dlight = calcDirectionalLight(n, l);
+ dlight = dlight * vary_directional.rgb * vary_pointlight_col;
vec4 col = vec4(vary_ambient + dlight, vertex_color.a);
vec4 color = diff * col;