summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/MPHDRDisplayGammaF.glsl55
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl1
4 files changed, 59 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/MPHDRDisplayGammaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/MPHDRDisplayGammaF.glsl
new file mode 100644
index 0000000000..7107cfcbce
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/MPHDRDisplayGammaF.glsl
@@ -0,0 +1,55 @@
+/**
+ * @file postDeferredGammaCorrect.glsl
+ *
+ * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+/*[EXTRA_CODE_HERE]*/
+
+out vec4 frag_color;
+
+uniform sampler2D diffuseRect;
+
+uniform float gamma = 2.2;
+uniform float mpHDRBoost;
+
+in vec2 vary_fragcoord;
+
+vec3 clampHDRRange(vec3 color);
+
+vec3 HDRDisplayGamma(vec3 linearRGB)
+{
+ bvec3 cutoff = lessThan(linearRGB, vec3(0.0031308));
+ vec3 higher = vec3(1.055)*pow(linearRGB, vec3(1.0/gamma)) - vec3(0.055);
+ vec3 lower = linearRGB * vec3(12.92);
+
+ return mix(higher, lower, cutoff);
+}
+
+void main()
+{
+ vec4 diff = texture(diffuseRect, vary_fragcoord);
+ diff.rgb = mpHDRBoost * HDRDisplayGamma(diff.rgb);
+ diff.rgb = clampHDRRange(diff.rgb);
+ frag_color = diff;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl
index 60a8300352..fdb77cce6e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl
@@ -1351,10 +1351,6 @@ float4 SMAABlendingWeightCalculationPS(float2 texcoord,
//-----------------------------------------------------------------------------
// Neighborhood Blending Pixel Shader (Third Pass)
-vec3 srgb_to_linear(vec3 cs);
-vec4 srgb_to_linear4(vec4 cs);
-vec3 linear_to_srgb(vec3 cl);
-
float4 SMAANeighborhoodBlendingPS(float2 texcoord,
float4 offset,
SMAATexture2D(colorTex),
@@ -1373,7 +1369,6 @@ float4 SMAANeighborhoodBlendingPS(float2 texcoord,
SMAA_BRANCH
if (dot(a, float4(1.0, 1.0, 1.0, 1.0)) < 1e-5) {
float4 color = SMAASampleLevelZero(colorTex, texcoord);
- color.rgb = srgb_to_linear(color.rgb);
#if SMAA_REPROJECTION
float2 velocity = SMAA_DECODE_VELOCITY(SMAASampleLevelZero(velocityTex, texcoord));
@@ -1382,8 +1377,6 @@ float4 SMAANeighborhoodBlendingPS(float2 texcoord,
color.a = sqrt(5.0 * length(velocity));
#endif
- color.rgb = linear_to_srgb(color.rgb);
-
return color;
} else {
bool h = max(a.x, a.z) > max(a.y, a.w); // max(horizontal) > max(vertical)
@@ -1400,15 +1393,8 @@ float4 SMAANeighborhoodBlendingPS(float2 texcoord,
// We exploit bilinear filtering to mix current pixel with the chosen
// neighbor:
- //float4 color = blendingWeight.x * SMAASampleLevelZero(colorTex, blendingCoord.xy);
- //color += blendingWeight.y * SMAASampleLevelZero(colorTex, blendingCoord.zw);
- float4 color = SMAASampleLevelZero(colorTex, blendingCoord.xy);
- color.rgb = srgb_to_linear(color.rgb);
- color = blendingWeight.x * color;
-
- float4 color2 = SMAASampleLevelZero(colorTex, blendingCoord.zw);
- color2.rgb = srgb_to_linear(color2.rgb);
- color += blendingWeight.y * color2;
+ float4 color = blendingWeight.x * SMAASampleLevelZero(colorTex, blendingCoord.xy);
+ color += blendingWeight.y * SMAASampleLevelZero(colorTex, blendingCoord.zw);
#if SMAA_REPROJECTION
// Antialias velocity for proper reprojection in a later stage:
@@ -1419,7 +1405,6 @@ float4 SMAANeighborhoodBlendingPS(float2 texcoord,
color.a = sqrt(5.0 * length(velocity));
#endif
- color.rgb = linear_to_srgb(color.rgb);
return color;
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 4ccc6f54a8..197ce48a45 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -30,7 +30,7 @@ out vec4 frag_color;
uniform sampler2D diffuseRect;
uniform float gamma;
-uniform vec2 screen_res;
+//uniform vec2 screen_res;
in vec2 vary_fragcoord;
vec3 linear_to_srgb(vec3 cl);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
index c05b4eed7a..8ee53e3ae4 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl
@@ -79,6 +79,7 @@ void main()
vec4 diff = texture(diffuseRect, vary_fragcoord.xy);
#ifdef HAS_NOISE
+
vec2 tc = vary_fragcoord.xy*screen_res*4.0;
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb));