diff options
author | Brian Paul <[email protected]> | 2006-06-30 15:41:55 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-06-30 15:41:55 +0000 |
commit | d179e16501c408e1c57e436d5cf597c91f7ef040 (patch) | |
tree | 33f5b26e268423267d4727ce9f6585a5b81192ee /src | |
parent | 9f6798d6e1a59b8a0ca258d49d6afae128735f41 (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')
-rw-r--r-- | src/mesa/main/dlist.c | 64 | ||||
-rw-r--r-- | src/mesa/main/dlist.h | 10 |
2 files changed, 44 insertions, 30 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 883fa730163..46e33a11d9d 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 9436603d0a5..ef6a10af832 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 ); @@ -82,9 +83,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) /** No-op */ |