diff options
author | Brian Paul <[email protected]> | 2009-10-07 16:41:18 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-10-07 16:41:18 -0600 |
commit | 33e9ac20e3b399c6ec6ec2f586a9402b68590992 (patch) | |
tree | b6aa2afc5cf3951f7b40612f3c4c766b7683932f | |
parent | 15f05e97aac46ffcf8a7765b0072535718833622 (diff) |
mesa: move gl_list_instruction and gl_list_extensions to dlist.c
-rw-r--r-- | src/mesa/main/dlist.c | 68 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 26 |
2 files changed, 52 insertions, 42 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index cec7d873d4a..69667942f08 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.7 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. 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"), @@ -91,6 +92,33 @@ #include "glapi/dispatch.h" + +/** + * Other parts of Mesa (such as the VBO module) can plug into the display + * list system. This structure describes new display list instructions. + */ +struct gl_list_instruction +{ + GLuint Size; + void (*Execute)( GLcontext *ctx, void *data ); + void (*Destroy)( GLcontext *ctx, void *data ); + void (*Print)( GLcontext *ctx, void *data ); +}; + + +#define MAX_DLIST_EXT_OPCODES 16 + +/** + * Used by device drivers to hook new commands into display lists. + */ +struct gl_list_extensions +{ + struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES]; + GLuint NumOpcodes; +}; + + + /** * Flush vertices. * @@ -496,9 +524,9 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) /* check for extension opcodes first */ GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; - if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { - ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]); - n += ctx->ListExt.Opcode[i].Size; + if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { + ctx->ListExt->Opcode[i].Destroy(ctx, &n[1]); + n += ctx->ListExt->Opcode[i].Size; } else { switch (n[0].opcode) { @@ -873,13 +901,13 @@ _mesa_dlist_alloc_opcode(GLcontext *ctx, void (*destroy) (GLcontext *, void *), void (*print) (GLcontext *, void *)) { - if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) { - const GLuint i = ctx->ListExt.NumOpcodes++; - ctx->ListExt.Opcode[i].Size = + if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) { + const GLuint i = ctx->ListExt->NumOpcodes++; + ctx->ListExt->Opcode[i].Size = 1 + (size + sizeof(Node) - 1) / sizeof(Node); - ctx->ListExt.Opcode[i].Execute = execute; - ctx->ListExt.Opcode[i].Destroy = destroy; - ctx->ListExt.Opcode[i].Print = print; + ctx->ListExt->Opcode[i].Execute = execute; + ctx->ListExt->Opcode[i].Destroy = destroy; + ctx->ListExt->Opcode[i].Print = print; return i + OPCODE_EXT_0; } return -1; @@ -6468,10 +6496,10 @@ execute_list(GLcontext *ctx, GLuint list) OpCode opcode = n[0].opcode; int i = (int) n[0].opcode - (int) OPCODE_EXT_0; - if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { + if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { /* this is a driver-extended opcode */ - ctx->ListExt.Opcode[i].Execute(ctx, &n[1]); - n += ctx->ListExt.Opcode[i].Size; + ctx->ListExt->Opcode[i].Execute(ctx, &n[1]); + n += ctx->ListExt->Opcode[i].Size; } else { switch (opcode) { @@ -9068,10 +9096,10 @@ print_list(GLcontext *ctx, GLuint list) OpCode opcode = n[0].opcode; GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; - if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { + if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { /* this is a driver-extended opcode */ - ctx->ListExt.Opcode[i].Print(ctx, &n[1]); - n += ctx->ListExt.Opcode[i].Size; + ctx->ListExt->Opcode[i].Print(ctx, &n[1]); + n += ctx->ListExt->Opcode[i].Size; } else { switch (opcode) { @@ -9449,6 +9477,9 @@ _mesa_init_display_list(GLcontext *ctx) tableInitialized = GL_TRUE; } + /* extension info */ + ctx->ListExt = CALLOC_STRUCT(gl_list_extensions); + /* Display list */ ctx->ListState.CallDepth = 0; ctx->ExecuteFlag = GL_TRUE; @@ -9468,5 +9499,6 @@ _mesa_init_display_list(GLcontext *ctx) void _mesa_free_display_list_data(GLcontext *ctx) { - + free(ctx->ListExt); + ctx->ListExt = NULL; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d0050646454..a1184df2817 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -84,6 +84,7 @@ /*@{*/ struct _mesa_HashTable; struct gl_attrib_node; +struct gl_list_extensions; struct gl_meta_state; struct gl_pixelstore_attrib; struct gl_program_cache; @@ -820,29 +821,6 @@ struct gl_list_attrib /** - * Used by device drivers to hook new commands into display lists. - */ -struct gl_list_instruction -{ - GLuint Size; - void (*Execute)( GLcontext *ctx, void *data ); - void (*Destroy)( GLcontext *ctx, void *data ); - void (*Print)( GLcontext *ctx, void *data ); -}; - -#define MAX_DLIST_EXT_OPCODES 16 - -/** - * Used by device drivers to hook new commands into display lists. - */ -struct gl_list_extensions -{ - struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES]; - GLuint NumOpcodes; -}; - - -/** * Multisample attribute group (GL_MULTISAMPLE_BIT). */ struct gl_multisample_attrib @@ -3061,7 +3039,7 @@ struct __GLcontextRec struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */ /**@}*/ - struct gl_list_extensions ListExt; /**< driver dlist extensions */ + struct gl_list_extensions *ListExt; /**< driver dlist extensions */ /** \name For debugging/development only */ /*@{*/ |