From 85957cb512e74c8ddeb5ba2e06df091943ab8400 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 11 Jul 2009 03:01:52 +1000 Subject: [PATCH] radeon: set texture in state properly. make sure to turn off when no texture is used in hw --- src/mesa/drivers/dri/radeon/radeon_state.c | 2 +- src/mesa/drivers/dri/radeon/radeon_texstate.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 528348a300b..89d08f08183 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -2073,7 +2073,7 @@ static GLboolean r100ValidateBuffers(GLcontext *ctx) if (!ctx->Texture.Unit[i]._ReallyEnabled) continue; - t = radeon_tex_obj(ctx->Texture.Unit[i]._Current); + t = rmesa->state.texture.unit[i].texobj; if (t->image_override && t->bo) radeon_cs_space_add_persistent_bo(rmesa->radeon.cmdbuf.cs, t->bo, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0); diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index d33eb9988f1..c29105d7b85 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -1143,12 +1143,14 @@ static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) r100ContextPtr rmesa = R100_CONTEXT(ctx); if (ctx->Texture.Unit[unit]._ReallyEnabled & TEXTURE_3D_BIT) { + rmesa->state.texture.unit[unit].texobj = NULL; return GL_FALSE; } if (!ctx->Texture.Unit[unit]._ReallyEnabled) { /* disable the unit */ disable_tex_obj_state(rmesa, unit); + rmesa->state.texture.unit[unit].texobj = NULL; return GL_TRUE; } @@ -1156,8 +1158,8 @@ static GLboolean radeonUpdateTextureUnit( GLcontext *ctx, int unit ) _mesa_warning(ctx, "failed to validate texture for unit %d.\n", unit); - rmesa->state.texture.unit[unit].texobj = NULL; - return GL_FALSE; + rmesa->state.texture.unit[unit].texobj = NULL; + return GL_FALSE; } rmesa->state.texture.unit[unit].texobj = radeon_tex_obj(ctx->Texture.Unit[unit]._Current); return GL_TRUE; -- 2.30.2