diff options
| author | Dave Parks <davep@lindenlab.com> | 2023-01-11 11:28:45 -0600 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2023-01-11 11:28:45 -0600 | 
| commit | b4f53334141b179bdb1762636ce313f14d9e2b10 (patch) | |
| tree | e03a3ec75618c9039f85771fc17ca36bcc453e8c /indra/newview/app_settings/shaders | |
| parent | cd1e7da099b66cbeb510d169a5415e57b617cd37 (diff) | |
SL-18869 Touch up -- Prune "post_pos" from shadow shaders that don't need it and fix non-standard gl_Position z values
Diffstat (limited to 'indra/newview/app_settings/shaders')
18 files changed, 9 insertions, 373 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaMaskShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaMaskShadowF.glsl deleted file mode 100644 index 26d23aec79..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaMaskShadowF.glsl +++ /dev/null @@ -1,60 +0,0 @@ -/**  - * @file attachmentAlphaMaskShadowF.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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform float minimum_alpha; - -uniform sampler2D diffuseMap; - -VARYING vec4 post_pos; -VARYING vec2 vary_texcoord0; -VARYING float pos_w; -VARYING float target_pos_x; -VARYING vec4 vertex_color; - -void main()  -{ -	float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a; - -	if (alpha < 0.05) // treat as totally transparent -	{ -		discard; -	} - -	if (alpha < minimum_alpha) // treat as semi-transparent -	{ -	  //if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25) -	  { -	    discard; -	  } -	} - -	frag_color = vec4(1,1,1,1); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaShadowF.glsl deleted file mode 100644 index 57fd620cae..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaShadowF.glsl +++ /dev/null @@ -1,63 +0,0 @@ -/**  - * @file attachmentAlphaShadowF.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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform float minimum_alpha; -uniform sampler2D diffuseMap; - -VARYING float pos_w; -VARYING float target_pos_x; - -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif - -VARYING vec2 vary_texcoord0; -VARYING vec4 vertex_color; - -void main()  -{ -	float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a * vertex_color.a; - -	if (alpha < 0.05) // treat as totally transparent -	{ -		discard; -	} - -	if (alpha < minimum_alpha) -	{ -	  if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25) -	  { -	    discard; -	  } -	} - -	frag_color = vec4(1,1,1,1); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaShadowV.glsl deleted file mode 100644 index a7bf4d7780..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentAlphaShadowV.glsl +++ /dev/null @@ -1,74 +0,0 @@ -/**  - * @file attachmentAlphaShadowV.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; -uniform mat4 modelview_matrix; -uniform mat4 texture_matrix0; -uniform float shadow_target_width; - -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec3 position; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec2 texcoord0; - -mat4 getObjectSkinnedTransform(); -void passTextureIndex(); - -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif -VARYING vec2 vary_texcoord0; -VARYING float pos_w; -VARYING float target_pos_x; -VARYING vec4 vertex_color; - -void main() -{ -	//transform vertex -	mat4 mat = getObjectSkinnedTransform(); -	 -	mat = modelview_matrix * mat; -	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - -	vec4 p = projection_matrix * vec4(pos, 1.0); - -	pos_w = p.w; - -	target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; - -	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - -	vertex_color = diffuse_color; - -#if !defined(DEPTH_CLAMP) -	p.z = max(p.z, -p.w+0.01); -    post_pos = p; -	gl_Position = p; -#else -	gl_Position = p; -#endif - -	passTextureIndex(); -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl deleted file mode 100644 index 8e9a5fcd41..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl +++ /dev/null @@ -1,41 +0,0 @@ -/**  - * @file avatarShadowF.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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseMap; - -VARYING vec2 vary_texcoord0; - -void main()  -{ -	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 deleted file mode 100644 index 0fa0edfd67..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl +++ /dev/null @@ -1,50 +0,0 @@ -/**  - * @file attachmentShadowV.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; -uniform mat4 modelview_matrix; -uniform mat4 texture_matrix0; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; - -mat4 getObjectSkinnedTransform(); - -void main() -{ -	//transform vertex -	mat4 mat = getObjectSkinnedTransform(); -	 -	mat = modelview_matrix * mat; -	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; -	 - -	vec4 p = projection_matrix * vec4(pos, 1.0); -#if !defined(DEPTH_CLAMP) -	p.z = max(p.z, -p.w+0.01); -	gl_Position = p; -#else -	gl_Position = p; -#endif -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl index 407ee39fbb..44f67899e4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl @@ -32,10 +32,6 @@ out vec4 frag_color;  uniform float minimum_alpha;  uniform sampler2D diffuseMap; -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif -  VARYING float target_pos_x;  VARYING float pos_w;  VARYING vec2 vary_texcoord0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl index cfebc7bc66..9a0024ede9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl @@ -33,10 +33,6 @@ uniform float minimum_alpha;  uniform sampler2D diffuseMap; -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif -  VARYING float pos_w;  VARYING float target_pos_x;  VARYING vec2 vary_texcoord0; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl index 40ac7b1f95..dfe7077db5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl @@ -34,9 +34,6 @@ ATTRIBUTE vec3 position;  ATTRIBUTE vec3 normal;  ATTRIBUTE vec2 texcoord0; -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif  VARYING float pos_w;  VARYING float target_pos_x;  VARYING vec2 vary_texcoord0; @@ -66,13 +63,7 @@ void main()  	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; -#if !defined(DEPTH_CLAMP) -	post_pos = pos; - -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else  	gl_Position = pos; -#endif  	passTextureIndex();  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 57c4bafd79..0c386ade6c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -25,18 +25,10 @@  /*[EXTRA_CODE_HERE]*/  -#ifdef DEFINE_GL_FRAGCOLOR  out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif  uniform sampler2D diffuseMap; -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif -  void main()   {  	frag_color = vec4(1,1,1,1); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 91b25613e0..ac8a483a6a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -31,10 +31,6 @@ ATTRIBUTE vec3 position;  ATTRIBUTE vec3 normal;  ATTRIBUTE vec2 texcoord0; -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif -  void main()  {  	vec4 pos; @@ -53,13 +49,7 @@ void main()  	norm = normalize(norm);  	pos = projection_matrix * pos; -#if !defined(DEPTH_CLAMP) -	post_pos = pos; - -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else  	gl_Position = pos; -#endif  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskSkinnedV.glsl index 2b17aea75a..61c9e60744 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskSkinnedV.glsl @@ -57,11 +57,7 @@ void main()  	post_pos = pos; -#if !defined(DEPTH_CLAMP) -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else  	gl_Position = pos; -#endif  	passTextureIndex(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index b6a0f0b165..40f8fc9894 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -47,11 +47,7 @@ void main()  	post_pos = pos; -#if !defined(DEPTH_CLAMP) -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else  	gl_Position = pos; -#endif  	passTextureIndex(); diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl index 0e74d2eb8a..9608e89169 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl @@ -27,10 +27,6 @@ uniform mat4 modelview_projection_matrix;  ATTRIBUTE vec3 position; -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif -  uniform vec3 box_center;  uniform vec3 box_size; @@ -40,11 +36,5 @@ void main()  	vec3 p = position*box_size+box_center;  	vec4 pos = modelview_projection_matrix*vec4(p.xyz, 1.0); -#if !defined(DEPTH_CLAMP) -	post_pos = pos; - -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else  	gl_Position = pos; -#endif  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl index bdf8e0854d..186ba49969 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl @@ -28,8 +28,6 @@ uniform mat4 projection_matrix;  ATTRIBUTE vec3 position; -VARYING vec4 post_pos; -  mat4 getObjectSkinnedTransform();  void main() @@ -41,12 +39,5 @@ void main()  	vec4 pos = (mat*vec4(position.xyz, 1.0));  	pos = projection_matrix*pos; -	post_pos = pos; - -#if !defined(DEPTH_CLAMP) -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else  	gl_Position = pos; -#endif -  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index e83cda89ef..bd62954ff8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl @@ -29,5 +29,6 @@ in vec3 position;  void main()  { +	//transform vertex  	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl index 802179a401..c850a39d6f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl @@ -25,18 +25,14 @@  /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR +  out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif  uniform float minimum_alpha;  uniform sampler2D diffuseMap; -VARYING vec4 post_pos; -VARYING vec2 vary_texcoord0; +in vec2 vary_texcoord0;  void main()   { @@ -48,5 +44,4 @@ void main()  	}  	frag_color = vec4(1,1,1,1); -	  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl index d9ca6d3a46..5a7cf369b5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl @@ -30,8 +30,7 @@ uniform mat4 projection_matrix;  ATTRIBUTE vec3 position;  ATTRIBUTE vec2 texcoord0; -VARYING vec4 post_pos; -VARYING vec2 vary_texcoord0; +out vec2 vary_texcoord0;  mat4 getObjectSkinnedTransform(); @@ -43,11 +42,7 @@ void main()  	mat = modelview_matrix * mat;  	vec4 pos = mat * vec4(position.xyz, 1.0); -    pos = projection_matrix * pos; -	 -	post_pos = pos; -	 -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); +    gl_Position = projection_matrix * pos;  	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl index e472a75304..3102c870fc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl @@ -26,20 +26,15 @@  uniform mat4 texture_matrix0;  uniform mat4 modelview_projection_matrix; -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; +in vec3 position; +in vec2 texcoord0; -VARYING vec4 post_pos; -VARYING vec2 vary_texcoord0; +out vec2 vary_texcoord0;  void main()  {  	//transform vertex -	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0); -	 -	post_pos = pos; -	 -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); +	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);  	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;  } | 
