diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl index fdb77cce6e..60a8300352 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl @@ -1351,6 +1351,10 @@ 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), @@ -1369,6 +1373,7 @@ 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)); @@ -1377,6 +1382,8 @@ 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) @@ -1393,8 +1400,15 @@ 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 = 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; #if SMAA_REPROJECTION // Antialias velocity for proper reprojection in a later stage: @@ -1405,6 +1419,7 @@ float4 SMAANeighborhoodBlendingPS(float2 texcoord, color.a = sqrt(5.0 * length(velocity)); #endif + color.rgb = linear_to_srgb(color.rgb); return color; } } |