summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl37
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl24
8 files changed, 58 insertions, 47 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl
index 4366376d99..edec83ea07 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightMSF.glsl
@@ -12,7 +12,7 @@
uniform sampler2DMS depthMap;
uniform sampler2DMS normalMap;
-uniform sampler2DMS lightMap;
+uniform sampler2DRect lightMap;
uniform float dist_factor;
uniform float blur_size;
@@ -25,12 +25,23 @@ varying vec2 vary_fragcoord;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
+vec3 texture2DMS3(sampler2DMS tex, ivec2 tc)
{
- vec4 ret = vec4(0,0,0,0);
+ vec3 ret = vec3(0,0,0);
for (int i = 0; i < samples; i++)
{
- ret += texelFetch(tex, tc, i);
+ ret += texelFetch(tex, tc, i).rgb;
+ }
+
+ return ret/samples;
+}
+
+float texture2DMS1(sampler2DMS tex, ivec2 tc)
+{
+ float ret = 0;
+ for (int i = 0; i < samples; i++)
+ {
+ ret += texelFetch(tex, tc, i).r;
}
return ret/samples;
@@ -38,7 +49,7 @@ vec4 texture2DMS(sampler2DMS tex, ivec2 tc)
vec4 getPosition(ivec2 pos_screen)
{
- float depth = texture2DMS(depthMap, pos_screen.xy).r;
+ float depth = texture2DMS1(depthMap, pos_screen.xy);
vec2 sc = pos_screen.xy*2.0;
sc /= screen_res;
sc -= vec2(1.0,1.0);
@@ -54,10 +65,10 @@ void main()
vec2 tc = vary_fragcoord.xy;
ivec2 itc = ivec2(tc);
- vec3 norm = texture2DMS(normalMap, itc).xyz;
+ vec3 norm = texture2DMS3(normalMap, itc).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
vec3 pos = getPosition(itc).xyz;
- vec4 ccol = texture2DMS(lightMap, itc).rgba;
+ vec4 ccol = texture2DRect(lightMap, tc).rgba;
vec2 dlt = kern_scale * delta / (1.0+norm.xy*norm.xy);
dlt /= max(-pos.z*dist_factor, 1.0);
@@ -73,23 +84,23 @@ void main()
for (int i = 1; i < 4; i++)
{
- ivec2 samptc = ivec2(tc + kern[i].z*dlt);
- vec3 samppos = getPosition(samptc).xyz;
+ vec2 samptc = tc + kern[i].z*dlt;
+ vec3 samppos = getPosition(ivec2(samptc)).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
if (d*d <= pointplanedist_tolerance_pow2)
{
- col += texture2DMS(lightMap, samptc)*kern[i].xyxx;
+ col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
defined_weight += kern[i].xy;
}
}
for (int i = 1; i < 4; i++)
{
- ivec2 samptc = ivec2(tc - kern[i].z*dlt);
- vec3 samppos = getPosition(samptc).xyz;
+ vec2 samptc = vec2(tc - kern[i].z*dlt);
+ vec3 samppos = getPosition(ivec2(samptc)).xyz;
float d = dot(norm.xyz, samppos.xyz-pos.xyz);// dist from plane
if (d*d <= pointplanedist_tolerance_pow2)
{
- col += texture2DMS(lightMap, samptc)*kern[i].xyxx;
+ col += texture2DRect(lightMap, samptc)*kern[i].xyxx;
defined_weight += kern[i].xy;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl
index 16e97109f9..66c7a5cb4a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightMSF.glsl
@@ -130,7 +130,7 @@ void main()
discard;
}
- gl_FragColor.rgb = fcol/wght;
+ gl_FragColor.rgb = fcol/samples;
gl_FragColor.a = 0.0;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl
index bdaa8e59c4..b450ff1ca2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightMSF.glsl
@@ -34,7 +34,6 @@ uniform float far_clip;
uniform vec3 proj_origin; //origin of projection to be used for angular attenuation
uniform float sun_wash;
-uniform int proj_shadow_idx;
uniform float shadow_fade;
varying vec4 vary_light;
@@ -228,6 +227,6 @@ void main()
discard;
}
- gl_FragColor.rgb = fcol/wght;
+ gl_FragColor.rgb = fcol/samples;
gl_FragColor.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl
index 23b5e76735..7521c3310c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightMSF.glsl
@@ -103,6 +103,6 @@ void main()
discard;
}
- gl_FragColor.rgb = fcol/wght;
+ gl_FragColor.rgb = fcol/samples;
gl_FragColor.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl
index 3a9d9266bb..6702bd5014 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightMSF.glsl
@@ -229,6 +229,6 @@ void main()
discard;
}
- gl_FragColor.rgb = fcol/wght;
+ gl_FragColor.rgb = fcol/samples;
gl_FragColor.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
index c6f0ea2a5d..d0f9101774 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl
@@ -14,7 +14,7 @@ uniform sampler2DMS diffuseRect;
uniform sampler2DMS specularRect;
uniform sampler2DMS depthMap;
uniform sampler2DMS normalMap;
-uniform sampler2DMS lightMap;
+uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
@@ -112,6 +112,17 @@ void main()
ivec2 itc = ivec2(frag.xy);
+ float shadow = 1.0;
+
+ if (proj_shadow_idx >= 0)
+ {
+ vec4 shd = texture2DRect(lightMap, frag);
+ float sh[2];
+ sh[0] = shd.b;
+ sh[1] = shd.a;
+ shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
+ }
+
for (int i = 0; i < samples; i++)
{
vec3 pos = getPosition(itc, i).xyz;
@@ -120,17 +131,6 @@ void main()
dist2 /= vary_light.w;
if (dist2 <= 1.0)
{
- float shadow = 1.0;
-
- if (proj_shadow_idx >= 0)
- {
- vec4 shd = texelFetch(lightMap, itc, i);
- float sh[2];
- sh[0] = shd.b;
- sh[1] = shd.a;
- shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
- }
-
vec3 norm = texelFetch(normalMap, itc, i).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm
@@ -239,6 +239,6 @@ void main()
discard;
}
- gl_FragColor.rgb = fcol/wght;
+ gl_FragColor.rgb = fcol/samples;
gl_FragColor.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
index 71482d0c7b..cb09fe9895 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl
@@ -13,7 +13,7 @@
uniform sampler2DMS diffuseRect;
uniform sampler2DMS specularRect;
uniform sampler2DMS normalMap;
-uniform sampler2DMS lightMap;
+uniform sampler2DRect lightMap;
uniform sampler2DMS depthMap;
uniform sampler2D noiseMap;
uniform samplerCube environmentMap;
@@ -257,7 +257,8 @@ void main()
vec3 fcol = vec3(0,0,0);
- float amb = 0;
+ vec2 scol_ambocc = texture2DRect(lightMap, tc).rg;
+ float ambocc = scol_ambocc.g;
for (int i = 0; i < samples; ++i)
{
@@ -271,9 +272,9 @@ void main()
vec4 diffuse = texelFetch(diffuseRect, itc, i);
vec4 spec = texelFetch(specularRect, itc, i);
- vec2 scol_ambocc = texelFetch(lightMap, itc, i).rg;
+ float amb = 0;
+
float scol = max(scol_ambocc.r, diffuse.a);
- float ambocc = scol_ambocc.g;
amb += ambocc;
calcAtmospherics(pos.xyz, ambocc);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
index 099a45718a..8d6ffd79c5 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl
@@ -14,7 +14,7 @@ uniform sampler2DMS diffuseRect;
uniform sampler2DMS specularRect;
uniform sampler2DMS depthMap;
uniform sampler2DMS normalMap;
-uniform sampler2DMS lightMap;
+uniform sampler2DRect lightMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2D projectionMap;
@@ -113,6 +113,17 @@ void main()
vec3 fcol = vec3(0,0,0);
int wght = 0;
+ float shadow = 1.0;
+
+ if (proj_shadow_idx >= 0)
+ {
+ vec4 shd = texture2DRect(lightMap, frag.xy);
+ float sh[2];
+ sh[0] = shd.b;
+ sh[1] = shd.a;
+ shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
+ }
+
for (int i = 0; i < samples; i++)
{
vec3 pos = getPosition(itc, i).xyz;
@@ -121,17 +132,6 @@ void main()
dist2 /= vary_light.w;
if (dist2 <= 1.0)
{
- float shadow = 1.0;
-
- if (proj_shadow_idx >= 0)
- {
- vec4 shd = texelFetch(lightMap, itc, i);
- float sh[2];
- sh[0] = shd.b;
- sh[1] = shd.a;
- shadow = min(sh[proj_shadow_idx]+shadow_fade, 1.0);
- }
-
vec3 norm = texelFetch(normalMap, itc, i).xyz;
norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm