-/* $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
void *driver_ctx,
GLboolean direct )
{
+ GLuint dispatchSize;
+
(void) direct; /* not used */
/* misc one-time initializations */
_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);
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;
-/* $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
-extern void
-_mesa_init_no_op_table(struct _glapi_table *exec);
-
-extern void
-_mesa_init_exec_table(struct _glapi_table *exec);
-
-
#endif
-/* $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
/*
- * 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;
-/* $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
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 );
-/* $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
}
+/*
+ * 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;
}
}
* 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;
-/* $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
#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 );