From: Felix Kuehling Date: Sun, 24 Apr 2005 20:55:57 +0000 (+0000) Subject: Software fallback for glColorMask. Can be avoided on Savage4 when all X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cbc8d7596a9939dcbaa2a1a2aaa65d7fc9d70127;p=mesa.git Software fallback for glColorMask. Can be avoided on Savage4 when all channels are masked (disable draw update). Bumped driver date to reflect recent correctness fixes. The driver now passes all glean tests except exactRGBA on both Savage4 and Savage3D-based cards. --- diff --git a/src/mesa/drivers/dri/savage/savagedd.c b/src/mesa/drivers/dri/savage/savagedd.c index b1fb3955dee..6bc9d3df8fc 100644 --- a/src/mesa/drivers/dri/savage/savagedd.c +++ b/src/mesa/drivers/dri/savage/savagedd.c @@ -41,7 +41,7 @@ #include "utils.h" -#define DRIVER_DATE "20050305" +#define DRIVER_DATE "20050424" /*************************************** * Mesa's Driver Functions diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index c772a248448..1a6a7f45794 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -845,64 +845,45 @@ static void savageUpdateCull( GLcontext *ctx ) * Color masks */ -/* Mesa calls this from the wrong place - it is called a very large - * number of redundant times. - * - * Colormask can be simulated by multipass or multitexture techniques. +/* Savage4 can disable draw updates when all channels are + * masked. Savage3D has a bit called drawUpdateEn, but it doesn't seem + * to have any effect. If only some channels are masked we need a + * software fallback on all chips. */ static void savageDDColorMask_s4(GLcontext *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); - GLuint enable; + GLboolean passAny, passAll; - if (ctx->Visual.alphaBits) - { - enable = b | g | r | a; - } - else - { - enable = b | g | r; + if (ctx->Visual.alphaBits) { + passAny = b || g || r || a; + passAll = r && g && b && a; + } else { + passAny = b || g || r; + passAll = r && g && b; } - if (enable) - { - imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn = GL_TRUE; - } - else - { + if (passAny) { + if (!imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn) { + imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn = GL_TRUE; + imesa->dirty |= SAVAGE_UPLOAD_LOCAL; + } + FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !passAll); + } else if (imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn) { imesa->regs.s4.drawLocalCtrl.ni.drawUpdateEn = GL_FALSE; + imesa->dirty |= SAVAGE_UPLOAD_LOCAL; } - imesa->dirty |= SAVAGE_UPLOAD_LOCAL; - /* TODO: need a software fallback */ } static void savageDDColorMask_s3d(GLcontext *ctx, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) { - savageContextPtr imesa = SAVAGE_CONTEXT( ctx ); - GLuint enable; - if (ctx->Visual.alphaBits) - { - enable = b | g | r | a; - } + FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b && a)); else - { - enable = b | g | r; - } - - if (enable) - { - imesa->regs.s3d.zBufCtrl.ni.drawUpdateEn = GL_TRUE; - } - else - { - imesa->regs.s3d.zBufCtrl.ni.drawUpdateEn = GL_FALSE; - } - imesa->dirty |= SAVAGE_UPLOAD_LOCAL; - /* TODO: need a software fallback */ + FALLBACK (ctx, SAVAGE_FALLBACK_COLORMASK, !(r && g && b)); } /* Seperate specular not fully implemented in hardware... Needs