summaryrefslogtreecommitdiff
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-01-19 14:50:52 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-01-19 14:50:52 +0000
commit42fee73aadd7f37a4f18e57c167e98b7a6294508 (patch)
treee1c471eaa6a42f024cf9bbe193678e6b7e47113e /src/mesa/main/texobj.c
parent140f99f81cf801ac4ea69fa4da3e9648da3b1046 (diff)
Change behaviour of glDeleteTextures as discussed on ARB list.
glDeleteTexture makes the texture ID immediately free for re-use while the actual texture object lingers until its reference count goes to zero (when no longer bound by any rendering context).
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r--src/mesa/main/texobj.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 4bbd348658..97cd358c19 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 6.2
+ * Version: 6.3
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -701,17 +701,14 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
}
ctx->NewState |= _NEW_TEXTURE;
- /* If user hasn't already tried to delete the texture... */
- if (!delObj->DeletePending) {
- delObj->DeletePending = GL_TRUE;
- delObj->RefCount--;
- ASSERT(delObj->RefCount >= 0);
- }
-
- /* See if we can really delete the texture now */
+ /* The texture _name_ is now free for re-use. */
+ _mesa_remove_texture_object(ctx, delObj);
+ /* The actual texture object will not be freed until it's no
+ * longer bound in any context.
+ */
+ delObj->RefCount--;
if (delObj->RefCount == 0) {
- ASSERT(delObj->Name != 0); /* Never delete default tex objects */
- _mesa_remove_texture_object(ctx, delObj);
+ ASSERT(delObj->Name != 0); /* Never delete default tex objs */
ASSERT(ctx->Driver.DeleteTexture);
(*ctx->Driver.DeleteTexture)(ctx, delObj);
}
@@ -892,8 +889,6 @@ _mesa_BindTexture( GLenum target, GLuint texName )
ASSERT(oldTexObj->RefCount >= 0);
if (oldTexObj->RefCount == 0) {
ASSERT(oldTexObj->Name != 0);
- ASSERT(oldTexObj->DeletePending);
- _mesa_remove_texture_object(ctx, oldTexObj);
ASSERT(ctx->Driver.DeleteTexture);
(*ctx->Driver.DeleteTexture)( ctx, oldTexObj );
}