]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
magical instruction sequence that works on both GL_ARB_texture_gather and GL_AMD_text...
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 Feb 2010 18:47:26 +0000 (18:47 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 25 Feb 2010 18:47:26 +0000 (18:47 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10007 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 788d53ee1c81b13eaddeba5967e578517ec27049..376db83fc5fe48b589d8af8288a7b9d8bbc9d585 100644 (file)
@@ -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"