summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/savage/savagestate.c
diff options
context:
space:
mode:
authorFelix Kuehling <fxkuehl@gmx.de>2005-04-23 17:18:57 +0000
committerFelix Kuehling <fxkuehl@gmx.de>2005-04-23 17:18:57 +0000
commit9b4536a654774e3df330e9f238475aa20e30f7a3 (patch)
tree0914b87511904e1553c9737fbda0c03f8e56f2b2 /src/mesa/drivers/dri/savage/savagestate.c
parentdf943a40411d2b71381e5053d7c59e8cd2400fff (diff)
Texturing fixes for Savage3D/MX/IX:
- force emitting texAddr when the texture image changed (flush caches) - set transparent texture color key to something improbable (couldn't find a way to disable it completely) - fixed texture environment modes GL_DECAL and GL_REPLACE - made texture environment mode GL_BLEND a software fallback - added two custom texture formats for promoting from GL_ALPHA to ARGB8888 and 4444. Since the hardware can't be made to ignore the RGB color components, set them to 1 instead of 0. This gives the correct results - disabled GL_EXT_texture_env_add on Savage3D/MX/IX - map both GL_CLAMP and GL_CLAMP_TO_EDGE to hardware mode "wrap". It doesn't match either mode exactly by the spec, so we should either fall back on both or none. I chose the latter. - fall back to software when s and t wrapping modes differ (hardware has only one bit for both)
Diffstat (limited to 'src/mesa/drivers/dri/savage/savagestate.c')
-rw-r--r--src/mesa/drivers/dri/savage/savagestate.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c
index c3df5f4f87..c772a24844 100644
--- a/src/mesa/drivers/dri/savage/savagestate.c
+++ b/src/mesa/drivers/dri/savage/savagestate.c
@@ -1461,6 +1461,13 @@ static void savageUpdateRegister_s4(savageContextPtr imesa)
}
static void savageUpdateRegister_s3d(savageContextPtr imesa)
{
+ /* In case the texture image was changed without changing the
+ * texture address as well, we need to force emitting the texture
+ * address in order to flush texture cashes. */
+ if ((imesa->dirty & SAVAGE_UPLOAD_TEX0) &&
+ imesa->oldRegs.s3d.texAddr.ui == imesa->regs.s3d.texAddr.ui)
+ imesa->oldRegs.s3d.texAddr.ui = 0xffffffff;
+
/* Some temporary hacks to workaround lockups. Not sure if they are
* still needed. But they work for now. */
imesa->regs.s3d.drawCtrl.ni.flushPdDestWrites = GL_TRUE;
@@ -1626,12 +1633,15 @@ static void savageDDInitState_s3d( savageContextPtr imesa )
imesa->regs.s3d.destTexWatermarks.ui = 0x4f000000;
#endif
- /* clrCmpAlphaBlendCtrl is needed to get alphatest and
- * alpha blending working properly
- */
-
imesa->regs.s3d.texCtrl.ni.dBias = 0x08;
imesa->regs.s3d.texCtrl.ni.texXprEn = GL_TRUE;
+ /* texXprEn is needed to get alphatest and alpha blending working
+ * properly. However, this makes texels with color texXprClr
+ * completely transparent in some texture environment modes. I
+ * couldn't find a way to disable this. So choose an arbitrary and
+ * improbable color. (0 is a bad choice, makes all black texels
+ * transparent.) */
+ imesa->regs.s3d.texXprClr.ui = 0x26ae26ae;
/* programm a valid tex address, in case texture state is emitted
* in wrong order. */
if (imesa->lastTexHeap == 2 && imesa->savageScreen->textureSize[1]) {