]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
use texture gather emulation for the shadowmap sampler path, and use it by default...
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 19 May 2012 04:17:00 +0000 (04:17 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 18 Sep 2012 12:08:11 +0000 (14:08 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11820 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=e2ab893f00f6244a9459fa6ad08281146069070a

r_shadow.c
shader_glsl.h

index 9f7b0b7418bb3aba1c7ef4c16c629156304279f0..f8c6557dbb45f4f0abbb57ae581fcdc7b3fe95e8 100644 (file)
@@ -462,13 +462,13 @@ static void R_Shadow_SetShadowMode(void)
                        {
                                if (!r_fb.usedepthtextures)
                                        r_shadow_shadowmappcf = 1;
-                               else if(vid.support.amd_texture_texture4 || vid.support.arb_texture_gather)
-                                       r_shadow_shadowmappcf = 1;
-                               else if(strstr(gl_vendor, "NVIDIA") || strstr(gl_renderer, "Radeon HD")) 
+                               else if((strstr(gl_vendor, "NVIDIA") || strstr(gl_renderer, "Radeon HD")) && vid.support.arb_shadow && r_shadow_shadowmapshadowsampler) 
                                {
-                                       r_shadow_shadowmapsampler = vid.support.arb_shadow && r_shadow_shadowmapshadowsampler;
+                                       r_shadow_shadowmapsampler = true;
                                        r_shadow_shadowmappcf = 1;
                                }
+                else if(vid.support.amd_texture_texture4 || vid.support.arb_texture_gather)
+                    r_shadow_shadowmappcf = 1;
                                else if((strstr(gl_vendor, "ATI") || strstr(gl_vendor, "Advanced Micro Devices")) && !strstr(gl_renderer, "Mesa") && !strstr(gl_version, "Mesa")) 
                                        r_shadow_shadowmappcf = 1;
                                else 
index d3b258de8e033c699094524f680d8d8692ac523c..dbc19d5747620ff649f7bc23bf1016c6e26cbaea 100644 (file)
 "#  else\n"
 "#   ifdef USESHADOWSAMPLER\n"
 "#     ifdef USESHADOWMAPPCF\n"
-"#       define texval(x, y) dp_shadow2D(Texture_ShadowMap2D, vec3(center + vec2(x, y)*ShadowMap_TextureScale, shadowmaptc.z))  \n"
-"      vec2 center = shadowmaptc.xy*ShadowMap_TextureScale;\n"
-"      f = dot(vec4(0.25), vec4(texval(-0.4, 1.0), texval(-1.0, -0.4), texval(0.4, -1.0), texval(1.0, 0.4)));\n"
+"#       define texval(off) dp_shadow2D(Texture_ShadowMap2D, vec3((center + off)*ShadowMap_TextureScale, shadowmaptc.z))  \n"
+"      vec2 offset = fract(shadowmaptc.xy - 0.5), center = shadowmaptc.xy - offset;\n"
+"      vec4 size = vec4(offset + 1.0, 2.0 - offset), weight = vec4(2.0 - 1.0 / size.xy, 1.0 / size.zw - 1.0);\n"
+"      f = (1.0/9.0)*dot(size.zxzx*size.wwyy, vec4(texval(weight.zw), texval(weight.xw), texval(weight.zy), texval(weight.xy)));\n"
+"//#       define texval(x, y) dp_shadow2D(Texture_ShadowMap2D, vec3(center + vec2(x, y)*ShadowMap_TextureScale, shadowmaptc.z))  \n"
+"//    vec2 center = shadowmaptc.xy*ShadowMap_TextureScale;\n"
+"//    f = dot(vec4(0.25), vec4(texval(-0.4, 1.0), texval(-1.0, -0.4), texval(0.4, -1.0), texval(1.0, 0.4)));\n"
 "#     else\n"
 "      f = dp_shadow2D(Texture_ShadowMap2D, vec3(shadowmaptc.xy*ShadowMap_TextureScale, shadowmaptc.z));\n"
 "#     endif\n"