]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
work around ATI bug in corona occlusion testing (use glDepthFunc, not glEnable)
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Mar 2009 15:26:43 +0000 (15:26 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 2 Mar 2009 15:26:43 +0000 (15:26 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8770 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
r_shadow.c

index eada61fd7f141851647a12324f63cd15256f2e0b..3a3416bf91f452bbd07ee5f4922426acfd15ac55 100644 (file)
@@ -4358,6 +4358,7 @@ float spritetexcoord2f[4*2] = {0, 1, 0, 0, 1, 0, 1, 1};
 
 void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_t *fogtexture, qboolean depthdisable, qboolean depthshort, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca)
 {
+       // NOTE: this must not call qglDepthFunc (see r_shadow.c, R_BeginCoronaQuery) thanks to ATI
        float fog = 1.0f;
        float vertex3f[12];
 
index b8e2e51f7b5ce120dac8e0d3036d3daa32dcb717..5b98bd1ef7f05f987a48c96d7af64893c49bd9e8 100644 (file)
@@ -3520,9 +3520,12 @@ void R_BeginCoronaQuery(rtlight_t *rtlight, float scale, qboolean usequery)
                rtlight->corona_queryindex_allpixels = r_queries[r_numqueries++];
                rtlight->corona_queryindex_visiblepixels = r_queries[r_numqueries++];
                CHECKGLERROR
+               // NOTE: we can't disable depth testing using R_DrawSprite's depthdisable argument, which calls GL_DepthTest, as that's broken in the ATI drivers
                qglBeginQueryARB(GL_SAMPLES_PASSED_ARB, rtlight->corona_queryindex_allpixels);
-               R_DrawSprite(GL_ONE, GL_ZERO, r_shadow_lightcorona, NULL, true, false, rtlight->shadoworigin, r_refdef.view.right, r_refdef.view.up, scale, -scale, -scale, scale, 1, 1, 1, 1);
+               qglDepthFunc(GL_ALWAYS);
+               R_DrawSprite(GL_ONE, GL_ZERO, r_shadow_lightcorona, NULL, false, false, rtlight->shadoworigin, r_refdef.view.right, r_refdef.view.up, scale, -scale, -scale, scale, 1, 1, 1, 1);
                qglEndQueryARB(GL_SAMPLES_PASSED_ARB);
+               qglDepthFunc(GL_LEQUAL);
                qglBeginQueryARB(GL_SAMPLES_PASSED_ARB, rtlight->corona_queryindex_visiblepixels);
                R_DrawSprite(GL_ONE, GL_ZERO, r_shadow_lightcorona, NULL, false, false, rtlight->shadoworigin, r_refdef.view.right, r_refdef.view.up, scale, -scale, -scale, scale, 1, 1, 1, 1);
                qglEndQueryARB(GL_SAMPLES_PASSED_ARB);