summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-11-01 21:27:43 +0000
committerRider Linden <rider@lindenlab.com>2018-11-01 21:27:43 +0000
commitc361ae8cec4cfd3cf93cc23669af45418f1f04ed (patch)
tree0ef5661eee6d826d8e6eb69f54fd129cbe9cc5ff
parente6b5ed3fefb1b5f0fca59075a20404a160b5116b (diff)
parent4f267a5723e7da2de36b9f2295e4942a4c8bf6c5 (diff)
Merged in graham_linden/viewer-eep-fixes (pull request #179)
SL-9994
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/srgb.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/srgbF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/terrainV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/transportF.glsl24
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl67
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/transportF.glsl29
-rw-r--r--indra/newview/llviewershadermgr.cpp162
17 files changed, 251 insertions, 177 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 7f2c5add16..1cfc19267c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -88,7 +88,7 @@ vec3 linear_to_srgb(vec3 cl);
vec2 encode_normal (vec3 n);
vec3 decode_normal (vec2 enc);
-vec3 scaleFragSoftClip(vec3 l);
+vec3 scaleSoftClipFrag(vec3 l);
vec3 atmosFragAmbient(vec3 light, vec3 sunlit);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit);
@@ -312,7 +312,7 @@ void main()
//color.rgb = mix(diff.rgb, color.rgb, final_alpha);
color.rgb = atmosFragLighting(color.rgb, additive, atten);
- color.rgb = scaleFragSoftClip(color.rgb);
+ color.rgb = scaleSoftClipFrag(color.rgb);
vec4 light = vec4(0,0,0,0);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 6e06453a5b..c001ff9ac8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -42,8 +42,8 @@ vec3 linear_to_srgb(vec3 cl);
vec3 atmosFragAmbient(vec3 l, vec3 ambient);
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
-vec3 scaleFragSoftClip(vec3 l);
-vec3 atmosFragAffectDirectionalLight(float intensity, vec3 sunlit);
+vec3 scaleSoftClipFrag(vec3 l);
+
void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
@@ -406,7 +406,7 @@ void main()
col.rgb *= ambient;
- col.rgb = col.rgb + atmosFragAffectDirectionalLight(final_da, sunlit);
+ col.rgb = col.rgb + (final_da * sunlit);
col.rgb *= gamma_diff.rgb;
@@ -455,7 +455,7 @@ void main()
//col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a);
col = atmosFragLighting(col, additive, atten);
- col = scaleFragSoftClip(col);
+ col = scaleSoftClipFrag(col);
//convert to linear space before adding local lights
col = srgb_to_linear(col);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index c3827e3a56..5627275df6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -69,13 +69,7 @@ vec3 srgb_to_linear(vec3 cs);
vec3 linear_to_srgb(vec3 cl);
vec3 decode_normal (vec2 enc);
-vec3 atmosFragAmbient(vec3 l, vec3 ambient);
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
-vec3 scaleFragSoftClip(vec3 l);
-vec3 atmosFragAffectDirectionalLight(float intensity, vec3 sunlit);
-vec3 fullbrightFragAtmosTransport(vec3 l, vec3 additive, vec3 atten);
-vec3 fullbrightScaleSoftClipFrag(vec3 l, vec3 atten);
-
void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
vec4 getPosition_d(vec2 pos_screen, float depth)
@@ -123,22 +117,20 @@ void main()
vec3 col;
float bloom = 0.0;
{
- vec3 sunlit;
- vec3 amblit;
- vec3 additive;
- vec3 atten;
+ vec3 sunlit;
+ vec3 amblit;
+ vec3 additive;
+ vec3 atten;
calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten);
- col = atmosFragAmbient(vec3(0), amblit);
float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
ambient *= 0.5;
ambient *= ambient;
- ambient = (1.0-ambient);
-
- col.rgb *= ambient;
+ ambient = (1.0 - ambient);
- col += atmosFragAffectDirectionalLight(final_da, sunlit);
-
+ col = amblit;
+ col += (final_da * sunlit);
+ col *= ambient;
col *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
@@ -174,9 +166,7 @@ void main()
if (norm.w < 0.5)
{
- vec3 add = additive;
- col = mix(atmosFragLighting(col, add, atten), fullbrightFragAtmosTransport(col, atten, add), diffuse.a);
- col = mix(scaleFragSoftClip(col), fullbrightScaleSoftClipFrag(col, atten), diffuse.a);
+ col = atmosFragLighting(col, additive, atten);
}
#ifdef WATER_FOG
@@ -187,7 +177,6 @@ void main()
col = srgb_to_linear(col);
- //col = vec3(1,0,1);
//col.g = envIntensity;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl b/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl
index 587f3d5a94..00ba0e8fad 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl
@@ -23,6 +23,24 @@
* $/LicenseInfo$
*/
+vec3 rgb2hsv(vec3 c)
+{
+ vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
+ vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
+ vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
+
+ float d = q.x - min(q.w, q.y);
+ float e = 1.0e-10;
+ return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
+}
+
+vec3 hsv2rgb(vec3 c)
+{
+ vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
+ vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
+ return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
+}
+
vec3 srgb_to_linear(vec3 cs)
{
vec3 low_range = cs / vec3(12.92);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index a29acb3e7d..73f6d9fec3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -73,6 +73,7 @@ VARYING vec4 vary_position;
vec3 srgb_to_linear(vec3 cs);
vec2 encode_normal(vec3 n);
+vec3 scaleSoftClipFrag(vec3 l);
vec3 BlendNormal(vec3 bump1, vec3 bump2)
{
@@ -175,7 +176,7 @@ void main()
color.rgb += spec * specular;
color.rgb = atmosTransport(color.rgb);
- color.rgb = scaleSoftClip(color.rgb);
+ color.rgb = scaleSoftClipFrag(color.rgb);
color.a = spec * sunAngle2;
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
index 835662732a..f98b3a5edf 100644
--- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
@@ -60,3 +60,7 @@ vec3 linear_to_srgb(vec3 cl)
}
+vec3 ColorFromRadiance(vec3 radiance)
+{
+ return vec3(1.0) - exp(-radiance * 0.0001);
+}
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
index 668a710c04..46bde7f308 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl
@@ -59,8 +59,10 @@ void main()
vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
/// Add WL Components
- outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb);
+ //outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb);
+ outColor.rgb = atmosLighting(outColor.rgb);
+
frag_color = vec4(scaleSoftClip(outColor.rgb), 1.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
index d09c5f9247..5ffe464172 100644
--- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl
@@ -71,7 +71,7 @@ void main()
/// Potentially better without it for water.
pos /= pos.w;
- vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0));
+ vec4 color = calcLighting(pos.xyz, norm, vec4(0), vec4(1));
vertex_color = color;
diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
index b7f117fc5f..768d93f005 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl
@@ -26,7 +26,7 @@
uniform int no_atmo;
uniform vec4 gamma;
-vec3 scaleFragSoftClip(vec3 light)
+vec3 scaleSoftClipFrag(vec3 light)
{
// For compatibility with lower cards. Do nothing.
return light;
@@ -35,16 +35,19 @@ vec3 scaleFragSoftClip(vec3 light)
/// Soft clips the light with a gamma correction
vec3 scaleSoftClip(vec3 light)
{
- // For compatibility with lower cards. Do nothing.
- return scaleFragSoftClip(light);
+ // For compatibility with lower cards. Do nothing
+ return light;
}
-vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 atten)
+vec3 fullbrightScaleSoftClipFrag(vec3 light)
{
- return (no_atmo == 1) ? light : mix(scaleFragSoftClip(light.rgb), light.rgb, atten);
+ // For compatibility with lower cards. Do nothing
+ return light;
}
-vec3 fullbrightScaleSoftClip(vec3 light) {
- return fullbrightScaleSoftClipFrag(light, vec3(1));
+vec3 fullbrightScaleSoftClip(vec3 light)
+{
+ // For compatibility with lower cards. Do nothing
+ return light;
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
index c3c8329017..ebce9ea91d 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl
@@ -25,37 +25,19 @@
uniform int no_atmo;
-vec3 atmosFragTransport(vec3 light, vec3 atten, vec3 additive)
-{
- /* stub function for fallback compatibility on class1 hardware */
- return light;
-}
-
-vec3 fullbrightFragAtmosTransport(vec3 light, vec3 atten, vec3 additive)
-{
- /* stub function for fallback compatibility on class1 hardware */
- return light;
-}
-
-vec3 fullbrightFragShinyAtmosTransport(vec3 light, vec3 atten, vec3 additive)
-{
- /* stub function for fallback compatibility on class1 hardware */
- return light;
-}
-
vec3 atmosTransport(vec3 light)
{
/* stub function for fallback compatibility on class1 hardware */
- return atmosFragTransport(light, vec3(1), vec3(0));
+ return light;
}
vec3 fullbrightAtmosTransport(vec3 light)
{
- return fullbrightFragAtmosTransport(light, vec3(1), vec3(0));
+ return light;
}
vec3 fullbrightShinyAtmosTransport(vec3 light)
{
- return fullbrightFragShinyAtmosTransport(light, vec3(1), vec3(0));
+ return light;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index af199fd78c..fa81317f3f 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -1,5 +1,5 @@
/**
- * @file softenLightF.glsl
+ * @file class2/deferred/softenLightF.glsl
*
* $LicenseInfo:firstyear=2007&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -72,17 +72,43 @@ VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
uniform vec2 screen_res;
+uniform int no_atmo;
+
vec3 srgb_to_linear(vec3 cs);
vec3 linear_to_srgb(vec3 cl);
vec3 decode_normal (vec2 enc);
-vec3 atmosFragAmbient(vec3 l, vec3 ambient);
-vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
-vec3 scaleFragSoftClip(vec3 l);
-vec3 atmosFragAffectDirectionalLight(float intensity, vec3 sunlit);
void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
-vec3 fullbrightFragAtmosTransport(vec3 l, vec3 additive, vec3 atten);
-vec3 fullbrightScaleSoftClipFrag(vec3 l, vec3 atten);
+vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
+vec3 fullbrightScaleSoftClipFrag(vec3 l);
+vec3 scaleSoftClipFrag(vec3 l);
+
+vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) {
+ if (no_atmo == 0)
+ {
+ light *= atten.r;
+ light += additive * 2.0;
+ }
+ return light;
+}
+
+vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) {
+ if (no_atmo == 1)
+ {
+ return light;
+ }
+ float brightness = dot(light.rgb, vec3(0.33333));
+ return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive.rgb, brightness * brightness);
+}
+
+vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) {
+ if (no_atmo == 1)
+ {
+ return light;
+ }
+ float brightness = dot(light.rgb, vec3(0.33333));
+ return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
+}
vec4 getPosition_d(vec2 pos_screen, float depth)
{
@@ -121,7 +147,6 @@ void main()
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
-
vec4 diffuse = texture2DRect(diffuseRect, tc);
//convert to gamma space
@@ -136,27 +161,23 @@ void main()
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
float scol = max(scol_ambocc.r, diffuse.a);
-
-
-
float ambocc = scol_ambocc.g;
- vec3 sunlit;
- vec3 amblit;
- vec3 additive;
- vec3 atten;
+ vec3 sunlit;
+ vec3 amblit;
+ vec3 additive;
+ vec3 atten;
calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten);
-
- col = atmosFragAmbient(vec3(0), amblit);
+
float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0);
ambient *= 0.5;
ambient *= ambient;
ambient = (1.0-ambient);
- col.rgb *= ambient;
+ col.rgb = ambient * amblit;
- col += atmosFragAffectDirectionalLight(max(min(da, scol), 0.0), sunlit);
+ col += sunlit * max(min(da, scol), 0.0);
col *= diffuse.rgb;
@@ -173,7 +194,6 @@ void main()
bloom = dot(spec_contrib, spec_contrib) / 6;
col += spec_contrib;
}
-
col = mix(col, diffuse.rgb, diffuse.a);
@@ -186,13 +206,12 @@ void main()
if (norm.w < 0.5)
{
- vec3 add = additive;
- col = mix(atmosFragLighting(col, add, atten), fullbrightFragAtmosTransport(col, atten, add), diffuse.a);
- col = mix(scaleFragSoftClip(col), fullbrightScaleSoftClipFrag(col, atten), diffuse.a);
+ col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a);
+ col = mix(scaleSoftClipFrag(col), fullbrightScaleSoftClipFrag(col), diffuse.a);
}
#ifdef WATER_FOG
- vec4 fogged = applyWaterFogView(pos,vec4(col, bloom));
+ vec4 fogged = applyWaterFogView(pos.xyz,vec4(col, bloom));
col = fogged.rgb;
bloom = fogged.a;
#endif
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 20c4d82ded..89bdbfc0e6 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -43,17 +43,7 @@ uniform float scene_light_strength;
uniform mat3 ssao_effect_mat;
uniform int no_atmo;
-vec3 scaleFragSoftClip(vec3 light)
-{
- if (no_atmo == 1)
- {
- return light;
- }
- //soft clip effect:
- light = 1. - clamp(light, vec3(0.), vec3(1.));
- light = 1. - pow(light, gamma.xxx);
- return light;
-}
+vec3 scaleSoftClipFrag(vec3 light);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
{
diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
index f2764b72c3..187876acf7 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
@@ -30,8 +30,8 @@ uniform int no_atmo;
vec3 getAtmosAttenuation();
-/// Soft clips the light with a gamma correction
-vec3 scaleSoftClip(vec3 light) {
+vec3 scaleSoftClipFrag(vec3 light)
+{
if (no_atmo == 1)
{
return light;
@@ -39,16 +39,21 @@ vec3 scaleSoftClip(vec3 light) {
//soft clip effect:
light = 1. - clamp(light, vec3(0.), vec3(1.));
light = 1. - pow(light, gamma.xxx);
-
return light;
}
-vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 atten)
+vec3 scaleSoftClip(vec3 light)
+{
+ return scaleSoftClipFrag(light);
+}
+
+vec3 fullbrightScaleSoftClipFrag(vec3 light)
{
- return (no_atmo == 1) ? light : mix(scaleSoftClip(light.rgb), light.rgb, atten);
+ return scaleSoftClipFrag(light.rgb);
}
-vec3 fullbrightScaleSoftClip(vec3 light) {
- return (no_atmo == 1) ? light : fullbrightScaleSoftClipFrag(light.rgb, getAtmosAttenuation());
+vec3 fullbrightScaleSoftClip(vec3 light)
+{
+ return fullbrightScaleSoftClipFrag(light.rgb);
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index d2fd70c9e2..2615400e52 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -115,7 +115,6 @@ void main()
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
-
vec4 diffuse = texture2DRect(diffuseRect, tc);
//convert to gamma space
@@ -133,14 +132,6 @@ void main()
float ambocc = scol_ambocc.g;
- vec3 sunlit;
- vec3 amblit;
- vec3 additive;
- vec3 atten;
-
- //calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten);
- //col += atmosFragAffectDirectionalLight(max(min(da, scol), 0.0), sunlit);
-
col *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
@@ -158,8 +149,7 @@ void main()
bloom = dot(spec_contrib, spec_contrib) / 6;
col += spec_contrib;
}
-
-
+
col = mix(col, diffuse.rgb, diffuse.a);
if (envIntensity > 0.0)
@@ -169,12 +159,6 @@ void main()
col = mix(col.rgb, refcol, envintensity);
}
- if (norm.w < 0.5)
- {
- //col = mix(atmosFragLighting(col, additive, atten), fullbrightFragAtmosTransport(col, atten, additive), diffuse.a);
- //col = mix(scaleFragSoftClip(col), fullbrightScaleSoftClipFrag(col, atten), diffuse.a);
- }
-
#ifdef WATER_FOG
vec4 fogged = applyWaterFogView(pos,vec4(col, bloom));
col = fogged.rgb;
diff --git a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
index c809a41a0f..a1b67fc31e 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/atmosphericsF.glsl
@@ -42,13 +42,7 @@ uniform vec4 glow;
uniform float scene_light_strength;
uniform mat3 ssao_effect_mat;
-vec3 scaleFragSoftClip(vec3 light)
-{
- //soft clip effect:
- light = 1. - clamp(light, vec3(0.), vec3(1.));
- light = 1. - pow(light, gamma.xxx);
- return light;
-}
+vec3 scaleSoftClipFrag(vec3 light);
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
{
diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
index c2f4c43101..5c93af386b 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl
@@ -32,41 +32,42 @@ vec3 getAtmosAttenuation();
uniform int no_atmo;
-vec3 atmosFragTransport(vec3 light, vec3 atten, vec3 additive) {
- if (no_atmo == 0)
+vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) {
+ if (no_atmo == 1)
{
- light *= atten.r;
- light += additive * 2.0;
+ return light;
}
+ light *= atten.r;
+ light += additive * 2.0;
return light;
}
-vec3 fullbrightFragAtmosTransport(vec3 light, vec3 atten, vec3 additive) {
- if (no_atmo)
+vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) {
+ if (no_atmo == 1)
{
return light;
}
- loat brightness = dot(light.rgb, vec3(0.33333));
- return mix(atmosFragTransport(light.rgb, atten, additive), light.rgb + additive.rgb, brightness * brightness);
+ float brightness = dot(light.rgb, vec3(0.33333));
+ return mix(atmosTransportFrag(light.rgb, additive,a tten), light.rgb + additive.rgb, brightness * brightness);
}
-vec3 fullbrightFragShinyAtmosTransport(vec3 light, vec3 atten, vec3 additive) {
- if (no_atmo)
+vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 atten, vec3 additive) {
+ if (no_atmo == 1)
{
return light;
}
float brightness = dot(light.rgb, vec3(0.33333));
- return mix(atmosFragTransport(light.rgb, atten, additive), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
+ return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness);
}
vec3 atmosTransport(vec3 light) {
- return no_atmo ? light : atmosFragTransport(light, getAtmosAttenuation(), getAdditiveColor());
+ return (no_atmo == 1) ? light : atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
}
vec3 fullbrightAtmosTransport(vec3 light) {
- return no_atmo ? light : fullbrightFragAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor());
+ return (no_atmo == 1) ? light : fullbrightAtmosTransportFrag(light, GetAdditiveColor(), getAtmosAttenuation());
}
vec3 fullbrightShinyAtmosTransport(vec3 light) {
- return no_atmo ? light : fullbrightFragShinyAtmosTransport(light, getAtmosAttenuation(), getAdditiveColor());
+ return (no_atmo == 1) ? light : fullbrightShinyAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 8a949c6b4e..6418c9900e 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -478,6 +478,12 @@ void LLViewerShaderMgr::setShaders()
&& (gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10)
&& gSavedSettings.getBOOL("VertexShaderEnable"))
{
+ bool canRenderDeferred = LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred");
+ bool hasWindLightShaders = LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders");
+ S32 shadow_detail = gSavedSettings.getS32("RenderShadowDetail");
+ bool useRenderDeferred = canRenderDeferred && gSavedSettings.getBOOL("RenderDeferred") && gSavedSettings.getBOOL("RenderAvatarVP");
+ bool doingWindLight = hasWindLightShaders && gSavedSettings.getBOOL("WindLightUseAtmosShaders");
+
//using shaders, disable fixed function
LLGLSLShader::sNoFixedFunction = true;
@@ -485,7 +491,7 @@ void LLViewerShaderMgr::setShaders()
S32 env_class = 2;
S32 obj_class = 2;
S32 effect_class = 2;
- S32 wl_class = 3;
+ S32 wl_class = 2;
S32 water_class = 2;
S32 deferred_class = 2;
S32 transform_class = gGLManager.mHasTransformFeedback ? 1 : 0;
@@ -495,31 +501,22 @@ void LLViewerShaderMgr::setShaders()
{
transform_class = 0;
}
-
- if (LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
- gSavedSettings.getBOOL("RenderDeferred") &&
- gSavedSettings.getBOOL("RenderAvatarVP") &&
- gSavedSettings.getBOOL("WindLightUseAtmosShaders"))
+
+ if (useRenderDeferred && doingWindLight)
{
- if (gSavedSettings.getS32("RenderShadowDetail") > 0)
- { //shadows
- deferred_class = 2;
- }
- else
- { //no shadows
- deferred_class = 1;
- }
+ //shadows
+ switch (shadow_detail)
+ {
+ case 0: deferred_class = 1; break; // no shadows
+ case 1: deferred_class = 2; break; // PCF shadows
+ case 2: deferred_class = 2; break; // PCF shadows
+ case 3: deferred_class = 3; break; // VSM shadows
+ default:
+ break;
+ }
}
-
- // clamp to WL class 2 if we have disabled adv atmo (class 3)
- if (!gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics"))
- {
- wl_class = llmin(wl_class, 2);
- }
-
- bool hasWindLightShaders = LLFeatureManager::getInstance()->isFeatureAvailable("WindLightUseAtmosShaders");
- bool useWindLightShaders = gSavedSettings.getBOOL("WindLightUseAtmosShaders");
- if (!hasWindLightShaders || !useWindLightShaders)
+
+ if (!doingWindLight)
{
// user has disabled WindLight in their settings, downgrade
// windlight shaders to stub versions.
@@ -545,6 +542,15 @@ void LLViewerShaderMgr::setShaders()
mVertexShaderLevel[SHADER_TRANSFORM] = transform_class;
BOOL loaded = loadBasicShaders();
+ if (loaded)
+ {
+ LL_INFOS() << "Loaded basic shaders." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Failed to load basic shaders." << LL_ENDL;
+ llassert(loaded);
+ }
if (loaded)
{
@@ -553,6 +559,16 @@ void LLViewerShaderMgr::setShaders()
// Load all shaders to set max levels
loaded = loadShadersEnvironment();
+
+ if (loaded)
+ {
+ LL_INFOS() << "Loaded environment shaders." << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Failed to load environment shaders." << LL_ENDL;
+ llassert(loaded);
+ }
if (loaded)
{
@@ -564,6 +580,7 @@ void LLViewerShaderMgr::setShaders()
else
{
LL_WARNS() << "Failed to load water shaders." << LL_ENDL;
+ llassert(loaded);
}
}
@@ -577,6 +594,7 @@ void LLViewerShaderMgr::setShaders()
else
{
LL_WARNS() << "Failed to load windlight shaders." << LL_ENDL;
+ llassert(loaded);
}
}
@@ -590,6 +608,7 @@ void LLViewerShaderMgr::setShaders()
else
{
LL_WARNS() << "Failed to load effects shaders." << LL_ENDL;
+ llassert(loaded);
}
}
@@ -603,6 +622,7 @@ void LLViewerShaderMgr::setShaders()
else
{
LL_WARNS() << "Failed to load interface shaders." << LL_ENDL;
+ llassert(loaded);
}
}
@@ -617,6 +637,7 @@ void LLViewerShaderMgr::setShaders()
else
{
LL_WARNS() << "Failed to load transform shaders." << LL_ENDL;
+ llassert(loaded);
}
}
@@ -635,7 +656,9 @@ void LLViewerShaderMgr::setShaders()
// Set the actual level
mVertexShaderLevel[SHADER_AVATAR] = avatar_class;
- loadShadersAvatar();
+ loaded = loadShadersAvatar();
+ llassert(loaded);
+
if (mVertexShaderLevel[SHADER_AVATAR] != avatar_class)
{
if (mVertexShaderLevel[SHADER_AVATAR] == 0)
@@ -668,6 +691,7 @@ void LLViewerShaderMgr::setShaders()
loadShadersAvatar(); // unloads
loaded = loadShadersObject();
+ llassert(loaded);
}
}
@@ -692,6 +716,8 @@ void LLViewerShaderMgr::setShaders()
}
}
+ llassert(loaded);
+
if (loaded && !loadShadersDeferred())
{ //everything else succeeded but deferred failed, disable deferred and try again
gSavedSettings.setBOOL("RenderDeferred", FALSE);
@@ -955,10 +981,10 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
std::vector<S32> index_channels;
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsVarsWaterF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsHelpersF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
- index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsHelpersF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/atmosphericsF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/transportF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT] ) );
+ index_channels.push_back(-1); shaders.push_back( make_pair( "windlight/gammaF.glsl", mVertexShaderLevel[SHADER_WINDLIGHT]) );
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/waterFogF.glsl", mVertexShaderLevel[SHADER_WATER] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/encodeNormF.glsl", mVertexShaderLevel[SHADER_ENVIRONMENT] ) );
index_channels.push_back(-1); shaders.push_back( make_pair( "environment/decodeNormF.glsl", mVertexShaderLevel[SHADER_ENVIRONMENT] ) );
@@ -1025,6 +1051,7 @@ BOOL LLViewerShaderMgr::loadShadersEnvironment()
gTerrainProgram.mShaderFiles.push_back(make_pair("environment/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
gTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
success = gTerrainProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (!success)
@@ -1064,6 +1091,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
success = gWaterProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1078,6 +1106,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_WATER];
gUnderWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
success = gUnderWaterProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1096,6 +1125,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gTerrainWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_ENVIRONMENT];
gTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
terrainWaterSuccess = gTerrainWaterProgram.createShader(NULL, NULL);
+ llassert(terrainWaterSuccess);
}
/// Keep track of water shader levels
@@ -1249,6 +1279,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredDiffuseProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredDiffuseProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1261,6 +1292,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredDiffuseAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredDiffuseAlphaMaskProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1272,6 +1304,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredNonIndexedDiffuseAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredNonIndexedDiffuseAlphaMaskProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1283,6 +1316,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderFiles.push_back(make_pair("deferred/diffuseAlphaMaskNoColorF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1294,6 +1328,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredNonIndexedDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredNonIndexedDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredNonIndexedDiffuseProgram.createShader(NULL, NULL);
+ llassert(success);
}
@@ -1307,6 +1342,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSkinnedDiffuseProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredSkinnedDiffuseProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1319,6 +1355,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSkinnedBumpProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredSkinnedBumpProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1346,7 +1383,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedAlphaProgram.addPermutation("USE_VERTEX_COLOR", "1");
gDeferredSkinnedAlphaProgram.addPermutation("HAS_SHADOW", mVertexShaderLevel[SHADER_DEFERRED] > 1 ? "1" : "0");
success = gDeferredSkinnedAlphaProgram.createShader(NULL, NULL);
-
+ llassert(success);
+
// Hack to include uniforms for lighting without linking in lighting file
gDeferredSkinnedAlphaProgram.mFeatures.calculatesLighting = true;
gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true;
@@ -1361,6 +1399,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredBumpProgram.mShaderFiles.push_back(make_pair("deferred/bumpF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredBumpProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredBumpProgram.createShader(NULL, NULL);
+ llassert(success);
}
gDeferredMaterialProgram[1].mFeatures.hasLighting = false;
@@ -1401,6 +1440,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredMaterialProgram[i].addPermutation("HAS_SKIN",has_skin ? "1" : "0");
gDeferredMaterialProgram[i].mFeatures.hasSrgb = true;
+ gDeferredMaterialProgram[i].mFeatures.hasGamma = true;
+ gDeferredMaterialProgram[i].mFeatures.hasTransport = true;
gDeferredMaterialProgram[i].mFeatures.decodesNormal = true;
gDeferredMaterialProgram[i].mFeatures.encodesNormal = true;
gDeferredMaterialProgram[i].mFeatures.calculatesAtmospherics = true;
@@ -1412,6 +1453,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
success = gDeferredMaterialProgram[i].createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1436,6 +1478,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredMaterialWaterProgram[i].mFeatures.hasWaterFog = true;
gDeferredMaterialWaterProgram[i].mFeatures.hasSrgb = true;
+ gDeferredMaterialWaterProgram[i].mFeatures.hasGamma = true;
+ gDeferredMaterialWaterProgram[i].mFeatures.hasTransport = true;
gDeferredMaterialWaterProgram[i].mFeatures.decodesNormal = true;
gDeferredMaterialWaterProgram[i].mFeatures.encodesNormal = true;
gDeferredMaterialWaterProgram[i].mFeatures.calculatesAtmospherics = true;
@@ -1447,6 +1491,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
success = gDeferredMaterialWaterProgram[i].createShader(NULL, NULL);//&mWLUniforms);
+ llassert(success);
}
}
@@ -1478,6 +1523,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredTreeProgram.mShaderFiles.push_back(make_pair("deferred/treeF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredTreeProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredTreeProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1488,6 +1534,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredTreeShadowProgram.mShaderFiles.push_back(make_pair("deferred/treeShadowF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredTreeShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredTreeShadowProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1501,6 +1548,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredImpostorProgram.mShaderFiles.push_back(make_pair("deferred/impostorF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredImpostorProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredImpostorProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1513,6 +1561,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredLightProgram.createShader(NULL, NULL);
+ llassert(success);
}
for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; i++)
@@ -1527,6 +1576,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredMultiLightProgram[i].mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredMultiLightProgram[i].addPermutation("LIGHT_COUNT", llformat("%d", i+1));
success = gDeferredMultiLightProgram[i].createShader(NULL, NULL);
+ llassert(success);
}
}
@@ -1541,6 +1591,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredSpotLightProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1554,6 +1605,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredMultiSpotLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredMultiSpotLightProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1582,6 +1634,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSunProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredSunProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1594,6 +1647,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredBlurLightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredBlurLightProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1605,6 +1659,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaProgram.mFeatures.isAlphaLighting = true;
gDeferredAlphaProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
gDeferredAlphaProgram.mFeatures.hasSrgb = true;
+ gDeferredAlphaProgram.mFeatures.hasGamma = true;
gDeferredAlphaProgram.mFeatures.decodesNormal = true;
gDeferredAlphaProgram.mFeatures.encodesNormal = true;
gDeferredAlphaProgram.mFeatures.calculatesAtmospherics = true;
@@ -1628,6 +1683,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAlphaProgram.createShader(NULL, NULL);
+ llassert(success);
// Hack
gDeferredAlphaProgram.mFeatures.calculatesLighting = true;
@@ -1665,6 +1721,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaImpostorProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAlphaImpostorProgram.createShader(NULL, NULL);
+ llassert(success);
// Hack
gDeferredAlphaImpostorProgram.mFeatures.calculatesLighting = true;
@@ -1680,6 +1737,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaWaterProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
gDeferredAlphaWaterProgram.mFeatures.hasWaterFog = true;
gDeferredAlphaWaterProgram.mFeatures.hasSrgb = true;
+ gDeferredAlphaWaterProgram.mFeatures.hasGamma = true;
gDeferredAlphaWaterProgram.mFeatures.decodesNormal = true;
gDeferredAlphaWaterProgram.mFeatures.encodesNormal = true;
gDeferredAlphaWaterProgram.mFeatures.calculatesAtmospherics = true;
@@ -1704,6 +1762,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAlphaWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAlphaWaterProgram.createShader(NULL, NULL);
+ llassert(success);
// Hack
gDeferredAlphaWaterProgram.mFeatures.calculatesLighting = true;
@@ -1719,11 +1778,13 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarEyesProgram.mFeatures.disableTextureIndex = true;
gDeferredAvatarEyesProgram.mFeatures.hasSrgb = true;
gDeferredAvatarEyesProgram.mFeatures.encodesNormal = true;
+ gDeferredAvatarEyesProgram.mFeatures.hasGamma = true;
gDeferredAvatarEyesProgram.mShaderFiles.clear();
gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/avatarEyesV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredAvatarEyesProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarEyesProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAvatarEyesProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1733,12 +1794,14 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightProgram.mFeatures.hasGamma = true;
gDeferredFullbrightProgram.mFeatures.hasTransport = true;
gDeferredFullbrightProgram.mFeatures.hasSrgb = true;
+ gDeferredFullbrightProgram.mFeatures.hasGamma = true;
gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredFullbrightProgram.mShaderFiles.clear();
gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredFullbrightProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1748,6 +1811,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
gDeferredFullbrightAlphaMaskProgram.mFeatures.hasTransport = true;
gDeferredFullbrightAlphaMaskProgram.mFeatures.hasSrgb = true;
+ gDeferredFullbrightAlphaMaskProgram.mFeatures.hasGamma = true;
gDeferredFullbrightAlphaMaskProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredFullbrightAlphaMaskProgram.mShaderFiles.clear();
gDeferredFullbrightAlphaMaskProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
@@ -1755,6 +1819,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightAlphaMaskProgram.addPermutation("HAS_ALPHA_MASK","1");
gDeferredFullbrightAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredFullbrightAlphaMaskProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1765,6 +1830,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightWaterProgram.mFeatures.hasTransport = true;
gDeferredFullbrightWaterProgram.mFeatures.hasWaterFog = true;
gDeferredFullbrightWaterProgram.mFeatures.hasSrgb = true;
+ gDeferredFullbrightWaterProgram.mFeatures.hasGamma = true;
gDeferredFullbrightWaterProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredFullbrightWaterProgram.mShaderFiles.clear();
gDeferredFullbrightWaterProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
@@ -1773,6 +1839,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredFullbrightWaterProgram.addPermutation("WATER_FOG","1");
success = gDeferredFullbrightWaterProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1783,6 +1850,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasTransport = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasWaterFog = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasSrgb = true;
+ gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.hasGamma = true;
gDeferredFullbrightAlphaMaskWaterProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
gDeferredFullbrightAlphaMaskWaterProgram.mShaderFiles.clear();
gDeferredFullbrightAlphaMaskWaterProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER_ARB));
@@ -1792,6 +1860,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightAlphaMaskWaterProgram.addPermutation("HAS_ALPHA_MASK","1");
gDeferredFullbrightAlphaMaskWaterProgram.addPermutation("WATER_FOG","1");
success = gDeferredFullbrightAlphaMaskWaterProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1806,6 +1875,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredFullbrightShinyProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1822,6 +1892,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSkinnedFullbrightProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
success = gDeferredSkinnedFullbrightProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1837,6 +1908,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedFullbrightShinyProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightShinyF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredSkinnedFullbrightShinyProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT];
success = gDeferredSkinnedFullbrightShinyProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1851,6 +1923,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredEmissiveProgram.mShaderFiles.push_back(make_pair("deferred/emissiveF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredEmissiveProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredEmissiveProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1867,6 +1940,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
success = gDeferredWaterProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1884,6 +1958,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredUnderWaterProgram.mShaderFiles.push_back(make_pair("deferred/underWaterF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredUnderWaterProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredUnderWaterProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1894,7 +1969,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSoftenProgram.mFeatures.decodesNormal = true;
gDeferredSoftenProgram.mFeatures.calculatesAtmospherics = true;
gDeferredSoftenProgram.mFeatures.hasAtmospherics = true;
- gDeferredSoftenProgram.mFeatures.hasTransport = true;
gDeferredSoftenProgram.mFeatures.hasGamma = true;
gDeferredSoftenProgram.mShaderFiles.push_back(make_pair("deferred/softenLightV.glsl", GL_VERTEX_SHADER_ARB));
@@ -1908,6 +1982,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
success = gDeferredSoftenProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1925,7 +2000,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSoftenWaterProgram.mFeatures.decodesNormal = true;
gDeferredSoftenWaterProgram.mFeatures.calculatesAtmospherics = true;
gDeferredSoftenWaterProgram.mFeatures.hasAtmospherics = true;
- gDeferredSoftenWaterProgram.mFeatures.hasTransport = true;
gDeferredSoftenWaterProgram.mFeatures.hasGamma = true;
if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
@@ -1934,6 +2008,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
}
success = gDeferredSoftenWaterProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1945,6 +2020,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredShadowProgram.addPermutation("DEPTH_CLAMP", gGLManager.mHasDepthClamp ? "1" : "0");
success = gDeferredShadowProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1956,6 +2032,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredShadowCubeProgram.addPermutation("DEPTH_CLAMP", gGLManager.mHasDepthClamp ? "1" : "0");
gDeferredShadowCubeProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredShadowCubeProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1968,6 +2045,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredShadowAlphaMaskProgram.addPermutation("DEPTH_CLAMP", gGLManager.mHasDepthClamp ? "1" : "0");
gDeferredShadowAlphaMaskProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredShadowAlphaMaskProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1980,6 +2058,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarShadowProgram.addPermutation("DEPTH_CLAMP", gGLManager.mHasDepthClamp ? "1" : "0");
gDeferredAvatarShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAvatarShadowProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -1992,6 +2071,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAttachmentShadowProgram.addPermutation("DEPTH_CLAMP", gGLManager.mHasDepthClamp ? "1" : "0");
gDeferredAttachmentShadowProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAttachmentShadowProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2003,6 +2083,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredTerrainProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredTerrainProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2015,6 +2096,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarProgram.mShaderFiles.push_back(make_pair("deferred/avatarF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredAvatarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAvatarProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2042,6 +2124,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredAvatarAlphaProgram.createShader(NULL, NULL);
+ llassert(success);
gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = true;
gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
@@ -2056,6 +2139,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredPostGammaCorrectProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredPostGammaCorrectProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2066,6 +2150,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER_ARB));
gFXAAProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gFXAAProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2076,6 +2161,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredPostProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredPostProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredPostProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2086,6 +2172,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredCoFProgram.mShaderFiles.push_back(make_pair("deferred/cofF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredCoFProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredCoFProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2096,6 +2183,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredDoFCombineProgram.mShaderFiles.push_back(make_pair("deferred/dofCombineF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredDoFCombineProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredDoFCombineProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2106,6 +2194,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER_ARB));
gDeferredPostNoDoFProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gDeferredPostNoDoFProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)
@@ -2118,12 +2207,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLSkyProgram.mFeatures.hasGamma = true;
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB));
- gDeferredWLSkyProgram.mShaderLevel = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") ? 3 : mVertexShaderLevel[SHADER_WINDLIGHT];
+ gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY;
- if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] > 1)
- {
- gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink();
- }
success = gDeferredWLSkyProgram.createShader(NULL, NULL);
llassert(success);
}
@@ -2137,12 +2222,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredWLCloudProgram.mFeatures.hasGamma = true;
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB));
- gDeferredWLCloudProgram.mShaderLevel = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") ? 3 : mVertexShaderLevel[SHADER_WINDLIGHT];
+ gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY;
- if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] > 1)
- {
- gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink();
- }
success = gDeferredWLCloudProgram.createShader(NULL, NULL);
llassert(success);
}
@@ -2192,6 +2273,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredStarProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
gDeferredStarProgram.mShaderGroup = LLGLSLShader::SG_SKY;
success = gDeferredStarProgram.createShader(NULL, NULL);
+ llassert(success);
}
if (success)