From: Brian Date: Sat, 31 Jan 2009 18:57:22 +0000 (-0700) Subject: mesa: display list clean-ups X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=446abc2799a143c32c4c48472f3f964f9288a623;p=mesa.git mesa: display list clean-ups Rename some structs and fields to be more consistant with the rest of mesa. --- diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7d616b2325e..608942979f4 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -581,7 +581,7 @@ static void delete_displaylist_cb(GLuint id, void *data, void *userData) { #if FEATURE_dlist - struct mesa_display_list *list = (struct mesa_display_list *) data; + struct gl_display_list *list = (struct gl_display_list *) data; GLcontext *ctx = (GLcontext *) userData; _mesa_delete_list(ctx, list); #endif diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 989791f39f1..411b6a7b21f 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -34,7 +34,7 @@ /* THIS FILE ONLY INCLUDED BY mtypes.h !!!!! */ struct gl_pixelstore_attrib; -struct mesa_display_list; +struct gl_display_list; /** * Device driver function table. @@ -999,7 +999,7 @@ struct dd_function_table { * Notify the T&L component before and after calling a display list. */ void (*BeginCallList)( GLcontext *ctx, - struct mesa_display_list *dlist ); + struct gl_display_list *dlist ); /** * Called by glEndCallList(). * diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index d3aee196c74..c03a41aea5f 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -370,7 +370,7 @@ typedef enum * contiguous nodes in memory. * Each node is the union of a variety of data types. */ -union node +union gl_dlist_node { OpCode opcode; GLboolean b; @@ -387,6 +387,9 @@ union node }; +typedef union gl_dlist_node Node; + + /** * How many nodes to allocate at a time. * @@ -414,13 +417,13 @@ void mesa_print_display_list(GLuint list); * Make an empty display list. This is used by glGenLists() to * reserve display list IDs. */ -static struct mesa_display_list * +static struct gl_display_list * make_list(GLuint list, GLuint count) { - struct mesa_display_list *dlist = CALLOC_STRUCT(mesa_display_list); - dlist->id = list; - dlist->node = (Node *) _mesa_malloc(sizeof(Node) * count); - dlist->node[0].opcode = OPCODE_END_OF_LIST; + struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list); + dlist->Name = list; + dlist->Head = (Node *) _mesa_malloc(sizeof(Node) * count); + dlist->Head[0].opcode = OPCODE_END_OF_LIST; return dlist; } @@ -428,10 +431,10 @@ make_list(GLuint list, GLuint count) /** * Lookup function to just encapsulate casting. */ -static INLINE struct mesa_display_list * +static INLINE struct gl_display_list * lookup_list(GLcontext *ctx, GLuint list) { - return (struct mesa_display_list *) + return (struct gl_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); } @@ -442,12 +445,12 @@ lookup_list(GLcontext *ctx, GLuint list) * \param dlist - display list pointer */ void -_mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist) +_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) { Node *n, *block; GLboolean done; - n = block = dlist->node; + n = block = dlist->Head; done = block ? GL_FALSE : GL_TRUE; while (!done) { @@ -596,7 +599,7 @@ _mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist) static void destroy_list(GLcontext *ctx, GLuint list) { - struct mesa_display_list *dlist; + struct gl_display_list *dlist; if (list == 0) return; @@ -5731,7 +5734,7 @@ islist(GLcontext *ctx, GLuint list) static void execute_list(GLcontext *ctx, GLuint list) { - struct mesa_display_list *dlist; + struct gl_display_list *dlist; Node *n; GLboolean done; @@ -5752,7 +5755,7 @@ execute_list(GLcontext *ctx, GLuint list) if (ctx->Driver.BeginCallList) ctx->Driver.BeginCallList(ctx, dlist); - n = dlist->node; + n = dlist->Head; done = GL_FALSE; while (!done) { @@ -6757,7 +6760,7 @@ _mesa_NewList(GLuint list, GLenum mode) /* Allocate new display list */ ctx->ListState.CurrentListNum = list; ctx->ListState.CurrentList = make_list(list, BLOCK_SIZE); - ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->node; + ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head; ctx->ListState.CurrentListPtr = ctx->ListState.CurrentBlock; ctx->ListState.CurrentPos = 0; @@ -6805,7 +6808,8 @@ _mesa_EndList(void) /* Destroy old list, if any */ destroy_list(ctx, ctx->ListState.CurrentListNum); - /* Install the list */ + + /* Install the new list */ _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentList); @@ -8209,7 +8213,7 @@ enum_string(GLenum k) static void GLAPIENTRY print_list(GLcontext *ctx, GLuint list) { - struct mesa_display_list *dlist; + struct gl_display_list *dlist; Node *n; GLboolean done; @@ -8222,7 +8226,7 @@ print_list(GLcontext *ctx, GLuint list) if (!dlist) return; - n = dlist->node; + n = dlist->Head; _mesa_printf("START-LIST %u, address %p\n", list, (void *) n); diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index ef6a10af832..ab7ec2c8db3 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -39,7 +39,7 @@ #if _HAVE_FULL_GL extern void -_mesa_delete_list(GLcontext *ctx, struct mesa_display_list *dlist); +_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); extern void GLAPIENTRY _mesa_CallList( GLuint list ); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c740e6d1627..f6e47245886 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2848,13 +2848,6 @@ struct gl_matrix_stack -/* - * Forward declaration of display list data types: - */ -union node; -typedef union node Node; - - /* This has to be included here. */ #include "dd.h" @@ -2886,11 +2879,17 @@ struct gl_tnl_module /** - * Strictly this is a tnl/ private concept, but it doesn't seem + * Display list flags. + * Strictly this is a tnl-private concept, but it doesn't seem * worthwhile adding a tnl private structure just to hold this one bit * of information: */ -#define MESA_DLIST_DANGLING_REFS 0x1 +#define DLIST_DANGLING_REFS 0x1 + +/* + * Forward declaration of display list data types: + */ +union gl_dlist_node; /** @@ -2898,11 +2897,12 @@ struct gl_tnl_module * collected. Could be extended with driverPrivate structures, * etc. in the future. */ -struct mesa_display_list +struct gl_display_list { - Node *node; /**< The dlist commands are in a linked list of nodes */ - GLuint id; - GLbitfield flags; /**< MESA_DLIST_x flags */ + GLuint Name; + GLbitfield Flags; /**< DLIST_x flags */ + /** The dlist commands are in a linked list of nodes */ + union gl_dlist_node *Head; }; @@ -2913,10 +2913,10 @@ struct gl_dlist_state { GLuint CallDepth; /**< Current recursion calling depth */ - struct mesa_display_list *CurrentList; - Node *CurrentListPtr; /**< Head of list being compiled */ + struct gl_display_list *CurrentList; GLuint CurrentListNum; /**< Number of the list being compiled */ - Node *CurrentBlock; /**< Pointer to current block of nodes */ + union gl_dlist_node *CurrentListPtr; /**< Head of list being compiled */ + union gl_dlist_node *CurrentBlock; /**< Pointer to current block of nodes */ GLuint CurrentPos; /**< Index into current block of nodes */ GLvertexformat ListVtxfmt; diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index b7e9baabf81..7dda54af48b 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -166,7 +166,7 @@ void vbo_loopback_vertex_list( GLcontext *ctx, void vbo_save_EndList( GLcontext *ctx ); void vbo_save_NewList( GLcontext *ctx, GLuint list, GLenum mode ); void vbo_save_EndCallList( GLcontext *ctx ); -void vbo_save_BeginCallList( GLcontext *ctx, struct mesa_display_list *list ); +void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *list ); void vbo_save_SaveFlushVertices( GLcontext *ctx ); GLboolean vbo_save_NotifyBegin( GLcontext *ctx, GLenum mode ); diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index f69a33d8176..ddfd2765774 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -293,7 +293,7 @@ static void _save_compile_vertex_list( GLcontext *ctx ) node->count == 0); if (save->dangling_attr_ref) - ctx->ListState.CurrentList->flags |= MESA_DLIST_DANGLING_REFS; + ctx->ListState.CurrentList->Flags |= DLIST_DANGLING_REFS; save->vertex_store->used += save->vertex_size * node->count; save->prim_store->used += node->prim_count; @@ -1076,10 +1076,10 @@ void vbo_save_EndList( GLcontext *ctx ) assert(save->vertex_size == 0); } -void vbo_save_BeginCallList( GLcontext *ctx, struct mesa_display_list *dlist ) +void vbo_save_BeginCallList( GLcontext *ctx, struct gl_display_list *dlist ) { struct vbo_save_context *save = &vbo_context(ctx)->save; - save->replay_flags |= dlist->flags; + save->replay_flags |= dlist->Flags; } void vbo_save_EndCallList( GLcontext *ctx )