From 58cfa0fd903979bd0c5127262683cdd8aa48e133 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 7 Aug 2001 23:10:55 +0000 Subject: fixed a glPush/PopAttrib bug related to texture binding (reported by Wes Bethel) --- src/mesa/main/attrib.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/mesa/main/attrib.c') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 49218c3785..fa8f9b0b20 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,4 +1,4 @@ -/* $Id: attrib.c,v 1.54 2001/08/07 21:46:52 brianp Exp $ */ +/* $Id: attrib.c,v 1.55 2001/08/07 23:10:55 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -49,6 +49,7 @@ #include "polygon.h" #include "simple_list.h" #include "stencil.h" +#include "texobj.h" #include "texstate.h" #include "mtypes.h" #endif @@ -79,8 +80,8 @@ static void copy_texobj_state( struct gl_texture_object *dest, const struct gl_texture_object *src ) { - /* dest->Name = src->Name; + /* dest->Dimensions = src->Dimensions; */ dest->Priority = src->Priority; @@ -592,16 +593,6 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) { GLuint u; - /* "un-bump" the texture object reference counts. We did that so they - * wouldn't inadvertantly get deleted. - */ - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { - ctx->Texture.Unit[u].Current1D->RefCount--; - ctx->Texture.Unit[u].Current2D->RefCount--; - ctx->Texture.Unit[u].Current3D->RefCount--; - ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; - } - for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { const struct gl_texture_unit *unit = &texAttrib->Unit[u]; GLuint numObjs, i; @@ -697,6 +688,8 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) ; /* silence warnings */ } + _mesa_BindTexture(target, obj->Name); + bordColor[0] = CHAN_TO_FLOAT(obj->BorderColor[0]); bordColor[1] = CHAN_TO_FLOAT(obj->BorderColor[1]); bordColor[2] = CHAN_TO_FLOAT(obj->BorderColor[2]); @@ -732,6 +725,17 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) } _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + texAttrib->CurrentUnit); + + /* "un-bump" the texture object reference counts. We did that so they + * wouldn't inadvertantly get deleted while they were still referenced + * inside the attribute state stack. + */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + ctx->Texture.Unit[u].Current1D->RefCount--; + ctx->Texture.Unit[u].Current2D->RefCount--; + ctx->Texture.Unit[u].Current3D->RefCount--; + ctx->Texture.Unit[u].CurrentCubeMap->RefCount--; + } } -- cgit v1.2.3