diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
10 files changed, 19 insertions, 46 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl index ce018623a8..1a065daf89 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl @@ -78,10 +78,10 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen)  {      float ret = 1.0;      vec3 pos_world = pos.xyz; -    vec2 noise_reflect = texture(noiseMap, pos_screen.xy * (screen_res / 128)).xy; +    vec2 noise_reflect = texture(noiseMap, pos_screen.xy * (screen_res / 128.0)).xy;      float angle_hidden = 0.0; -    float points = 0; +    float points = 0.0;      float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index dba9c46332..63ab0b9b38 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -265,7 +265,7 @@ vec4 texture2DLodSpecular(vec2 tc, float lod)      vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));      float det = min(lod/(proj_lod*0.5), 1.0);      float d = min(dist.x, dist.y); -    d *= min(1, d * (proj_lod - lod)); // BUG? extra factor compared to diffuse causes N repeats +    d *= min(1.0, d * (proj_lod - lod)); // BUG? extra factor compared to diffuse causes N repeats      float edge = 0.25*det;      ret *= clamp(d/edge, 0.0, 1.0); @@ -383,7 +383,7 @@ void pbrIbl(vec3 diffuseColor,              out vec3 specularOut)  {      // retrieve a scale and bias to F0. See [1], Figure 3 -    vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough); +    vec2 brdf = BRDF(clamp(nv, 0.0, 1.0), 1.0-perceptualRough);      vec3 diffuseLight = irradiance;      vec3 specularLight = radiance; @@ -438,9 +438,10 @@ float geometricOcclusion(PBRInfo pbrInputs)      float NdotL = pbrInputs.NdotL;      float NdotV = pbrInputs.NdotV;      float r = pbrInputs.alphaRoughness; +    float r2 = r * r; -    float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL))); -    float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV))); +    float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r2 + (1.0 - r2) * (NdotL * NdotL))); +    float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r2 + (1.0 - r2) * (NdotV * NdotV)));      return attenuationL * attenuationV;  } @@ -625,24 +626,11 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,  uniform vec4 waterPlane;  uniform float waterSign; -// discard if given position in eye space is on the wrong side of the waterPlane according to waterSign  void waterClip(vec3 pos)  { -    // TODO: make this less branchy -    if (waterSign > 0) +    if (((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) * waterSign) < 0.0)      { -        if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) < 0.0) -        { -            discard; -        } -    } -    else -    { -        if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) > 0.0) -        { -            discard; -        } +        discard;      } -  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl index 2ed4ba3163..9060d358cf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/globalF.glsl @@ -34,7 +34,7 @@ uniform float clipSign;  void mirrorClip(vec3 pos)  { -    if (mirror_flag > 0) +    if (mirror_flag > 0.0)      {          if ((dot(pos.xyz, clipPlane.xyz) + clipPlane.w) < 0.0)          { diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index 4acab159cb..4331418b33 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -37,14 +37,10 @@ uniform sampler2D emissiveRect;  uniform sampler2D normalMap;  uniform float diffuse_luminance_scale; -float lum(vec3 col) -{ -    vec3 l = vec3(0.2126, 0.7152, 0.0722); -    return dot(l, col); -}  void main()  { +    const vec3 l = vec3(0.2126, 0.7152, 0.0722);      vec2 tc = vary_fragcoord*0.6+0.2;      tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky      vec3 c = texture(diffuseRect, tc).rgb; @@ -62,7 +58,7 @@ void main()      c += texture(emissiveRect, tc).rgb; -    float L = lum(c); +    float L = dot(l, c);      frag_color = vec4(max(L, 0.0));  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl index dc43007dca..fb4b139662 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainUtilF.glsl @@ -297,7 +297,7 @@ vec3 _t_normal_post_1(vec3 vNt0, float sign_or_zero)      sign = (2.0*sign) + 1.0;      sign /= abs(sign);      // If the sign is negative, rotate normal by 180 degrees -    vNt1.xy = (min(0, sign) * vNt1.xy) + (min(0, -sign) * -vNt1.xy); +    vNt1.xy = (min(0.0, sign) * vNt1.xy) + (min(0.0, -sign) * -vNt1.xy);      return vNt1;  } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index 72eda80716..bfb592be9b 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -49,7 +49,7 @@ void main()      float warmth = smoothstep(minLuminance, minLuminance+1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) );  #if HAS_NOISE -    float TRUE_NOISE_RES = 128; // See mTrueNoiseMap +    float TRUE_NOISE_RES = 128.0; // See mTrueNoiseMap      // *NOTE: Usually this is vary_fragcoord not vary_texcoord0, but glow extraction is in screen space      vec3 glow_noise = texture(glowNoiseMap, vary_texcoord0.xy * (screen_res / TRUE_NOISE_RES)).xyz;      // Dithering. Reduces banding effects in the reduced precision glow buffer. diff --git a/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl b/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl index 09eb7a6a6a..82f32da048 100644 --- a/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/gaussianF.glsl @@ -45,7 +45,7 @@ void main()      for (int i = 0; i < 9; ++i)      { -        vec2 tc = vary_texcoord0 + (i-4)*direction*resScale; +        vec2 tc = vary_texcoord0 + float(i-4)*direction*resScale;          col += texture(diffuseRect, tc).rgb * w[i];      } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleColorF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleColorF.glsl index dea76da5a5..30d70122cb 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleColorF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleColorF.glsl @@ -33,20 +33,9 @@ uniform float waterSign;  void waterClip(vec3 pos)  { -    // TODO: make this less branchy -    if (waterSign > 0) +    if (((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) * waterSign) < 0.0)      { -        if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) < 0.0) -        { -            discard; -        } -    } -    else -    { -        if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) > 0.0) -        { -            discard; -        } +        discard;      }  } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index 5089b9e31e..9101fc0222 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -99,7 +99,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou      haze_glow = max(haze_glow, .001);  // set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot)      haze_glow *= glow.x;      // higher glow.x gives dimmer glow (because next step is 1 / "angle") -    haze_glow = clamp(pow(haze_glow, glow.z), -100000, 100000); +    haze_glow = clamp(pow(haze_glow, glow.z), -100000.0, 100000.0);      // glow.z should be negative, so we're doing a sort of (1 / "angle") function      // add "minimum anti-solar illumination" diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl index 1372ddbcfa..bdc5b58060 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl @@ -47,7 +47,7 @@ void calcAtmospherics(vec3 inPositionEye) {      vec3 tmpaddlit = vec3(1);      vec3 tmpattenlit = vec3(1);      vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; -    calcAtmosphericVars(inPositionEye, light_dir, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit); +    calcAtmosphericVars(inPositionEye, light_dir, 1.0, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit);      setSunlitColor(tmpsunlit);      setAmblitColor(tmpamblit);      setAdditiveColor(tmpaddlit);  | 
