From ab44a97ef03edca719418e665bc3c2ff0990281a Mon Sep 17 00:00:00 2001 From: keithw Date: Mon, 21 Jan 2002 15:59:52 +0000 Subject: Fray Bentos' occlusion test patch --- xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c index 132bea2ad..b783b1ea9 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_dd.c @@ -160,6 +160,7 @@ static GLboolean get_occlusion_result( GLcontext *ctx ) GLboolean result; LOCK_HARDWARE( fxMesa ); + fxMesa->Glide.grFinish(); /* required to flush the FIFO - FB 21-01-2002 */ if (ctx->Depth.OcclusionTest) { if (ctx->OcclusionResult) { @@ -168,13 +169,12 @@ static GLboolean get_occlusion_result( GLcontext *ctx ) else { FxI32 zfail, in; fxMesa->Glide.grGet(GR_STATS_PIXELS_DEPTHFUNC_FAIL, 4, &zfail); - /*zfail = FX_grGetInteger_NoLock(GR_STATS_PIXELS_DEPTHFUNC_FAIL);*/ fxMesa->Glide.grGet(GR_STATS_PIXELS_IN, 4, &in); - /*in = FX_grGetInteger_NoLock(GR_STATS_PIXELS_IN);*/ - if (in == zfail) - result = GL_FALSE; /* geom was completely occluded */ - else - result = GL_TRUE; /* all or part of geom was visible */ + /* Geometry is occluded if there is no input (in == 0) */ + /* or if all pixels failed the depth test (zfail == in) */ + /* The < 1 is there because I have empirically seen cases where */ + /* zfail > in.... go figure. FB - 21-01-2002. */ + result = ((in - zfail) < 1 || in == 0) ? GL_FALSE : GL_TRUE; } } else { -- cgit v1.2.3