summaryrefslogtreecommitdiff
path: root/src/mesa/main/dlist.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-06-30 15:41:55 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-06-30 15:41:55 +0000
commitd179e16501c408e1c57e436d5cf597c91f7ef040 (patch)
tree33f5b26e268423267d4727ce9f6585a5b81192ee /src/mesa/main/dlist.c
parent9f6798d6e1a59b8a0ca258d49d6afae128735f41 (diff)
Added _mesa_delete_list() to delete a display list, but don't remove from
hash table. Make _mesa_destroy_list() static.
Diffstat (limited to 'src/mesa/main/dlist.c')
-rw-r--r--src/mesa/main/dlist.c64
1 files changed, 40 insertions, 24 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 883fa73016..46e33a11d9 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5
+ * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
@@ -428,27 +428,28 @@ make_list(GLuint list, GLuint count)
}
+/**
+ * Lookup function to just encapsulate casting.
+ */
+static INLINE struct mesa_display_list *
+lookup_list(GLcontext *ctx, GLuint list)
+{
+ return (struct mesa_display_list *)
+ _mesa_HashLookup(ctx->Shared->DisplayList, list);
+}
+
+
/**
- * Destroy all nodes in a display list.
- * \param list - display list number
+ * Delete the named display list, but don't remove from hash table.
+ * \param dlist - display list pointer
*/
void
-_mesa_destroy_list(GLcontext *ctx, GLuint list)
+_mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist)
{
- struct mesa_display_list *dlist;
Node *n, *block;
GLboolean done;
- if (list == 0)
- return;
-
- dlist =
- (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList,
- list);
- if (!dlist)
- return;
-
n = block = dlist->node;
done = block ? GL_FALSE : GL_TRUE;
@@ -588,10 +589,29 @@ _mesa_destroy_list(GLcontext *ctx, GLuint list)
}
_mesa_free(dlist);
- _mesa_HashRemove(ctx->Shared->DisplayList, list);
}
+/**
+ * Destroy a display list and remove from hash table.
+ * \param list - display list number
+ */
+static void
+destroy_list(GLcontext *ctx, GLuint list)
+{
+ struct mesa_display_list *dlist;
+
+ if (list == 0)
+ return;
+
+ dlist = lookup_list(ctx, list);
+ if (!dlist)
+ return;
+
+ _mesa_delete_list(ctx, dlist);
+ _mesa_HashRemove(ctx->Shared->DisplayList, list);
+}
+
/*
* Translate the nth element of list from type to GLuint.
@@ -5642,7 +5662,7 @@ _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s)
static GLboolean
islist(GLcontext *ctx, GLuint list)
{
- if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) {
+ if (list > 0 && lookup_list(ctx, list)) {
return GL_TRUE;
}
else {
@@ -5678,10 +5698,7 @@ execute_list(GLcontext *ctx, GLuint list)
return;
}
-
- dlist =
- (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList,
- list);
+ dlist = lookup_list(ctx, list);
if (!dlist)
return;
@@ -6616,7 +6633,7 @@ _mesa_DeleteLists(GLuint list, GLsizei range)
return;
}
for (i = list; i < list + range; i++) {
- _mesa_destroy_list(ctx, i);
+ destroy_list(ctx, i);
}
}
@@ -6745,7 +6762,7 @@ _mesa_EndList(void)
(void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0);
/* Destroy old list, if any */
- _mesa_destroy_list(ctx, ctx->ListState.CurrentListNum);
+ destroy_list(ctx, ctx->ListState.CurrentListNum);
/* Install the list */
_mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum,
ctx->ListState.CurrentList);
@@ -8164,8 +8181,7 @@ print_list(GLcontext *ctx, GLuint list)
return;
}
- dlist = (struct mesa_display_list *)
- _mesa_HashLookup(ctx->Shared->DisplayList, list);
+ dlist = lookup_list(ctx, list);
if (!dlist)
return;