diff options
author | Dave Parks <davep@lindenlab.com> | 2011-09-28 00:41:10 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-09-28 00:41:10 -0500 |
commit | 348a70181211b8fe37c569f8b3fb8324cc8c59ea (patch) | |
tree | 4b3e5ad42d549879c319bcf7e3fdfc0b60076dc9 /indra/newview/app_settings/shaders/class2 | |
parent | 554b14dedac5a51927bad57b475d8f5a571c1add (diff) |
SH-2507 Shave some unused/redundant varying state and make the max texture index debug setting rebuild shaders to use no flow control when set to 1 or lower
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
13 files changed, 185 insertions, 66 deletions
diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 04d3e2aa1f..5af9f5c902 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -56,7 +56,7 @@ void main() vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index ad353eb624..5a3955ef00 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -50,7 +50,7 @@ VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -140,7 +140,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 6a3777c7c8..9540ddd2e8 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -49,10 +49,10 @@ VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; VARYING vec3 vary_pointlight_col; -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -97,7 +97,7 @@ void main() { //transform vertex vec4 vert = vec4(position.xyz, 1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -136,7 +136,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 091a865160..63c7a6b13d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -48,7 +48,7 @@ VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + uniform float near_clip; uniform float shadow_offset; @@ -139,7 +139,7 @@ void main() vertex_color = col; - fog_depth = pos.z; + vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl index 580ef2694f..34bd8d445a 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -34,10 +34,10 @@ void calcAtmospherics(vec3 inPositionEye); uniform vec4 origin; -VARYING float vary_texture_index; + ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; @@ -45,13 +45,13 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -64,6 +64,4 @@ void main() calcAtmospherics(pos.xyz); vertex_color = diffuse_color; - - fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl index 09dbd0b6cd..fc20d3270e 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -28,7 +28,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -36,16 +36,16 @@ ATTRIBUTE vec4 diffuse_color; void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; @@ -54,5 +54,5 @@ void main() vertex_color = diffuse_color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index 86c592ea57..fdb3453cc5 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -30,7 +30,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -43,16 +43,13 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; -VARYING float fog_depth; - uniform vec4 origin; void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); @@ -64,7 +61,5 @@ void main() calcAtmospherics(pos.xyz); - vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); - - fog_depth = pos.z; + vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl index 6799e43b9a..cb80697d15 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec4 diffuse_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -57,5 +57,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl index 8e8f0664b0..37a20383e2 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -29,7 +29,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE float texture_index; +void passTextureIndex(); ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; @@ -37,16 +37,16 @@ ATTRIBUTE vec4 diffuse_color; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -VARYING float vary_texture_index; + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); - vary_texture_index = texture_index; + passTextureIndex(); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; @@ -60,5 +60,5 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); vertex_color = color; - fog_depth = pos.z; + } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index 08814b49d8..e8e56e12c1 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -24,25 +24,17 @@ */ - -VARYING vec3 vary_PositionEye; - VARYING vec3 vary_SunlitColor; -VARYING vec3 vary_AmblitColor; VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; +VARYING float vary_AtmosAttenuation; -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return vec3(0,0,0); } vec3 getAmblitColor() { - return vary_AmblitColor; + return vec3(0,0,0); } vec3 getAdditiveColor() { @@ -50,5 +42,5 @@ vec3 getAdditiveColor() } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return vec3(vary_AtmosAttenuation); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 514f009add..01605e5b25 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -24,49 +24,50 @@ */ - -VARYING vec3 vary_PositionEye; - -VARYING vec3 vary_SunlitColor; -VARYING vec3 vary_AmblitColor; VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; +VARYING float vary_AtmosAttenuation; + +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; +vec3 position_eye; -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return sunlit_color; } vec3 getAmblitColor() { - return vary_AmblitColor; + return amblit_color; } + vec3 getAdditiveColor() { return vary_AdditiveColor; } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return atmos_attenuation; } +vec3 getPositionEye() +{ + return position_eye; +} void setPositionEye(vec3 v) { - vary_PositionEye = v; + position_eye = v; } void setSunlitColor(vec3 v) { - vary_SunlitColor = v; + sunlit_color = v; } void setAmblitColor(vec3 v) { - vary_AmblitColor = v; + amblit_color = v; } void setAdditiveColor(vec3 v) @@ -76,5 +77,6 @@ void setAdditiveColor(vec3 v) void setAtmosAttenuation(vec3 v) { - vary_AtmosAttenuation = v; + atmos_attenuation = v; + vary_AtmosAttenuation = v.r; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl new file mode 100644 index 0000000000..23046f990d --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl @@ -0,0 +1,51 @@ +/** + * @file 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_SunlitColor; +VARYING vec3 vary_AdditiveColor; +VARYING float vary_AtmosAttenuation; + +vec3 getSunlitColor() +{ + return vec3(0,0,0); +} +vec3 getAmblitColor() +{ + return vec3(0,0,0); +} +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return vec3(vary_AtmosAttenuation); +} +vec3 getPositionEye() +{ + return vary_PositionEye; +} + diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl new file mode 100644 index 0000000000..279c4dd981 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl @@ -0,0 +1,81 @@ +/** + * @file 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 float vary_AtmosAttenuation; + +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; + +vec3 getSunlitColor() +{ + return sunlit_color; +} +vec3 getAmblitColor() +{ + return amblit_color; +} + +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return atmos_attenuation; +} + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ + sunlit_color = v; +} + +void setAmblitColor(vec3 v) +{ + amblit_color = v; +} + +void setAdditiveColor(vec3 v) +{ + vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ + atmos_attenuation = v; + vary_AtmosAttenuation = v.r; +} |