From: Keith Whitwell Date: Tue, 11 Jan 2005 15:40:06 +0000 (+0000) Subject: Add a big nasty fallback for AlphaTest -- seems to always be wrong X-Git-Tag: 062012170305~23410 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b13eaf269895df3b688e2c014c9fdfb93de48462;p=profile%2Fivi%2Fmesa.git Add a big nasty fallback for AlphaTest -- seems to always be wrong on CLE266 because Z values are written even for fragments which fail the test. --- diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index ee7f7a0..e070b27 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -504,7 +504,8 @@ viaCreateContext(const __GLcontextModes *mesaVis, if (getenv("VIA_NO_RAST")) FALLBACK(vmesa, VIA_FALLBACK_USER_DISABLE, 1); - + if (getenv("VIA_CONFORM")) + vmesa->strictConformance = 1; /* I don't understand why this isn't working: */ diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h index 4562c9e..ae3b415 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.h +++ b/src/mesa/drivers/dri/unichrome/via_context.h @@ -66,6 +66,7 @@ enum VIACHIPTAGS { #define VIA_FALLBACK_USER_DISABLE 0x800 #define VIA_FALLBACK_PROJ_TEXTURE 0x1000 #define VIA_FALLBACK_STIPPLE 0x2000 +#define VIA_FALLBACK_ALPHATEST 0x4000 #define VIA_DMA_BUFSIZ 4096 #define VIA_DMA_HIGHWATER (VIA_DMA_BUFSIZ - 128) @@ -284,6 +285,8 @@ struct via_context_t { GLuint nDoneFirstFlip; GLuint agpFullCount; + GLboolean strictConformance; + /* Configuration cache */ driOptionCache optionCache; diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 1ea7b2f..30ca7f6 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -531,8 +531,11 @@ static void via_emit_cliprect(viaContextPtr vmesa, vb[4] = ((HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF)); vb[5] = ((HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000)) >> 24); - vb[6] = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); - vb[7] = 0xcccccccc; + vb[6] = ((HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch); + + /* Seems to be ignored on CLE266: + */ + vb[7] = ((HC_SubA_HSPXYOS << 24) | ((32 - vmesa->drawXoff) << HC_HSPXOS_SHIFT)); } diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index f0c8e88..6b16a17 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -784,7 +784,11 @@ static void viaPolygonStipple( GLcontext *ctx, const GLubyte *mask ) GLubyte *s = (GLubyte *)vmesa->stipple; int i; - /* Fallback for the CLE266 case as it doesn't seem to work */ + /* Fallback for the CLE266 case. Stipple works on the CLE266, but + * the stipple x/y offset registers don't seem to be respected, + * meaning that when drawXoff != 0, the stipple is rotated left or + * right by a few pixels, giving incorrect results. + */ if (vmesa->viaScreen->deviceID == VIA_CLE266) { FALLBACK( vmesa, VIA_FALLBACK_STIPPLE, ctx->Polygon.StippleFlag); } else { @@ -1599,6 +1603,17 @@ void viaValidateState( GLcontext *ctx ) else vmesa->regEnable &= ~HC_HenCS_MASK; + /* CLE266 gets this wrong at least: Pixels which fail alpha test + * are incorrectly writen to the z buffer. This is a pretty big + * slowdown, it would be good to find out this wasn't necessary: + */ + if (vmesa->viaScreen->deviceID == VIA_CLE266) { + GLboolean fallback = (ctx->Color.AlphaEnabled && + ctx->Color.AlphaFunc != GL_ALWAYS && + ctx->Depth.Mask); + FALLBACK( vmesa, VIA_FALLBACK_ALPHATEST, fallback ); + } + vmesa->newEmitState |= vmesa->newState; vmesa->newState = 0; }