diff options
author | Graham Linden <graham@lindenlab.com> | 2019-02-28 14:06:19 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-02-28 14:06:19 -0800 |
commit | c1d2416826406631807f153e7de9d2b790b0caa5 (patch) | |
tree | e5092c0a9e6ff778d74cb13af44d9c61325fe20f /indra/newview/app_settings | |
parent | d7ad30a2d4dfd83f93b0150464214f2df776eb9c (diff) |
EEP performance WIP
Mods to improve alpha obj render performance.
Removes hacky fix for HUD elements getting atmospherics.
Re-orders rendering of glow to remove ~10ms/frame of shader re-re-rebinding.
Fix up default classes and basic shader loading (remove unused shared modules).
Diffstat (limited to 'indra/newview/app_settings')
14 files changed, 31 insertions, 72 deletions
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl index c4caed4d71..767fad016c 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl @@ -38,5 +38,12 @@ mat4 getSkinnedTransform() ret[1] = mix(matrixPalette[i+15],matrixPalette[i+16], x); ret[2] = mix(matrixPalette[i+30],matrixPalette[i+31], x); ret[3] = vec4(0,0,0,1); + return ret; + +#ifdef IS_AMD_CARD + // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. + vec4 dummy1 = matrixPalette[0]; + vec4 dummy2 = matrixPalette[44]; +#endif } diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 94de2f7b53..90bf2851c9 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -61,5 +61,12 @@ mat4 getObjectSkinnedTransform() ret[3] = vec4(trans, 1.0); return ret; + +#ifdef IS_AMD_CARD + // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. + mat3x4 dummy1 = matrixPalette[0]; + mat3x4 dummy2 = matrixPalette[MAX_JOINTS_PER_MESH_OBJECT-1]; +#endif + } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl index 10407eeb02..3572331d74 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl @@ -25,11 +25,9 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; -uniform int no_atmo; vec3 atmosAmbient(vec3 light) { - if (no_atmo == 1) return light + vec3(0.66); return light + light_ambient.rgb; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index 14034bccae..7e4855b7c6 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -25,11 +25,9 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; -uniform int no_atmo; vec3 atmosAmbient(vec3 light) { - if (no_atmo == 1) return light + vec3(0.66); return light + light_ambient.rgb; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl index 667301443a..9917ba8d3b 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl @@ -23,7 +23,6 @@ * $/LicenseInfo$ */ -uniform int no_atmo; uniform vec4 gamma; vec3 scaleSoftClipFrag(vec3 light) diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl index e2b391cb7a..f61194db6d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl @@ -23,8 +23,6 @@ * $/LicenseInfo$ */ -uniform int no_atmo; - vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { /* stub function for fallback compatibility on class1 hardware */ diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 142b03e095..0f6bf38388 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -212,6 +212,7 @@ void main() col = dlit*lit*diff_tex*shadow; amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; + amb_da = min(amb_da,shadow); } //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 565c00ba79..ebb06e0f23 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -43,17 +43,12 @@ uniform float max_y; uniform vec4 glow; uniform float scene_light_strength; uniform mat3 ssao_effect_mat; -uniform int no_atmo; uniform float sun_moon_glow_factor; vec3 scaleSoftClipFrag(vec3 light); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { - if (no_atmo == 1) - { - return light; - } light *= atten.r; light += additive; return light * 2.0; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl index 86743dc306..c836ca98c5 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl @@ -26,11 +26,9 @@ // Output variables uniform float scene_light_strength; -uniform int no_atmo; vec3 atmosFragAmbient(vec3 light, vec3 amblit) { - if (no_atmo == 1) return light; return amblit + light / 2.0; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl index 95b4a76880..589c95bc96 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl @@ -33,11 +33,9 @@ vec3 getAtmosAttenuation(); vec3 getPositionEye(); uniform float scene_light_strength; -uniform int no_atmo; vec3 atmosAmbient(vec3 light) { - if (no_atmo == 1) return light + vec3(0.66); return getAmblitColor() + light / 2.0; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index a26752f741..bef7a8827a 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -64,8 +64,8 @@ void calcAtmospherics(vec3 inPositionEye) { setPositionEye(P); //(TERRAIN) limit altitude - //if (P.y > max_y) P *= (max_y / P.y); - //if (P.y < -max_y) P *= (-max_y / P.y); + if (P.y > max_y) P *= (max_y / P.y); + if (P.y < -max_y) P *= (-max_y / P.y); vec3 tmpLightnorm = lightnorm.xyz; @@ -134,21 +134,11 @@ void calcAtmospherics(vec3 inPositionEye) { + tmpAmbient)); additive = normalize(additive); - //haze color - //setAdditiveColor( - // vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient) - // + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x - // + tmpAmbient))); - //brightness of surface both sunlight and ambient setSunlitColor(vec3(sunlight * .5)); setAmblitColor(vec3(tmpAmbient * .25)); setAdditiveColor(additive * vec3(1.0 - exp(-temp2.z * distance_multiplier)) * 0.5); - // vary_SunlitColor = vec3(0); - // vary_AmblitColor = vec3(0); - // vary_AdditiveColor = vec4(Pn, 1.0); - /* const float cloudShadowScale = 100.; // Get cloud uvs for shadowing diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index 143bafc9c9..e985c50c67 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -26,16 +26,12 @@ uniform vec4 gamma; -uniform int no_atmo; vec3 getAtmosAttenuation(); +vec3 getAdditiveColor(); vec3 scaleSoftClipFrag(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); @@ -47,12 +43,13 @@ vec3 scaleSoftClip(vec3 light) return scaleSoftClipFrag(light); } -vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten) { - return scaleSoftClipFrag(light.rgb); +vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten) +{ + return mix(scaleSoftClipFrag(light.rgb), add, atten); } vec3 fullbrightScaleSoftClip(vec3 light) { - return scaleSoftClipFrag(light); + return fullbrightScaleSoftClipFrag(light, getAdditiveColor(), getAtmosAttenuation()); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index df731662e8..d799453712 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -30,34 +30,21 @@ vec3 getAdditiveColor(); vec3 getAtmosAttenuation(); -uniform int no_atmo; - vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { - if (no_atmo == 1) - { - return light; - } light *= atten.r; - light += additive * 2.0; - return light; + light += additive; + return light * 2.0; } 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; - } +vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) +{ float brightness = dot(light.rgb, vec3(0.33333)); return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl index 90ab5d2793..7f74122665 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -30,35 +30,21 @@ vec3 getAdditiveColor(); vec3 getAtmosAttenuation(); -uniform int no_atmo; - vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { - if (no_atmo == 1) - { - return light; - } - return (light + additive) * atten * 2.0; + return (light + additive) * atten * 2.0; } 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); + 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); + float brightness = dot(light.rgb, vec3(0.33333)); + return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } vec3 atmosTransport(vec3 light) |