summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/context.c20
-rw-r--r--src/mesa/main/context.h9
-rw-r--r--src/mesa/main/dlist.c8
-rw-r--r--src/mesa/main/dlist.h4
-rw-r--r--src/mesa/main/state.c27
-rw-r--r--src/mesa/main/state.h9
6 files changed, 42 insertions, 35 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 60dfda5791..2fd0045c8c 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.68 2000/05/23 23:23:00 brianp Exp $ */
+/* $Id: context.c,v 1.69 2000/05/24 15:04:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1341,6 +1341,8 @@ _mesa_initialize_context( GLcontext *ctx,
void *driver_ctx,
GLboolean direct )
{
+ GLuint dispatchSize;
+
(void) direct; /* not used */
/* misc one-time initializations */
@@ -1421,9 +1423,17 @@ _mesa_initialize_context( GLcontext *ctx,
_glapi_add_entrypoint("glCompressedTexSubImage1DARB", 559);
_glapi_add_entrypoint("glGetCompressedTexImageARB", 560);
+ /* Find the larger of Mesa's dispatch table and libGL's dispatch table.
+ * In practice, this'll be the same for stand-alone Mesa. But for DRI
+ * Mesa we do this to accomodate different versions of libGL and various
+ * DRI drivers.
+ */
+ dispatchSize = MAX2(_glapi_get_dispatch_table_size(),
+ sizeof(struct _glapi_table) / sizeof(void *));
+
/* setup API dispatch tables */
- ctx->Exec = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *));
- ctx->Save = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *));
+ ctx->Exec = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*));
+ ctx->Save = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*));
if (!ctx->Exec || !ctx->Save) {
free_shared_state(ctx, ctx->Shared);
FREE(ctx->VB);
@@ -1432,8 +1442,8 @@ _mesa_initialize_context( GLcontext *ctx,
FREE(ctx->Exec);
FREE(ctx);
}
- _mesa_init_exec_table( ctx->Exec );
- _mesa_init_dlist_table( ctx->Save );
+ _mesa_init_exec_table(ctx->Exec, dispatchSize);
+ _mesa_init_dlist_table(ctx->Save, dispatchSize);
ctx->CurrentDispatch = ctx->Exec;
return GL_TRUE;
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 581931153c..284f15e078 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -1,4 +1,4 @@
-/* $Id: context.h,v 1.17 2000/05/04 13:53:55 brianp Exp $ */
+/* $Id: context.h,v 1.18 2000/05/24 15:04:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -253,11 +253,4 @@ _mesa_Flush( void );
-extern void
-_mesa_init_no_op_table(struct _glapi_table *exec);
-
-extern void
-_mesa_init_exec_table(struct _glapi_table *exec);
-
-
#endif
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 9d80cb5004..2f291a6bde 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.40 2000/05/23 20:10:49 brianp Exp $ */
+/* $Id: dlist.c,v 1.41 2000/05/24 15:04:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -4723,13 +4723,13 @@ _mesa_ListBase( GLuint base )
/*
- * Assign all the pointers in 'table' to point to Mesa's display list
+ * Assign all the pointers in <table> to point to Mesa's display list
* building functions.
*/
void
-_mesa_init_dlist_table( struct _glapi_table *table )
+_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
{
- _mesa_init_no_op_table(table);
+ _mesa_init_no_op_table(table, tableSize);
/* GL 1.0 */
table->Accum = save_Accum;
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
index 1d9c0a1ca2..987c2cbab6 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -1,4 +1,4 @@
-/* $Id: dlist.h,v 1.3 2000/04/05 14:40:04 brianp Exp $ */
+/* $Id: dlist.h,v 1.4 2000/05/24 15:04:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -65,7 +65,7 @@ extern void _mesa_ListBase( GLuint base );
extern void _mesa_NewList( GLuint list, GLenum mode );
-extern void _mesa_init_dlist_table( struct _glapi_table *table );
+extern void _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize );
extern void gl_compile_cassette( GLcontext *ctx );
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 9eb8aafb67..a2ba03a02a 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.13 2000/05/23 20:10:50 brianp Exp $ */
+/* $Id: state.c,v 1.14 2000/05/24 15:04:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -99,20 +99,17 @@ generic_noop(void)
}
+/*
+ * Set all pointers in the given dispatch table to point to a
+ * generic no-op function.
+ */
void
-_mesa_init_no_op_table(struct _glapi_table *table)
+_mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize)
{
- /* Check to be sure the dispatcher's table is at least as big as Mesa's. */
- const GLuint size = sizeof(struct _glapi_table) / sizeof(void *);
- assert(_glapi_get_dispatch_table_size() >= size);
-
- {
- const GLuint n = _glapi_get_dispatch_table_size();
- GLuint i;
- void **dispatch = (void **) table;
- for (i = 0; i < n; i++) {
- dispatch[i] = (void *) generic_noop;
- }
+ GLuint i;
+ void **dispatch = (void **) table;
+ for (i = 0; i < tableSize; i++) {
+ dispatch[i] = (void *) generic_noop;
}
}
@@ -122,10 +119,10 @@ _mesa_init_no_op_table(struct _glapi_table *table)
* immediate-mode commands.
*/
void
-_mesa_init_exec_table(struct _glapi_table *exec)
+_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
{
/* first initialize all dispatch slots to no-op */
- _mesa_init_no_op_table(exec);
+ _mesa_init_no_op_table(exec, tableSize);
/* load the dispatch slots we understand */
exec->Accum = _mesa_Accum;
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index fc0b63cda4..55d7b4c1c4 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -1,4 +1,4 @@
-/* $Id: state.h,v 1.1 2000/02/02 19:15:19 brianp Exp $ */
+/* $Id: state.h,v 1.2 2000/05/24 15:04:45 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -31,6 +31,13 @@
#include "types.h"
+extern void
+_mesa_init_no_op_table(struct _glapi_table *exec, GLuint tableSize);
+
+extern void
+_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize);
+
+
extern void gl_update_state( GLcontext *ctx );