aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/attrib.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-06 08:19:53 +0100
committermarha <marha@users.sourceforge.net>2012-02-06 08:19:53 +0100
commitada3d2c30b5a7a1a79e128b7326d50c3bab77a8a (patch)
tree30539a1a7c6b011c3a5d8028d7428a1ad2b07546 /mesalib/src/mesa/main/attrib.c
parent58ff764d4111bfaa7360c57bc62dd620fbdce06f (diff)
downloadvcxsrv-ada3d2c30b5a7a1a79e128b7326d50c3bab77a8a.tar.gz
vcxsrv-ada3d2c30b5a7a1a79e128b7326d50c3bab77a8a.tar.bz2
vcxsrv-ada3d2c30b5a7a1a79e128b7326d50c3bab77a8a.zip
mesa git update 6 feb 2012
Diffstat (limited to 'mesalib/src/mesa/main/attrib.c')
-rw-r--r--mesalib/src/mesa/main/attrib.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c
index 01e79455c..846da35e9 100644
--- a/mesalib/src/mesa/main/attrib.c
+++ b/mesalib/src/mesa/main/attrib.c
@@ -47,6 +47,7 @@
#include "multisample.h"
#include "points.h"
#include "polygon.h"
+#include "shared.h"
#include "scissor.h"
#include "stencil.h"
#include "texenv.h"
@@ -165,6 +166,13 @@ struct texture_state
* deleted while saved in the attribute stack).
*/
struct gl_texture_object *SavedTexRef[MAX_TEXTURE_UNITS][NUM_TEXTURE_TARGETS];
+
+ /* We need to keep a reference to the shared state. That's where the
+ * default texture objects are kept. We don't want that state to be
+ * freed while the attribute stack contains pointers to any default
+ * texture objects.
+ */
+ struct gl_shared_state *SharedRef;
};
@@ -437,6 +445,8 @@ _mesa_PushAttrib(GLbitfield mask)
}
}
+ _mesa_reference_shared_state(ctx, &texstate->SharedRef, ctx->Shared);
+
_mesa_unlock_context_textures(ctx);
save_attrib_data(&head, GL_TEXTURE_BIT, texstate);
@@ -806,6 +816,8 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
_mesa_ActiveTextureARB(GL_TEXTURE0_ARB + texstate->Texture.CurrentUnit);
+ _mesa_reference_shared_state(ctx, &texstate->SharedRef, NULL);
+
_mesa_unlock_context_textures(ctx);
}
@@ -1244,7 +1256,6 @@ _mesa_PopAttrib(void)
}
break;
case GL_TEXTURE_BIT:
- /* Take care of texture object reference counters */
{
struct texture_state *texstate
= (struct texture_state *) attr->data;
@@ -1605,6 +1616,7 @@ _mesa_free_attrib_data(struct gl_context *ctx)
_mesa_reference_texobj(&texstate->SavedTexRef[u][tgt], NULL);
}
}
+ _mesa_reference_shared_state(ctx, &texstate->SharedRef, NULL);
}
else {
/* any other chunks of state that requires special handling? */