From d179e16501c408e1c57e436d5cf597c91f7ef040 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Jun 2006 15:41:55 +0000 Subject: Added _mesa_delete_list() to delete a display list, but don't remove from hash table. Make _mesa_destroy_list() static. --- src/mesa/main/dlist.c | 64 ++++++++++++++++++++++++++++++++------------------- src/mesa/main/dlist.h | 10 ++++---- 2 files changed, 44 insertions(+), 30 deletions(-) (limited to 'src') 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; diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index 9436603d0a..ef6a10af83 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -5,9 +5,9 @@ /* * Mesa 3-D graphics library - * Version: 5.1 + * Version: 6.5.1 * - * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2006 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"), @@ -38,7 +38,8 @@ #if _HAVE_FULL_GL -extern void _mesa_destroy_list( GLcontext *ctx, GLuint list ); +extern void +_mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist); extern void GLAPIENTRY _mesa_CallList( GLuint list ); @@ -81,9 +82,6 @@ extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); #else -/** No-op */ -#define _mesa_destroy_list(c,l) ((void)0) - /** No-op */ #define _mesa_init_dlist_table(t,ts) ((void)0) -- cgit v1.2.3