diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-04-26 14:04:55 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-04-26 14:04:55 -0400 |
commit | 78f2663c4a61a7983c84cf50e5d2fdd92811a1b0 (patch) | |
tree | 56bf81cc39cb8c5180508c37c552c8ab23273300 /indra/newview/app_settings/shaders/class1/deferred | |
parent | d6569db3520f7e0ce2d93febb6f4e26b48c08a3d (diff) | |
parent | 75c53a6a269890b9fe78b4b50d9b093a94778650 (diff) |
Automated merge with http://hg.secondlife.com/viewer-release
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
49 files changed, 389 insertions, 181 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index c012efa056..dd87ddb330 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -26,15 +26,15 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect depthMap; vec4 diffuseLookup(vec2 texcoord); -uniform mat4 shadow_matrix[6]; -uniform vec4 shadow_clip; uniform vec2 screen_res; vec3 atmosLighting(vec3 light); @@ -69,6 +69,6 @@ void main() color.rgb += diff.rgb * vary_pointlight_col.rgb; - gl_FragColor = color; + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl index 8641827777..beb3290187 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl @@ -26,15 +26,15 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect depthMap; uniform sampler2D diffuseMap; -uniform mat4 shadow_matrix[6]; -uniform vec4 shadow_clip; uniform vec2 screen_res; vec3 atmosLighting(vec3 light); @@ -81,9 +81,9 @@ void main() color.rgb += diff.rgb * vary_pointlight_col.rgb; - gl_FragColor = color; - //gl_FragColor = vec4(1,0,1,1); - //gl_FragColor = vec4(1,0,1,1)*shadow; + frag_color = color; + //frag_color = vec4(1,0,1,1); + //frag_color = vec4(1,0,1,1)*shadow; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl index c13ea702db..cb87b754b4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl @@ -26,14 +26,14 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect depthMap; uniform sampler2D diffuseMap; -uniform mat4 shadow_matrix[6]; -uniform vec4 shadow_clip; uniform vec2 screen_res; vec3 atmosLighting(vec3 light); @@ -79,6 +79,6 @@ void main() color.rgb += diff.rgb * vary_pointlight_col.rgb; - gl_FragColor = color; + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index eada38eaaa..5a0e8ff684 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -41,7 +41,6 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); VARYING vec3 vary_position; VARYING vec3 vary_ambient; VARYING vec3 vary_directional; -VARYING vec3 vary_normal; VARYING vec3 vary_fragcoord; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; @@ -110,8 +109,7 @@ void main() gl_Position = frag_pos; vary_position = pos.xyz; - vary_normal = norm; - + calcAtmospherics(pos.xyz); vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 5c36118a50..cf38a2f4f7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -48,7 +48,6 @@ VARYING vec3 vary_ambient; VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; -VARYING vec3 vary_light; VARYING vec3 vary_pointlight_col; VARYING vec4 vertex_color; @@ -134,8 +133,6 @@ void main() // Add windlight lights col.rgb = atmosAmbient(vec3(0.)); - vary_light = light_position[0].xyz; - vary_ambient = col.rgb*diffuse_color.rgb; vary_directional.rgb = diffuse_color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), (1.0-diffuse_color.a)*(1.0-diffuse_color.a))); diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl index 402f681631..22c9a4d14e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl @@ -23,17 +23,17 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2D diffuseMap; -VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; void main() { - //gl_FragColor = vec4(1,1,1,vertex_color.a * texture2D(diffuseMap, vary_texcoord0.xy).a); - gl_FragColor = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl index ded6cced27..81961d7746 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl @@ -27,11 +27,8 @@ uniform mat4 modelview_matrix; uniform mat4 texture_matrix0; ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec2 texcoord0; -VARYING vec4 vertex_color; - mat4 getObjectSkinnedTransform(); void main() @@ -42,8 +39,6 @@ void main() mat = modelview_matrix * mat; vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vertex_color = diffuse_color; - vec4 p = projection_matrix * vec4(pos, 1.0); p.z = max(p.z, -p.w+0.01); gl_Position = p; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl new file mode 100644 index 0000000000..5f395801e5 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl @@ -0,0 +1,148 @@ +/** + * @file avatarAlphaNoColorV.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$ + */ + +uniform mat4 projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +mat4 getSkinnedTransform(); +void calcAtmospherics(vec3 inPositionEye); + +float calcDirectionalLight(vec3 n, vec3 l); +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); + +vec3 atmosAmbient(vec3 light); +vec3 atmosAffectDirectionalLight(float lightIntensity); +vec3 scaleDownLight(vec3 light); +vec3 scaleUpLight(vec3 light); + +VARYING vec3 vary_position; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_pointlight_col; +VARYING vec2 vary_texcoord0; + + +uniform float near_clip; + +uniform vec4 color; + +uniform vec4 light_position[8]; +uniform vec3 light_direction[8]; +uniform vec3 light_attenuation[8]; +uniform vec3 light_diffuse[8]; + +float calcDirectionalLight(vec3 n, vec3 l) +{ + float a = max(dot(n,l),0.0); + return a; +} + +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ + //get light vector + vec3 lv = lp.xyz-v; + + //get distance + float d = dot(lv,lv); + + float da = 0.0; + + if (d > 0.0 && la > 0.0 && fa > 0.0) + { + //normalize light vector + lv = normalize(lv); + + //distance attenuation + float dist2 = d/la; + da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + + // spotlight coefficient. + float spot = max(dot(-ln, lv), is_pointlight); + da *= spot*spot; // GL_SPOT_EXPONENT=2 + + //angular attenuation + da *= max(dot(n, lv), 0.0); + } + + return da; +} + +void main() +{ + vary_texcoord0 = texcoord0; + + vec4 pos; + vec3 norm; + + mat4 trans = getSkinnedTransform(); + vec4 pos_in = vec4(position.xyz, 1.0); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); + pos.w = 1.0; + + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); + norm = normalize(norm); + + vec4 frag_pos = projection_matrix * pos; + gl_Position = frag_pos; + + vary_position = pos.xyz; + + calcAtmospherics(pos.xyz); + + vec4 col = vec4(0.0, 0.0, 0.0, 1.0); + + // Collect normal lights + col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z); + col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z); + col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z); + col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, light_attenuation[5].z); + col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].y, light_attenuation[6].z); + col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].y, light_attenuation[7].z); + + vary_pointlight_col = col.rgb*color.rgb; + + col.rgb = vec3(0,0,0); + + // Add windlight lights + col.rgb = atmosAmbient(vec3(0.)); + + vary_ambient = col.rgb*color.rgb; + vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); + + col.rgb = col.rgb * color.rgb; + + vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); +} + + diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index 9a3b2e3e8a..46d2aa4877 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform sampler2D diffuseMap; @@ -41,9 +43,9 @@ void main() discard; } - gl_FragData[0] = vec4(diff.rgb, 0.0); - gl_FragData[1] = vec4(0,0,0,0); + frag_data[0] = vec4(diff.rgb, 0.0); + frag_data[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 558a88009a..3686f2f647 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2D diffuseMap; @@ -33,7 +35,7 @@ VARYING vec4 post_pos; void main() { - gl_FragColor = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 60d4dae99f..f400eb7a5b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect depthMap; @@ -111,6 +113,6 @@ void main() col /= defined_weight.xyxx; col.y *= col.y; - gl_FragColor = col; + frag_color = col; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 6cc5f23aca..680eadb852 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform sampler2D diffuseMap; @@ -46,9 +48,9 @@ void main() dot(norm,vary_mat1), dot(norm,vary_mat2)); - gl_FragData[0] = vec4(col, 0.0); - gl_FragData[1] = vertex_color.aaaa; // spec - //gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested + frag_data[0] = vec4(col, 0.0); + frag_data[1] = vertex_color.aaaa; // spec + //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(tnorm); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl index 6c205074b4..8ba75010a2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl @@ -30,7 +30,7 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec4 diffuse_color; ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; -ATTRIBUTE vec2 texcoord2; +ATTRIBUTE vec3 binormal; VARYING vec3 vary_mat0; VARYING vec3 vary_mat1; @@ -52,7 +52,7 @@ void main() vec3 n = normalize((mat * vec4(normal.xyz+position.xyz, 1.0)).xyz-pos.xyz); - vec3 b = normalize((mat * vec4(vec4(texcoord2,0,1).xyz+position.xyz, 1.0)).xyz-pos.xyz); + vec3 b = normalize((mat * vec4(binormal.xyz+position.xyz, 1.0)).xyz-pos.xyz); vec3 t = cross(b, n); vary_mat0 = vec3(t.x, b.x, n.x); diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index db272cf601..1d8ca04ccd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -25,7 +25,9 @@ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif ///////////////////////////////////////////////////////////////////////// @@ -98,8 +100,8 @@ void main() color *= 2.; /// Gamma correct for WL (soft clip effect). - gl_FragData[0] = vec4(scaleSoftClip(color.rgb), alpha1); - gl_FragData[1] = vec4(0.0,0.0,0.0,0.0); - gl_FragData[2] = vec4(0,0,1,0); + frag_data[0] = vec4(scaleSoftClip(color.rgb), alpha1); + frag_data[1] = vec4(0.0,0.0,0.0,0.0); + frag_data[2] = vec4(0,0,1,0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index e612efba61..ccbc3c557c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect diffuseRect; @@ -83,6 +85,6 @@ void main() sc = max(sc, -max_cof); vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); - gl_FragColor.rgb = diff.rgb + bloom.rgb; - gl_FragColor.a = sc/max_cof*0.5+0.5; + frag_color.rgb = diff.rgb + bloom.rgb; + frag_color.a = sc/max_cof*0.5+0.5; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl index e9989a4e48..b2027d3a5d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform float minimum_alpha; @@ -44,9 +46,9 @@ void main() discard; } - gl_FragData[0] = vec4(col.rgb, 0.0); - gl_FragData[1] = vec4(0,0,0,0); // spec + frag_data[0] = vec4(col.rgb, 0.0); + frag_data[1] = vec4(0,0,0,0); // spec vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl index fdf8d72b38..ead384b07c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif VARYING vec3 vary_normal; @@ -43,8 +45,8 @@ void main() discard; } - gl_FragData[0] = vec4(col.rgb, 0.0); - gl_FragData[1] = vec4(0,0,0,0); + frag_data[0] = vec4(col.rgb, 0.0); + frag_data[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl index bb20e2ca47..f73fa6f231 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl @@ -25,7 +25,9 @@ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform float minimum_alpha; @@ -44,9 +46,9 @@ void main() discard; } - gl_FragData[0] = vec4(col.rgb, 0.0); - gl_FragData[1] = vec4(0,0,0,0); // spec + frag_data[0] = vec4(col.rgb, 0.0); + frag_data[1] = vec4(0,0,0,0); // spec vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 7bde49eb86..227aa2aae3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform sampler2D diffuseMap; @@ -36,10 +38,10 @@ VARYING vec2 vary_texcoord0; void main() { vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb; - gl_FragData[0] = vec4(col, 0.0); - gl_FragData[1] = vertex_color.aaaa; // spec - //gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested + frag_data[0] = vec4(col, 0.0); + frag_data[1] = vertex_color.aaaa; // spec + //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl index 75b45111e0..d442e5403a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif VARYING vec3 vary_normal; @@ -35,9 +37,9 @@ void main() { vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb; - gl_FragData[0] = vec4(col, 0.0); - gl_FragData[1] = vertex_color.aaaa; // spec - //gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested + frag_data[0] = vec4(col, 0.0); + frag_data[1] = vertex_color.aaaa; // spec + //frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl index 01e3505359..a425e5062e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect diffuseRect; @@ -37,14 +39,24 @@ uniform vec2 screen_res; uniform float max_cof; uniform float res_scale; +uniform float dof_width; +uniform float dof_height; VARYING vec2 vary_fragcoord; +vec4 dofSample(sampler2DRect tex, vec2 tc) +{ + tc.x = min(tc.x, dof_width); + tc.y = min(tc.y, dof_height); + + return texture2DRect(tex, tc); +} + void main() { vec2 tc = vary_fragcoord.xy; - vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*res_scale); + vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale); vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy); @@ -63,5 +75,5 @@ void main() diff = mix(diff, col*0.25, a); } - gl_FragColor = mix(diff, dof, a); + frag_color = mix(diff, dof, a); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index 92f78125d8..6aa4d7b4ed 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif vec3 fullbrightAtmosTransport(vec3 light); @@ -45,6 +47,6 @@ void main() color.rgb = fullbrightScaleSoftClip(color.rgb); - gl_FragColor = color; + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 84ae2f9f10..36433a5827 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif VARYING vec4 vertex_color; @@ -46,6 +48,6 @@ void main() color.rgb = fullbrightScaleSoftClip(color.rgb); - gl_FragColor = color; + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl index 5af9406452..e02a7b405b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif #define FXAA_PC 1 @@ -341,18 +343,23 @@ A. Or use FXAA_GREEN_AS_LUMA. // 1 = API supports gather4 on alpha channel. // 0 = API does not support gather4 on alpha channel. // + #if (FXAA_GLSL_130 == 0) + #define FXAA_GATHER4_ALPHA 0 + #endif #if (FXAA_HLSL_5 == 1) #define FXAA_GATHER4_ALPHA 1 #endif - #ifdef GL_ARB_gpu_shader5 - #define FXAA_GATHER4_ALPHA 1 - #endif - #ifdef GL_NV_gpu_shader5 - #define FXAA_GATHER4_ALPHA 1 - #endif #ifndef FXAA_GATHER4_ALPHA - #define FXAA_GATHER4_ALPHA 0 - #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifndef FXAA_GATHER4_ALPHA + #define FXAA_GATHER4_ALPHA 0 + #endif + #endif #endif /*============================================================================ @@ -2113,6 +2120,6 @@ void main() //diff = texture2D(diffuseMap, vary_tc); - gl_FragColor = diff; + frag_color = diff; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl index 29ca80ae92..da1b234240 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect depthMap; @@ -184,5 +186,5 @@ void main() vec3 norm = texture2DRect(normalMap, pos_screen).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - gl_FragColor.xyz = giAmbient(pos, norm); + frag_color.xyz = giAmbient(pos, norm); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index a44173a2a4..bc0719cb82 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform float minimum_alpha; @@ -45,7 +47,7 @@ void main() discard; } - gl_FragData[0] = vec4(col.rgb, col.a * 0.005); - gl_FragData[1] = texture2D(specularMap, vary_texcoord0.xy); - gl_FragData[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0); + frag_data[0] = vec4(col.rgb, col.a * 0.005); + frag_data[1] = texture2D(specularMap, vary_texcoord0.xy); + frag_data[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index e014a14ad8..dcf474824d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -26,12 +26,14 @@ uniform sampler2DRect diffuseMap; #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif VARYING vec2 vary_fragcoord; void main() { - gl_FragColor = texture2DRect(diffuseMap, vary_fragcoord.xy); + frag_color = texture2DRect(diffuseMap, vary_fragcoord.xy); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 179c721a2f..53a2a13392 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect depthMap; @@ -141,6 +143,6 @@ void main() discard; } - gl_FragColor.rgb = out_col; - gl_FragColor.a = 0.0; + frag_color.rgb = out_col; + frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 2196d14895..75de47614c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif //class 1 -- no shadows @@ -242,6 +244,6 @@ void main() } } - gl_FragColor.rgb = col; - gl_FragColor.a = 0.0; + frag_color.rgb = col; + frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl index 879942d8fa..62cfa5c316 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2D alphaMap; @@ -52,5 +54,5 @@ void main() norm *= 0.5; norm += 0.5; - gl_FragColor = vec4(norm, alpha); + frag_color = vec4(norm, alpha); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index b673d00d6e..a5e04fba57 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect diffuseRect; @@ -118,6 +120,6 @@ void main() discard; } - gl_FragColor.rgb = col; - gl_FragColor.a = 0.0; + frag_color.rgb = col; + frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 18d451bf87..bf362e21a4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect diffuseRect; @@ -122,5 +124,5 @@ void main() diff /= w; } - gl_FragColor = diff; + frag_color = diff; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl index c275434777..eb5beeef39 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect diffuseRect; @@ -40,6 +42,6 @@ void main() vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); - gl_FragColor = diff + bloom; + frag_color = diff + bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl index 0d5c8e7287..bd0cb50464 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl @@ -1,5 +1,5 @@ /** - * @file postgiV.glsl + * @file postDeferredV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code @@ -24,17 +24,17 @@ */ uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; +ATTRIBUTE vec3 position; VARYING vec2 vary_fragcoord; + uniform vec2 screen_res; void main() { //transform vertex vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_Position = pos; + gl_Position = pos; vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl index 84d65d5b3b..96f9628424 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl @@ -24,8 +24,10 @@ */ #ifdef DEFINE_GL_FRAGCOLOR - out vec4 gl_FragColor; - #endif +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif uniform sampler2DRect depthMap; uniform sampler2DRect normalMap; @@ -96,5 +98,5 @@ void main() col = col*col*blur_quad.x + col*blur_quad.y + blur_quad.z; - gl_FragColor.rgb = col; + frag_color.rgb = col; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index c1fb7b55d4..cf8cf8364a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform float minimum_alpha; @@ -44,7 +46,7 @@ void main() discard; } - gl_FragColor = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index bf75ca262e..7e55fdc12a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl @@ -24,14 +24,16 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif VARYING vec4 post_pos; void main() { - gl_FragColor = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 96ad0aa93a..faa54a316e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif ///////////////////////////////////////////////////////////////////////// @@ -57,8 +59,8 @@ void main() color *= 2.; /// Gamma correct for WL (soft clip effect). - gl_FragData[0] = vec4(scaleSoftClip(color.rgb), 1.0); - gl_FragData[1] = vec4(0.0,0.0,0.0,0.0); - gl_FragData[2] = vec4(0,0,1,0); + frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0); + frag_data[1] = vec4(0.0,0.0,0.0,0.0); + frag_data[2] = vec4(0,0,1,0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index cb7603f4fd..7c02d31d43 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -26,7 +26,6 @@ uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky @@ -34,7 +33,6 @@ ATTRIBUTE vec2 texcoord0; // Output parameters VARYING vec4 vary_HazeColor; -VARYING vec2 vary_texcoord0; // Inputs uniform vec3 camPosLocal; @@ -60,8 +58,7 @@ void main() // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = texcoord0; - + // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); //vec3 P = position.xyz + vec3(0,50,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 0c53a4ffa5..b5501c2820 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect diffuseRect; @@ -322,7 +324,7 @@ void main() col = diffuse.rgb; } - gl_FragColor.rgb = col; + frag_color.rgb = col; - gl_FragColor.a = bloom; + frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index cc0f4e5b6b..7ed8ed3370 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -27,7 +27,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform sampler2DRect diffuseRect; @@ -184,6 +186,6 @@ void main() } } - gl_FragColor.rgb = col; - gl_FragColor.a = 0.0; + frag_color.rgb = col; + frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index 03fccd2766..821058804c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif VARYING vec4 vertex_color; @@ -36,7 +38,7 @@ void main() { vec4 col = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy); - gl_FragData[0] = col; - gl_FragData[1] = vec4(0,0,0,0); - gl_FragData[2] = vec4(0,0,1,0); + frag_data[0] = col; + frag_data[1] = vec4(0,0,0,0); + frag_data[2] = vec4(0,0,1,0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl index adc7c5d005..5ca817aff6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl @@ -28,10 +28,12 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif void main() { - gl_FragColor = vec4(0,0,0,0); + frag_color = vec4(0,0,0,0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl index e5d3bb8ea6..47e9d15fbc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl @@ -1,5 +1,5 @@ /** - * @file giV.glsl + * @file sunLightF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code @@ -24,13 +24,8 @@ */ uniform mat4 modelview_projection_matrix; - + ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -VARYING vec4 vertex_color; -VARYING vec2 vary_fragcoord; uniform vec2 screen_res; @@ -39,10 +34,4 @@ void main() //transform vertex vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); gl_Position = pos; - - vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - vec4 tex = vec4(texcoord0,0,1); - tex.w = 1.0; - - vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index fc5959a33c..2422d73a3e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif //class 1 -- no shadow, SSAO only @@ -37,8 +39,6 @@ uniform sampler2D noiseMap; // Inputs -uniform mat4 shadow_matrix[6]; -uniform vec4 shadow_clip; uniform float ssao_radius; uniform float ssao_max_radius; uniform float ssao_factor; @@ -49,9 +49,6 @@ VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; -uniform float shadow_bias; -uniform float shadow_offset; - vec4 getPosition(vec2 pos_screen) { float depth = texture2DRect(depthMap, pos_screen.xy).r; @@ -128,8 +125,8 @@ void main() vec3 norm = texture2DRect(normalMap, pos_screen).xyz; norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - gl_FragColor[0] = 1.0; - gl_FragColor[1] = calcAmbientOcclusion(pos, norm); - gl_FragColor[2] = 1.0; - gl_FragColor[3] = 1.0; + frag_color[0] = 1.0; + frag_color[1] = calcAmbientOcclusion(pos, norm); + frag_color[2] = 1.0; + frag_color[3] = 1.0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index 5522e6c41d..8a5e482e80 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform sampler2D detail_0; @@ -51,9 +53,9 @@ void main() float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a; vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); - gl_FragData[0] = vec4(outColor.rgb, 0.0); - gl_FragData[1] = vec4(0,0,0,0); + frag_data[0] = vec4(outColor.rgb, 0.0); + frag_data[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index ea98d6884c..6cf6106b51 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif uniform sampler2D diffuseMap; @@ -43,8 +45,8 @@ void main() discard; } - gl_FragData[0] = vec4(vertex_color.rgb*col.rgb, 0.0); - gl_FragData[1] = vec4(0,0,0,0); + frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0); + frag_data[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); - gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); + frag_data[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl index 20d0170535..d4d2f5f571 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl @@ -24,7 +24,9 @@ */ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragColor; +out vec4 frag_color; +#else +#define frag_color gl_FragColor #endif uniform float minimum_alpha; @@ -43,7 +45,7 @@ void main() discard; } - gl_FragColor = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index 4c9ea24a24..42dc7c0980 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -26,7 +26,9 @@ #extension GL_ARB_texture_rectangle : enable #ifdef DEFINE_GL_FRAGCOLOR -out vec4 gl_FragData[3]; +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData #endif vec3 scaleSoftClip(vec3 inColor); @@ -157,7 +159,7 @@ void main() //wavef = normalize(wavef); vec3 screenspacewavef = (norm_mat*vec4(wavef, 1.0)).xyz; - gl_FragData[0] = vec4(color.rgb, 0.5); // diffuse - gl_FragData[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec - gl_FragData[2] = vec4(screenspacewavef.xy*0.5+0.5, screenspacewavef.z, screenspacewavef.z*0.5); // normalxyz, displace + frag_data[0] = vec4(color.rgb, 0.5); // diffuse + frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec + frag_data[2] = vec4(screenspacewavef.xy*0.5+0.5, screenspacewavef.z, screenspacewavef.z*0.5); // normalxyz, displace } |