diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-06-07 21:03:27 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2021-06-07 21:03:27 +0300 |
commit | e7319fb6710f7121ead544493af6407482aea44c (patch) | |
tree | a2c8706ff26103026c4c8a1af8fc4fea8c9c3bbb /indra/newview | |
parent | 34ef50f3b272cbf01e96a8356a1e67f2ec831452 (diff) | |
parent | 4623b822386accfae5907c88099c2a88377a0271 (diff) |
Merge branch 'master' into DRTVWR-518-ui
Diffstat (limited to 'indra/newview')
66 files changed, 1465 insertions, 1018 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e8e5b83957..424fd17707 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -589,6 +589,7 @@ set(viewer_SOURCE_FILES llsyntaxid.cpp llsyswellitem.cpp llsyswellwindow.cpp + lltelemetry.cpp llteleporthistory.cpp llteleporthistorystorage.cpp lltextureatlas.cpp diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 427dc381ad..e786022da5 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -6.4.19 +6.4.20 diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index fa47596bfa..1df3ed5346 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6597,7 +6597,7 @@ <key>Value</key> <integer>1</integer> </map> - <key>MemoryFailurePreventionEnabled</key> + <key>MemoryFailurePreventionEnabled</key> <!-- deprecated, only used for obsolete-in-2020 Intel 965 Express GPU --> <map> <key>Comment</key> <string>If set, the viewer will quit to avoid crash when memory failure happens</string> @@ -9124,7 +9124,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>0.03</real> + <real>0.1</real> </map> <key>RenderDebugPipeline</key> <map> diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index b7036e02cf..8e0a001403 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file WLCloudsV.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2005, 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$ */ @@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0; /////////////////////////////////////////////////////////////////////////////// // Output parameters -VARYING vec4 vary_CloudColorSun; -VARYING vec4 vary_CloudColorAmbient; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; VARYING float vary_CloudDensity; -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; VARYING float altitude_blend_factor; // Inputs uniform vec3 camPosLocal; -uniform vec4 lightnorm; -uniform vec4 sunlight_color; -uniform vec4 moonlight_color; -uniform int sun_up_factor; -uniform vec4 ambient_color; -uniform vec4 blue_horizon; -uniform vec4 blue_density; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 moonlight_color; +uniform int sun_up_factor; +uniform vec4 ambient_color; +uniform vec4 blue_horizon; +uniform vec4 blue_density; uniform float haze_horizon; uniform float haze_density; @@ -60,7 +60,7 @@ uniform float cloud_shadow; uniform float density_multiplier; uniform float max_y; -uniform vec4 glow; +uniform vec4 glow; uniform float sun_moon_glow_factor; uniform vec4 cloud_color; @@ -75,53 +75,53 @@ uniform float cloud_scale; // indra\newview\llsettingsvo.cpp void main() { - // World / view / projection - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - // Texture coords + // Texture coords // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial - vary_texcoord0.xy -= 0.5; - vary_texcoord0.xy /= cloud_scale; - vary_texcoord0.xy += 0.5; + vary_texcoord0.xy -= 0.5; + vary_texcoord0.xy /= cloud_scale; + vary_texcoord0.xy += 0.5; - vary_texcoord1 = vary_texcoord0; - vary_texcoord1.x += lightnorm.x * 0.0125; - vary_texcoord1.y += lightnorm.z * 0.0125; + vary_texcoord1 = vary_texcoord0; + vary_texcoord1.x += lightnorm.x * 0.0125; + vary_texcoord1.y += lightnorm.z * 0.0125; - vary_texcoord2 = vary_texcoord0 * 16.; - vary_texcoord3 = vary_texcoord1 * 16.; + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; - // Get relative position + // Get relative position vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); - // Set altitude + // Set altitude if (rel_pos.y > 0) - { + { rel_pos *= (max_y / rel_pos.y); - } + } if (rel_pos.y < 0) - { - altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon + { + altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon rel_pos *= (-32000. / rel_pos.y); - } + } - // Can normalize then + // Can normalize then vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); - // Initialize temp variables - vec4 sunlight = sunlight_color; - vec4 light_atten; + // Initialize temp variables + vec4 sunlight = sunlight_color; + vec4 light_atten; - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); - // Calculate relative weights + // Calculate relative weights vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density)); vec4 blue_weight = blue_density / combined_haze; vec4 haze_weight = haze_density / combined_haze; @@ -130,63 +130,64 @@ void main() float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); sunlight *= exp(-light_atten * off_axis); - // Distance + // Distance float density_dist = rel_pos_len * density_multiplier; // Transparency (-> combined_haze) // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. + // compiler gets confused. combined_haze = exp(-combined_haze * density_dist); - // Compute haze glow + // Compute haze glow float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); // haze_glow is 0 at the sun and increases away from sun haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + // 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") + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function + // glow.z should be negative, so we're doing a sort of (1 / "angle") function haze_glow *= sun_moon_glow_factor; - // Add "minimum anti-solar illumination" + // Add "minimum anti-solar illumination" // For sun, add to glow. For moon, remove glow entirely. SL-13768 haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); - // Increase ambient when there are more clouds - vec4 tmpAmbient = ambient_color; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; + // Increase ambient when there are more clouds + vec4 tmpAmbient = ambient_color; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; - // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow); + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow); - // Haze color below cloud + // Haze color below cloud vec4 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - // CLOUDS + // CLOUDS + sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); sunlight *= exp(-light_atten * off_axis); - // Cloud color out + // Cloud color out vary_CloudColorSun = (sunlight * haze_glow) * cloud_color; - vary_CloudColorAmbient = tmpAmbient * cloud_color; - - // Attenuate cloud color by atmosphere + vary_CloudColorAmbient = tmpAmbient * cloud_color; + + // Attenuate cloud color by atmosphere combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds vary_CloudColorSun *= combined_haze; vary_CloudColorAmbient *= combined_haze; vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); - // Make a nice cloud density based on the cloud_shadow value that was passed in. - vary_CloudDensity = 2. * (cloud_shadow - 0.25); + // Make a nice cloud density based on the cloud_shadow value that was passed in. + vary_CloudDensity = 2. * (cloud_shadow - 0.25); - // Combine these to minimize register use - vary_CloudColorAmbient += oHazeColorBelowCloud; + // Combine these to minimize register use + vary_CloudColorAmbient += oHazeColorBelowCloud; - // needs this to compile on mac - // vary_AtmosAttenuation = vec3(0.0,0.0,0.0); + // needs this to compile on mac + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); - // END CLOUDS + // END CLOUDS } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index 6b36d00f97..9fcee04c32 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -64,28 +64,27 @@ void main() #else vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); #endif - + color.rgb *= vertex_color.rgb; // SL-9632 HUDs are affected by Atmosphere if (no_atmo == 0) { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; vec3 pos = vary_position.xyz/vary_position.w; - calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - float env_intensity = vertex_color.a; + calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); + + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + float env_intensity = vertex_color.a; //color.rgb = srgb_to_linear(color.rgb); color.rgb = mix(color.rgb, envColor.rgb, env_intensity); - - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); + color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); + color.rgb = fullbrightScaleSoftClip(color.rgb); } /* diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index d29e8a9423..eb6e56e718 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -40,6 +40,8 @@ uniform sampler2D specularMap; VARYING vec2 vary_texcoord0; +vec3 linear_to_srgb(vec3 c); + void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); @@ -52,6 +54,7 @@ void main() vec4 norm = texture2D(normalMap, vary_texcoord0.xy); vec4 spec = texture2D(specularMap, vary_texcoord0.xy); + col.rgb = linear_to_srgb(col.rgb); frag_data[0] = vec4(col.rgb, 0.0); frag_data[1] = spec; frag_data[2] = vec4(norm.xy,0,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 80d19102b6..e1f7031af6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -406,6 +406,8 @@ void main() vec3 light = vec3(0, 0, 0); + final_specular.rgb = srgb_to_linear(final_specular.rgb); // SL-14035 + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w ); LIGHT_LOOP(1) diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 8c402fcb54..09c47165dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -73,9 +73,7 @@ void main() vec3 norm = getNorm(frag.xy); vec4 spec = texture2DRect(specularRect, frag.xy); - spec.rgb = srgb_to_linear(spec.rgb); vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; - diff.rgb = srgb_to_linear(diff.rgb); float noise = texture2D(noiseMap, frag.xy / 128.0).b; vec3 npos = normalize(-pos); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 9bba45bc4e..ec3fb9c543 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -182,10 +182,6 @@ void main() vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; - // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. - // We can't switch to linear here unless we do it everywhere* - // *gbuffer is sRGB, convert to linear whenever sampling from it - diff_tex.rgb = srgb_to_linear(diff_tex.rgb); vec3 dlit = vec3(0, 0, 0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index d805c9ea48..18616a9bb3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -90,7 +90,6 @@ void main() float noise = texture2D(noiseMap, frag.xy/128.0).b; vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; - col.rgb = srgb_to_linear(col.rgb); float fa = falloff+1.0; float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); @@ -127,7 +126,7 @@ void main() { discard; } -//col.rgb = vec3(0); + frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index f80f1a985a..7f2c603f87 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -90,7 +90,7 @@ void main() vec4 diffuse = texture2DRect(diffuseRect, tc); //convert to gamma space - //diffuse.rgb = linear_to_srgb(diffuse.rgb); + diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec3 color = vec3(0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index 454af2a9bc..b2fa5d8a25 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -49,10 +49,6 @@ void main() vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunDiscA, sunDiscB, blend_factor); - c.rgb = srgb_to_linear(c.rgb); - c.rgb = clamp(c.rgb, vec3(0), vec3(1)); - c.rgb = pow(c.rgb, vec3(0.7f)); - //c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index 6f7e777d23..5e966293c6 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -48,15 +48,15 @@ void fullbright_shiny_lighting() { vec4 color = diffuseLookup(vary_texcoord0.xy); color.rgb *= vertex_color.rgb; - + // SL-9632 HUDs are affected by Atmosphere if (no_atmo == 0) { - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a*0.75); // MAGIC NUMBER SL-12574; ALM: Off, Quality > Low - color.rgb = fullbrightShinyAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); + color.rgb = fullbrightShinyAtmosTransport(color.rgb); + color.rgb = fullbrightScaleSoftClip(color.rgb); } /* // NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects. diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index a0699affbf..3b4d358cfa 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -1,30 +1,37 @@ -/** +/** * @file class1\windlight\atmosphericVarsF.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$ */ - -vec3 getPositionEye() -{ - return vec3(0,0,0); -} +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 getAmblitColor() { return vec3(0, 0, 0); } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } + +vec3 getAtmosAttenuation() { return vec3(vary_AtmosAttenuation); } + +vec3 getSunlitColor() { return vec3(0, 0, 0); } + +vec3 getPositionEye() { return vec3(0, 0, 0); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index bd1d150fc8..1fea2c3628 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -1,36 +1,56 @@ -/** +/** * @file class1\windlight\atmosphericVarsV.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$ */ - +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; -vec3 getPositionEye() +vec3 additive_color; +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; +vec3 position_eye; + +vec3 getSunlitColor() { return sunlit_color; } +void setSunlitColor(vec3 v) { sunlit_color = v; } + +vec3 getAdditiveColor() { return additive_color; } +void setAdditiveColor(vec3 v) { - return vec3(0,0,0); + additive_color = v; + vary_AdditiveColor = v; } -void setPositionEye(vec3 v) +vec3 getAmblitColor() { return amblit_color; } +void setAmblitColor(vec3 v) { amblit_color = v; } + +vec3 getAtmosAttenuation() { return atmos_attenuation; } +void setAtmosAttenuation(vec3 v) { - + atmos_attenuation = v; + vary_AtmosAttenuation = v; } + +vec3 getPositionEye() { return position_eye; } +void setPositionEye(vec3 v) { position_eye = v; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl index 5dc086ab1e..f83434b7ec 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl @@ -1,33 +1,38 @@ -/** +/** * @file class1\windlight\atmosphericVarsWaterF.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$ */ - VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 getSunlitColor() { return vec3(0, 0, 0); } + +vec3 getAmblitColor() { return vec3(0, 0, 0); } + +vec3 getAdditiveColor() { return vary_AdditiveColor; } -vec3 getPositionEye() -{ - return vary_PositionEye; -} +vec3 getAtmosAttenuation() { return vary_AtmosAttenuation; } +vec3 getPositionEye() { return vary_PositionEye; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl index e59eca265a..65d1176777 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl @@ -1,37 +1,51 @@ -/** +/** * @file class1\windlight\atmosphericVarsWaterV.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$ */ - - + VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; -vec3 getPositionEye() -{ - return vary_PositionEye; -} +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; + +vec3 getSunlitColor() { return sunlit_color; } +void setSunlitColor(vec3 v) { sunlit_color = v; } + +vec3 getAmblitColor() { return amblit_color; } +void setAmblitColor(vec3 v) { amblit_color = v; } -void setPositionEye(vec3 v) +vec3 getAdditiveColor() { return vary_AdditiveColor; } +void setAdditiveColor(vec3 v) { vary_AdditiveColor = v; } + +vec3 getAtmosAttenuation() { return atmos_attenuation; } +void setAtmosAttenuation(vec3 v) { - vary_PositionEye = v; + atmos_attenuation = v; + vary_AtmosAttenuation = v; } + +vec3 getPositionEye() { return vary_PositionEye; } +void setPositionEye(vec3 v) { vary_PositionEye = v; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index b9ae7a0226..5a41dc644a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -51,7 +51,6 @@ void main() // SL-9806 stars poke through // c.a *= sun_fade; - c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); frag_color = c; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 5d7a28c359..1b7a1cc6ec 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -191,10 +191,6 @@ void main() float da = dot(norm, lv); vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; - // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. - // We can't switch to linear here unless we do it everywhere* - // *gbuffer IS sRGB, convert to linear since this shader outputs linear - diff_tex.rgb = srgb_to_linear(diff_tex.rgb); vec4 spec = texture2DRect(specularRect, frag.xy); diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl index 1485c515a4..6841a8194f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl @@ -73,7 +73,21 @@ uniform float ice_level; vec3 rainbow(float d) { - d = clamp(d, -1.0, 0.0); + // d is the dot product of view and sun directions, so ranging -1.0..1.0 + // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec + // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175. + + // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted. + // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the + // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575 + d = clamp(-0.575 - d, 0.0, 1.0); + + // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. + // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate + // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 + float interior_coord = max(0.0, d - 0.25) * 4.2857; + d = clamp(d, 0.0, 0.25) + interior_coord; + float rad = (droplet_radius - 5.0f) / 1024.0f; return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f4db53e0b7..7700d16007 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -87,8 +87,9 @@ void main() float light_gamma = 1.0 / 1.3; da = pow(da, light_gamma); - vec4 diffuse = texture2DRect(diffuseRect, tc); - vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); + vec4 diffuse = texture2DRect(diffuseRect, tc); + diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14025 + vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; scol_ambocc = pow(scol_ambocc, vec2(light_gamma)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 5ab0b5c5b4..774f537821 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -189,7 +189,7 @@ void main() lv = normalize(lv); float da = dot(norm, lv); - vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb); + vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; vec4 spec = texture2DRect(specularRect, frag.xy); vec3 dlit = vec3(0, 0, 0); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index d758f85d71..07733bda18 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -1,5 +1,5 @@ /** - * @file class2\wl\atmosphericVars.glsl + * @file class2\wl\atmosphericVarsF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 75bf8730df..fa928d993e 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -26,9 +26,9 @@ /*[EXTRA_CODE_HERE]*/ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; +out vec4 frag_color; #else -#define frag_data gl_FragData +#define frag_color gl_FragColor #endif ///////////////////////////////////////////////////////////////////////// @@ -126,8 +126,6 @@ void main() color.rgb = scaleSoftClip(color.rgb); /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, alpha1); - frag_data[1] = vec4(0.0,0.0,0.0,0.0); - frag_data[2] = vec4(0,0,0,1); + frag_color = vec4(color.rgb, alpha1); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 1f881eb44b..97ffa9feef 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class2\wl\cloudsV.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2005, 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$ */ @@ -33,26 +33,26 @@ ATTRIBUTE vec2 texcoord0; /////////////////////////////////////////////////////////////////////////////// // Output parameters -VARYING vec4 vary_CloudColorSun; -VARYING vec4 vary_CloudColorAmbient; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; VARYING float vary_CloudDensity; -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; VARYING float altitude_blend_factor; // Inputs uniform vec3 camPosLocal; -uniform vec4 lightnorm; -uniform vec4 sunlight_color; -uniform vec4 moonlight_color; -uniform int sun_up_factor; -uniform vec4 ambient_color; -uniform vec4 blue_horizon; -uniform vec4 blue_density; +uniform vec4 lightnorm; +uniform vec4 sunlight_color; +uniform vec4 moonlight_color; +uniform int sun_up_factor; +uniform vec4 ambient_color; +uniform vec4 blue_horizon; +uniform vec4 blue_density; uniform float haze_horizon; uniform float haze_density; @@ -60,7 +60,7 @@ uniform float cloud_shadow; uniform float density_multiplier; uniform float max_y; -uniform vec4 glow; +uniform vec4 glow; uniform float sun_moon_glow_factor; uniform vec4 cloud_color; @@ -75,8 +75,8 @@ uniform float cloud_scale; // indra\newview\llsettingsvo.cpp void main() { - // World / view / projection - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); // Texture coords // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll @@ -93,7 +93,7 @@ void main() vary_texcoord2 = vary_texcoord0 * 16.; vary_texcoord3 = vary_texcoord1 * 16.; - // Get relative position + // Get relative position vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); // fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude @@ -101,27 +101,27 @@ void main() // Adj position vector to clamp altitude if (rel_pos.y > 0.) - { + { rel_pos *= (max_y / rel_pos.y); - } + } if (rel_pos.y < 0.) - { + { rel_pos *= (-32000. / rel_pos.y); - } + } - // Can normalize then + // Can normalize then vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); - // Initialize temp variables - vec4 sunlight = sunlight_color; - vec4 light_atten; + // Initialize temp variables + vec4 sunlight = sunlight_color; + vec4 light_atten; - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); - // Calculate relative weights + // Calculate relative weights vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density)); vec4 blue_weight = blue_density / combined_haze; vec4 haze_weight = haze_density / combined_haze; @@ -130,63 +130,64 @@ void main() float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); sunlight *= exp(-light_atten * off_axis); - // Distance + // Distance float density_dist = rel_pos_len * density_multiplier; // Transparency (-> combined_haze) // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. + // compiler gets confused. combined_haze = exp(-combined_haze * density_dist); - // Compute haze glow + // Compute haze glow float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); // haze_glow is 0 at the sun and increases away from sun haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + // 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") + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function + // glow.z should be negative, so we're doing a sort of (1 / "angle") function haze_glow *= sun_moon_glow_factor; - // Add "minimum anti-solar illumination" + // Add "minimum anti-solar illumination" // For sun, add to glow. For moon, remove glow entirely. SL-13768 haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); - // Increase ambient when there are more clouds - vec4 tmpAmbient = ambient_color; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; + // Increase ambient when there are more clouds + vec4 tmpAmbient = ambient_color; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; - // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow); + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow); - // Haze color below cloud + // Haze color below cloud vec4 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - // CLOUDS + // CLOUDS + sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); sunlight *= exp(-light_atten * off_axis); - // Cloud color out + // Cloud color out vary_CloudColorSun = (sunlight * haze_glow) * cloud_color; - vary_CloudColorAmbient = tmpAmbient * cloud_color; - - // Attenuate cloud color by atmosphere + vary_CloudColorAmbient = tmpAmbient * cloud_color; + + // Attenuate cloud color by atmosphere combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds vary_CloudColorSun *= combined_haze; vary_CloudColorAmbient *= combined_haze; vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); - // Make a nice cloud density based on the cloud_shadow value that was passed in. - vary_CloudDensity = 2. * (cloud_shadow - 0.25); + // Make a nice cloud density based on the cloud_shadow value that was passed in. + vary_CloudDensity = 2. * (cloud_shadow - 0.25); - // Combine these to minimize register use - vary_CloudColorAmbient += oHazeColorBelowCloud; + // Combine these to minimize register use + vary_CloudColorAmbient += oHazeColorBelowCloud; - // needs this to compile on mac - // vary_AtmosAttenuation = vec3(0.0,0.0,0.0); + // needs this to compile on mac + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); - // END CLOUDS + // END CLOUDS } diff --git a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl deleted file mode 100644 index 8bb3f07fc6..0000000000 --- a/indra/newview/app_settings/shaders/class3/deferred/lightUtil.glsl +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @file lightInfo.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$ - */ - -struct DirectionalLightInfo -{ - vec4 pos; - float depth; - vec4 normal; - vec3 normalizedLightDirection; - vec3 normalizedToLight; - float lightIntensity; - vec3 lightDiffuseColor; - float specExponent; - float shadow; -}; - -struct SpotLightInfo -{ - vec4 pos; - float depth; - vec4 normal; - vec3 normalizedLightDirection; - vec3 normalizedToLight; - float lightIntensity; - float attenuation; - float distanceToLight; - vec3 lightDiffuseColor; - float innerHalfAngleCos; - float outerHalfAngleCos; - float spotExponent; - float specExponent; - float shadow; -}; - -struct PointLightInfo -{ - vec4 pos; - float depth; - vec4 normal; - vec3 normalizedToLight; - float lightIntensity; - float attenuation; - float distanceToLight; - vec3 lightDiffuseColor; - float lightRadius; - float specExponent; - vec3 worldspaceLightDirection; - float shadow; -}; - -float attenuate(float attenuationSelection, float distanceToLight) -{ -// LLRENDER_REVIEW -// sh/could eventually consume attenuation func defined in texture - return (attenuationSelection == 0.0f) ? 1.0f : // none - (attenuationSelection < 1.0f) ? (1.0f / distanceToLight) : // linear atten - (attenuationSelection < 2.0f) ? (1.0f / (distanceToLight*distanceToLight)) // quadratic atten - : (1.0f / (distanceToLight*distanceToLight*distanceToLight)); // cubic atten -} - - -vec3 lightDirectional(struct DirectionalLightInfo dli) -{ - float lightIntensity = dli.lightIntensity; - lightIntensity *= dot(dli.normal.xyz, dli.normalizedLightDirection); - //lightIntensity *= directionalShadowSample(vec4(dli.pos.xyz, 1.0f), dli.depth, dli.directionalShadowMap, dli.directionalShadowMatrix); - return lightIntensity * dli.lightDiffuseColor; -} - - -vec3 lightSpot(struct SpotLightInfo sli) -{ - float penumbraRange = (sli.outerHalfAngleCos - sli.innerHalfAngleCos); - float coneAngleCos = max(dot(sli.normalizedLightDirection, sli.normalizedToLight), 0.0); - float coneAttenFactor = (coneAngleCos <= sli.outerHalfAngleCos) ? 1.0f : pow(smoothstep(1,0, sli.outerHalfAngleCos / penumbraRange), sli.spotExponent); - float distanceAttenuation = attenuate(sli.attenuation, sli.distanceToLight); - float lightIntensity = sli.lightIntensity; - lightIntensity *= distanceAttenuation; - lightIntensity *= max(dot(sli.normal.xyz, sli.normalizedLightDirection), 0.0); - lightIntensity *= coneAttenFactor; - lightIntensity *= sli.shadow; - return lightIntensity * sli.lightDiffuseColor; -} - -vec3 lightPoint(struct PointLightInfo pli) -{ - float padRadius = pli.lightRadius * 0.1; // distance for which to perform smoothed dropoff past light radius - float distanceAttenuation = attenuate(pli.attenuation, pli.distanceToLight); - float lightIntensity = pli.lightIntensity; - lightIntensity*= distanceAttenuation; - lightIntensity *= clamp((padRadius - pli.distanceToLight + pli.lightRadius) / padRadius, 0.0, 1.0); - lightIntensity *= pli.shadow; - lightIntensity *= max(dot(pli.normal.xyz, pli.normalizedToLight), 0.0); - return lightIntensity * pli.lightDiffuseColor; -} diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 6de01cb667..a0b082ed7c 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -56,8 +56,23 @@ vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir vec3 ColorFromRadiance(vec3 radiance); vec3 rainbow(float d) { - float rad = (droplet_radius - 5.0f) / 1024.0f; - return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; + // d is the dot product of view and sun directions, so ranging -1.0..1.0 + // 'interesting' values of d are the range -0.75..-0.825, when view is nearly opposite of sun vec + // Rainbox texture mode is GL_REPEAT, so tc of -.75 is equiv to 0.25, -0.825 equiv to 0.175. + + // SL-13629 Rainbow texture has colors within the correct .175...250 range, but order is inverted. + // Rather than replace the texture, we mirror and translate the y tc to keep the colors within the + // interesting range, but in reversed order: i.e. d = (1 - d) - 1.575 + d = clamp(-0.575 - d, 0.0, 1.0); + + // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible. + // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate + // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857 + float interior_coord = max(0.0, d - 0.25) * 4.2857; + d = clamp(d, 0.0, 0.25) + interior_coord; + + float rad = (droplet_radius - 5.0f) / 1024.0f; + return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; } vec3 halo22(float d) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9d03edc060..c0971ba943 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -91,6 +91,7 @@ #include "llsdutil_math.h" #include "lllocationhistory.h" #include "llfasttimerview.h" +#include "lltelemetry.h" #include "llvector4a.h" #include "llviewermenufile.h" #include "llvoicechannel.h" @@ -257,9 +258,9 @@ // define a self-registering event API object #include "llappviewerlistener.h" -#if (LL_LINUX || LL_SOLARIS) && LL_GTK +#if LL_LINUX && LL_GTK #include "glib.h" -#endif // (LL_LINUX || LL_SOLARIS) && LL_GTK +#endif // (LL_LINUX) && LL_GTK #if LL_MSVC // disable boost::lexical_cast warning @@ -1100,6 +1101,46 @@ bool LLAppViewer::init() } } +#if LL_WINDOWS && ADDRESS_SIZE == 64 + if (gGLManager.mIsIntel) + { + // Check intel driver's version + // Ex: "3.1.0 - Build 8.15.10.2559"; + std::string version = ll_safe_string((const char *)glGetString(GL_VERSION)); + + const boost::regex is_intel_string("[0-9].[0-9].[0-9] - Build [0-9]{1,2}.[0-9]{2}.[0-9]{2}.[0-9]{4}"); + + if (boost::regex_search(version, is_intel_string)) + { + // Valid string, extract driver version + std::size_t found = version.find("Build "); + std::string driver = version.substr(found + 6); + S32 v1, v2, v3, v4; + S32 count = sscanf(driver.c_str(), "%d.%d.%d.%d", &v1, &v2, &v3, &v4); + if (count > 0 && v1 <= 10) + { + LL_INFOS("AppInit") << "Detected obsolete intel driver: " << driver << LL_ENDL; + LLUIString details = LLNotifications::instance().getGlobalString("UnsupportedIntelDriver"); + std::string gpu_name = ll_safe_string((const char *)glGetString(GL_RENDERER)); + details.setArg("[VERSION]", driver); + details.setArg("[GPUNAME]", gpu_name); + S32 button = OSMessageBox(details.getString(), + LLStringUtil::null, + OSMB_YESNO); + if (OSBTN_YES == button && gViewerWindow) + { + std::string url = LLWeb::escapeURL(LLTrans::getString("IntelDriverPage")); + if (gViewerWindow->getWindow()) + { + gViewerWindow->getWindow()->spawnWebBrowser(url, false); + } + } + } + } + } +#endif + + // Obsolete? mExpectedGLVersion is always zero #if LL_WINDOWS if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion()) { @@ -1324,39 +1365,8 @@ void LLAppViewer::initMaxHeapSize() //F32 max_heap_size_gb = llmin(1.6f, (F32)gSavedSettings.getF32("MaxHeapSize")) ; F32Gigabytes max_heap_size_gb = (F32Gigabytes)gSavedSettings.getF32("MaxHeapSize") ; - BOOL enable_mem_failure_prevention = (BOOL)gSavedSettings.getBOOL("MemoryFailurePreventionEnabled") ; - LLMemory::initMaxHeapSizeGB(max_heap_size_gb, enable_mem_failure_prevention) ; -} - -void LLAppViewer::checkMemory() -{ - const static F32 MEMORY_CHECK_INTERVAL = 1.0f ; //second - //const static F32 MAX_QUIT_WAIT_TIME = 30.0f ; //seconds - //static F32 force_quit_timer = MAX_QUIT_WAIT_TIME + MEMORY_CHECK_INTERVAL ; - - if(!gGLManager.mDebugGPU) - { - return ; - } - - if(MEMORY_CHECK_INTERVAL > mMemCheckTimer.getElapsedTimeF32()) - { - return ; - } - mMemCheckTimer.reset() ; - - //update the availability of memory - LLMemory::updateMemoryInfo() ; - - bool is_low = LLMemory::isMemoryPoolLow() ; - - LLPipeline::throttleNewMemoryAllocation(is_low) ; - - if(is_low) - { - LLMemory::logMemoryInfo() ; - } + LLMemory::initMaxHeapSizeGB(max_heap_size_gb); } static LLTrace::BlockTimerStatHandle FTM_MESSAGES("System Messages"); @@ -1435,9 +1445,6 @@ bool LLAppViewer::doFrame() //clear call stack records LL_CLEAR_CALLSTACKS(); - //check memory availability information - checkMemory() ; - { pingMainloopTimeout("Main:MiscNativeWindowEvents"); @@ -1672,6 +1679,8 @@ bool LLAppViewer::doFrame() LL_INFOS() << "Exiting main_loop" << LL_ENDL; } + LLPROFILE_UPDATE(); + return ! LLApp::isRunning(); } diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index d24cdcedc7..5ceb540784 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -235,7 +235,6 @@ private: bool initConfiguration(); // Initialize settings from the command line/config file. void initStrings(); // Initialize LLTrans machinery bool initCache(); // Initialize local client cache. - void checkMemory() ; // We have switched locations of both Mac and Windows cache, make sure // files migrate and old cache is cleared out. @@ -314,8 +313,6 @@ private: LLAllocator mAlloc; - LLFrameTimer mMemCheckTimer; - // llcorehttp library init/shutdown helper LLAppCoreHttp mAppCoreHttp; diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp index 6f32aab851..dc487967fc 100644 --- a/indra/newview/llappviewerlinux.cpp +++ b/indra/newview/llappviewerlinux.cpp @@ -73,10 +73,6 @@ static void exceptionTerminateHandler() int main( int argc, char **argv ) { -#if LL_SOLARIS && defined(__sparc) - asm ("ta\t6"); // NOTE: Make sure memory alignment is enforced on SPARC -#endif - gArgC = argc; gArgV = argv; @@ -336,8 +332,6 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze) cmd += gDirUtilp->getDirDelimiter(); #if LL_LINUX cmd += "linux-crash-logger.bin"; -#elif LL_SOLARIS - cmd += "solaris-crash-logger"; #else # error Unknown platform #endif @@ -394,9 +388,6 @@ bool LLAppViewerLinux::beingDebugged() { static enum {unknown, no, yes} debugged = unknown; -#if LL_SOLARIS - return debugged == no; // BUG: fix this for Solaris -#else if (debugged == unknown) { pid_t ppid = getppid(); @@ -431,7 +422,6 @@ bool LLAppViewerLinux::beingDebugged() } return debugged == yes; -#endif } void LLAppViewerLinux::initLoggingAndGetLastDuration() diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 4cfde21e32..a685639427 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -380,7 +380,7 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const for (iter = mChildren.begin(); iter != mChildren.end(); iter++) { participant = dynamic_cast<LLConversationItemParticipant*>(*iter); - if (participant->hasSameValue(participant_id)) + if (participant && participant->hasSameValue(participant_id)) { break; } @@ -491,7 +491,7 @@ const bool LLConversationItemSession::getTime(F64& time) const { participant = dynamic_cast<LLConversationItemParticipant*>(*iter); F64 participant_time; - if (participant->getTime(participant_time)) + if (participant && participant->getTime(participant_time)) { has_time = true; most_recent_time = llmax(most_recent_time,participant_time); diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index df16868132..65cec68884 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -696,10 +696,13 @@ void LLConversationViewParticipant::refresh() { // Refresh the participant view from its model data LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem()); - participant_model->resetRefresh(); - - // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat - mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted()); + if (participant_model) + { + participant_model->resetRefresh(); + + // *TODO: We should also do something with vmi->isModerator() to echo that state in the UI somewhat + mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted()); + } // Do the regular upstream refresh LLFolderViewItem::refresh(); diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp index b8e6e81ee6..01790ad19e 100644 --- a/indra/newview/lldirpicker.cpp +++ b/indra/newview/lldirpicker.cpp @@ -37,7 +37,7 @@ #include "llviewercontrol.h" #include "llwin32headerslean.h" -#if LL_LINUX || LL_SOLARIS || LL_DARWIN +#if LL_LINUX || LL_DARWIN # include "llfilepicker.h" #endif @@ -187,7 +187,7 @@ std::string LLDirPicker::getDirName() return mFilePicker->getFirstFile(); } -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX LLDirPicker::LLDirPicker() : mFileName(NULL), diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h index c7dba12130..52febe4523 100644 --- a/indra/newview/lldirpicker.h +++ b/indra/newview/lldirpicker.h @@ -78,7 +78,7 @@ private: void buildDirname( void ); bool check_local_file_access_enabled(); -#if LL_LINUX || LL_SOLARIS || LL_DARWIN +#if LL_LINUX || LL_DARWIN // On Linux we just implement LLDirPicker on top of LLFilePicker LLFilePicker *mFilePicker; #endif diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5034bd1c5e..507af56cb0 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -912,22 +912,18 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) if (volume->getAvatar()) { const LLVector3* av_box = volume->getAvatar()->getLastAnimExtents(); - LLVector3d cam_pos = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()); - LLVector3 cam_region_pos = LLVector3(cam_pos - volume->getRegion()->getOriginGlobal()); - - LLVector3 cam_to_box_offset = point_to_box_offset(cam_region_pos, av_box); + LLVector3 cam_pos_from_agent = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 cam_to_box_offset = point_to_box_offset(cam_pos_from_agent, av_box); mDistanceWRTCamera = llmax(0.01f, ll_round(cam_to_box_offset.magVec(), 0.01f)); LL_DEBUGS("DynamicBox") << volume->getAvatar()->getFullname() << " pos (ignored) " << pos - << " cam pos " << cam_pos - << " cam region pos " << cam_region_pos + << " cam pos " << cam_pos_from_agent << " box " << av_box[0] << "," << av_box[1] << " -> dist " << mDistanceWRTCamera << LL_ENDL; mVObjp->updateLOD(); return; } - } else { diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 55b3864b6d..687b13d2c8 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -2129,7 +2129,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) if (mat) { - switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaModeRender())) + switch (LLMaterial::eDiffuseAlphaMode(mat->getDiffuseAlphaMode())) { case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: { @@ -2267,7 +2267,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow) sVertexProgram->uniform4f(LLShaderMgr::SPECULAR_COLOR, col.mV[0], col.mV[1], col.mV[2], spec); sVertexProgram->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env); - if (mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { F32 cutoff = mat->getAlphaMaskCutoff()/255.f; sVertexProgram->setMinimumAlpha(cutoff); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index d4e7f1600e..0c3d8f3098 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -226,7 +226,7 @@ void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightL } } -void LLDrawPoolWLSky::renderStars(void) const +void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const { LLGLSPipelineBlendSkyBox gls_skybox(true, false); @@ -266,6 +266,7 @@ void LLDrawPoolWLSky::renderStars(void) const } gGL.pushMatrix(); + gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); if (LLGLSLShader::sNoFixedFunction) { @@ -296,7 +297,7 @@ void LLDrawPoolWLSky::renderStars(void) const } } -void LLDrawPoolWLSky::renderStarsDeferred(void) const +void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const { LLGLSPipelineBlendSkyBox gls_sky(true, false); @@ -337,6 +338,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const gGL.getTexUnit(1)->bind(tex_b); } + gGL.pushMatrix(); + gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); if (LLPipeline::sReflectionRender) @@ -355,6 +358,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); gDeferredStarProgram.unbind(); + + gGL.popMatrix(); } void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const @@ -601,7 +606,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) if (gPipeline.canUseWindLightShaders()) { renderSkyHazeDeferred(origin, camHeightLocal); - renderStarsDeferred(); + renderStarsDeferred(origin); renderHeavenlyBodies(); renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader); } @@ -620,7 +625,7 @@ void LLDrawPoolWLSky::render(S32 pass) LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); renderSkyHaze(origin, camHeightLocal); - renderStars(); + renderStars(origin); renderHeavenlyBodies(); renderSkyClouds(origin, camHeightLocal, cloud_shader); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index a4f176d6db..324886ed42 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -78,8 +78,8 @@ private: void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const; void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; - void renderStarsDeferred(void) const; - void renderStars(void) const; + void renderStarsDeferred(const LLVector3& camPosLocal) const; + void renderStars(const LLVector3& camPosLocal) const; void renderHeavenlyBodies(); }; diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 89c20904c1..8b8273d183 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -56,13 +56,6 @@ LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 compon { llassert((1 <= components) && (components <= 4)); - if(gGLManager.mDebugGPU) - { - if(components == 3) - { - mComponents = 4 ; //convert to 32bits. - } - } generateGLTexture(); llassert( 0 <= order && order < ORDER_COUNT ); @@ -211,7 +204,7 @@ void LLViewerDynamicTexture::postRender(BOOL success) BOOL LLViewerDynamicTexture::updateAllInstances() { sNumRenders = 0; - if (gGLManager.mIsDisabled || LLPipeline::sMemAllocationThrottled) + if (gGLManager.mIsDisabled) { return TRUE; } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 01d8b6775b..4a802ad9aa 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1165,7 +1165,7 @@ bool LLFace::canRenderAsMask() } LLMaterial* mat = te->getMaterialParams(); - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) { return false; } @@ -1412,7 +1412,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume, } else { - if (!mat || mat->getDiffuseAlphaModeRender() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (!mat || mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { shiny_in_alpha = true; } diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index dc9816c9f7..e6bbe234b3 100644 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -755,12 +755,7 @@ void LLFeatureManager::applyBaseMasks() maskFeatures("RAM256MB"); } -#if LL_SOLARIS && defined(__sparc) // even low MHz SPARCs are fast -#error The 800 is hinky. Would something like a LL_MIN_MHZ make more sense here? - if (gSysCPU.getMHz() < 800) -#else if (gSysCPU.getMHz() < 1100) -#endif { maskFeatures("CPUSlow"); } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index b6fd70452e..3669fb1eeb 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -40,7 +40,7 @@ #include "llwindowsdl.h" // for some X/GTK utils to help with filepickers #endif // LL_SDL -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include "llhttpconstants.h" // file picker uses some of thes constants on Linux #endif @@ -939,7 +939,7 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, } //END LL_DARWIN -#elif LL_LINUX || LL_SOLARIS +#elif LL_LINUX # if LL_GTK @@ -1504,4 +1504,4 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking) return FALSE; } -#endif // LL_LINUX || LL_SOLARIS +#endif // LL_LINUX diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 8d38a5743b..9c84fa1991 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -59,7 +59,9 @@ #include "boost/foreach.hpp" -const S32 EVENTS_PER_IDLE_LOOP = 100; +const S32 EVENTS_PER_IDLE_LOOP_CURRENT_SESSION = 80; +const S32 EVENTS_PER_IDLE_LOOP_BACKGROUND = 40; +const F32 EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE = 0.01f; // process a minimum of 1% of total events per frame // // LLFloaterIMContainer @@ -426,8 +428,11 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate() while (current_participant_model != end_participant_model) { LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model); - // Get the avatar name for this participant id from the cache and update the model - participant_model->updateName(); + if (participant_model) + { + // Get the avatar name for this participant id from the cache and update the model + participant_model->updateName(); + } // Next participant current_participant_model++; } @@ -474,8 +479,11 @@ void LLFloaterIMContainer::idleUpdate() while (current_participant_model != end_participant_model) { LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model); - participant_model->setModeratorOptionsVisible(is_moderator); - participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID); + if (participant_model) + { + participant_model->setModeratorOptionsVisible(is_moderator); + participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID); + } current_participant_model++; } @@ -508,20 +516,49 @@ void LLFloaterIMContainer::idleUpdate() void LLFloaterIMContainer::idleProcessEvents() { - if (!mConversationEventQueue.empty()) - { - S32 events_to_handle = llmin((S32)mConversationEventQueue.size(), EVENTS_PER_IDLE_LOOP); - for (S32 i = 0; i < events_to_handle; i++) - { - handleConversationModelEvent(mConversationEventQueue.back()); - mConversationEventQueue.pop_back(); - } - } + LLUUID current_session_id = getSelectedSession(); + conversations_items_deque::iterator iter = mConversationEventQueue.begin(); + conversations_items_deque::iterator end = mConversationEventQueue.end(); + while (iter != end) + { + std::deque<LLSD> &events = iter->second; + if (!events.empty()) + { + S32 events_to_handle; + S32 query_size = (S32)events.size(); + if (current_session_id == iter->first) + { + events_to_handle = EVENTS_PER_IDLE_LOOP_CURRENT_SESSION; + } + else + { + events_to_handle = EVENTS_PER_IDLE_LOOP_BACKGROUND; + } + + if (events_to_handle <= query_size) + { + // Some groups can be very large and can generate huge amount of updates, scale processing up to keep up + events_to_handle = llmax(events_to_handle, (S32)(query_size * EVENTS_PER_IDLE_LOOP_MIN_PERCENTAGE)); + } + else + { + events_to_handle = query_size; + } + + for (S32 i = 0; i < events_to_handle; i++) + { + handleConversationModelEvent(events.back()); + events.pop_back(); + } + } + iter++; + } } bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event) { - mConversationEventQueue.push_front(event); + LLUUID id = event.get("session_uuid").asUUID(); + mConversationEventQueue[id].push_front(event); return true; } @@ -1834,6 +1871,8 @@ bool LLFloaterIMContainer::removeConversationListItem(const LLUUID& uuid, bool c // Suppress the conversation items and widgets from their respective maps mConversationsItems.erase(uuid); mConversationsWidgets.erase(uuid); + // Clear event query (otherwise reopening session in some way can bombard session with stale data) + mConversationEventQueue.erase(uuid); // Don't let the focus fall IW, select and refocus on the first conversation in the list if (change_focus) diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index 468b47f1f1..b4a9d377ab 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -229,9 +229,10 @@ private: conversations_widgets_map mConversationsWidgets; LLConversationViewModel mConversationViewModel; LLFolderView* mConversationsRoot; - LLEventStream mConversationsEventStream; + LLEventStream mConversationsEventStream; - std::deque<LLSD> mConversationEventQueue; + typedef std::map<LLUUID, std::deque<LLSD> > conversations_items_deque; + conversations_items_deque mConversationEventQueue; LLTimer mParticipantRefreshTimer; }; diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index e7f428c06a..7541bb5efe 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -497,7 +497,10 @@ void LLFloaterIMSessionTab::buildConversationViewParticipant() while (current_participant_model != end_participant_model) { LLConversationItem* participant_model = dynamic_cast<LLConversationItem*>(*current_participant_model); - addConversationViewParticipant(participant_model); + if (participant_model) + { + addConversationViewParticipant(participant_model); + } current_participant_model++; } } diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index 999e4a9582..d9edd4dc30 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -911,7 +911,7 @@ BOOL LLFloaterModelPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) { LLFloaterModelUploadBase::handleScrollWheel(x, y, clicks); } - return TRUE; + return TRUE; } /*virtual*/ @@ -1292,47 +1292,47 @@ void LLFloaterModelPreview::onMouseCaptureLostModelPreview(LLMouseHandler* handl void LLFloaterModelPreview::addStringToLog(const std::string& message, const LLSD& args, bool flash, S32 lod) { if (sInstance && sInstance->hasString(message)) - { + { std::string str; switch (lod) - { +{ case LLModel::LOD_IMPOSTOR: str = "LOD0 "; break; case LLModel::LOD_LOW: str = "LOD1 "; break; case LLModel::LOD_MEDIUM: str = "LOD2 "; break; case LLModel::LOD_PHYSICS: str = "PHYS "; break; case LLModel::LOD_HIGH: str = "LOD3 "; break; default: break; - } - +} + LLStringUtil::format_map_t args_msg; LLSD::map_const_iterator iter = args.beginMap(); LLSD::map_const_iterator end = args.endMap(); for (; iter != end; ++iter) - { +{ args_msg[iter->first] = iter->second.asString(); - } + } str += sInstance->getString(message, args_msg); sInstance->addStringToLogTab(str, flash); - } -} + } + } // static void LLFloaterModelPreview::addStringToLog(const std::string& str, bool flash) -{ + { if (sInstance) - { + { sInstance->addStringToLogTab(str, flash); - } -} + } + } // static void LLFloaterModelPreview::addStringToLog(const std::ostringstream& strm, bool flash) -{ + { if (sInstance) - { + { sInstance->addStringToLogTab(strm.str(), flash); - } -} + } + } void LLFloaterModelPreview::clearAvatarTab() { @@ -1343,9 +1343,9 @@ void LLFloaterModelPreview::clearAvatarTab() joints_pos->deleteAllItems(); mSelectedJointName.clear(); for (U32 i = 0; i < LLModel::NUM_LODS; ++i) - { +{ mJointOverrides[i].clear(); - } + } LLTextBox *joint_total_descr = panel->getChild<LLTextBox>("conflicts_description"); joint_total_descr->setTextArg("[CONFLICTS]", llformat("%d", 0)); @@ -1354,34 +1354,34 @@ void LLFloaterModelPreview::clearAvatarTab() LLTextBox *joint_pos_descr = panel->getChild<LLTextBox>("pos_overrides_descr"); joint_pos_descr->setTextArg("[JOINT]", std::string("mPelvis")); // Might be better to hide it -} + } void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) -{ + { S32 display_lod = mModelPreview->mPreviewLOD; if (mModelPreview->mModel[display_lod].empty()) - { + { mSelectedJointName.clear(); return; - } + } // Joints will be listed as long as they are listed in mAlternateBindMatrix // even if they are for some reason identical to defaults. // Todo: Are overrides always identical for all lods? They normally are, but there might be situations where they aren't. if (mJointOverrides[display_lod].empty()) - { + { // populate map for (LLModelLoader::scene::iterator iter = mModelPreview->mScene[display_lod].begin(); iter != mModelPreview->mScene[display_lod].end(); ++iter) - { + { for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter) - { + { LLModelInstance& instance = *model_iter; LLModel* model = instance.mModel; const LLMeshSkinInfo *skin = &model->mSkinInfo; U32 joint_count = LLSkinningUtil::getMeshJointCount(skin); U32 bind_count = highlight_overrides ? skin->mAlternateBindMatrix.size() : 0; // simply do not include overrides if data is not needed if (bind_count > 0 && bind_count != joint_count) - { + { std::ostringstream out; out << "Invalid joint overrides for model " << model->getName(); out << ". Amount of joints " << joint_count; @@ -1390,68 +1390,68 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) addStringToLog(out.str(), true); // Disable overrides for this model bind_count = 0; - } + } if (bind_count > 0) - { + { for (U32 j = 0; j < joint_count; ++j) - { + { const LLVector3& joint_pos = skin->mAlternateBindMatrix[j].getTranslation(); LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]]; LLJoint* pJoint = LLModelPreview::lookupJointByName(skin->mJointNames[j], mModelPreview); if (pJoint) - { + { // see how voavatar uses aboveJointPosThreshold if (pJoint->aboveJointPosThreshold(joint_pos)) - { + { // valid override if (data.mPosOverrides.size() > 0 && (data.mPosOverrides.begin()->second - joint_pos).lengthSquared() > (LL_JOINT_TRESHOLD_POS_OFFSET * LL_JOINT_TRESHOLD_POS_OFFSET)) - { + { // File contains multiple meshes with conflicting joint offsets // preview may be incorrect, upload result might wary (depends onto // mesh_id that hasn't been generated yet). data.mHasConflicts = true; - } + } data.mPosOverrides[model->getName()] = joint_pos; - } - else - { + } + else + { // default value, it won't be accounted for by avatar data.mModelsNoOverrides.insert(model->getName()); - } - } - } - } - else - { + } + } + } + } + else + { for (U32 j = 0; j < joint_count; ++j) - { + { LLJointOverrideData &data = mJointOverrides[display_lod][skin->mJointNames[j]]; data.mModelsNoOverrides.insert(model->getName()); } } - } - } - } + } + } + } LLPanel *panel = mTabContainer->getPanelByName("rigging_panel"); LLScrollListCtrl *joints_list = panel->getChild<LLScrollListCtrl>("joints_list"); if (joints_list->isEmpty()) - { + { // Populate table - std::map<std::string, std::string> joint_alias_map; + std::map<std::string, std::string> joint_alias_map; mModelPreview->getJointAliases(joint_alias_map); - + S32 conflicts = 0; joint_override_data_map_t::iterator joint_iter = mJointOverrides[display_lod].begin(); joint_override_data_map_t::iterator joint_end = mJointOverrides[display_lod].end(); while (joint_iter != joint_end) - { + { const std::string& listName = joint_iter->first; - + LLScrollListItem::Params item_params; item_params.value(listName); @@ -1459,38 +1459,38 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) cell_params.font = LLFontGL::getFontSansSerif(); cell_params.value = listName; if (joint_alias_map.find(listName) == joint_alias_map.end()) - { + { // Missing names cell_params.color = LLColor4::red; - } + } if (joint_iter->second.mHasConflicts) - { + { // Conflicts cell_params.color = LLColor4::orange; conflicts++; - } + } if (highlight_overrides && joint_iter->second.mPosOverrides.size() > 0) - { + { cell_params.font.style = "BOLD"; - } + } item_params.columns.add(cell_params); joints_list->addRow(item_params, ADD_BOTTOM); joint_iter++; - } + } joints_list->selectFirstItem(); LLScrollListItem *selected = joints_list->getFirstSelected(); if (selected) - { +{ mSelectedJointName = selected->getValue().asString(); - } + } LLTextBox *joint_conf_descr = panel->getChild<LLTextBox>("conflicts_description"); joint_conf_descr->setTextArg("[CONFLICTS]", llformat("%d", conflicts)); joint_conf_descr->setTextArg("[JOINTS_COUNT]", llformat("%d", mJointOverrides[display_lod].size())); - } -} + } + } //----------------------------------------------------------------------------- // addStringToLogTab() @@ -1498,52 +1498,52 @@ void LLFloaterModelPreview::updateAvatarTab(bool highlight_overrides) void LLFloaterModelPreview::addStringToLogTab(const std::string& str, bool flash) { if (str.empty()) - { - return; - } + { + return; + } LLWString text = utf8str_to_wstring(str); S32 add_text_len = text.length() + 1; // newline S32 editor_max_len = mUploadLogText->getMaxTextLength(); if (add_text_len > editor_max_len) - { - return; - } + { + return; + } // Make sure we have space for new string S32 editor_text_len = mUploadLogText->getLength(); if (editor_max_len < (editor_text_len + add_text_len) && mUploadLogText->getLineCount() <= 0) - { + { mUploadLogText->getTextBoundingRect();// forces a reflow() to fix line count - } + } while (editor_max_len < (editor_text_len + add_text_len)) - { + { S32 shift = mUploadLogText->removeFirstLine(); if (shift > 0) - { + { // removed a line editor_text_len -= shift; - } - else - { +} + else + { //nothing to remove? LL_WARNS() << "Failed to clear log lines" << LL_ENDL; - break; - } - } + break; + } + } mUploadLogText->appendText(str, true); if (flash) - { + { LLPanel* panel = mTabContainer->getPanelByName("logs_panel"); if (mTabContainer->getCurrentPanel() != panel) - { + { mTabContainer->setTabPanelFlashing(panel, true); - } - } -} + } + } + } void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost) { @@ -1551,15 +1551,15 @@ void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, childSetTextArg("import_dimensions", "[X]", llformat("%.3f", x)); childSetTextArg("import_dimensions", "[Y]", llformat("%.3f", y)); childSetTextArg("import_dimensions", "[Z]", llformat("%.3f", z)); -} + } void LLFloaterModelPreview::setPreviewLOD(S32 lod) -{ + { if (mModelPreview) { mModelPreview->setPreviewLOD(lod); - } -} + } + } void LLFloaterModelPreview::onBrowseLOD(S32 lod) { @@ -1648,13 +1648,13 @@ void LLFloaterModelPreview::setCtrlLoadFromFile(S32 lod) } } else - { +{ LLComboBox* lod_combo = findChild<LLComboBox>("lod_source_" + lod_name[lod]); if (lod_combo) - { + { lod_combo->setCurrentByIndex(0); - } - } + } +} } void LLFloaterModelPreview::setStatusMessage(const std::string& msg) diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 7bfba2a6d7..a30c73768d 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -746,9 +746,6 @@ LLSD LLFloaterReporter::gatherReport() const char* platform = "Mac"; #elif LL_LINUX const char* platform = "Lnx"; -#elif LL_SOLARIS - const char* platform = "Sol"; - const char* short_platform = "O:S"; #else const char* platform = "???"; #endif diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 2cb27d85bc..efa4a7fd66 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2253,52 +2253,91 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) } } -void renderNormals(LLDrawable* drawablep) +void renderNormals(LLDrawable *drawablep) { - LLVertexBuffer::unbind(); + if (!drawablep->isVisible()) + return; - LLVOVolume* vol = drawablep->getVOVolume(); - if (vol) - { - LLVolume* volume = vol->getVolume(); - gGL.pushMatrix(); - gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix); - - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLVertexBuffer::unbind(); - LLVector4a scale(gSavedSettings.getF32("RenderDebugNormalScale")); + LLVOVolume *vol = drawablep->getVOVolume(); - for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) - { - const LLVolumeFace& face = volume->getVolumeFace(i); + if (vol) + { + LLVolume *volume = vol->getVolume(); - for (S32 j = 0; j < face.mNumVertices; ++j) - { - gGL.begin(LLRender::LINES); - LLVector4a n,p; - - n.setMul(face.mNormals[j], scale); - p.setAdd(face.mPositions[j], n); - - gGL.diffuseColor4f(1,1,1,1); - gGL.vertex3fv(face.mPositions[j].getF32ptr()); - gGL.vertex3fv(p.getF32ptr()); - - if (face.mTangents) - { - n.setMul(face.mTangents[j], scale); - p.setAdd(face.mPositions[j], n); - - gGL.diffuseColor4f(0,1,1,1); - gGL.vertex3fv(face.mPositions[j].getF32ptr()); - gGL.vertex3fv(p.getF32ptr()); - } - gGL.end(); - } - } + // Drawable's normals & tangents are stored in model space, i.e. before any scaling is applied. + // + // SL-13490, using pos + normal to compute the 2nd vertex of a normal line segment doesn't + // work when there's a non-uniform scale in the mix. Normals require MVP-inverse-transpose + // transform. We get that effect here by pre-applying the inverse scale (twice, because + // one forward scale will be re-applied via the MVP in the vertex shader) - gGL.popMatrix(); - } + LLVector3 scale_v3 = vol->getScale(); + float scale_len = scale_v3.length(); + LLVector4a obj_scale(scale_v3.mV[VX], scale_v3.mV[VY], scale_v3.mV[VZ]); + obj_scale.normalize3(); + + // Normals &tangent line segments get scaled along with the object. Divide by scale length + // to keep the as-viewed lengths (relatively) constant with the debug setting length + float draw_length = gSavedSettings.getF32("RenderDebugNormalScale") / scale_len; + + // Create inverse-scale vector for normals + LLVector4a inv_scale(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ]); + inv_scale.mul(inv_scale); // Squared, to apply inverse scale twice + inv_scale.normalize3fast(); + + gGL.pushMatrix(); + gGL.multMatrix((F32 *) vol->getRelativeXform().mMatrix); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) + { + const LLVolumeFace &face = volume->getVolumeFace(i); + + gGL.flush(); + gGL.diffuseColor4f(1, 1, 0, 1); + gGL.begin(LLRender::LINES); + for (S32 j = 0; j < face.mNumVertices; ++j) + { + LLVector4a n, p; + + n.setMul(face.mNormals[j], 1.0); + n.mul(inv_scale); // Pre-scale normal, so it's left with an inverse-transpose xform after MVP + n.normalize3fast(); + n.mul(draw_length); + p.setAdd(face.mPositions[j], n); + + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); + } + gGL.end(); + + // Tangents are simple vectors and do not require reorientation via pre-scaling + if (face.mTangents) + { + gGL.flush(); + gGL.diffuseColor4f(0, 1, 1, 1); + gGL.begin(LLRender::LINES); + for (S32 j = 0; j < face.mNumVertices; ++j) + { + LLVector4a t, p; + + t.setMul(face.mTangents[j], 1.0f); + t.normalize3fast(); + t.mul(draw_length); + p.setAdd(face.mPositions[j], t); + + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); + } + gGL.end(); + } + } + + gGL.popMatrix(); + } } S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& scale) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 55048b03be..c5d5be3509 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -179,6 +179,7 @@ #include "pipeline.h" #include "llappviewer.h" #include "llfasttimerview.h" +#include "lltelemetry.h" #include "llfloatermap.h" #include "llweb.h" #include "llvoiceclient.h" @@ -529,6 +530,8 @@ bool idle_startup() } #if LL_WINDOWS + LLPROFILE_STARTUP(); + // On the windows dev builds, unpackaged, the message.xml file will // be located in indra/build-vc**/newview/<config>/app_settings. std::string message_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"message.xml"); diff --git a/indra/newview/lltelemetry.cpp b/indra/newview/lltelemetry.cpp new file mode 100644 index 0000000000..0c63e2fede --- /dev/null +++ b/indra/newview/lltelemetry.cpp @@ -0,0 +1,145 @@ + /** + * @file lltelemetry.cpp + * @brief Wrapper for Rad Game Tools Telemetry + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "lltelemetry.h" + +#if LLPROFILE_USE_RAD_TELEMETRY_PROFILER + #if LL_WINDOWS + #include "llwin32headers.h" + + // build-vc120-64\packages\lib\release + // build-vc150-64\packages\lib\release + #ifdef _MSC_VER + #pragma comment(lib,"rad_tm_win64.lib") + #else + #pragma message "NOTE: Rad GameTools Telemetry requested but non-MSVC compiler not yet supported on Windows" + #endif + #endif // LL_WINDOWS + + #if LL_DARWIN + #pragma message "NOTE: Rad Game Tools Telemetry requested but not yet supported on Darwin" + #endif + + #if LL_LINUX + #pragma message "NOTE: Rad Game Tools Telemetry requested but not yet supported on Linux" + #endif + +// +// local consts +// +static const tm_int32 TELEMETRY_BUFFER_SIZE = 8 * 1024 * 1024; + +// +// local globals +// +static char *gTelemetryBufferPtr = NULL; // Telemetry + +static const char *tm_status[ TMERR_INIT_NETWORKING_FAILED + 1 ] = +{ + "Telemetry pass: connected" // TM_OK + , "Telemetry FAIL: disabled via #define NTELEMETRY" // TMERR_DISABLED + , "Telemetry FAIL: invalid paramater" // TMERR_INVALID_PARAM + , "Telemetry FAIL: DLL not found" // TMERR_NULL_API + , "Telemetry FAIL: out of resources" // TMERR_OUT_OF_RESOURCES + , "Telemetry FAIL: tmInitialize() not called" // TMERR_UNINITIALIZED + , "Telemetry FAIL: bad hostname" // TMERR_BAD_HOSTNAME + , "Telemetry FAIL: couldn't connect to server" // TMERR_COULD_NOT_CONNECT + , "Telemetry FAIL: unknown network error" // TMERR_UNKNOWN_NETWORK + , "Telemetry FAIL: tmShutdown() already called" // TMERR_ALREADY_SHUTDOWN + , "Telemetry FAIL: memory buffer too small" // TMERR_ARENA_TOO_SMALL + , "Telemetry FAIL: server handshake error" // TMERR_BAD_HANDSHAKE + , "Telemetry FAIL: unaligned parameters" // TMERR_UNALIGNED + , "Telemetry FAIL: network not initialized" // TMERR_NETWORK_NOT_INITIALIZED -- WSAStartup not called before tmOpen() + , "Telemetry FAIL: bad version" // TMERR_BAD_VERSION + , "Telemetry FAIL: timer too large" // TMERR_BAD_TIMER + , "Telemetry FAIL: tmOpen() already called" // TMERR_ALREADY_OPENED + , "Telemetry FAIL: tmInitialize() already called" // TMERR_ALREADY_INITIALIZED + , "Telemetry FAIL: could't open file" // TMERR_FILE_OPEN_FAILED + , "Telemetry FAIL: tmOpen() failed networking" // TMERR_INIT_NETWORKING_FAILED +}; + +// +// exported functionality +// + +void telemetry_shutdown() +{ + #if LL_WINDOWS + if (gTelemetryBufferPtr) + { + tmClose(0); + tmShutdown(); + + delete[] gTelemetryBufferPtr; + gTelemetryBufferPtr = NULL; + } + #endif +} + +void telemetry_startup() +{ + #if LL_WINDOWS + tmLoadLibrary(TM_RELEASE); // Loads .dll + + gTelemetryBufferPtr = new char[ TELEMETRY_BUFFER_SIZE ]; + tmInitialize(TELEMETRY_BUFFER_SIZE, gTelemetryBufferPtr); + + tm_error telemetry_status = tmOpen( + 0, // unused + "SecondLife", // app name + __DATE__ " " __TIME__, // build identifier + "localhost", // server name (or filename) + TMCT_TCP, // connection type (or TMCT_FILE) + 4719, // port + TMOF_INIT_NETWORKING, // open flags + 250 ); // timeout ms + + if (telemetry_status == TMERR_UNKNOWN) + { + LL_ERRS() << "Telemetry FAIL: unknown error" << LL_ENDL; + } + else if (telemetry_status && (telemetry_status <= TMERR_INIT_NETWORKING_FAILED)) + { + LL_INFOS() << tm_status[ telemetry_status ] << LL_ENDL; + free(gTelemetryBufferPtr); + gTelemetryBufferPtr = NULL; + } + #endif // LL_WINDOWS +} + +// Called after we render a frame +void telemetry_update() +{ + #if LL_WINDOWS + if (gTelemetryBufferPtr) + { + tmTick(0); + } + #endif +} +#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER diff --git a/indra/newview/lltelemetry.h b/indra/newview/lltelemetry.h new file mode 100644 index 0000000000..a73e5fcfa2 --- /dev/null +++ b/indra/newview/lltelemetry.h @@ -0,0 +1,81 @@ +/** + * @file lltelemetry.h + * @brief Wrapper for Rad Game Tools Telemetry + * + * $LicenseInfo:firstyear=2020&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2020, 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$ + */ + +/* +To use: + +1. Uncomment #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER below + +2. Include this header file + #include "lltelemetry.h" + +3. Add zones to the functions you wish to profile + void onFoo() + { + LLPROFILE_ZONE("Foo"); + } +*/ +//#define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 1 + +// Default NO local telemetry profiling +#ifndef LLPROFILE_USE_RAD_TELEMETRY_PROFILER + #define LLPROFILE_USE_RAD_TELEMETRY_PROFILER 0 + #define LLPROFILE_SHUTDOWN( ...) {} + #define LLPROFILE_STARTUP( ...) {} + #define LLPROFILE_UPDATE( ...) {} + + #define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) + #define LLPROFILE_ENTER(name) + #define LLPROFILE_ENTER_FORMAT(format, ...) + #define LLPROFILE_FUNCTION + #define LLPROFILE_LEAVE() + #define LLPROFILE_THREAD_NAME(name) + #define LLPROFILE_ZONE(name) + #define LLPROFILE_ZONE_FORMAT(format, ...) +#else + #include <rad_tm.h> + + #define LLPROFILE_SHUTDOWN telemetry_shutdown + #define LLPROFILE_STARTUP telemetry_startup + #define LLPROFILE_UPDATE telemetry_update + + #define LLPROFILE_AUTO_CPU_MARKER_COLOR(r, g, b) tmZoneColor(r, g, b) + #define LLPROFILE_ENTER(name) tmEnter(0, 0, name) + #define LLPROFILE_ENTER_FORMAT(format, ...) tmEnter(0, 0, format, __VA_ARGS__) + #define LLPROFILE_FUNCTION tmFunction(0, 0) + #define LLPROFILE_LEAVE() tmLeave(0) + #define LLPROFILE_THREAD_NAME(name) tmThreadName(0, 0, name) + #define LLPROFILE_ZONE(name) tmZone(0, 0, name) + #define LLPROFILE_ZONE_FORMAT(format, ...) tmZone(0, 0, format, __VA_ARGS__) +#endif // LLPROFILE_USE_RAD_TELEMETRY_PROFILER + +// +// exported functionality +// + +extern void telemetry_startup(); +extern void telemetry_shutdown(); +extern void telemetry_update(); // called after every frame update diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 5679c3c325..066c874eb8 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -754,10 +754,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glViewport(0,0,512,512); LLVOAvatar::updateFreezeCounter() ; - if(!LLPipeline::sMemAllocationThrottled) - { - LLVOAvatar::updateImpostors(); - } + LLVOAvatar::updateImpostors(); set_current_projection(proj); set_current_modelview(mod); diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index a448a95904..9653e80b53 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -143,8 +143,10 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) //---------------------------------------------------------------- for (LLJoint* j : mChildren) { - LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(j); - F32 jointLOD = joint ? joint->getLOD() : 0; + // LLViewerJoint is derived from LLAvatarJoint, + // all children of LLAvatarJoint are assumed to be LLAvatarJoint + LLAvatarJoint* joint = static_cast<LLAvatarJoint*>(j); + F32 jointLOD = joint->getLOD(); if (pixelArea >= jointLOD || sDisableLOD) { triangle_count += joint->render( pixelArea, TRUE, is_dummy ); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index fdfd22c117..63ad708e59 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -56,7 +56,7 @@ #include "m4math.h" #include "llmatrix4a.h" -#if !LL_DARWIN && !LL_LINUX && !LL_SOLARIS +#if !LL_DARWIN && !LL_LINUX extern PFNGLWEIGHTPOINTERARBPROC glWeightPointerARB; extern PFNGLWEIGHTFVARBPROC glWeightfvARB; extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 395dd0495f..b88baf6aa7 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4880,78 +4880,22 @@ void LLViewerObject::refreshBakeTexture() } } -void LLViewerObject::updateDiffuseMatParams(const U8 te, LLMaterial* mat, LLViewerTexture *imagep, bool baked_texture) -{ - // Objects getting non-alpha texture and alpha mask can result in graphical bugs, like white or red alphas. - // To resolve the issue this function provides image format to material and based on format material's - // getDiffuseAlphaModeRender() function will decide what value to provide to render - // - // Unfortunately LLMaterial has no access to diffuse image, so we have to set this data in LLViewerObject - // regardles of object being used/seen or frequency of image-updates. - mat->setDiffuseBaked(baked_texture); - - if (!baked_texture) - { - if (imagep->isMissingAsset()) - { - mat->setDiffuseFormatPrimary(0); - } - else if (0 == imagep->getPrimaryFormat()) - { - // We don't have information about this texture, wait for it - mWaitingTextureInfo.insert(uuid_material_mmap_t::value_type(imagep->getID(), material_info(LLRender::DIFFUSE_MAP, te))); - // Temporary assume RGBA image - mat->setDiffuseFormatPrimary(GL_RGBA); - } - else - { - mat->setDiffuseFormatPrimary(imagep->getPrimaryFormat()); - } - } -} - -S32 LLViewerObject::setDiffuseImageAndParams(const U8 te, LLViewerTexture *imagep) -{ - LLUUID new_id = imagep->getID(); - S32 retval = LLPrimitive::setTETexture(te, new_id); - - LLTextureEntry* tep = getTE(te); - LLUUID old_image_id = tep->getID(); - - LLViewerTexture* baked_texture = getBakedTextureForMagicId(new_id); - mTEImages[te] = baked_texture ? baked_texture : imagep; - updateAvatarMeshVisibility(new_id, old_image_id); - - LLMaterial* mat = tep->getMaterialParams(); - if (mat) - { - // Don't update format from texture (and don't shedule one) if material has no alpha mode set, - // just assume RGBA format, format will get updated with setTEMaterialParams call if mode changes - if (mat->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - { - bool baked = baked_texture != NULL; - updateDiffuseMatParams(te, mat, imagep, baked); - } - else - { - mat->setDiffuseFormatPrimary(GL_RGBA); - } - } - - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - - return retval; -} - void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) { if (mTEImages[te] != imagep) { - setDiffuseImageAndParams(te, imagep); + LLUUID old_image_id = getTE(te) ? getTE(te)->getID() : LLUUID::null; + + LLPrimitive::setTETexture(te, imagep->getID()); + + LLViewerTexture* baked_texture = getBakedTextureForMagicId(imagep->getID()); + mTEImages[te] = baked_texture ? baked_texture : imagep; + updateAvatarMeshVisibility(imagep->getID(), old_image_id); + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } } @@ -4963,7 +4907,15 @@ S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { - retval = setDiffuseImageAndParams(te, image); + retval = LLPrimitive::setTETexture(te, uuid); + LLViewerTexture* baked_texture = getBakedTextureForMagicId(uuid); + mTEImages[te] = baked_texture ? baked_texture : image; + updateAvatarMeshVisibility(uuid,old_image_id); + setChanged(TEXTURE); + if (mDrawable.notNull()) + { + gPipeline.markTextured(mDrawable); + } } return retval; } @@ -5258,29 +5210,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return 0; } - if (pMaterialParams.notNull() - && pMaterialParams->getDiffuseAlphaMode() != LLMaterial::DIFFUSE_ALPHA_MODE_NONE) - { - // Don't update if no alpha is set. If alpha changes, this function will run again, - // no point in sheduling additional texture callbacks (in updateDiffuseMatParams) - LLTextureEntry* tex_entry = getTE(te); - bool is_baked = tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID()); - - LLViewerTexture *img_diffuse = getTEImage(te); - llassert(NULL != img_diffuse); - - if (NULL != img_diffuse) - { - // Will modify alpha mask provided to renderer to fit image - updateDiffuseMatParams(te, pMaterialParams.get(), img_diffuse, is_baked); - } - else - { - LLMaterial *mat = pMaterialParams.get(); // to avoid const - mat->setDiffuseFormatPrimary(0); - } - } - retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams); LL_DEBUGS("Material") << "Changing material params for te " << (S32)te << ", object " << mID @@ -5293,84 +5222,6 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri return retval; } -bool LLViewerObject::notifyAboutCreatingTexture(LLViewerTexture *texture) -{ - // Confirmation about texture creation, check wait-list - // and make changes, or return false - - std::pair<uuid_material_mmap_t::iterator, uuid_material_mmap_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID()); - - bool refresh_materials = false; - - // RGB textures without alpha channels won't work right with alpha, - // we provide format to material for material to decide when to drop alpha - for (uuid_material_mmap_t::iterator range_it = range.first; range_it != range.second; ++range_it) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.notNull() - && LLRender::DIFFUSE_MAP == range_it->second.map) - { - U32 format = texture->getPrimaryFormat(); - if (format != cur_material->getDiffuseFormatPrimary()) - { - cur_material->setDiffuseFormatPrimary(format); - refresh_materials = true; - } - } - } //for - - if (refresh_materials) - { - LLViewerObject::refreshMaterials(); - } - - //clear wait-list - mWaitingTextureInfo.erase(range.first, range.second); - - return refresh_materials; -} - -bool LLViewerObject::notifyAboutMissingAsset(LLViewerTexture *texture) -{ - // When waiting information about texture it turned out to be missing. - // Confirm the state, update values accordingly - std::pair<uuid_material_mmap_t::iterator, uuid_material_mmap_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID()); - if (range.first == range.second) return false; - - bool refresh_materials = false; - - for (uuid_material_mmap_t::iterator range_it = range.first; range_it != range.second; ++range_it) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.isNull()) - continue; - - if (range_it->second.map == LLRender::DIFFUSE_MAP) - { - LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); - if (cur_material.notNull() - && LLRender::DIFFUSE_MAP == range_it->second.map) - { - if (0 != cur_material->getDiffuseFormatPrimary()) - { - cur_material->setDiffuseFormatPrimary(0); - refresh_materials = true; - } - } - } - } //for - - if (refresh_materials) - { - LLViewerObject::refreshMaterials(); - } - - //clear wait-list - mWaitingTextureInfo.erase(range.first, range.second); - - return refresh_materials; -} - void LLViewerObject::refreshMaterials() { setChanged(TEXTURE); diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 9444c4f788..250c4ac328 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -768,12 +768,7 @@ protected: void unpackParticleSource(LLDataPacker &dp, const LLUUID& owner_id, bool legacy); void deleteParticleSource(); void setParticleSource(const LLPartSysData& particle_parameters, const LLUUID& owner_id); - - // Helper function to modify alpha mask provided to render according to image (ex: RGB image will drop alpha mask) - void updateDiffuseMatParams(const U8 te, LLMaterial* mat, LLViewerTexture *imagep, bool baked_texture); - // Shared part of code from setTEImage and setTETextureCore - S32 setDiffuseImageAndParams(const U8 te, LLViewerTexture *imagep); - + private: void setNameValueList(const std::string& list); // clears nv pairs and then individually adds \n separated NV pairs from \0 terminated string void deleteTEImages(); // correctly deletes list of images @@ -906,27 +901,10 @@ public: LLJointRiggingInfoTab mJointRiggingInfoTab; - bool notifyAboutCreatingTexture(LLViewerTexture *texture); - bool notifyAboutMissingAsset(LLViewerTexture *texture); - private: LLUUID mAttachmentItemID; // ItemID of the associated object is in user inventory. EObjectUpdateType mLastUpdateType; BOOL mLastUpdateCached; - - struct material_info - { - LLRender::eTexIndex map; - U8 te; - - material_info(LLRender::eTexIndex map_, U8 te_) - : map(map_) - , te(te_) - {} - }; - - typedef std::multimap<LLUUID, material_info> uuid_material_mmap_t; - uuid_material_mmap_t mWaitingTextureInfo; }; /////////////////// diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 20a22ba45e..ca01bb46aa 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3314,13 +3314,6 @@ void LLViewerLODTexture::processTextureStats() { mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, (S8)mDesiredSavedRawDiscardLevel); } - else if(LLPipeline::sMemAllocationThrottled)//release memory of large textures by decrease their resolutions. - { - if(scaleDown()) - { - mDesiredDiscardLevel = mCachedRawDiscardLevel; - } - } } bool LLViewerLODTexture::scaleDown() diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0f96a0b06c..21985d5a8a 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -314,6 +314,99 @@ RecordToChatConsole::RecordToChatConsole(): //////////////////////////////////////////////////////////////////////////// // +// Print Utility +// + +// Convert a normalized float (-1.0 <= x <= +1.0) to a fixed 1.4 format string: +// +// s#.#### +// +// Where: +// s sign character; space if x is positiv, minus if negative +// # decimal digits +// +// This is similar to printf("%+.4f") except positive numbers are NOT cluttered with a leading '+' sign. +// NOTE: This does NOT null terminate the output +void normalized_float_to_string(const float x, char *out_str) +{ + static const unsigned char DECIMAL_BCD2[] = + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99 + }; + + int neg = (x < 0); + int rem = neg + ? (int)(x * -10000.) + : (int)(x * 10000.); + + int d10 = rem % 100; rem /= 100; + int d32 = rem % 100; rem /= 100; + + out_str[6] = '0' + ((DECIMAL_BCD2[ d10 ] >> 0) & 0xF); + out_str[5] = '0' + ((DECIMAL_BCD2[ d10 ] >> 4) & 0xF); + out_str[4] = '0' + ((DECIMAL_BCD2[ d32 ] >> 0) & 0xF); + out_str[3] = '0' + ((DECIMAL_BCD2[ d32 ] >> 4) & 0xF); + out_str[2] = '.'; + out_str[1] = '0' + (rem & 1); + out_str[0] = " -"[neg]; // Could always show '+' for positive but this clutters up the common case +} + +// normalized float +// printf("%-.4f %-.4f %-.4f") +// Params: +// float &matrix_row[4] +// int matrix_cell_index +// string out_buffer (size 32) +// Note: The buffer is assumed to be pre-filled with spaces +#define MATRIX_ROW_N32_TO_STR(matrix_row, i, out_buffer) \ + normalized_float_to_string(matrix_row[i+0], out_buffer + 0); \ + normalized_float_to_string(matrix_row[i+1], out_buffer + 11); \ + normalized_float_to_string(matrix_row[i+2], out_buffer + 22); \ + out_buffer[31] = 0; + + +// regular float +// sprintf(buffer, "%-8.2f %-8.2f %-8.2f", matrix_row[i+0], matrix_row[i+1], matrix_row[i+2]); +// Params: +// float &matrix_row[4] +// int matrix_cell_index +// char out_buffer[32] +// Note: The buffer is assumed to be pre-filled with spaces +#define MATRIX_ROW_F32_TO_STR(matrix_row, i, out_buffer) { \ + static const char *format[3] = { \ + "%-8.2f" , /* 0 */ \ + "> 99K ", /* 1 */ \ + "< -99K " /* 2 */ \ + }; \ + \ + F32 temp_0 = matrix_row[i+0]; \ + F32 temp_1 = matrix_row[i+1]; \ + F32 temp_2 = matrix_row[i+2]; \ + \ + U8 flag_0 = (((U8)(temp_0 < -99999.99)) << 1) | ((U8)(temp_0 > 99999.99)); \ + U8 flag_1 = (((U8)(temp_1 < -99999.99)) << 1) | ((U8)(temp_1 > 99999.99)); \ + U8 flag_2 = (((U8)(temp_2 < -99999.99)) << 1) | ((U8)(temp_2 > 99999.99)); \ + \ + if (temp_0 < 0.f) out_buffer[ 0] = '-'; \ + if (temp_1 < 0.f) out_buffer[11] = '-'; \ + if (temp_2 < 0.f) out_buffer[22] = '-'; \ + \ + sprintf(out_buffer+ 1,format[flag_0],fabsf(temp_0)); out_buffer[ 1+8] = ' '; \ + sprintf(out_buffer+12,format[flag_1],fabsf(temp_1)); out_buffer[12+8] = ' '; \ + sprintf(out_buffer+23,format[flag_2],fabsf(temp_2)); out_buffer[23+8] = 0 ; \ +} + +//////////////////////////////////////////////////////////////////////////// +// // LLDebugText // @@ -334,7 +427,11 @@ private: typedef std::vector<Line> line_list_t; line_list_t mLineList; LLColor4 mTextColor; - + + LLColor4 mBackColor; + LLRect mBackRectCamera1; + LLRect mBackRectCamera2; + void addText(S32 x, S32 y, const std::string &text) { mLineList.push_back(Line(text, x, y)); @@ -376,11 +473,22 @@ public: mTextColor = LLColor4( 0.86f, 0.86f, 0.86f, 1.f ); // Draw stuff growing up from right lower corner of screen - S32 xpos = mWindow->getWorldViewWidthScaled() - 400; + S32 x_right = mWindow->getWorldViewWidthScaled(); + S32 xpos = x_right - 400; xpos = llmax(xpos, 0); S32 ypos = 64; const S32 y_inc = 20; + // Camera matrix text is hard to see again a white background + // Add a dark background underneath the matrices for readability (contrast) + mBackRectCamera1.mLeft = xpos; + mBackRectCamera1.mRight = x_right; + mBackRectCamera1.mTop = -1; + mBackRectCamera1.mBottom = -1; + mBackRectCamera2 = mBackRectCamera1; + + mBackColor = LLUIColorTable::instance().getColor( "MenuDefaultBgColor" ); + clearText(); if (gSavedSettings.getBOOL("DebugShowTime")) @@ -716,48 +824,45 @@ public: } if (gSavedSettings.getBOOL("DebugShowRenderMatrices")) { - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[12], gGLProjection[13], gGLProjection[14], gGLProjection[15])); - ypos += y_inc; + char camera_lines[8][32]; + memset(camera_lines, ' ', sizeof(camera_lines)); - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[8], gGLProjection[9], gGLProjection[10], gGLProjection[11])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[4], gGLProjection[5], gGLProjection[6], gGLProjection[7])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLProjection[0], gGLProjection[1], gGLProjection[2], gGLProjection[3])); - ypos += y_inc; + // Projection last column is always <0,0,-1.0001,0> + // Projection last row is always <0,0,-0.2> + mBackRectCamera1.mBottom = ypos - y_inc + 2; + MATRIX_ROW_N32_TO_STR(gGLProjection, 12,camera_lines[7]); addText(xpos, ypos, std::string(camera_lines[7])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 8,camera_lines[6]); addText(xpos, ypos, std::string(camera_lines[6])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLProjection, 4,camera_lines[5]); addText(xpos, ypos, std::string(camera_lines[5])); ypos += y_inc; mBackRectCamera1.mTop = ypos + 2; + MATRIX_ROW_N32_TO_STR(gGLProjection, 0,camera_lines[4]); addText(xpos, ypos, std::string(camera_lines[4])); ypos += y_inc; mBackRectCamera2.mBottom = ypos + 2; addText(xpos, ypos, "Projection Matrix"); ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[12], gGLModelView[13], gGLModelView[14], gGLModelView[15])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[8], gGLModelView[9], gGLModelView[10], gGLModelView[11])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[4], gGLModelView[5], gGLModelView[6], gGLModelView[7])); - ypos += y_inc; - - addText(xpos, ypos, llformat("%.4f .%4f %.4f %.4f", gGLModelView[0], gGLModelView[1], gGLModelView[2], gGLModelView[3])); - ypos += y_inc; + // View last column is always <0,0,0,1> + MATRIX_ROW_F32_TO_STR(gGLModelView, 12,camera_lines[3]); addText(xpos, ypos, std::string(camera_lines[3])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 8,camera_lines[2]); addText(xpos, ypos, std::string(camera_lines[2])); ypos += y_inc; + MATRIX_ROW_N32_TO_STR(gGLModelView, 4,camera_lines[1]); addText(xpos, ypos, std::string(camera_lines[1])); ypos += y_inc; mBackRectCamera2.mTop = ypos + 2; + MATRIX_ROW_N32_TO_STR(gGLModelView, 0,camera_lines[0]); addText(xpos, ypos, std::string(camera_lines[0])); ypos += y_inc; addText(xpos, ypos, "View Matrix"); ypos += y_inc; } // disable use of glReadPixels which messes up nVidia nSight graphics debugging - if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport) - { - U8 color[4]; - LLCoordGL coord = gViewerWindow->getCurrentMouse(); - glReadPixels(coord.mX, coord.mY, 1,1,GL_RGBA, GL_UNSIGNED_BYTE, color); - addText(xpos, ypos, llformat("%d %d %d %d", color[0], color[1], color[2], color[3])); - ypos += y_inc; - } + if (gSavedSettings.getBOOL("DebugShowColor") && !LLRender::sNsightDebugSupport) + { + U8 color[4]; + LLCoordGL coord = gViewerWindow->getCurrentMouse(); - // only display these messages if we are actually rendering beacons at this moment + // Convert x,y to raw pixel coords + S32 x_raw = llround(coord.mX * gViewerWindow->getWindowWidthRaw() / (F32) gViewerWindow->getWindowWidthScaled()); + S32 y_raw = llround(coord.mY * gViewerWindow->getWindowHeightRaw() / (F32) gViewerWindow->getWindowHeightScaled()); + + glReadPixels(x_raw, y_raw, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color); + addText(xpos, ypos, llformat("Pixel <%1d, %1d> R:%1d G:%1d B:%1d A:%1d", x_raw, y_raw, color[0], color[1], color[2], color[3])); + ypos += y_inc; + } + + // only display these messages if we are actually rendering beacons at this moment if (LLPipeline::getRenderBeacons() && LLFloaterReg::instanceVisible("beacons")) { if (LLPipeline::getRenderMOAPBeacons()) @@ -884,6 +989,18 @@ public: void draw() { LL_RECORD_BLOCK_TIME(FTM_DISPLAY_DEBUG_TEXT); + + // Camera matrix text is hard to see again a white background + // Add a dark background underneath the matrices for readability (contrast) + if (mBackRectCamera1.mTop >= 0) + { + mBackColor.setAlpha( 0.75f ); + gl_rect_2d(mBackRectCamera1, mBackColor, true); + + mBackColor.setAlpha( 0.66f ); + gl_rect_2d(mBackRectCamera2, mBackColor, true); + } + for (line_list_t::iterator iter = mLineList.begin(); iter != mLineList.end(); ++iter) { @@ -892,7 +1009,6 @@ public: LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE); } - mLineList.clear(); } }; @@ -1800,8 +1916,8 @@ LLViewerWindow::LLViewerWindow(const Params& p) ms_sleep(5000) ; //wait for 5 seconds. LLSplashScreen::update(LLTrans::getString("ShuttingDown")); -#if LL_LINUX || LL_SOLARIS - LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information." +#if LL_LINUX + LL_WARNS() << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt for further information." << LL_ENDL; #else LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings" @@ -4735,10 +4851,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei return FALSE; } //check if there is enough memory for the snapshot image - if(LLPipeline::sMemAllocationThrottled) - { - return FALSE ; //snapshot taking is disabled due to memory restriction. - } if(image_width * image_height > (1 << 22)) //if snapshot image is larger than 2K by 2K { if(!LLMemory::tryToAlloc(NULL, image_width * image_height * 3)) diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index f9ffefd4a2..b0f57beff8 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -359,7 +359,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : // gMuteListp->addObserver(&mutelist_listener); -#if LL_DARWIN || LL_LINUX || LL_SOLARIS +#if LL_DARWIN || LL_LINUX // HACK: THIS DOES NOT BELONG HERE // When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us. // This should cause us to ignore SIGPIPE and handle the error through proper channels. diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 2037aca7e9..878d7287ed 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -209,14 +209,7 @@ void LLSkyTex::create() void LLSkyTex::createGLImage(S32 which) { - if (mIsShiny) - { - mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA); - } - else - { - mTexture[which]->setExplicitFormat(GL_SRGB8_ALPHA8, GL_RGBA); - } + mTexture[which]->setExplicitFormat(GL_RGBA8, GL_RGBA); mTexture[which]->createGLTexture(0, mImageRaw[which], 0, TRUE, LLGLTexture::LOCAL); mTexture[which]->setAddressMode(LLTexUnit::TAM_CLAMP); } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 2d1a882a7e..3bdb8a2981 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2295,11 +2295,243 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) return res; } +bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture) +{ //Ok, here we have confirmation about texture creation, check our wait-list + //and make changes, or return false + + std::pair<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID()); + + typedef std::map<U8, LLMaterialPtr> map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + + //here we just interesting in DIFFUSE_MAP only! + if(NULL != cur_material.get() && LLRender::DIFFUSE_MAP == range_it->second.map && GL_RGBA != texture->getPrimaryFormat()) + { //ok let's check the diffuse mode + switch(cur_material->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //uups... we have non 32 bit texture with LLMaterial::DIFFUSE_ALPHA_MODE_* => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + + } break; + } //switch + } //if + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + +bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture) +{ //Ok, here if we wait information about texture and it's missing + //then depending from the texture map (diffuse, normal, or specular) + //make changes in material and confirm it. If not return false. + std::pair<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID()); + if(range.first == range.second) return false; + + typedef std::map<U8, LLMaterialPtr> map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + if (cur_material.isNull()) + continue; + + switch(range_it->second.map) + { + case LLRender::DIFFUSE_MAP: + { + if(LLMaterial::DIFFUSE_ALPHA_MODE_NONE != cur_material->getDiffuseAlphaMode()) + { //missing texture + !LLMaterial::DIFFUSE_ALPHA_MODE_NONE => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } break; + case LLRender::NORMAL_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setNormalID(LLUUID::null); + } break; + case LLRender::SPECULAR_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setSpecularID(LLUUID::null); + } break; + case LLRender::NUM_TEXTURE_CHANNELS: + //nothing to do, make compiler happy + break; + } //switch + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { - S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + LLMaterialPtr pMaterial = const_cast<LLMaterialPtr&>(pMaterialParams); + + if(pMaterialParams) + { //check all of them according to material settings + + LLViewerTexture *img_diffuse = getTEImage(te); + LLViewerTexture *img_normal = getTENormalMap(te); + LLViewerTexture *img_specular = getTESpecularMap(te); + + llassert(NULL != img_diffuse); + + LLMaterialPtr new_material = NULL; + + //diffuse + if(NULL != img_diffuse) + { //guard + if(0 == img_diffuse->getPrimaryFormat() && !img_diffuse->isMissingAsset()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(img_diffuse->getID(), material_info(LLRender::DIFFUSE_MAP, te))); + } + else + { + bool bSetDiffuseNone = false; + if(img_diffuse->isMissingAsset()) + { + bSetDiffuseNone = true; + } + else + { + switch(pMaterialParams->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //all of them modes available only for 32 bit textures + LLTextureEntry* tex_entry = getTE(te); + bool bIsBakedImageId = false; + if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID())) + { + bIsBakedImageId = true; + } + if (GL_RGBA != img_diffuse->getPrimaryFormat() && !bIsBakedImageId) + { + bSetDiffuseNone = true; + } + } break; + } + } //else + + + if(bSetDiffuseNone) + { //upps... we should substitute this material with LLMaterial::DIFFUSE_ALPHA_MODE_NONE + new_material = new LLMaterial(pMaterialParams->asLLSD()); + new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } + } + + //normal + if(LLUUID::null != pMaterialParams->getNormalID()) + { + if(img_normal && img_normal->isMissingAsset() && img_normal->getID() == pMaterialParams->getNormalID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setNormalID(LLUUID::null); + } + else if(NULL == img_normal || 0 == img_normal->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getNormalID(), material_info(LLRender::NORMAL_MAP,te))); + } + + } + + + //specular + if(LLUUID::null != pMaterialParams->getSpecularID()) + { + if(img_specular && img_specular->isMissingAsset() && img_specular->getID() == pMaterialParams->getSpecularID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setSpecularID(LLUUID::null); + } + else if(NULL == img_specular || 0 == img_specular->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getSpecularID(), material_info(LLRender::SPECULAR_MAP, te))); + } + } + + if(new_material) { + pMaterial = new_material; + LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial); + } + } + + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial); - LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" ) << LL_ENDL; setChanged(ALL_CHANGED); @@ -4366,7 +4598,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& LLMaterial* mat = te->getMaterialParams(); if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE @@ -5012,7 +5244,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, } draw_info->mAlphaMaskCutoff = mat->getAlphaMaskCutoff() * (1.f / 255.f); - draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaModeRender(); + draw_info->mDiffuseAlphaMode = mat->getDiffuseAlphaMode(); draw_info->mNormalMap = facep->getViewerObject()->getTENormalMap(facep->getTEOffset()); } else @@ -5374,7 +5606,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) if (mat && LLPipeline::sRenderDeferred) { - U8 alpha_mode = mat->getDiffuseAlphaModeRender(); + U8 alpha_mode = mat->getDiffuseAlphaMode(); bool is_alpha = type == LLDrawPool::POOL_ALPHA && (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND || @@ -5403,7 +5635,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) else if (mat) { bool is_alpha = type == LLDrawPool::POOL_ALPHA; - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; @@ -6301,7 +6533,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace bool can_be_shiny = true; if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; } @@ -6323,7 +6555,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace // if (te->getFullbright()) { - if (mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { if (opaque) { @@ -6408,7 +6640,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } else if (mat) { - U8 mode = mat->getDiffuseAlphaModeRender(); + U8 mode = mat->getDiffuseAlphaMode(); is_alpha = (is_alpha || (mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)); @@ -6507,7 +6739,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } else if (fullbright || bake_sunlight) { //fullbright - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); } @@ -6529,7 +6761,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace else { //all around simple llassert(mask & LLVertexBuffer::MAP_NORMAL); - if (mat && mat->getDiffuseAlphaModeRender() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + if (mat && mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { //material alpha mask can be respected in non-deferred registerFace(group, facep, LLRenderPass::PASS_ALPHA_MASK); } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 97888ed869..ce400a3498 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -441,6 +441,26 @@ protected: static S32 sNumLODChanges; friend class LLVolumeImplFlexible; + +public: + bool notifyAboutCreatingTexture(LLViewerTexture *texture); + bool notifyAboutMissingAsset(LLViewerTexture *texture); + +private: + struct material_info + { + LLRender::eTexIndex map; + U8 te; + + material_info(LLRender::eTexIndex map_, U8 te_) + : map(map_) + , te(te_) + {} + }; + + typedef std::multimap<LLUUID, material_info> mmap_UUID_MAP_t; + mmap_UUID_MAP_t mWaitingTextureInfo; + }; #endif // LL_LLVOVOLUME_H diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index bd667acb53..cd1b9c7c69 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -129,6 +129,16 @@ // #define MATERIALS_IN_REFLECTIONS 0 +// NOTE: Keep in sync with indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +// NOTE: Unused consts are commented out since some compilers (on macOS) may complain about unused variables. +// const S32 WATER_REFLECT_NONE_WATER_OPAQUE = -2; + const S32 WATER_REFLECT_NONE_WATER_TRANSPARENT = -1; + const S32 WATER_REFLECT_MINIMAL = 0; +// const S32 WATER_REFLECT_TERRAIN = 1; + const S32 WATER_REFLECT_STATIC_OBJECTS = 2; + const S32 WATER_REFLECT_AVATARS = 3; + const S32 WATER_REFLECT_EVERYTHING = 4; + bool gShiftFrame = false; //cached settings @@ -348,7 +358,6 @@ bool LLPipeline::sRenderFrameTest = false; bool LLPipeline::sRenderAttachedLights = true; bool LLPipeline::sRenderAttachedParticles = true; bool LLPipeline::sRenderDeferred = false; -bool LLPipeline::sMemAllocationThrottled = false; S32 LLPipeline::sVisibleLightCount = 0; F32 LLPipeline::sMinRenderSize = 0.f; bool LLPipeline::sRenderingHUDs; @@ -718,24 +727,6 @@ void LLPipeline::destroyGL() static LLTrace::BlockTimerStatHandle FTM_RESIZE_SCREEN_TEXTURE("Resize Screen Texture"); -//static -void LLPipeline::throttleNewMemoryAllocation(bool disable) -{ - if(sMemAllocationThrottled != disable) - { - sMemAllocationThrottled = disable ; - - if(sMemAllocationThrottled) - { - //send out notification - LLNotification::Params params("LowMemory"); - LLNotifications::instance().add(params); - - //release some memory. - } - } -} - void LLPipeline::requestResizeScreenTexture() { gResizeScreenTexture = TRUE; @@ -1677,7 +1668,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima if (alpha && mat) { - switch (mat->getDiffuseAlphaModeRender()) + switch (mat->getDiffuseAlphaMode()) { case 1: alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool. @@ -9270,30 +9261,29 @@ inline float sgn(float a) } void LLPipeline::generateWaterReflection(LLCamera& camera_in) -{ - if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) - { - bool skip_avatar_update = false; - if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) - { - skip_avatar_update = true; - } - - LLCamera camera = camera_in; +{ + if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate) + { + bool skip_avatar_update = false; + if (!isAgentAvatarValid() || gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || !LLVOAvatar::sVisibleInFirstPerson) + { + skip_avatar_update = true; + } + LLCamera camera = camera_in; camera.setFar(camera_in.getFar() * 0.75f); bool camera_is_underwater = LLViewerCamera::getInstance()->cameraUnderWater(); - LLPipeline::sReflectionRender = true; - - gPipeline.pushRenderTypeMask(); + LLPipeline::sReflectionRender = true; + + gPipeline.pushRenderTypeMask(); glh::matrix4f saved_modelview = get_current_modelview(); glh::matrix4f saved_projection = get_current_projection(); - glh::matrix4f mat; + glh::matrix4f mat; - S32 detail = RenderReflectionDetail; + S32 reflection_detail = RenderReflectionDetail; F32 water_height = gAgent.getRegion()->getWaterHeight(); F32 camera_height = camera_in.getOrigin().mV[VZ]; @@ -9307,32 +9297,34 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) camera.setOriginAndLookAt(reflect_origin, LLVector3::z_axis, reflect_interest_point); - //plane params + //plane params LLPlane plane; - LLVector3 pnorm; - S32 water_clip = 0; + LLVector3 pnorm; + S32 water_clip = 0; if (!camera_is_underwater) - { //camera is above water, clip plane points up - pnorm.setVec(0,0,1); + { + //camera is above water, clip plane points up + pnorm.setVec(0,0,1); plane.setVec(pnorm, -water_height); water_clip = 1; - } - else - { //camera is below water, clip plane points down - pnorm = LLVector3(0,0,-1); + } + else + { + //camera is below water, clip plane points down + pnorm = LLVector3(0,0,-1); plane.setVec(pnorm, water_height); water_clip = -1; - } + } S32 occlusion = LLPipeline::sUseOcclusion; - //disable occlusion culling for reflection map for now - LLPipeline::sUseOcclusion = 0; + //disable occlusion culling for reflection map for now + LLPipeline::sUseOcclusion = 0; if (!camera_is_underwater) - { //generate planar reflection map - - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0; + { + //generate planar reflection map + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER0; gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); @@ -9345,9 +9337,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) mReflectionModelView = mat; set_current_modelview(mat); - gGL.loadMatrix(mat.m); + gGL.loadMatrix(mat.m); - LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE); + LLViewerCamera::updateFrustumPlanes(camera, FALSE, TRUE); glh::vec3f origin(0, 0, 0); glh::matrix4f inv_mat = mat.inverse(); @@ -9355,10 +9347,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) camera.setOrigin(origin.v); - glCullFace(GL_FRONT); + glCullFace(GL_FRONT); - if (LLDrawPoolWater::sNeedsReflectionUpdate) - { + if (LLDrawPoolWater::sNeedsReflectionUpdate) + { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); glClearColor(0,0,0,0); mWaterRef.bindTarget(); @@ -9368,106 +9360,127 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) gGL.setColorMask(true, false); mWaterRef.getViewport(gGLViewport); - //initial sky pass (no user clip plane) - { //mask out everything but the sky - gPipeline.pushRenderTypeMask(); - gPipeline.andRenderTypeMask(LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_WL_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); + //initial sky pass (no user clip plane) + //mask out everything but the sky + gPipeline.pushRenderTypeMask(); + { + if (reflection_detail >= WATER_REFLECT_MINIMAL) + { + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); + } + else + { + gPipeline.andRenderTypeMask( + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_WL_SKY, + LLPipeline::END_RENDER_TYPES); + } updateCull(camera, mSky); stateSort(camera, mSky); - renderGeom(camera, TRUE); - - gPipeline.popRenderTypeMask(); - } + renderGeom(camera, TRUE); + } + gPipeline.popRenderTypeMask(); - gPipeline.pushRenderTypeMask(); + if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) + { + gPipeline.pushRenderTypeMask(); + { + clearRenderTypeMask( + LLPipeline::RENDER_TYPE_WATER, + LLPipeline::RENDER_TYPE_VOIDWATER, + LLPipeline::RENDER_TYPE_GROUND, + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::END_RENDER_TYPES); + + if (reflection_detail > WATER_REFLECT_MINIMAL) + { //mask out selected geometry based on reflection detail + if (reflection_detail < WATER_REFLECT_EVERYTHING) + { + clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); + if (reflection_detail < WATER_REFLECT_AVATARS) + { + clearRenderTypeMask( + LLPipeline::RENDER_TYPE_AVATAR, + LLPipeline::RENDER_TYPE_CONTROL_AV, + END_RENDER_TYPES); + if (reflection_detail < WATER_REFLECT_STATIC_OBJECTS) + { + clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); + } + } + } - clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, - LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_GROUND, - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::END_RENDER_TYPES); - - if (detail > 0) - { //mask out selected geometry based on reflection detail - if (detail < 4) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_PARTICLES, END_RENDER_TYPES); - if (detail < 3) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_AVATAR, LLPipeline::RENDER_TYPE_CONTROL_AV, END_RENDER_TYPES); - if (detail < 2) - { - clearRenderTypeMask(LLPipeline::RENDER_TYPE_VOLUME, END_RENDER_TYPES); - } - } - } + LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); + LLGLDisable cull(GL_CULL_FACE); + updateCull(camera, mReflectedObjects, -water_clip, &plane); + stateSort(camera, mReflectedObjects); + renderGeom(camera); + } + } + gPipeline.popRenderTypeMask(); + } - LLGLUserClipPlane clip_plane(plane, mReflectionModelView, saved_projection); - LLGLDisable cull(GL_CULL_FACE); - updateCull(camera, mReflectedObjects, -water_clip, &plane); - stateSort(camera, mReflectedObjects); - renderGeom(camera); - } - gPipeline.popRenderTypeMask(); mWaterRef.flush(); - } + } - glCullFace(GL_BACK); + glCullFace(GL_BACK); gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); - + gGL.popMatrix(); + set_current_modelview(saved_modelview); - } + } //LLPipeline::sUseOcclusion = occlusion; - camera.setOrigin(camera_in.getOrigin()); - //render distortion map - static bool last_update = true; - if (last_update) - { + camera.setOrigin(camera_in.getOrigin()); + //render distortion map + static bool last_update = true; + if (last_update) + { gPipeline.pushRenderTypeMask(); - camera.setFar(camera_in.getFar()); - clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER, - LLPipeline::RENDER_TYPE_VOIDWATER, - LLPipeline::RENDER_TYPE_GROUND, - END_RENDER_TYPES); + camera.setFar(camera_in.getFar()); + clearRenderTypeMask( + LLPipeline::RENDER_TYPE_WATER, + LLPipeline::RENDER_TYPE_VOIDWATER, + LLPipeline::RENDER_TYPE_GROUND, + END_RENDER_TYPES); // intentionally inverted so that distortion map contents (objects under the water when we're above it) // will properly include water fog effects LLPipeline::sUnderWaterRender = !camera_is_underwater; - if (LLPipeline::sUnderWaterRender) - { + if (LLPipeline::sUnderWaterRender) + { clearRenderTypeMask( - LLPipeline::RENDER_TYPE_GROUND, - LLPipeline::RENDER_TYPE_SKY, - LLPipeline::RENDER_TYPE_CLOUDS, - LLPipeline::RENDER_TYPE_WL_SKY, - END_RENDER_TYPES); - } - LLViewerCamera::updateFrustumPlanes(camera); + LLPipeline::RENDER_TYPE_GROUND, + LLPipeline::RENDER_TYPE_SKY, + LLPipeline::RENDER_TYPE_CLOUDS, + LLPipeline::RENDER_TYPE_WL_SKY, + END_RENDER_TYPES); + } + LLViewerCamera::updateFrustumPlanes(camera); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - if (LLPipeline::sUnderWaterRender || LLDrawPoolWater::sNeedsDistortionUpdate) { LLPipeline::sDistortionRender = true; LLColor3 col = LLEnvironment::instance().getCurrentWater()->getWaterFogColor(); - glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); + glClearColor(col.mV[0], col.mV[1], col.mV[2], 0.f); + + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1; - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WATER1; - mWaterDis.bindTarget(); - mWaterDis.getViewport(gGLViewport); - + mWaterDis.getViewport(gGLViewport); + gGL.setColorMask(true, true); mWaterDis.clear(); gGL.setColorMask(true, false); @@ -9479,66 +9492,69 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) LLPlane plane(-pnorm, water_dist); LLGLUserClipPlane clip_plane(plane, saved_modelview, saved_projection); - gGL.setColorMask(true, true); - mWaterDis.clear(); - gGL.setColorMask(true, false); + gGL.setColorMask(true, true); + mWaterDis.clear(); + gGL.setColorMask(true, false); // ignore clip plane if we're underwater and viewing distortion map of objects above waterline if (camera_is_underwater) - { + { clip_plane.disable(); - } + } - updateCull(camera, mRefractedObjects, water_clip, &plane); - stateSort(camera, mRefractedObjects); - renderGeom(camera); + if (reflection_detail >= WATER_REFLECT_NONE_WATER_TRANSPARENT) + { + updateCull(camera, mRefractedObjects, water_clip, &plane); + stateSort(camera, mRefractedObjects); + renderGeom(camera); + } - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.bind(); - } - - LLWorld::getInstance()->renderPropertyLines(); - - if (LLGLSLShader::sNoFixedFunction) - { - gUIProgram.unbind(); - } + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.bind(); + } + + LLWorld::getInstance()->renderPropertyLines(); + + if (LLGLSLShader::sNoFixedFunction) + { + gUIProgram.unbind(); + } mWaterDis.flush(); - } + } LLPipeline::sDistortionRender = false; - + gPipeline.popRenderTypeMask(); - } - last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate; + } + last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate; gPipeline.popRenderTypeMask(); LLPipeline::sUseOcclusion = occlusion; LLPipeline::sUnderWaterRender = false; - LLPipeline::sReflectionRender = false; + LLPipeline::sReflectionRender = false; LLDrawPoolWater::sNeedsReflectionUpdate = FALSE; LLDrawPoolWater::sNeedsDistortionUpdate = FALSE; - if (!LLRenderTarget::sUseFBO) - { - glClear(GL_DEPTH_BUFFER_BIT); - } - glClearColor(0.f, 0.f, 0.f, 0.f); - gViewerWindow->setup3DViewport(); - - LLGLState::checkStates(); + if (!LLRenderTarget::sUseFBO) + { + glClear(GL_DEPTH_BUFFER_BIT); + } + glClearColor(0.f, 0.f, 0.f, 0.f); + gViewerWindow->setup3DViewport(); - if (!skip_avatar_update) - { - gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); - } + LLGLState::checkStates(); - LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; - } + if (!skip_avatar_update) + { + gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode()); + } + + LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD; + } } glh::matrix4f look(const LLVector3 pos, const LLVector3 dir, const LLVector3 up) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 52fd51cd80..0eaa6b141d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -414,10 +414,6 @@ public: static void updateRenderDeferred(); static void refreshCachedSettings(); - static void throttleNewMemoryAllocation(bool disable); - - - void addDebugBlip(const LLVector3& position, const LLColor4& color); void hidePermanentObjects( std::vector<U32>& restoreList ); @@ -600,7 +596,6 @@ public: static bool sRenderAttachedLights; static bool sRenderAttachedParticles; static bool sRenderDeferred; - static bool sMemAllocationThrottled; static S32 sVisibleLightCount; static F32 sMinRenderSize; static bool sRenderingHUDs; diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index e282f1b179..3cc99b28c9 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -724,6 +724,14 @@ name="Reflections" width="150"> <combo_box.item + label="None; opaque" + name="0" + value="-2"/> + <combo_box.item + label="None; transparent" + name="0" + value="-1"/> + <combo_box.item label="Minimal" name="0" value="0"/> diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 4a47ccf23b..4a02b576c2 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -9624,6 +9624,12 @@ You do not appear to have the proper hardware requirements for [APP_NAME]. [APP_ If you continue to have problems, please visit the [SUPPORT_SITE]. </global> + <global name="UnsupportedIntelDriver"> +The installed Intel graphics driver for [GPUNAME], version [VERSION], is significantly out of date and is known to cause excessive rates of program crashes. You are strongly advised to update to a current Intel driver + +Do you want to check the Intel driver website? + </global> + <global name="UnsupportedCPUAmount"> 796 </global> |