diff options
Diffstat (limited to 'src/mesa/main/dlist.c')
-rw-r--r-- | src/mesa/main/dlist.c | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index d3aee196c74..76b33150346 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -85,7 +85,6 @@ #endif #include "math/m_matrix.h" -#include "math/m_xform.h" #include "glapi/dispatch.h" @@ -370,7 +369,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 +386,9 @@ union node }; +typedef union gl_dlist_node Node; + + /** * How many nodes to allocate at a time. * @@ -414,13 +416,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 * -make_list(GLuint list, GLuint count) +static struct gl_display_list * +make_list(GLuint name, 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 = name; + dlist->Head = (Node *) _mesa_malloc(sizeof(Node) * count); + dlist->Head[0].opcode = OPCODE_END_OF_LIST; return dlist; } @@ -428,10 +430,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 +444,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 +598,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; @@ -2521,12 +2523,12 @@ save_MultMatrixd(const GLdouble * m) static void GLAPIENTRY -save_NewList(GLuint list, GLenum mode) +save_NewList(GLuint name, GLenum mode) { GET_CURRENT_CONTEXT(ctx); /* It's an error to call this function while building a display list */ _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList"); - (void) list; + (void) name; (void) mode; } @@ -5731,7 +5733,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 +5754,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) { @@ -6723,7 +6725,7 @@ _mesa_GenLists(GLsizei range) * Begin a new display list. */ void GLAPIENTRY -_mesa_NewList(GLuint list, GLenum mode) +_mesa_NewList(GLuint name, GLenum mode) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -6732,10 +6734,10 @@ _mesa_NewList(GLuint list, GLenum mode) ASSERT_OUTSIDE_BEGIN_END(ctx); if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, "glNewList %u %s\n", list, + _mesa_debug(ctx, "glNewList %u %s\n", name, _mesa_lookup_enum_by_nr(mode)); - if (list == 0) { + if (name == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glNewList"); return; } @@ -6745,7 +6747,7 @@ _mesa_NewList(GLuint list, GLenum mode) return; } - if (ctx->ListState.CurrentListPtr) { + if (ctx->ListState.CurrentList) { /* already compiling a display list */ _mesa_error(ctx, GL_INVALID_OPERATION, "glNewList"); return; @@ -6755,10 +6757,8 @@ _mesa_NewList(GLuint list, GLenum mode) ctx->ExecuteFlag = (mode == GL_COMPILE_AND_EXECUTE); /* 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.CurrentListPtr = ctx->ListState.CurrentBlock; + ctx->ListState.CurrentList = make_list(name, BLOCK_SIZE); + ctx->ListState.CurrentBlock = ctx->ListState.CurrentList->Head; ctx->ListState.CurrentPos = 0; /* Reset acumulated list state: @@ -6770,7 +6770,7 @@ _mesa_NewList(GLuint list, GLenum mode) ctx->ListState.ActiveMaterialSize[i] = 0; ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; - ctx->Driver.NewList(ctx, list, mode); + ctx->Driver.NewList(ctx, name, mode); ctx->CurrentDispatch = ctx->Save; _glapi_set_dispatch(ctx->CurrentDispatch); @@ -6791,7 +6791,7 @@ _mesa_EndList(void) _mesa_debug(ctx, "glEndList\n"); /* Check that a list is under construction */ - if (!ctx->ListState.CurrentListPtr) { + if (!ctx->ListState.CurrentList) { _mesa_error(ctx, GL_INVALID_OPERATION, "glEndList"); return; } @@ -6804,18 +6804,18 @@ _mesa_EndList(void) (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); /* Destroy old list, if any */ - destroy_list(ctx, ctx->ListState.CurrentListNum); - /* Install the list */ - _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, + destroy_list(ctx, ctx->ListState.CurrentList->Name); + + /* Install the new list */ + _mesa_HashInsert(ctx->Shared->DisplayList, + ctx->ListState.CurrentList->Name, ctx->ListState.CurrentList); if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) - mesa_print_display_list(ctx->ListState.CurrentListNum); + mesa_print_display_list(ctx->ListState.CurrentList->Name); ctx->ListState.CurrentList = NULL; - ctx->ListState.CurrentListNum = 0; - ctx->ListState.CurrentListPtr = NULL; ctx->ExecuteFlag = GL_TRUE; ctx->CompileFlag = GL_FALSE; @@ -8209,7 +8209,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 +8222,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); @@ -8584,9 +8584,7 @@ _mesa_init_display_list(GLcontext *ctx) ctx->ListState.CallDepth = 0; ctx->ExecuteFlag = GL_TRUE; ctx->CompileFlag = GL_FALSE; - ctx->ListState.CurrentListPtr = NULL; ctx->ListState.CurrentBlock = NULL; - ctx->ListState.CurrentListNum = 0; ctx->ListState.CurrentPos = 0; /* Display List group */ |