From: eihrul Date: Thu, 25 Feb 2010 18:47:26 +0000 (+0000) Subject: magical instruction sequence that works on both GL_ARB_texture_gather and GL_AMD_text... X-Git-Tag: xonotic-v0.1.0preview~230^2~462 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=23dca6dfc6b7d92aa2f12dc50fa6e18c85b3895a;p=xonotic%2Fdarkplaces.git magical instruction sequence that works on both GL_ARB_texture_gather and GL_AMD_texture_texture4 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10007 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 788d53ee..376db83f 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1162,12 +1162,11 @@ static const char *builtinshaderstring = "# else\n" "# define texval(x, y) texture4(Texture_ShadowMap2D, center + vec2(x, y)*ShadowMap_TextureScale)\n" "# endif\n" -" vec2 center = shadowmaptc.xy - 1.5, offset = fract(center);\n" -" center = (center - offset)*ShadowMap_TextureScale;\n" -" vec4 group1 = step(shadowmaptc.z, texval(0.0, 0.0));\n" -" vec4 group2 = step(shadowmaptc.z, texval(2.0, 0.0));\n" -" vec4 group3 = step(shadowmaptc.z, texval(0.0, 2.0));\n" -" vec4 group4 = step(shadowmaptc.z, texval(2.0, 2.0));\n" +" vec2 offset = fract(shadowmaptc.xy - 0.5), center = (shadowmaptc.xy - offset)*ShadowMap_TextureScale;\n" +" vec4 group1 = step(shadowmaptc.z, texval(-1.0, -1.0));\n" +" vec4 group2 = step(shadowmaptc.z, texval( 1.0, -1.0));\n" +" vec4 group3 = step(shadowmaptc.z, texval(-1.0, 1.0));\n" +" vec4 group4 = step(shadowmaptc.z, texval( 1.0, 1.0));\n" " vec4 cols = vec4(group1.rg, group2.rg) + vec4(group3.ab, group4.ab) +\n" " mix(vec4(group1.ab, group2.ab), vec4(group3.rg, group4.rg), offset.y);\n" " f = dot(mix(cols.xyz, cols.yzw, offset.x), vec3(1.0/9.0));\n" @@ -2301,12 +2300,11 @@ const char *builtincgshaderstring = "# else\n" "# define texval(x, y) texture4(Texture_ShadowMap2D, center + float2(x, y)*ShadowMap_TextureScale)\n" "# endif\n" -" float2 center = shadowmaptc.xy - 1.5, offset = fract(center);\n" -" center = (center - offset)*ShadowMap_TextureScale;\n" -" float4 group1 = step(shadowmaptc.z, texval(0.0, 0.0));\n" -" float4 group2 = step(shadowmaptc.z, texval(2.0, 0.0));\n" -" float4 group3 = step(shadowmaptc.z, texval(0.0, 2.0));\n" -" float4 group4 = step(shadowmaptc.z, texval(2.0, 2.0));\n" +" float2 offset = fract(shadowmaptc.xy - 0.5), center = (shadowmaptc.xy - offset)*ShadowMap_TextureScale;\n" +" float4 group1 = step(shadowmaptc.z, texval(-1.0, -1.0));\n" +" float4 group2 = step(shadowmaptc.z, texval( 1.0, -1.0));\n" +" float4 group3 = step(shadowmaptc.z, texval(-1.0, 1.0));\n" +" float4 group4 = step(shadowmaptc.z, texval( 1.0, 1.0));\n" " float4 cols = float4(group1.rg, group2.rg) + float4(group3.ab, group4.ab) +\n" " lerp(float4(group1.ab, group2.ab), float4(group3.rg, group4.rg), offset.y);\n" " f = dot(lerp(cols.xyz, cols.yzw, offset.x), float3(1.0/9.0));\n"