summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorFelix Kuehling <[email protected]>2005-03-10 22:45:00 +0000
committerFelix Kuehling <[email protected]>2005-03-10 22:45:00 +0000
commit96035d54f3c223e6d2f6dea79fb68dbfb2b74f0a (patch)
tree9cd59f3e776715c83ba2155ed67210dd83e31860 /src/mesa/drivers/dri
parent746df5671789aa5338c82a8e1b7fb50d342198e0 (diff)
- Flush before updating the timestamp of a texture heap from a bound texture.
- Flush before using a new texture or before disabling a texture unit, because savageFlushCmdBuf can only update the timestamp of the last used texture. This fixes corruption in quake2 with single-textured lighting.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/savage/savagetex.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c
index 1b5b7901b58..568b5c4e7a5 100644
--- a/src/mesa/drivers/dri/savage/savagetex.c
+++ b/src/mesa/drivers/dri/savage/savagetex.c
@@ -1407,6 +1407,15 @@ static void savageUpdateTexState_s3d( GLcontext *ctx )
static void savageUpdateTextureState_s4( GLcontext *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
+
+ if ((imesa->CurrentTexObj[0] && ctx->Texture.Unit[0]._ReallyEnabled &&
+ ctx->Texture.Unit[0]._Current->DriverData != imesa->CurrentTexObj[0]) ||
+ (imesa->CurrentTexObj[1] && ctx->Texture.Unit[1]._ReallyEnabled &&
+ ctx->Texture.Unit[1]._Current->DriverData != imesa->CurrentTexObj[1]) ||
+ (imesa->CurrentTexObj[0] && !ctx->Texture.Unit[0]._ReallyEnabled) ||
+ (imesa->CurrentTexObj[1] && !ctx->Texture.Unit[1]._ReallyEnabled))
+ FLUSH_BATCH(imesa);
+
if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->bound &= ~1;
if (imesa->CurrentTexObj[1]) imesa->CurrentTexObj[1]->bound &= ~2;
imesa->CurrentTexObj[0] = 0;
@@ -1419,6 +1428,12 @@ static void savageUpdateTextureState_s4( GLcontext *ctx )
static void savageUpdateTextureState_s3d( GLcontext *ctx )
{
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
+
+ if ((imesa->CurrentTexObj[0] && ctx->Texture.Unit[0]._ReallyEnabled &&
+ ctx->Texture.Unit[0]._Current->DriverData != imesa->CurrentTexObj[0]) ||
+ (imesa->CurrentTexObj[0] && !ctx->Texture.Unit[0]._ReallyEnabled))
+ FLUSH_BATCH(imesa);
+
if (imesa->CurrentTexObj[0]) imesa->CurrentTexObj[0]->bound &= ~1;
imesa->CurrentTexObj[0] = 0;
savageUpdateTexState_s3d( ctx );
@@ -1472,13 +1487,16 @@ static void savageTexEnv( GLcontext *ctx, GLenum target,
/* Update a heap's timestamp when a texture image is modified, so the
* new image is not uploaded while the old one is still in use.
- * FIXME: this should be moved to ../common/texmem.c
*/
static void savageTexImageChanged (savageTexObjPtr t) {
/* Update the heap's time stamp, so the new image is not uploaded
* while the old one is still in use. */
- if (t->base.heap && t->base.timestamp > t->base.heap->timestamp)
- t->base.heap->timestamp = t->base.timestamp;
+ if (t->base.heap) {
+ if (t->base.bound)
+ FLUSH_BATCH((savageContextPtr)t->base.heap->driverContext);
+ if (t->base.timestamp > t->base.heap->timestamp)
+ t->base.heap->timestamp = t->base.timestamp;
+ }
}
static void savageTexImage1D( GLcontext *ctx, GLenum target, GLint level,