Fix pow <small> and a very stypid bug with dummy srcs(0 equals to tmp0.x)</small...
[mesa.git] / src / mesa / main / dlist.c
index abfc2dfff88c946d1483df50d66d8316ceee8b4a..8a0ac0fa4ab37ad09fee1f14c93f91a669b220f6 100644 (file)
@@ -1,13 +1,8 @@
-/**
- * \file dlist.c
- * Display lists management functions.
- */
-
 /*
  * Mesa 3-D graphics library
- * Version:  5.1
+ * Version:  6.5
  *
- * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2005  Brian Paul   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"),
  */
 
 
+/**
+ * \file dlist.c
+ * Display lists management functions.
+ */
+
 #include "glheader.h"
 #include "imports.h"
+#include "api_arrayelt.h"
 #include "api_loopback.h"
 #include "config.h"
 #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
 #include "arbprogram.h"
+#include "program.h"
 #endif
 #include "attrib.h"
 #include "blend.h"
 #include "buffers.h"
+#if FEATURE_ARB_vertex_buffer_object
+#include "bufferobj.h"
+#endif
 #include "clip.h"
 #include "colormac.h"
 #include "colortab.h"
@@ -60,6 +65,7 @@
 #include "dlist.h"
 #include "macros.h"
 #include "matrix.h"
+#include "occlude.h"
 #include "pixel.h"
 #include "points.h"
 #include "polygon.h"
 #include "varray.h"
 #if FEATURE_NV_vertex_program || FEATURE_NV_fragment_program
 #include "nvprogram.h"
+#include "program.h"
+#endif
+#if FEATURE_ATI_fragment_shader
+#include "atifragshader.h"
 #endif
 
 #include "math/m_matrix.h"
 #include "math/m_xform.h"
 
+#include "dispatch.h"
 
 
 /**
- * Functions which aren't compiled but executed immediately:
- * - glIsList
- * - glGenLists
- * - glDeleteLists
- * - glEndList  --- BUT:  call ctx->Driver.EndList at end of list execution?
- * - glFeedbackBuffer
- * - glSelectBuffer
- * - glRenderMode
- * - glReadPixels
- * - glPixelStore
- * - glFlush
- * - glFinish
- * - glIsEnabled
- * - glGet*
- * 
- * Functions which cause errors if called while compiling a display list:
- *  - glNewList
+ * Flush vertices.
+ *
+ * \param ctx GL context.
+ *
+ * Checks if dd_function_table::SaveNeedFlush is marked to flush
+ * stored (save) vertices, and calls
+ * dd_function_table::SaveFlushVertices if so.
  */
+#define SAVE_FLUSH_VERTICES(ctx)               \
+do {                                           \
+   if (ctx->Driver.SaveNeedFlush)              \
+      ctx->Driver.SaveFlushVertices(ctx);      \
+} while (0)
 
 
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair, with return value.
+ * 
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
+ */
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval)         \
+do {                                                                   \
+   if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON ||               \
+       ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
+      _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" );   \
+      return retval;                                                   \
+   }                                                                   \
+} while (0)
 
 /**
- * Display list instructions are stored as sequences of "nodes".  Nodes
- * are allocated in blocks.  Each block has BLOCK_SIZE nodes.  Blocks
- * are linked together with a pointer.
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair.
+ * 
+ * \param ctx GL context.
  */
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx)                             \
+do {                                                                   \
+   if (ctx->Driver.CurrentSavePrimitive <= GL_POLYGON ||               \
+       ctx->Driver.CurrentSavePrimitive == PRIM_INSIDE_UNKNOWN_PRIM) { \
+      _mesa_compile_error( ctx, GL_INVALID_OPERATION, "begin/end" );   \
+      return;                                                          \
+   }                                                                   \
+} while (0)
 
+/**
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices.
+ * 
+ * \param ctx GL context.
+ */
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx)                   \
+do {                                                                   \
+   ASSERT_OUTSIDE_SAVE_BEGIN_END(ctx);                                 \
+   SAVE_FLUSH_VERTICES(ctx);                                           \
+} while (0)
 
 /**
- * How many nodes to allocate at a time.
+ * Macro to assert that the API call was made outside the
+ * glBegin()/glEnd() pair and flush the vertices, with return value.
  * 
- * \note Reduced now that we hold vertices etc. elsewhere.
+ * \param ctx GL context.
+ * \param retval value to return value in case the assertion fails.
  */
-#define BLOCK_SIZE 256
+#define ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH_WITH_RETVAL(ctx, retval)\
+do {                                                                   \
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_WITH_RETVAL(ctx, retval);             \
+   SAVE_FLUSH_VERTICES(ctx);                                           \
+} while (0)
+
 
 
 /**
  * integer values starting at 0 is very important, see InstSize array usage)
  */
 typedef enum {
+       OPCODE_INVALID = -1,                    /* Force signed enum */
        OPCODE_ACCUM,
        OPCODE_ALPHA_FUNC,
         OPCODE_BIND_TEXTURE,
        OPCODE_BITMAP,
        OPCODE_BLEND_COLOR,
        OPCODE_BLEND_EQUATION,
-       OPCODE_BLEND_FUNC,
+       OPCODE_BLEND_EQUATION_SEPARATE,
        OPCODE_BLEND_FUNC_SEPARATE,
         OPCODE_CALL_LIST,
         OPCODE_CALL_LIST_OFFSET,
@@ -236,9 +285,6 @@ typedef enum {
        OPCODE_WINDOW_POS,
         /* GL_ARB_multitexture */
         OPCODE_ACTIVE_TEXTURE,
-        /* GL_SGIX/SGIS_pixel_texture */
-        OPCODE_PIXEL_TEXGEN_SGIX,
-        OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS,
         /* GL_ARB_texture_compression */
         OPCODE_COMPRESSED_TEX_IMAGE_1D,
         OPCODE_COMPRESSED_TEX_IMAGE_2D,
@@ -264,17 +310,61 @@ typedef enum {
         OPCODE_ACTIVE_STENCIL_FACE_EXT,
         /* GL_EXT_depth_bounds_test */
         OPCODE_DEPTH_BOUNDS_EXT,
+        /* GL_ARB_vertex/fragment_program */
+        OPCODE_PROGRAM_STRING_ARB,
+        OPCODE_PROGRAM_ENV_PARAMETER_ARB,
+        /* GL_ARB_occlusion_query */
+        OPCODE_BEGIN_QUERY_ARB,
+        OPCODE_END_QUERY_ARB,
+       /* GL_ARB_draw_buffers */
+        OPCODE_DRAW_BUFFERS_ARB,
+       /* GL_ATI_fragment_shader */
+       OPCODE_BIND_FRAGMENT_SHADER_ATI,
+       OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
+        /* OpenGL 2.0 */
+        OPCODE_STENCIL_FUNC_SEPARATE,
+        OPCODE_STENCIL_OP_SEPARATE,
+        OPCODE_STENCIL_MASK_SEPARATE,
+       
+       /* Vertex attributes -- fallback for when optimized display
+        * list build isn't active.
+        */
+       OPCODE_ATTR_1F_NV,
+       OPCODE_ATTR_2F_NV,
+       OPCODE_ATTR_3F_NV,
+       OPCODE_ATTR_4F_NV,
+       OPCODE_ATTR_1F_ARB,
+       OPCODE_ATTR_2F_ARB,
+       OPCODE_ATTR_3F_ARB,
+       OPCODE_ATTR_4F_ARB,
+       OPCODE_MATERIAL,
+       OPCODE_INDEX,
+       OPCODE_EDGEFLAG,
+       OPCODE_BEGIN,
+       OPCODE_END,
+       OPCODE_RECTF,
+       OPCODE_EVAL_C1,
+       OPCODE_EVAL_C2,
+       OPCODE_EVAL_P1,
+       OPCODE_EVAL_P2,
+
+
        /* The following three are meta instructions */
        OPCODE_ERROR,           /* raise compiled-in error */
        OPCODE_CONTINUE,
        OPCODE_END_OF_LIST,
-       OPCODE_DRV_0
+       OPCODE_EXT_0
 } OpCode;
 
 
+
 /**
  * Display list node.
  *
+ * Display list instructions are stored as sequences of "nodes".  Nodes
+ * are allocated in blocks.  Each block has BLOCK_SIZE nodes.  Blocks
+ * are linked together with a pointer.
+ *
  * Each instruction in the display list is stored as a sequence of
  * contiguous nodes in memory.
  * Each node is the union of a variety of data types.
@@ -296,7 +386,16 @@ union node {
 
 
 /**
- * Number of nodes of storage needed for each instruction.  
+ * How many nodes to allocate at a time.
+ *
+ * \note Reduced now that we hold vertices etc. elsewhere.
+ */
+#define BLOCK_SIZE 256
+
+
+
+/**
+ * Number of nodes of storage needed for each instruction.
  * Sizes for dynamically allocated opcodes are stored in the context struct.
  */
 static GLuint InstSize[ OPCODE_END_OF_LIST+1 ];
@@ -312,11 +411,13 @@ void mesa_print_display_list( GLuint list );
  * Make an empty display list.  This is used by glGenLists() to
  * reserver display list IDs.
  */
-static Node *make_empty_list( void )
+static struct mesa_display_list *make_list( GLuint list, GLuint count )
 {
-   Node *n = (Node *) MALLOC( sizeof(Node) );
-   n[0].opcode = OPCODE_END_OF_LIST;
-   return n;
+   struct mesa_display_list *dlist = CALLOC_STRUCT( mesa_display_list );
+   dlist->id = list;
+   dlist->node = (Node *) MALLOC( sizeof(Node) * count );
+   dlist->node[0].opcode = OPCODE_END_OF_LIST;
+   return dlist;
 }
 
 
@@ -327,24 +428,28 @@ static Node *make_empty_list( void )
  */
 void _mesa_destroy_list( GLcontext *ctx, GLuint list )
 {
+   struct mesa_display_list *dlist;
    Node *n, *block;
    GLboolean done;
 
    if (list==0)
       return;
 
-   block = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
-   n = block;
+   dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+   if (!dlist)
+      return;
+   
+   n = block = dlist->node;
 
    done = block ? GL_FALSE : GL_TRUE;
    while (!done) {
 
       /* check for extension opcodes first */
 
-      GLint i = (GLint) n[0].opcode - (GLint) OPCODE_DRV_0;
-      if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) {
-        ctx->listext.opcode[i].destroy(ctx, &n[1]);
-        n += ctx->listext.opcode[i].size;
+      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;
       }
       else {
         switch (n[0].opcode) {
@@ -435,17 +540,23 @@ void _mesa_destroy_list( GLcontext *ctx, GLuint list )
             break;
 #if FEATURE_NV_vertex_program
          case OPCODE_LOAD_PROGRAM_NV:
-            FREE(n[4].data);
+            FREE(n[4].data);  /* program string */
             n += InstSize[n[0].opcode];
             break;
          case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
-            FREE(n[2].data);
+            FREE(n[2].data);  /* array of program ids */
             n += InstSize[n[0].opcode];
             break;
 #endif
 #if FEATURE_NV_fragment_program
          case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
-            FREE(n[3].data);
+            FREE(n[3].data);  /* parameter name */
+            n += InstSize[n[0].opcode];
+            break;
+#endif
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+         case OPCODE_PROGRAM_STRING_ARB:
+            FREE(n[4].data);  /* program string */
             n += InstSize[n[0].opcode];
             break;
 #endif
@@ -466,6 +577,7 @@ void _mesa_destroy_list( GLcontext *ctx, GLuint list )
       }
    }
 
+   FREE( dlist );
    _mesa_HashRemove(ctx->Shared->DisplayList, list);
 }
 
@@ -532,7 +644,11 @@ static GLuint translate_id( GLsizei n, GLenum type, const GLvoid *list )
 /*****                        Public                              *****/
 /**********************************************************************/
 
-void _mesa_init_lists( void )
+/**
+ * Do one-time initialiazations for display lists.
+ */
+void
+_mesa_init_lists( void )
 {
    static int init_flag = 0;
 
@@ -543,7 +659,7 @@ void _mesa_init_lists( void )
       InstSize[OPCODE_BITMAP] = 8;
       InstSize[OPCODE_BLEND_COLOR] = 5;
       InstSize[OPCODE_BLEND_EQUATION] = 2;
-      InstSize[OPCODE_BLEND_FUNC] = 3;
+      InstSize[OPCODE_BLEND_EQUATION_SEPARATE] = 3;
       InstSize[OPCODE_BLEND_FUNC_SEPARATE] = 5;
       InstSize[OPCODE_CALL_LIST] = 2;
       InstSize[OPCODE_CALL_LIST_OFFSET] = 3;
@@ -650,9 +766,6 @@ void _mesa_init_lists( void )
       InstSize[OPCODE_CONTINUE] = 2;
       InstSize[OPCODE_ERROR] = 3;
       InstSize[OPCODE_END_OF_LIST] = 1;
-      /* GL_SGIX/SGIS_pixel_texture */
-      InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2;
-      InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3;
       /* GL_ARB_texture_compression */
       InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8;
       InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9;
@@ -680,11 +793,73 @@ void _mesa_init_lists( void )
       InstSize[OPCODE_ACTIVE_STENCIL_FACE_EXT] = 2;
       /* GL_EXT_depth_bounds_test */
       InstSize[OPCODE_DEPTH_BOUNDS_EXT] = 3;
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+      InstSize[OPCODE_PROGRAM_STRING_ARB] = 5;
+      InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7;
+#endif
+#if FEATURE_ARB_occlusion_query
+      InstSize[OPCODE_BEGIN_QUERY_ARB] = 3;
+      InstSize[OPCODE_END_QUERY_ARB] = 2;
+#endif
+      InstSize[OPCODE_DRAW_BUFFERS_ARB] = 2 + MAX_DRAW_BUFFERS;
+#if FEATURE_ATI_fragment_shader
+      InstSize[OPCODE_BIND_FRAGMENT_SHADER_ATI] = 2;
+      InstSize[OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI] = 6;
+#endif
+      /* OpenGL 2.0 */
+      InstSize[OPCODE_STENCIL_FUNC_SEPARATE] = 5;
+      InstSize[OPCODE_STENCIL_MASK_SEPARATE] = 3;
+      InstSize[OPCODE_STENCIL_OP_SEPARATE] = 5;
+
+      InstSize[OPCODE_ATTR_1F_NV] = 3;
+      InstSize[OPCODE_ATTR_2F_NV] = 4;
+      InstSize[OPCODE_ATTR_3F_NV] = 5;
+      InstSize[OPCODE_ATTR_4F_NV] = 6;
+      InstSize[OPCODE_ATTR_1F_ARB] = 3;
+      InstSize[OPCODE_ATTR_2F_ARB] = 4;
+      InstSize[OPCODE_ATTR_3F_ARB] = 5;
+      InstSize[OPCODE_ATTR_4F_ARB] = 6;
+      InstSize[OPCODE_MATERIAL] = 7;
+      InstSize[OPCODE_INDEX] = 2;
+      InstSize[OPCODE_EDGEFLAG] = 2;
+      InstSize[OPCODE_BEGIN] = 2;
+      InstSize[OPCODE_END] = 1;
+      InstSize[OPCODE_RECTF] = 5;
+      InstSize[OPCODE_EVAL_C1] = 2;
+      InstSize[OPCODE_EVAL_C2] = 3;
+      InstSize[OPCODE_EVAL_P1] = 2;
+      InstSize[OPCODE_EVAL_P2] = 3;
    }
    init_flag = 1;
 }
 
 
+
+/**
+ * Wrapper for _mesa_unpack_image() that handles pixel buffer objects.
+ * \todo This won't suffice when the PBO is really in VRAM/GPU memory.
+ */
+static GLvoid *
+unpack_image( GLuint dimensions, GLsizei width, GLsizei height, GLsizei depth,
+              GLenum format, GLenum type, const GLvoid *pixels,
+              const struct gl_pixelstore_attrib *unpack )
+{
+   if (unpack->BufferObj->Name == 0) {
+      /* no PBO */
+      return _mesa_unpack_image(dimensions, width, height, depth, format, type,
+                                pixels, unpack);
+   }
+   else if (_mesa_validate_pbo_access(dimensions, unpack, width, height, depth,
+                                      format, type, pixels)) {
+      const GLubyte *src = ADD_POINTERS(unpack->BufferObj->Data, pixels);
+      return _mesa_unpack_image(dimensions, width, height, depth, format, type,
+                                src, unpack);
+   }
+   /* bad access! */
+   return NULL;
+}
+
+
 /*
  * Allocate space for a display list instruction.
  * \param opcode - type of instruction
@@ -699,14 +874,14 @@ _mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz )
    GLuint count = 1 + (sz + sizeof(Node) - 1) / sizeof(Node);
 
 #ifdef DEBUG
-   if (opcode < (int) OPCODE_DRV_0) {
+   if (opcode < (int) OPCODE_EXT_0) {
       assert( count == InstSize[opcode] );
    }
 #endif
 
-   if (ctx->CurrentPos + count + 2 > BLOCK_SIZE) {
+   if (ctx->ListState.CurrentPos + count + 2 > BLOCK_SIZE) {
       /* This block is full.  Allocate a new block and chain to it */
-      n = ctx->CurrentBlock + ctx->CurrentPos;
+      n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
       n[0].opcode = OPCODE_CONTINUE;
       newblock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE );
       if (!newblock) {
@@ -714,12 +889,12 @@ _mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz )
          return NULL;
       }
       n[1].next = (Node *) newblock;
-      ctx->CurrentBlock = newblock;
-      ctx->CurrentPos = 0;
+      ctx->ListState.CurrentBlock = newblock;
+      ctx->ListState.CurrentPos = 0;
    }
 
-   n = ctx->CurrentBlock + ctx->CurrentPos;
-   ctx->CurrentPos += count;
+   n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
+   ctx->ListState.CurrentPos += count;
 
    n[0].opcode = (OpCode) opcode;
 
@@ -727,22 +902,30 @@ _mesa_alloc_instruction( GLcontext *ctx, int opcode, GLint sz )
 }
 
 
-/* Allow modules and drivers to get their own opcodes.
+/**
+ * This function allows modules and drivers to get their own opcodes
+ * for extending display list functionality.
+ * \param ctx  the rendering context
+ * \param size  number of bytes for storing the new display list command
+ * \param execute  function to execute the new display list command
+ * \param destroy  function to destroy the new display list command
+ * \param print  function to print the new display list command
+ * \return  the new opcode number or -1 if error
  */
-int
+GLint
 _mesa_alloc_opcode( GLcontext *ctx,
-                   GLuint sz,
+                   GLuint size,
                    void (*execute)( GLcontext *, void * ),
                    void (*destroy)( GLcontext *, void * ),
                    void (*print)( GLcontext *, void * ) )
 {
-   if (ctx->listext.nr_opcodes < GL_MAX_EXT_OPCODES) {
-      GLuint i = ctx->listext.nr_opcodes++;
-      ctx->listext.opcode[i].size = 1 + (sz + sizeof(Node) - 1)/sizeof(Node);
-      ctx->listext.opcode[i].execute = execute;
-      ctx->listext.opcode[i].destroy = destroy;
-      ctx->listext.opcode[i].print = print;
-      return i + OPCODE_DRV_0;
+   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;
+      return i + OPCODE_EXT_0;
    }
    return -1;
 }
@@ -762,7 +945,7 @@ _mesa_alloc_opcode( GLcontext *ctx,
 /*
  * Display List compilation functions
  */
-static void save_Accum( GLenum op, GLfloat value )
+static void GLAPIENTRY save_Accum( GLenum op, GLfloat value )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -773,12 +956,12 @@ static void save_Accum( GLenum op, GLfloat value )
       n[2].f = value;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Accum)( op, value );
+      CALL_Accum(ctx->Exec, ( op, value ));
    }
 }
 
 
-static void save_AlphaFunc( GLenum func, GLclampf ref )
+static void GLAPIENTRY save_AlphaFunc( GLenum func, GLclampf ref )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -789,12 +972,12 @@ static void save_AlphaFunc( GLenum func, GLclampf ref )
       n[2].f = (GLfloat) ref;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->AlphaFunc)( func, ref );
+      CALL_AlphaFunc(ctx->Exec, ( func, ref ));
    }
 }
 
 
-static void save_BindTexture( GLenum target, GLuint texture )
+static void GLAPIENTRY save_BindTexture( GLenum target, GLuint texture )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -805,12 +988,12 @@ static void save_BindTexture( GLenum target, GLuint texture )
       n[2].ui = texture;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->BindTexture)( target, texture );
+      CALL_BindTexture(ctx->Exec, ( target, texture ));
    }
 }
 
 
-static void save_Bitmap( GLsizei width, GLsizei height,
+static void GLAPIENTRY save_Bitmap( GLsizei width, GLsizei height,
                          GLfloat xorig, GLfloat yorig,
                          GLfloat xmove, GLfloat ymove,
                          const GLubyte *pixels )
@@ -833,13 +1016,13 @@ static void save_Bitmap( GLsizei width, GLsizei height,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Bitmap)( width, height,
-                           xorig, yorig, xmove, ymove, pixels );
+      CALL_Bitmap(ctx->Exec, ( width, height,
+                           xorig, yorig, xmove, ymove, pixels ));
    }
 }
 
 
-static void save_BlendEquation( GLenum mode )
+static void GLAPIENTRY save_BlendEquation( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -849,28 +1032,29 @@ static void save_BlendEquation( GLenum mode )
       n[1].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->BlendEquation)( mode );
+      CALL_BlendEquation(ctx->Exec, ( mode ));
    }
 }
 
 
-static void save_BlendFunc( GLenum sfactor, GLenum dfactor )
+static void GLAPIENTRY save_BlendEquationSeparateEXT( GLenum modeRGB,
+                                                     GLenum modeA )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_FUNC, 2 );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2 );
    if (n) {
-      n[1].e = sfactor;
-      n[2].e = dfactor;
+      n[1].e = modeRGB;
+      n[2].e = modeA;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->BlendFunc)( sfactor, dfactor );
+      CALL_BlendEquationSeparateEXT(ctx->Exec, ( modeRGB, modeA ));
    }
 }
 
 
-static void save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
+static void GLAPIENTRY save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
                                       GLenum sfactorA, GLenum dfactorA)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -884,13 +1068,13 @@ static void save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB,
       n[4].e = dfactorA;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->BlendFuncSeparateEXT)( sfactorRGB, dfactorRGB,
-                                          sfactorA, dfactorA);
+      CALL_BlendFuncSeparateEXT(ctx->Exec, 
+                               (sfactorRGB, dfactorRGB, sfactorA, dfactorA));
    }
 }
 
 
-static void save_BlendColor( GLfloat red, GLfloat green,
+static void GLAPIENTRY save_BlendColor( GLfloat red, GLfloat green,
                              GLfloat blue, GLfloat alpha )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -904,36 +1088,39 @@ static void save_BlendColor( GLfloat red, GLfloat green,
       n[4].f = alpha;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->BlendColor)( red, green, blue, alpha );
+      CALL_BlendColor(ctx->Exec, ( red, green, blue, alpha ));
    }
 }
 
 
-void _mesa_save_CallList( GLuint list )
+void GLAPIENTRY _mesa_save_CallList( GLuint list )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   FLUSH_CURRENT(ctx, 0);
+   SAVE_FLUSH_VERTICES(ctx);
 
    n = ALLOC_INSTRUCTION( ctx, OPCODE_CALL_LIST, 1 );
    if (n) {
       n[1].ui = list;
    }
+   
+   /* After this, we don't know what begin/end state we're in:
+    */
+   ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CallList)( list );
+      CALL_CallList(ctx->Exec, ( list ));
    }
 }
 
 
-void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
+void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
 {
    GET_CURRENT_CONTEXT(ctx);
    GLint i;
    GLboolean typeErrorFlag;
 
-   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   FLUSH_CURRENT(ctx, 0);
+   SAVE_FLUSH_VERTICES(ctx);
 
    switch (type) {
       case GL_BYTE:
@@ -960,13 +1147,18 @@ void _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
          n[2].b = typeErrorFlag;
       }
    }
+
+   /* After this, we don't know what begin/end state we're in:
+    */
+   ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
+
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CallLists)( n, type, lists );
+      CALL_CallLists(ctx->Exec, ( n, type, lists ));
    }
 }
 
 
-static void save_Clear( GLbitfield mask )
+static void GLAPIENTRY save_Clear( GLbitfield mask )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -976,12 +1168,12 @@ static void save_Clear( GLbitfield mask )
       n[1].bf = mask;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Clear)( mask );
+      CALL_Clear(ctx->Exec, ( mask ));
    }
 }
 
 
-static void save_ClearAccum( GLfloat red, GLfloat green,
+static void GLAPIENTRY save_ClearAccum( GLfloat red, GLfloat green,
                              GLfloat blue, GLfloat alpha )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -995,12 +1187,12 @@ static void save_ClearAccum( GLfloat red, GLfloat green,
       n[4].f = alpha;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ClearAccum)( red, green, blue, alpha );
+      CALL_ClearAccum(ctx->Exec, ( red, green, blue, alpha ));
    }
 }
 
 
-static void save_ClearColor( GLclampf red, GLclampf green,
+static void GLAPIENTRY save_ClearColor( GLclampf red, GLclampf green,
                              GLclampf blue, GLclampf alpha )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1014,12 +1206,12 @@ static void save_ClearColor( GLclampf red, GLclampf green,
       n[4].f = alpha;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ClearColor)( red, green, blue, alpha );
+      CALL_ClearColor(ctx->Exec, ( red, green, blue, alpha ));
    }
 }
 
 
-static void save_ClearDepth( GLclampd depth )
+static void GLAPIENTRY save_ClearDepth( GLclampd depth )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1029,12 +1221,12 @@ static void save_ClearDepth( GLclampd depth )
       n[1].f = (GLfloat) depth;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ClearDepth)( depth );
+      CALL_ClearDepth(ctx->Exec, ( depth ));
    }
 }
 
 
-static void save_ClearIndex( GLfloat c )
+static void GLAPIENTRY save_ClearIndex( GLfloat c )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1044,12 +1236,12 @@ static void save_ClearIndex( GLfloat c )
       n[1].f = c;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ClearIndex)( c );
+      CALL_ClearIndex(ctx->Exec, ( c ));
    }
 }
 
 
-static void save_ClearStencil( GLint s )
+static void GLAPIENTRY save_ClearStencil( GLint s )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1059,12 +1251,12 @@ static void save_ClearStencil( GLint s )
       n[1].i = s;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ClearStencil)( s );
+      CALL_ClearStencil(ctx->Exec, ( s ));
    }
 }
 
 
-static void save_ClipPlane( GLenum plane, const GLdouble *equ )
+static void GLAPIENTRY save_ClipPlane( GLenum plane, const GLdouble *equ )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1078,13 +1270,13 @@ static void save_ClipPlane( GLenum plane, const GLdouble *equ )
       n[5].f = (GLfloat) equ[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ClipPlane)( plane, equ );
+      CALL_ClipPlane(ctx->Exec, ( plane, equ ));
    }
 }
 
 
 
-static void save_ColorMask( GLboolean red, GLboolean green,
+static void GLAPIENTRY save_ColorMask( GLboolean red, GLboolean green,
                             GLboolean blue, GLboolean alpha )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1098,17 +1290,16 @@ static void save_ColorMask( GLboolean red, GLboolean green,
       n[4].b = alpha;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ColorMask)( red, green, blue, alpha );
+      CALL_ColorMask(ctx->Exec, ( red, green, blue, alpha ));
    }
 }
 
 
-static void save_ColorMaterial( GLenum face, GLenum mode )
+static void GLAPIENTRY save_ColorMaterial( GLenum face, GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   FLUSH_CURRENT(ctx, 0);
 
    n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_MATERIAL, 2 );
    if (n) {
@@ -1116,27 +1307,24 @@ static void save_ColorMaterial( GLenum face, GLenum mode )
       n[2].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ColorMaterial)( face, mode );
+      CALL_ColorMaterial(ctx->Exec, ( face, mode ));
    }
 }
 
 
-static void save_ColorTable( GLenum target, GLenum internalFormat,
+static void GLAPIENTRY save_ColorTable( GLenum target, GLenum internalFormat,
                              GLsizei width, GLenum format, GLenum type,
                              const GLvoid *table )
 {
    GET_CURRENT_CONTEXT(ctx);
-   if (target == GL_PROXY_TEXTURE_1D ||
-       target == GL_PROXY_TEXTURE_2D ||
-       target == GL_PROXY_TEXTURE_3D ||
-       target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
+   if (_mesa_is_proxy_texture(target)) {
       /* execute immediately */
-      (*ctx->Exec->ColorTable)( target, internalFormat, width,
-                                format, type, table );
+      CALL_ColorTable(ctx->Exec, ( target, internalFormat, width,
+                                format, type, table ));
    }
    else {
-      GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, table,
-                                         &ctx->Unpack);
+      GLvoid *image = unpack_image(1, width, 1, 1, format, type, table,
+                                   &ctx->Unpack);
       Node *n;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
       n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_TABLE, 6 );
@@ -1152,15 +1340,15 @@ static void save_ColorTable( GLenum target, GLenum internalFormat,
          FREE(image);
       }
       if (ctx->ExecuteFlag) {
-         (*ctx->Exec->ColorTable)( target, internalFormat, width,
-                                   format, type, table );
+         CALL_ColorTable(ctx->Exec, ( target, internalFormat, width,
+                                   format, type, table ));
       }
    }
 }
 
 
 
-static void
+static void GLAPIENTRY
 save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1184,12 +1372,12 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params)
    }
 
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ColorTableParameterfv)( target, pname, params );
+      CALL_ColorTableParameterfv(ctx->Exec, ( target, pname, params ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1213,19 +1401,19 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params)
    }
 
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ColorTableParameteriv)( target, pname, params );
+      CALL_ColorTableParameteriv(ctx->Exec, ( target, pname, params ));
    }
 }
 
 
 
-static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count,
+static void GLAPIENTRY save_ColorSubTable( GLenum target, GLsizei start, GLsizei count,
                                 GLenum format, GLenum type,
                                 const GLvoid *table)
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLvoid *image = _mesa_unpack_image(count, 1, 1, format, type, table,
-                                      &ctx->Unpack);
+   GLvoid *image = unpack_image(1, count, 1, 1, format, type, table,
+                                &ctx->Unpack);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_COLOR_SUB_TABLE, 6 );
@@ -1241,12 +1429,12 @@ static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ColorSubTable)(target, start, count, format, type, table);
+      CALL_ColorSubTable(ctx->Exec, (target, start, count, format, type, table));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CopyColorSubTable(GLenum target, GLsizei start,
                        GLint x, GLint y, GLsizei width)
 {
@@ -1263,12 +1451,12 @@ save_CopyColorSubTable(GLenum target, GLsizei start,
       n[5].i = width;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyColorSubTable)(target, start, x, y, width);
+      CALL_CopyColorSubTable(ctx->Exec, (target, start, x, y, width));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CopyColorTable(GLenum target, GLenum internalformat,
                     GLint x, GLint y, GLsizei width)
 {
@@ -1285,18 +1473,18 @@ save_CopyColorTable(GLenum target, GLenum internalformat,
       n[5].i = width;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyColorTable)(target, internalformat, x, y, width);
+      CALL_CopyColorTable(ctx->Exec, (target, internalformat, x, y, width));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
                          GLenum format, GLenum type, const GLvoid *filter)
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, filter,
-                                      &ctx->Unpack);
+   GLvoid *image = unpack_image(1, width, 1, 1, format, type, filter,
+                                &ctx->Unpack);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 );
@@ -1312,20 +1500,20 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ConvolutionFilter1D)( target, internalFormat, width,
-                                         format, type, filter );
+      CALL_ConvolutionFilter1D(ctx->Exec, ( target, internalFormat, width,
+                                         format, type, filter ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
                          GLsizei width, GLsizei height, GLenum format,
                          GLenum type, const GLvoid *filter)
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, filter,
-                                      &ctx->Unpack);
+   GLvoid *image = unpack_image(2, width, height, 1, format, type, filter,
+                                &ctx->Unpack);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 );
@@ -1342,13 +1530,13 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ConvolutionFilter2D)( target, internalFormat, width, height,
-                                         format, type, filter );
+      CALL_ConvolutionFilter2D(ctx->Exec, ( target, internalFormat, width, height,
+                                         format, type, filter ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1361,12 +1549,12 @@ save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param)
       n[3].i = param;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ConvolutionParameteri)( target, pname, param );
+      CALL_ConvolutionParameteri(ctx->Exec, ( target, pname, param ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1389,12 +1577,12 @@ save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params)
       }
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ConvolutionParameteriv)( target, pname, params );
+      CALL_ConvolutionParameteriv(ctx->Exec, ( target, pname, params ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1407,12 +1595,12 @@ save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param)
       n[3].f = param;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ConvolutionParameterf)( target, pname, param );
+      CALL_ConvolutionParameterf(ctx->Exec, ( target, pname, param ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1435,12 +1623,12 @@ save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params)
       }
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ConvolutionParameterfv)( target, pname, params );
+      CALL_ConvolutionParameterfv(ctx->Exec, ( target, pname, params ));
    }
 }
 
 
-static void 
+static void GLAPIENTRY
 save_CopyPixels( GLint x, GLint y,
                 GLsizei width, GLsizei height, GLenum type )
 {
@@ -1456,13 +1644,13 @@ save_CopyPixels( GLint x, GLint y,
       n[5].e = type;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyPixels)( x, y, width, height, type );
+      CALL_CopyPixels(ctx->Exec, ( x, y, width, height, type ));
    }
 }
 
 
 
-static void
+static void GLAPIENTRY
 save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
                      GLint x, GLint y, GLsizei width, GLint border )
 {
@@ -1480,13 +1668,13 @@ save_CopyTexImage1D( GLenum target, GLint level, GLenum internalformat,
       n[7].i = border;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyTexImage1D)( target, level, internalformat,
-                                   x, y, width, border );
+      CALL_CopyTexImage1D(ctx->Exec, ( target, level, internalformat,
+                                   x, y, width, border ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CopyTexImage2D( GLenum target, GLint level,
                      GLenum internalformat,
                      GLint x, GLint y, GLsizei width,
@@ -1507,14 +1695,14 @@ save_CopyTexImage2D( GLenum target, GLint level,
       n[8].i = border;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyTexImage2D)( target, level, internalformat,
-                                   x, y, width, height, border );
+      CALL_CopyTexImage2D(ctx->Exec, ( target, level, internalformat,
+                                   x, y, width, height, border ));
    }
 }
 
 
 
-static void
+static void GLAPIENTRY
 save_CopyTexSubImage1D( GLenum target, GLint level,
                         GLint xoffset, GLint x, GLint y,
                         GLsizei width )
@@ -1532,12 +1720,12 @@ save_CopyTexSubImage1D( GLenum target, GLint level,
       n[6].i = width;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyTexSubImage1D)( target, level, xoffset, x, y, width );
+      CALL_CopyTexSubImage1D(ctx->Exec, ( target, level, xoffset, x, y, width ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CopyTexSubImage2D( GLenum target, GLint level,
                         GLint xoffset, GLint yoffset,
                         GLint x, GLint y,
@@ -1558,13 +1746,13 @@ save_CopyTexSubImage2D( GLenum target, GLint level,
       n[8].i = height;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyTexSubImage2D)( target, level, xoffset, yoffset,
-                               x, y, width, height );
+      CALL_CopyTexSubImage2D(ctx->Exec, ( target, level, xoffset, yoffset,
+                               x, y, width, height ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CopyTexSubImage3D( GLenum target, GLint level,
                         GLint xoffset, GLint yoffset, GLint zoffset,
                         GLint x, GLint y,
@@ -1586,14 +1774,14 @@ save_CopyTexSubImage3D( GLenum target, GLint level,
       n[9].i = height;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CopyTexSubImage3D)( target, level,
+      CALL_CopyTexSubImage3D(ctx->Exec, ( target, level,
                                       xoffset, yoffset, zoffset,
-                                      x, y, width, height );
+                                      x, y, width, height ));
    }
 }
 
 
-static void save_CullFace( GLenum mode )
+static void GLAPIENTRY save_CullFace( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1603,12 +1791,12 @@ static void save_CullFace( GLenum mode )
       n[1].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CullFace)( mode );
+      CALL_CullFace(ctx->Exec, ( mode ));
    }
 }
 
 
-static void save_DepthFunc( GLenum func )
+static void GLAPIENTRY save_DepthFunc( GLenum func )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1618,12 +1806,12 @@ static void save_DepthFunc( GLenum func )
       n[1].e = func;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->DepthFunc)( func );
+      CALL_DepthFunc(ctx->Exec, ( func ));
    }
 }
 
 
-static void save_DepthMask( GLboolean mask )
+static void GLAPIENTRY save_DepthMask( GLboolean mask )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1633,12 +1821,12 @@ static void save_DepthMask( GLboolean mask )
       n[1].b = mask;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->DepthMask)( mask );
+      CALL_DepthMask(ctx->Exec, ( mask ));
    }
 }
 
 
-static void save_DepthRange( GLclampd nearval, GLclampd farval )
+static void GLAPIENTRY save_DepthRange( GLclampd nearval, GLclampd farval )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1649,12 +1837,12 @@ static void save_DepthRange( GLclampd nearval, GLclampd farval )
       n[2].f = (GLfloat) farval;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->DepthRange)( nearval, farval );
+      CALL_DepthRange(ctx->Exec, ( nearval, farval ));
    }
 }
 
 
-static void save_Disable( GLenum cap )
+static void GLAPIENTRY save_Disable( GLenum cap )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1664,12 +1852,12 @@ static void save_Disable( GLenum cap )
       n[1].e = cap;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Disable)( cap );
+      CALL_Disable(ctx->Exec, ( cap ));
    }
 }
 
 
-static void save_DrawBuffer( GLenum mode )
+static void GLAPIENTRY save_DrawBuffer( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1679,18 +1867,18 @@ static void save_DrawBuffer( GLenum mode )
       n[1].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->DrawBuffer)( mode );
+      CALL_DrawBuffer(ctx->Exec, ( mode ));
    }
 }
 
 
-static void save_DrawPixels( GLsizei width, GLsizei height,
+static void GLAPIENTRY save_DrawPixels( GLsizei width, GLsizei height,
                              GLenum format, GLenum type,
                              const GLvoid *pixels )
 {
    GET_CURRENT_CONTEXT(ctx);
-   GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
-                                      pixels, &ctx->Unpack);
+   GLvoid *image = unpack_image(2, width, height, 1, format, type,
+                                pixels, &ctx->Unpack);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_PIXELS, 5 );
@@ -1705,13 +1893,13 @@ static void save_DrawPixels( GLsizei width, GLsizei height,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->DrawPixels)( width, height, format, type, pixels );
+      CALL_DrawPixels(ctx->Exec, ( width, height, format, type, pixels ));
    }
 }
 
 
 
-static void save_Enable( GLenum cap )
+static void GLAPIENTRY save_Enable( GLenum cap )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1721,13 +1909,13 @@ static void save_Enable( GLenum cap )
       n[1].e = cap;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Enable)( cap );
+      CALL_Enable(ctx->Exec, ( cap ));
    }
 }
 
 
 
-void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
+void GLAPIENTRY _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1739,12 +1927,12 @@ void _mesa_save_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
       n[3].i = i2;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->EvalMesh1)( mode, i1, i2 );
+      CALL_EvalMesh1(ctx->Exec, ( mode, i1, i2 ));
    }
 }
 
 
-void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
+void GLAPIENTRY _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1758,14 +1946,14 @@ void _mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 )
       n[5].i = j2;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->EvalMesh2)( mode, i1, i2, j1, j2 );
+      CALL_EvalMesh2(ctx->Exec, ( mode, i1, i2, j1, j2 ));
    }
 }
 
 
 
 
-static void save_Fogfv( GLenum pname, const GLfloat *params )
+static void GLAPIENTRY save_Fogfv( GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1779,18 +1967,18 @@ static void save_Fogfv( GLenum pname, const GLfloat *params )
       n[5].f = params[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Fogfv)( pname, params );
+      CALL_Fogfv(ctx->Exec, ( pname, params ));
    }
 }
 
 
-static void save_Fogf( GLenum pname, GLfloat param )
+static void GLAPIENTRY save_Fogf( GLenum pname, GLfloat param )
 {
    save_Fogfv(pname, &param);
 }
 
 
-static void save_Fogiv(GLenum pname, const GLint *params )
+static void GLAPIENTRY save_Fogiv(GLenum pname, const GLint *params )
 {
    GLfloat p[4];
    switch (pname) {
@@ -1815,13 +2003,13 @@ static void save_Fogiv(GLenum pname, const GLint *params )
 }
 
 
-static void save_Fogi(GLenum pname, GLint param )
+static void GLAPIENTRY save_Fogi(GLenum pname, GLint param )
 {
    save_Fogiv(pname, &param);
 }
 
 
-static void save_FrontFace( GLenum mode )
+static void GLAPIENTRY save_FrontFace( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1831,12 +2019,12 @@ static void save_FrontFace( GLenum mode )
       n[1].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->FrontFace)( mode );
+      CALL_FrontFace(ctx->Exec, ( mode ));
    }
 }
 
 
-static void save_Frustum( GLdouble left, GLdouble right,
+static void GLAPIENTRY save_Frustum( GLdouble left, GLdouble right,
                       GLdouble bottom, GLdouble top,
                       GLdouble nearval, GLdouble farval )
 {
@@ -1853,12 +2041,12 @@ static void save_Frustum( GLdouble left, GLdouble right,
       n[6].f = (GLfloat) farval;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Frustum)( left, right, bottom, top, nearval, farval );
+      CALL_Frustum(ctx->Exec, ( left, right, bottom, top, nearval, farval ));
    }
 }
 
 
-static void save_Hint( GLenum target, GLenum mode )
+static void GLAPIENTRY save_Hint( GLenum target, GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1869,12 +2057,12 @@ static void save_Hint( GLenum target, GLenum mode )
       n[2].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Hint)( target, mode );
+      CALL_Hint(ctx->Exec, ( target, mode ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -1889,12 +2077,12 @@ save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean si
       n[4].b = sink;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Histogram)( target, width, internalFormat, sink );
+      CALL_Histogram(ctx->Exec, ( target, width, internalFormat, sink ));
    }
 }
 
 
-static void save_IndexMask( GLuint mask )
+static void GLAPIENTRY save_IndexMask( GLuint mask )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1904,23 +2092,23 @@ static void save_IndexMask( GLuint mask )
       n[1].ui = mask;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->IndexMask)( mask );
+      CALL_IndexMask(ctx->Exec, ( mask ));
    }
 }
 
 
-static void save_InitNames( void )
+static void GLAPIENTRY save_InitNames( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    (void) ALLOC_INSTRUCTION( ctx, OPCODE_INIT_NAMES, 0 );
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->InitNames)();
+      CALL_InitNames(ctx->Exec, ());
    }
 }
 
 
-static void save_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
+static void GLAPIENTRY save_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -1969,18 +2157,18 @@ static void save_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
       }
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Lightfv)( light, pname, params );
+      CALL_Lightfv(ctx->Exec, ( light, pname, params ));
    }
 }
 
 
-static void save_Lightf( GLenum light, GLenum pname, GLfloat params )
+static void GLAPIENTRY save_Lightf( GLenum light, GLenum pname, GLfloat params )
 {
    save_Lightfv(light, pname, &params);
 }
 
 
-static void save_Lightiv( GLenum light, GLenum pname, const GLint *params )
+static void GLAPIENTRY save_Lightiv( GLenum light, GLenum pname, const GLint *params )
 {
    GLfloat fparam[4];
    switch (pname) {
@@ -2018,13 +2206,13 @@ static void save_Lightiv( GLenum light, GLenum pname, const GLint *params )
 }
 
 
-static void save_Lighti( GLenum light, GLenum pname, GLint param )
+static void GLAPIENTRY save_Lighti( GLenum light, GLenum pname, GLint param )
 {
    save_Lightiv( light, pname, &param );
 }
 
 
-static void save_LightModelfv( GLenum pname, const GLfloat *params )
+static void GLAPIENTRY save_LightModelfv( GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2038,18 +2226,18 @@ static void save_LightModelfv( GLenum pname, const GLfloat *params )
       n[5].f = params[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LightModelfv)( pname, params );
+      CALL_LightModelfv(ctx->Exec, ( pname, params ));
    }
 }
 
 
-static void save_LightModelf( GLenum pname, GLfloat param )
+static void GLAPIENTRY save_LightModelf( GLenum pname, GLfloat param )
 {
    save_LightModelfv(pname, &param);
 }
 
 
-static void save_LightModeliv( GLenum pname, const GLint *params )
+static void GLAPIENTRY save_LightModeliv( GLenum pname, const GLint *params )
 {
    GLfloat fparam[4];
    switch (pname) {
@@ -2072,13 +2260,13 @@ static void save_LightModeliv( GLenum pname, const GLint *params )
 }
 
 
-static void save_LightModeli( GLenum pname, GLint param )
+static void GLAPIENTRY save_LightModeli( GLenum pname, GLint param )
 {
    save_LightModeliv(pname, &param);
 }
 
 
-static void save_LineStipple( GLint factor, GLushort pattern )
+static void GLAPIENTRY save_LineStipple( GLint factor, GLushort pattern )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2089,12 +2277,12 @@ static void save_LineStipple( GLint factor, GLushort pattern )
       n[2].us = pattern;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LineStipple)( factor, pattern );
+      CALL_LineStipple(ctx->Exec, ( factor, pattern ));
    }
 }
 
 
-static void save_LineWidth( GLfloat width )
+static void GLAPIENTRY save_LineWidth( GLfloat width )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2104,12 +2292,12 @@ static void save_LineWidth( GLfloat width )
       n[1].f = width;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LineWidth)( width );
+      CALL_LineWidth(ctx->Exec, ( width ));
    }
 }
 
 
-static void save_ListBase( GLuint base )
+static void GLAPIENTRY save_ListBase( GLuint base )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2119,23 +2307,23 @@ static void save_ListBase( GLuint base )
       n[1].ui = base;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ListBase)( base );
+      CALL_ListBase(ctx->Exec, ( base ));
    }
 }
 
 
-static void save_LoadIdentity( void )
+static void GLAPIENTRY save_LoadIdentity( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    (void) ALLOC_INSTRUCTION( ctx, OPCODE_LOAD_IDENTITY, 0 );
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LoadIdentity)();
+      CALL_LoadIdentity(ctx->Exec, ());
    }
 }
 
 
-static void save_LoadMatrixf( const GLfloat *m )
+static void GLAPIENTRY save_LoadMatrixf( const GLfloat *m )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2148,12 +2336,12 @@ static void save_LoadMatrixf( const GLfloat *m )
       }
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LoadMatrixf)( m );
+      CALL_LoadMatrixf(ctx->Exec, ( m ));
    }
 }
 
 
-static void save_LoadMatrixd( const GLdouble *m )
+static void GLAPIENTRY save_LoadMatrixd( const GLdouble *m )
 {
    GLfloat f[16];
    GLint i;
@@ -2164,7 +2352,7 @@ static void save_LoadMatrixd( const GLdouble *m )
 }
 
 
-static void save_LoadName( GLuint name )
+static void GLAPIENTRY save_LoadName( GLuint name )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2174,12 +2362,12 @@ static void save_LoadName( GLuint name )
       n[1].ui = name;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LoadName)( name );
+      CALL_LoadName(ctx->Exec, ( name ));
    }
 }
 
 
-static void save_LogicOp( GLenum opcode )
+static void GLAPIENTRY save_LogicOp( GLenum opcode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2189,12 +2377,12 @@ static void save_LogicOp( GLenum opcode )
       n[1].e = opcode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LogicOp)( opcode );
+      CALL_LogicOp(ctx->Exec, ( opcode ));
    }
 }
 
 
-static void save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
+static void GLAPIENTRY save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
                         GLint order, const GLdouble *points)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2211,11 +2399,11 @@ static void save_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride,
       n[6].data = (void *) pnts;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Map1d)( target, u1, u2, stride, order, points );
+      CALL_Map1d(ctx->Exec, ( target, u1, u2, stride, order, points ));
    }
 }
 
-static void save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+static void GLAPIENTRY save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
                         GLint order, const GLfloat *points)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2232,12 +2420,12 @@ static void save_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
       n[6].data = (void *) pnts;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Map1f)( target, u1, u2, stride, order, points );
+      CALL_Map1f(ctx->Exec, ( target, u1, u2, stride, order, points ));
    }
 }
 
 
-static void save_Map2d( GLenum target,
+static void GLAPIENTRY save_Map2d( GLenum target,
                         GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
                         GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
                         const GLdouble *points )
@@ -2262,14 +2450,14 @@ static void save_Map2d( GLenum target,
       n[10].data = (void *) pnts;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Map2d)( target,
+      CALL_Map2d(ctx->Exec, ( target,
                           u1, u2, ustride, uorder,
-                          v1, v2, vstride, vorder, points );
+                          v1, v2, vstride, vorder, points ));
    }
 }
 
 
-static void save_Map2f( GLenum target,
+static void GLAPIENTRY save_Map2f( GLenum target,
                         GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
                         GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
                         const GLfloat *points )
@@ -2294,13 +2482,13 @@ static void save_Map2f( GLenum target,
       n[10].data = (void *) pnts;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Map2f)( target, u1, u2, ustride, uorder,
-                          v1, v2, vstride, vorder, points );
+      CALL_Map2f(ctx->Exec, ( target, u1, u2, ustride, uorder,
+                          v1, v2, vstride, vorder, points ));
    }
 }
 
 
-static void save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
+static void GLAPIENTRY save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2312,18 +2500,18 @@ static void save_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
       n[3].f = u2;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->MapGrid1f)( un, u1, u2 );
+      CALL_MapGrid1f(ctx->Exec, ( un, u1, u2 ));
    }
 }
 
 
-static void save_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
+static void GLAPIENTRY save_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
 {
    save_MapGrid1f(un, (GLfloat) u1, (GLfloat) u2);
 }
 
 
-static void save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+static void GLAPIENTRY save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
                             GLint vn, GLfloat v1, GLfloat v2 )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2339,21 +2527,21 @@ static void save_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
       n[6].f = v2;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->MapGrid2f)( un, u1, u2, vn, v1, v2 );
+      CALL_MapGrid2f(ctx->Exec, ( un, u1, u2, vn, v1, v2 ));
    }
 }
 
 
 
-static void save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+static void GLAPIENTRY save_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
                             GLint vn, GLdouble v1, GLdouble v2 )
 {
-   save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2, 
+   save_MapGrid2f(un, (GLfloat) u1, (GLfloat) u2,
                  vn, (GLfloat) v1, (GLfloat) v2);
 }
 
 
-static void save_MatrixMode( GLenum mode )
+static void GLAPIENTRY save_MatrixMode( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2363,12 +2551,12 @@ static void save_MatrixMode( GLenum mode )
       n[1].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->MatrixMode)( mode );
+      CALL_MatrixMode(ctx->Exec, ( mode ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2382,12 +2570,12 @@ save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink)
       n[3].b = sink;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Minmax)( target, internalFormat, sink );
+      CALL_Minmax(ctx->Exec, ( target, internalFormat, sink ));
    }
 }
 
 
-static void save_MultMatrixf( const GLfloat *m )
+static void GLAPIENTRY save_MultMatrixf( const GLfloat *m )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2400,12 +2588,12 @@ static void save_MultMatrixf( const GLfloat *m )
       }
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->MultMatrixf)( m );
+      CALL_MultMatrixf(ctx->Exec, ( m ));
    }
 }
 
 
-static void save_MultMatrixd( const GLdouble *m )
+static void GLAPIENTRY save_MultMatrixd( const GLdouble *m )
 {
    GLfloat f[16];
    GLint i;
@@ -2416,7 +2604,7 @@ static void save_MultMatrixd( const GLdouble *m )
 }
 
 
-static void save_NewList( GLuint list, GLenum mode )
+static void GLAPIENTRY save_NewList( GLuint list, GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    /* It's an error to call this function while building a display list */
@@ -2427,7 +2615,7 @@ static void save_NewList( GLuint list, GLenum mode )
 
 
 
-static void save_Ortho( GLdouble left, GLdouble right,
+static void GLAPIENTRY save_Ortho( GLdouble left, GLdouble right,
                     GLdouble bottom, GLdouble top,
                     GLdouble nearval, GLdouble farval )
 {
@@ -2444,12 +2632,12 @@ static void save_Ortho( GLdouble left, GLdouble right,
       n[6].f = (GLfloat) farval;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Ortho)( left, right, bottom, top, nearval, farval );
+      CALL_Ortho(ctx->Exec, ( left, right, bottom, top, nearval, farval ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2463,12 +2651,12 @@ save_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
       MEMCPY( n[3].data, (void *) values, mapsize * sizeof(GLfloat) );
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PixelMapfv)( map, mapsize, values );
+      CALL_PixelMapfv(ctx->Exec, ( map, mapsize, values ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values )
 {
    GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
@@ -2487,7 +2675,7 @@ save_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values )
 }
 
 
-static void
+static void GLAPIENTRY
 save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
 {
    GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
@@ -2506,7 +2694,7 @@ save_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values)
 }
 
 
-static void
+static void GLAPIENTRY
 save_PixelTransferf( GLenum pname, GLfloat param )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2518,19 +2706,19 @@ save_PixelTransferf( GLenum pname, GLfloat param )
       n[2].f = param;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PixelTransferf)( pname, param );
+      CALL_PixelTransferf(ctx->Exec, ( pname, param ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_PixelTransferi( GLenum pname, GLint param )
 {
    save_PixelTransferf( pname, (GLfloat) param );
 }
 
 
-static void
+static void GLAPIENTRY
 save_PixelZoom( GLfloat xfactor, GLfloat yfactor )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2542,12 +2730,12 @@ save_PixelZoom( GLfloat xfactor, GLfloat yfactor )
       n[2].f = yfactor;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PixelZoom)( xfactor, yfactor );
+      CALL_PixelZoom(ctx->Exec, ( xfactor, yfactor ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_PointParameterfvEXT( GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2561,30 +2749,30 @@ save_PointParameterfvEXT( GLenum pname, const GLfloat *params )
       n[4].f = params[2];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PointParameterfvEXT)( pname, params );
+      CALL_PointParameterfvEXT(ctx->Exec, ( pname, params ));
    }
 }
 
 
-static void save_PointParameterfEXT( GLenum pname, GLfloat param )
+static void GLAPIENTRY save_PointParameterfEXT( GLenum pname, GLfloat param )
 {
    save_PointParameterfvEXT(pname, &param);
 }
 
-static void save_PointParameteriNV( GLenum pname, GLint param )
+static void GLAPIENTRY save_PointParameteriNV( GLenum pname, GLint param )
 {
    GLfloat p = (GLfloat) param;
    save_PointParameterfvEXT(pname, &p);
 }
 
-static void save_PointParameterivNV( GLenum pname, const GLint *param )
+static void GLAPIENTRY save_PointParameterivNV( GLenum pname, const GLint *param )
 {
    GLfloat p = (GLfloat) param[0];
    save_PointParameterfvEXT(pname, &p);
 }
 
 
-static void save_PointSize( GLfloat size )
+static void GLAPIENTRY save_PointSize( GLfloat size )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2594,12 +2782,12 @@ static void save_PointSize( GLfloat size )
       n[1].f = size;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PointSize)( size );
+      CALL_PointSize(ctx->Exec, ( size ));
    }
 }
 
 
-static void save_PolygonMode( GLenum face, GLenum mode )
+static void GLAPIENTRY save_PolygonMode( GLenum face, GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2610,7 +2798,7 @@ static void save_PolygonMode( GLenum face, GLenum mode )
       n[2].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PolygonMode)( face, mode );
+      CALL_PolygonMode(ctx->Exec, ( face, mode ));
    }
 }
 
@@ -2618,7 +2806,7 @@ static void save_PolygonMode( GLenum face, GLenum mode )
 /*
  * Polygon stipple must have been upacked already!
  */
-static void save_PolygonStipple( const GLubyte *pattern )
+static void GLAPIENTRY save_PolygonStipple( const GLubyte *pattern )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2631,12 +2819,12 @@ static void save_PolygonStipple( const GLubyte *pattern )
       MEMCPY( data, pattern, 32 * 4 );
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PolygonStipple)( (GLubyte*) pattern );
+      CALL_PolygonStipple(ctx->Exec, ( (GLubyte*) pattern ));
    }
 }
 
 
-static void save_PolygonOffset( GLfloat factor, GLfloat units )
+static void GLAPIENTRY save_PolygonOffset( GLfloat factor, GLfloat units )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2647,53 +2835,53 @@ static void save_PolygonOffset( GLfloat factor, GLfloat units )
       n[2].f = units;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PolygonOffset)( factor, units );
+      CALL_PolygonOffset(ctx->Exec, ( factor, units ));
    }
 }
 
 
-static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
+static void GLAPIENTRY save_PolygonOffsetEXT( GLfloat factor, GLfloat bias )
 {
    GET_CURRENT_CONTEXT(ctx);
-   save_PolygonOffset(factor, ctx->DepthMaxF * bias);
+   /* XXX mult by DepthMaxF here??? */
+   save_PolygonOffset(factor, ctx->DrawBuffer->_DepthMaxF * bias);
 }
 
 
-static void save_PopAttrib( void )
+static void GLAPIENTRY save_PopAttrib( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_ATTRIB, 0 );
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PopAttrib)();
+      CALL_PopAttrib(ctx->Exec, ());
    }
 }
 
 
-static void save_PopMatrix( void )
+static void GLAPIENTRY save_PopMatrix( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   FLUSH_CURRENT(ctx, 0);
    (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_MATRIX, 0 );
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PopMatrix)();
+      CALL_PopMatrix(ctx->Exec, ());
    }
 }
 
 
-static void save_PopName( void )
+static void GLAPIENTRY save_PopName( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    (void) ALLOC_INSTRUCTION( ctx, OPCODE_POP_NAME, 0 );
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PopName)();
+      CALL_PopName(ctx->Exec, ());
    }
 }
 
 
-static void save_PrioritizeTextures( GLsizei num, const GLuint *textures,
+static void GLAPIENTRY save_PrioritizeTextures( GLsizei num, const GLuint *textures,
                                      const GLclampf *priorities )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2709,39 +2897,38 @@ static void save_PrioritizeTextures( GLsizei num, const GLuint *textures,
       }
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PrioritizeTextures)( num, textures, priorities );
+      CALL_PrioritizeTextures(ctx->Exec, ( num, textures, priorities ));
    }
 }
 
 
-static void save_PushAttrib( GLbitfield mask )
+static void GLAPIENTRY save_PushAttrib( GLbitfield mask )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   FLUSH_CURRENT(ctx, 0);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_ATTRIB, 1 );
    if (n) {
       n[1].bf = mask;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PushAttrib)( mask );
+      CALL_PushAttrib(ctx->Exec, ( mask ));
    }
 }
 
 
-static void save_PushMatrix( void )
+static void GLAPIENTRY save_PushMatrix( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    (void) ALLOC_INSTRUCTION( ctx, OPCODE_PUSH_MATRIX, 0 );
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PushMatrix)();
+      CALL_PushMatrix(ctx->Exec, ());
    }
 }
 
 
-static void save_PushName( GLuint name )
+static void GLAPIENTRY save_PushName( GLuint name )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2751,17 +2938,16 @@ static void save_PushName( GLuint name )
       n[1].ui = name;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PushName)( name );
+      CALL_PushName(ctx->Exec, ( name ));
    }
 }
 
 
-static void save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+static void GLAPIENTRY save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   FLUSH_CURRENT(ctx, 0);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_RASTER_POS, 4 );
    if (n) {
       n[1].f = x;
@@ -2770,129 +2956,129 @@ static void save_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
       n[4].f = w;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->RasterPos4f)( x, y, z, w );
+      CALL_RasterPos4f(ctx->Exec, ( x, y, z, w ));
    }
 }
 
-static void save_RasterPos2d(GLdouble x, GLdouble y)
+static void GLAPIENTRY save_RasterPos2d(GLdouble x, GLdouble y)
 {
    save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
 }
 
-static void save_RasterPos2f(GLfloat x, GLfloat y)
+static void GLAPIENTRY save_RasterPos2f(GLfloat x, GLfloat y)
 {
    save_RasterPos4f(x, y, 0.0F, 1.0F);
 }
 
-static void save_RasterPos2i(GLint x, GLint y)
+static void GLAPIENTRY save_RasterPos2i(GLint x, GLint y)
 {
    save_RasterPos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
 }
 
-static void save_RasterPos2s(GLshort x, GLshort y)
+static void GLAPIENTRY save_RasterPos2s(GLshort x, GLshort y)
 {
    save_RasterPos4f(x, y, 0.0F, 1.0F);
 }
 
-static void save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
+static void GLAPIENTRY save_RasterPos3d(GLdouble x, GLdouble y, GLdouble z)
 {
    save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-static void save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
+static void GLAPIENTRY save_RasterPos3f(GLfloat x, GLfloat y, GLfloat z)
 {
    save_RasterPos4f(x, y, z, 1.0F);
 }
 
-static void save_RasterPos3i(GLint x, GLint y, GLint z)
+static void GLAPIENTRY save_RasterPos3i(GLint x, GLint y, GLint z)
 {
    save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-static void save_RasterPos3s(GLshort x, GLshort y, GLshort z)
+static void GLAPIENTRY save_RasterPos3s(GLshort x, GLshort y, GLshort z)
 {
    save_RasterPos4f(x, y, z, 1.0F);
 }
 
-static void save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+static void GLAPIENTRY save_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
    save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-static void save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
+static void GLAPIENTRY save_RasterPos4i(GLint x, GLint y, GLint z, GLint w)
 {
    save_RasterPos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-static void save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
+static void GLAPIENTRY save_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w)
 {
    save_RasterPos4f(x, y, z, w);
 }
 
-static void save_RasterPos2dv(const GLdouble *v)
+static void GLAPIENTRY save_RasterPos2dv(const GLdouble *v)
 {
    save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-static void save_RasterPos2fv(const GLfloat *v)
+static void GLAPIENTRY save_RasterPos2fv(const GLfloat *v)
 {
    save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
 }
 
-static void save_RasterPos2iv(const GLint *v)
+static void GLAPIENTRY save_RasterPos2iv(const GLint *v)
 {
    save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-static void save_RasterPos2sv(const GLshort *v)
+static void GLAPIENTRY save_RasterPos2sv(const GLshort *v)
 {
    save_RasterPos4f(v[0], v[1], 0.0F, 1.0F);
 }
 
-static void save_RasterPos3dv(const GLdouble *v)
+static void GLAPIENTRY save_RasterPos3dv(const GLdouble *v)
 {
    save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-static void save_RasterPos3fv(const GLfloat *v)
+static void GLAPIENTRY save_RasterPos3fv(const GLfloat *v)
 {
    save_RasterPos4f(v[0], v[1], v[2], 1.0F);
 }
 
-static void save_RasterPos3iv(const GLint *v)
+static void GLAPIENTRY save_RasterPos3iv(const GLint *v)
 {
    save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-static void save_RasterPos3sv(const GLshort *v)
+static void GLAPIENTRY save_RasterPos3sv(const GLshort *v)
 {
    save_RasterPos4f(v[0], v[1], v[2], 1.0F);
 }
 
-static void save_RasterPos4dv(const GLdouble *v)
+static void GLAPIENTRY save_RasterPos4dv(const GLdouble *v)
 {
-   save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 
+   save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
                    (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-static void save_RasterPos4fv(const GLfloat *v)
+static void GLAPIENTRY save_RasterPos4fv(const GLfloat *v)
 {
    save_RasterPos4f(v[0], v[1], v[2], v[3]);
 }
 
-static void save_RasterPos4iv(const GLint *v)
+static void GLAPIENTRY save_RasterPos4iv(const GLint *v)
 {
-   save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1], 
+   save_RasterPos4f((GLfloat) v[0], (GLfloat) v[1],
                    (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-static void save_RasterPos4sv(const GLshort *v)
+static void GLAPIENTRY save_RasterPos4sv(const GLshort *v)
 {
    save_RasterPos4f(v[0], v[1], v[2], v[3]);
 }
 
 
-static void save_PassThrough( GLfloat token )
+static void GLAPIENTRY save_PassThrough( GLfloat token )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2902,12 +3088,12 @@ static void save_PassThrough( GLfloat token )
       n[1].f = token;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PassThrough)( token );
+      CALL_PassThrough(ctx->Exec, ( token ));
    }
 }
 
 
-static void save_ReadBuffer( GLenum mode )
+static void GLAPIENTRY save_ReadBuffer( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2917,12 +3103,12 @@ static void save_ReadBuffer( GLenum mode )
       n[1].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ReadBuffer)( mode );
+      CALL_ReadBuffer(ctx->Exec, ( mode ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ResetHistogram(GLenum target)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2933,12 +3119,12 @@ save_ResetHistogram(GLenum target)
       n[1].e = target;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ResetHistogram)( target );
+      CALL_ResetHistogram(ctx->Exec, ( target ));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ResetMinmax(GLenum target)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -2949,12 +3135,12 @@ save_ResetMinmax(GLenum target)
       n[1].e = target;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ResetMinmax)( target );
+      CALL_ResetMinmax(ctx->Exec, ( target ));
    }
 }
 
 
-static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+static void GLAPIENTRY save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2967,18 +3153,18 @@ static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
       n[4].f = z;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Rotatef)( angle, x, y, z );
+      CALL_Rotatef(ctx->Exec, ( angle, x, y, z ));
    }
 }
 
 
-static void save_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z )
+static void GLAPIENTRY save_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z )
 {
    save_Rotatef((GLfloat) angle, (GLfloat) x, (GLfloat) y, (GLfloat) z);
 }
 
 
-static void save_Scalef( GLfloat x, GLfloat y, GLfloat z )
+static void GLAPIENTRY save_Scalef( GLfloat x, GLfloat y, GLfloat z )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -2990,18 +3176,18 @@ static void save_Scalef( GLfloat x, GLfloat y, GLfloat z )
       n[3].f = z;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Scalef)( x, y, z );
+      CALL_Scalef(ctx->Exec, ( x, y, z ));
    }
 }
 
 
-static void save_Scaled( GLdouble x, GLdouble y, GLdouble z )
+static void GLAPIENTRY save_Scaled( GLdouble x, GLdouble y, GLdouble z )
 {
    save_Scalef((GLfloat) x, (GLfloat) y, (GLfloat) z);
 }
 
 
-static void save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
+static void GLAPIENTRY save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3014,12 +3200,12 @@ static void save_Scissor( GLint x, GLint y, GLsizei width, GLsizei height )
       n[4].i = height;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Scissor)( x, y, width, height );
+      CALL_Scissor(ctx->Exec, ( x, y, width, height ));
    }
 }
 
 
-static void save_ShadeModel( GLenum mode )
+static void GLAPIENTRY save_ShadeModel( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3029,12 +3215,12 @@ static void save_ShadeModel( GLenum mode )
       n[1].e = mode;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ShadeModel)( mode );
+      CALL_ShadeModel(ctx->Exec, ( mode ));
    }
 }
 
 
-static void save_StencilFunc( GLenum func, GLint ref, GLuint mask )
+static void GLAPIENTRY save_StencilFunc( GLenum func, GLint ref, GLuint mask )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3046,12 +3232,12 @@ static void save_StencilFunc( GLenum func, GLint ref, GLuint mask )
       n[3].ui = mask;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->StencilFunc)( func, ref, mask );
+      CALL_StencilFunc(ctx->Exec, ( func, ref, mask ));
    }
 }
 
 
-static void save_StencilMask( GLuint mask )
+static void GLAPIENTRY save_StencilMask( GLuint mask )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3061,12 +3247,12 @@ static void save_StencilMask( GLuint mask )
       n[1].ui = mask;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->StencilMask)( mask );
+      CALL_StencilMask(ctx->Exec, ( mask ));
    }
 }
 
 
-static void save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
+static void GLAPIENTRY save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3078,12 +3264,67 @@ static void save_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
       n[3].e = zpass;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->StencilOp)( fail, zfail, zpass );
+      CALL_StencilOp(ctx->Exec, ( fail, zfail, zpass ));
+   }
+}
+
+
+static void GLAPIENTRY
+save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
+   if (n) {
+      n[1].e = face;
+      n[2].e = func;
+      n[3].i = ref;
+      n[4].ui = mask;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_StencilFuncSeparate(ctx->Exec, (face, func, ref, mask));
+   }
+}
+
+
+static void GLAPIENTRY
+save_StencilMaskSeparate(GLenum face, GLuint mask)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2);
+   if (n) {
+      n[1].e = face;
+      n[2].ui = mask;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_StencilMaskSeparate(ctx->Exec, (face, mask));
+   }
+}
+
+
+static void GLAPIENTRY
+save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_STENCIL_OP_SEPARATE, 4 );
+   if (n) {
+      n[1].e = face;
+      n[2].e = fail;
+      n[3].e = zfail;
+      n[4].e = zpass;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_StencilOpSeparate(ctx->Exec, (face, fail, zfail, zpass));
    }
 }
 
 
-static void save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
+static void GLAPIENTRY save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3092,24 +3333,30 @@ static void save_TexEnvfv( GLenum target, GLenum pname, const GLfloat *params )
    if (n) {
       n[1].e = target;
       n[2].e = pname;
-      n[3].f = params[0];
-      n[4].f = params[1];
-      n[5].f = params[2];
-      n[6].f = params[3];
+      if (pname == GL_TEXTURE_ENV_COLOR) {
+         n[3].f = params[0];
+         n[4].f = params[1];
+         n[5].f = params[2];
+         n[6].f = params[3];
+      }
+      else {
+         n[3].f = params[0];
+         n[4].f = n[5].f = n[6].f = 0.0F;
+      }
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->TexEnvfv)( target, pname, params );
+      CALL_TexEnvfv(ctx->Exec, ( target, pname, params ));
    }
 }
 
 
-static void save_TexEnvf( GLenum target, GLenum pname, GLfloat param )
+static void GLAPIENTRY save_TexEnvf( GLenum target, GLenum pname, GLfloat param )
 {
    save_TexEnvfv( target, pname, &param );
 }
 
 
-static void save_TexEnvi( GLenum target, GLenum pname, GLint param )
+static void GLAPIENTRY save_TexEnvi( GLenum target, GLenum pname, GLint param )
 {
    GLfloat p[4];
    p[0] = (GLfloat) param;
@@ -3118,18 +3365,24 @@ static void save_TexEnvi( GLenum target, GLenum pname, GLint param )
 }
 
 
-static void save_TexEnviv( GLenum target, GLenum pname, const GLint *param )
+static void GLAPIENTRY save_TexEnviv( GLenum target, GLenum pname, const GLint *param )
 {
    GLfloat p[4];
-   p[0] = INT_TO_FLOAT( param[0] );
-   p[1] = INT_TO_FLOAT( param[1] );
-   p[2] = INT_TO_FLOAT( param[2] );
-   p[3] = INT_TO_FLOAT( param[3] );
+   if (pname == GL_TEXTURE_ENV_COLOR) {
+      p[0] = INT_TO_FLOAT( param[0] );
+      p[1] = INT_TO_FLOAT( param[1] );
+      p[2] = INT_TO_FLOAT( param[2] );
+      p[3] = INT_TO_FLOAT( param[3] );
+   }
+   else {
+      p[0] = (GLfloat) param[0];
+      p[1] = p[2] = p[3] = 0.0F;
+   }
    save_TexEnvfv( target, pname, p );
 }
 
 
-static void save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
+static void GLAPIENTRY save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3144,12 +3397,12 @@ static void save_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
       n[6].f = params[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->TexGenfv)( coord, pname, params );
+      CALL_TexGenfv(ctx->Exec, ( coord, pname, params ));
    }
 }
 
 
-static void save_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
+static void GLAPIENTRY save_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
 {
    GLfloat p[4];
    p[0] = (GLfloat) params[0];
@@ -3160,14 +3413,14 @@ static void save_TexGeniv(GLenum coord, GLenum pname, const GLint *params )
 }
 
 
-static void save_TexGend(GLenum coord, GLenum pname, GLdouble param )
+static void GLAPIENTRY save_TexGend(GLenum coord, GLenum pname, GLdouble param )
 {
    GLfloat p = (GLfloat) param;
    save_TexGenfv( coord, pname, &p );
 }
 
 
-static void save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
+static void GLAPIENTRY save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
 {
    GLfloat p[4];
    p[0] = (GLfloat) params[0];
@@ -3178,19 +3431,19 @@ static void save_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )
 }
 
 
-static void save_TexGenf( GLenum coord, GLenum pname, GLfloat param )
+static void GLAPIENTRY save_TexGenf( GLenum coord, GLenum pname, GLfloat param )
 {
    save_TexGenfv(coord, pname, &param);
 }
 
 
-static void save_TexGeni( GLenum coord, GLenum pname, GLint param )
+static void GLAPIENTRY save_TexGeni( GLenum coord, GLenum pname, GLint param )
 {
    save_TexGeniv( coord, pname, &param );
 }
 
 
-static void save_TexParameterfv( GLenum target,
+static void GLAPIENTRY save_TexParameterfv( GLenum target,
                              GLenum pname, const GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -3206,18 +3459,18 @@ static void save_TexParameterfv( GLenum target,
       n[6].f = params[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->TexParameterfv)( target, pname, params );
+      CALL_TexParameterfv(ctx->Exec, ( target, pname, params ));
    }
 }
 
 
-static void save_TexParameterf( GLenum target, GLenum pname, GLfloat param )
+static void GLAPIENTRY save_TexParameterf( GLenum target, GLenum pname, GLfloat param )
 {
    save_TexParameterfv(target, pname, &param);
 }
 
 
-static void save_TexParameteri( GLenum target, GLenum pname, GLint param )
+static void GLAPIENTRY save_TexParameteri( GLenum target, GLenum pname, GLint param )
 {
    GLfloat fparam[4];
    fparam[0] = (GLfloat) param;
@@ -3226,7 +3479,7 @@ static void save_TexParameteri( GLenum target, GLenum pname, GLint param )
 }
 
 
-static void save_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
+static void GLAPIENTRY save_TexParameteriv( GLenum target, GLenum pname, const GLint *params )
 {
    GLfloat fparam[4];
    fparam[0] = (GLfloat) params[0];
@@ -3235,7 +3488,7 @@ static void save_TexParameteriv( GLenum target, GLenum pname, const GLint *param
 }
 
 
-static void save_TexImage1D( GLenum target,
+static void GLAPIENTRY save_TexImage1D( GLenum target,
                              GLint level, GLint components,
                              GLsizei width, GLint border,
                              GLenum format, GLenum type,
@@ -3244,12 +3497,12 @@ static void save_TexImage1D( GLenum target,
    GET_CURRENT_CONTEXT(ctx);
    if (target == GL_PROXY_TEXTURE_1D) {
       /* don't compile, execute immediately */
-      (*ctx->Exec->TexImage1D)( target, level, components, width,
-                               border, format, type, pixels );
+      CALL_TexImage1D(ctx->Exec, ( target, level, components, width,
+                               border, format, type, pixels ));
    }
    else {
-      GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type,
-                                         pixels, &ctx->Unpack);
+      GLvoid *image = unpack_image(1, width, 1, 1, format, type,
+                                   pixels, &ctx->Unpack);
       Node *n;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
       n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE1D, 8 );
@@ -3267,14 +3520,14 @@ static void save_TexImage1D( GLenum target,
          FREE(image);
       }
       if (ctx->ExecuteFlag) {
-         (*ctx->Exec->TexImage1D)( target, level, components, width,
-                                  border, format, type, pixels );
+         CALL_TexImage1D(ctx->Exec, ( target, level, components, width,
+                                  border, format, type, pixels ));
       }
    }
 }
 
 
-static void save_TexImage2D( GLenum target,
+static void GLAPIENTRY save_TexImage2D( GLenum target,
                              GLint level, GLint components,
                              GLsizei width, GLsizei height, GLint border,
                              GLenum format, GLenum type,
@@ -3283,12 +3536,12 @@ static void save_TexImage2D( GLenum target,
    GET_CURRENT_CONTEXT(ctx);
    if (target == GL_PROXY_TEXTURE_2D) {
       /* don't compile, execute immediately */
-      (*ctx->Exec->TexImage2D)( target, level, components, width,
-                               height, border, format, type, pixels );
+      CALL_TexImage2D(ctx->Exec, ( target, level, components, width,
+                               height, border, format, type, pixels ));
    }
    else {
-      GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
-                                         pixels, &ctx->Unpack);
+      GLvoid *image = unpack_image(2, width, height, 1, format, type,
+                                   pixels, &ctx->Unpack);
       Node *n;
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
       n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE2D, 9 );
@@ -3307,14 +3560,14 @@ static void save_TexImage2D( GLenum target,
          FREE(image);
       }
       if (ctx->ExecuteFlag) {
-         (*ctx->Exec->TexImage2D)( target, level, components, width,
-                                  height, border, format, type, pixels );
+         CALL_TexImage2D(ctx->Exec, ( target, level, components, width,
+                                  height, border, format, type, pixels ));
       }
    }
 }
 
 
-static void save_TexImage3D( GLenum target,
+static void GLAPIENTRY save_TexImage3D( GLenum target,
                              GLint level, GLint internalFormat,
                              GLsizei width, GLsizei height, GLsizei depth,
                              GLint border,
@@ -3324,13 +3577,13 @@ static void save_TexImage3D( GLenum target,
    GET_CURRENT_CONTEXT(ctx);
    if (target == GL_PROXY_TEXTURE_3D) {
       /* don't compile, execute immediately */
-      (*ctx->Exec->TexImage3D)( target, level, internalFormat, width,
-                               height, depth, border, format, type, pixels );
+      CALL_TexImage3D(ctx->Exec, ( target, level, internalFormat, width,
+                               height, depth, border, format, type, pixels ));
    }
    else {
       Node *n;
-      GLvoid *image = _mesa_unpack_image(width, height, depth, format, type,
-                                         pixels, &ctx->Unpack);
+      GLvoid *image = unpack_image(3, width, height, depth, format, type,
+                                   pixels, &ctx->Unpack);
       ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
       n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_IMAGE3D, 10 );
       if (n) {
@@ -3349,21 +3602,21 @@ static void save_TexImage3D( GLenum target,
          FREE(image);
       }
       if (ctx->ExecuteFlag) {
-         (*ctx->Exec->TexImage3D)( target, level, internalFormat, width,
-                                height, depth, border, format, type, pixels );
+         CALL_TexImage3D(ctx->Exec, ( target, level, internalFormat, width,
+                                height, depth, border, format, type, pixels ));
       }
    }
 }
 
 
-static void save_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
+static void GLAPIENTRY save_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
                                 GLsizei width, GLenum format, GLenum type,
                                 const GLvoid *pixels )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type,
-                                      pixels, &ctx->Unpack);
+   GLvoid *image = unpack_image(1, width, 1, 1, format, type,
+                                pixels, &ctx->Unpack);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE1D, 7 );
    if (n) {
@@ -3379,13 +3632,13 @@ static void save_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->TexSubImage1D)( target, level, xoffset, width,
-                                  format, type, pixels );
+      CALL_TexSubImage1D(ctx->Exec, ( target, level, xoffset, width,
+                                  format, type, pixels ));
    }
 }
 
 
-static void save_TexSubImage2D( GLenum target, GLint level,
+static void GLAPIENTRY save_TexSubImage2D( GLenum target, GLint level,
                                 GLint xoffset, GLint yoffset,
                                 GLsizei width, GLsizei height,
                                 GLenum format, GLenum type,
@@ -3393,8 +3646,8 @@ static void save_TexSubImage2D( GLenum target, GLint level,
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   GLvoid *image = _mesa_unpack_image(width, height, 1, format, type,
-                                      pixels, &ctx->Unpack);
+   GLvoid *image = unpack_image(2, width, height, 1, format, type,
+                                pixels, &ctx->Unpack);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE2D, 9 );
    if (n) {
@@ -3412,13 +3665,13 @@ static void save_TexSubImage2D( GLenum target, GLint level,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->TexSubImage2D)( target, level, xoffset, yoffset,
-                           width, height, format, type, pixels );
+      CALL_TexSubImage2D(ctx->Exec, ( target, level, xoffset, yoffset,
+                           width, height, format, type, pixels ));
    }
 }
 
 
-static void save_TexSubImage3D( GLenum target, GLint level,
+static void GLAPIENTRY save_TexSubImage3D( GLenum target, GLint level,
                                 GLint xoffset, GLint yoffset,GLint zoffset,
                                 GLsizei width, GLsizei height, GLsizei depth,
                                 GLenum format, GLenum type,
@@ -3426,8 +3679,8 @@ static void save_TexSubImage3D( GLenum target, GLint level,
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   GLvoid *image = _mesa_unpack_image(width, height, depth, format, type,
-                                      pixels, &ctx->Unpack);
+   GLvoid *image = unpack_image(3, width, height, depth, format, type,
+                                pixels, &ctx->Unpack);
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
    n = ALLOC_INSTRUCTION( ctx, OPCODE_TEX_SUB_IMAGE3D, 11 );
    if (n) {
@@ -3447,14 +3700,14 @@ static void save_TexSubImage3D( GLenum target, GLint level,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->TexSubImage3D)( target, level,
+      CALL_TexSubImage3D(ctx->Exec, ( target, level,
                                   xoffset, yoffset, zoffset,
-                                  width, height, depth, format, type, pixels );
+                                  width, height, depth, format, type, pixels ));
    }
 }
 
 
-static void save_Translatef( GLfloat x, GLfloat y, GLfloat z )
+static void GLAPIENTRY save_Translatef( GLfloat x, GLfloat y, GLfloat z )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3466,19 +3719,19 @@ static void save_Translatef( GLfloat x, GLfloat y, GLfloat z )
       n[3].f = z;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Translatef)( x, y, z );
+      CALL_Translatef(ctx->Exec, ( x, y, z ));
    }
 }
 
 
-static void save_Translated( GLdouble x, GLdouble y, GLdouble z )
+static void GLAPIENTRY save_Translated( GLdouble x, GLdouble y, GLdouble z )
 {
    save_Translatef((GLfloat) x, (GLfloat) y, (GLfloat) z);
 }
 
 
 
-static void save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
+static void GLAPIENTRY save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3491,17 +3744,16 @@ static void save_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
       n[4].i = (GLint) height;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->Viewport)( x, y, width, height );
+      CALL_Viewport(ctx->Exec, ( x, y, width, height ));
    }
 }
 
 
-static void save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+static void GLAPIENTRY save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   FLUSH_CURRENT(ctx, 0);
    n = ALLOC_INSTRUCTION( ctx,  OPCODE_WINDOW_POS, 4 );
    if (n) {
       n[1].f = x;
@@ -3510,123 +3762,123 @@ static void save_WindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
       n[4].f = w;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->WindowPos4fMESA)( x, y, z, w );
+      CALL_WindowPos4fMESA(ctx->Exec, ( x, y, z, w ));
    }
 }
 
-static void save_WindowPos2dMESA(GLdouble x, GLdouble y)
+static void GLAPIENTRY save_WindowPos2dMESA(GLdouble x, GLdouble y)
 {
    save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
 }
 
-static void save_WindowPos2fMESA(GLfloat x, GLfloat y)
+static void GLAPIENTRY save_WindowPos2fMESA(GLfloat x, GLfloat y)
 {
    save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
 }
 
-static void save_WindowPos2iMESA(GLint x, GLint y)
+static void GLAPIENTRY save_WindowPos2iMESA(GLint x, GLint y)
 {
    save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, 0.0F, 1.0F);
 }
 
-static void save_WindowPos2sMESA(GLshort x, GLshort y)
+static void GLAPIENTRY save_WindowPos2sMESA(GLshort x, GLshort y)
 {
    save_WindowPos4fMESA(x, y, 0.0F, 1.0F);
 }
 
-static void save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
+static void GLAPIENTRY save_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z)
 {
    save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-static void save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
+static void GLAPIENTRY save_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z)
 {
    save_WindowPos4fMESA(x, y, z, 1.0F);
 }
 
-static void save_WindowPos3iMESA(GLint x, GLint y, GLint z)
+static void GLAPIENTRY save_WindowPos3iMESA(GLint x, GLint y, GLint z)
 {
    save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F);
 }
 
-static void save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
+static void GLAPIENTRY save_WindowPos3sMESA(GLshort x, GLshort y, GLshort z)
 {
    save_WindowPos4fMESA(x, y, z, 1.0F);
 }
 
-static void save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
+static void GLAPIENTRY save_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
    save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-static void save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
+static void GLAPIENTRY save_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w)
 {
    save_WindowPos4fMESA((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w);
 }
 
-static void save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
+static void GLAPIENTRY save_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w)
 {
    save_WindowPos4fMESA(x, y, z, w);
 }
 
-static void save_WindowPos2dvMESA(const GLdouble *v)
+static void GLAPIENTRY save_WindowPos2dvMESA(const GLdouble *v)
 {
    save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-static void save_WindowPos2fvMESA(const GLfloat *v)
+static void GLAPIENTRY save_WindowPos2fvMESA(const GLfloat *v)
 {
    save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
 }
 
-static void save_WindowPos2ivMESA(const GLint *v)
+static void GLAPIENTRY save_WindowPos2ivMESA(const GLint *v)
 {
    save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F);
 }
 
-static void save_WindowPos2svMESA(const GLshort *v)
+static void GLAPIENTRY save_WindowPos2svMESA(const GLshort *v)
 {
    save_WindowPos4fMESA(v[0], v[1], 0.0F, 1.0F);
 }
 
-static void save_WindowPos3dvMESA(const GLdouble *v)
+static void GLAPIENTRY save_WindowPos3dvMESA(const GLdouble *v)
 {
    save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-static void save_WindowPos3fvMESA(const GLfloat *v)
+static void GLAPIENTRY save_WindowPos3fvMESA(const GLfloat *v)
 {
    save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
 }
 
-static void save_WindowPos3ivMESA(const GLint *v)
+static void GLAPIENTRY save_WindowPos3ivMESA(const GLint *v)
 {
    save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F);
 }
 
-static void save_WindowPos3svMESA(const GLshort *v)
+static void GLAPIENTRY save_WindowPos3svMESA(const GLshort *v)
 {
    save_WindowPos4fMESA(v[0], v[1], v[2], 1.0F);
 }
 
-static void save_WindowPos4dvMESA(const GLdouble *v)
+static void GLAPIENTRY save_WindowPos4dvMESA(const GLdouble *v)
 {
-   save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 
+   save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
                        (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-static void save_WindowPos4fvMESA(const GLfloat *v)
+static void GLAPIENTRY save_WindowPos4fvMESA(const GLfloat *v)
 {
    save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
 }
 
-static void save_WindowPos4ivMESA(const GLint *v)
+static void GLAPIENTRY save_WindowPos4ivMESA(const GLint *v)
 {
-   save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1], 
+   save_WindowPos4fMESA((GLfloat) v[0], (GLfloat) v[1],
                        (GLfloat) v[2], (GLfloat) v[3]);
 }
 
-static void save_WindowPos4svMESA(const GLshort *v)
+static void GLAPIENTRY save_WindowPos4svMESA(const GLshort *v)
 {
    save_WindowPos4fMESA(v[0], v[1], v[2], v[3]);
 }
@@ -3634,7 +3886,7 @@ static void save_WindowPos4svMESA(const GLshort *v)
 
 
 /* GL_ARB_multitexture */
-static void save_ActiveTextureARB( GLenum target )
+static void GLAPIENTRY save_ActiveTextureARB( GLenum target )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -3644,14 +3896,14 @@ static void save_ActiveTextureARB( GLenum target )
       n[1].e = target;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ActiveTextureARB)( target );
+      CALL_ActiveTextureARB(ctx->Exec, ( target ));
    }
 }
 
 
 /* GL_ARB_transpose_matrix */
 
-static void save_LoadTransposeMatrixdARB( const GLdouble m[16] )
+static void GLAPIENTRY save_LoadTransposeMatrixdARB( const GLdouble m[16] )
 {
    GLfloat tm[16];
    _math_transposefd(tm, m);
@@ -3659,7 +3911,7 @@ static void save_LoadTransposeMatrixdARB( const GLdouble m[16] )
 }
 
 
-static void save_LoadTransposeMatrixfARB( const GLfloat m[16] )
+static void GLAPIENTRY save_LoadTransposeMatrixfARB( const GLfloat m[16] )
 {
    GLfloat tm[16];
    _math_transposef(tm, m);
@@ -3667,7 +3919,7 @@ static void save_LoadTransposeMatrixfARB( const GLfloat m[16] )
 }
 
 
-static void
+static void GLAPIENTRY
 save_MultTransposeMatrixdARB( const GLdouble m[16] )
 {
    GLfloat tm[16];
@@ -3676,7 +3928,7 @@ save_MultTransposeMatrixdARB( const GLdouble m[16] )
 }
 
 
-static void
+static void GLAPIENTRY
 save_MultTransposeMatrixfARB( const GLfloat m[16] )
 {
    GLfloat tm[16];
@@ -3685,24 +3937,8 @@ save_MultTransposeMatrixfARB( const GLfloat m[16] )
 }
 
 
-static void
-save_PixelTexGenSGIX(GLenum mode)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   Node *n;
-   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 );
-   if (n) {
-      n[1].e = mode;
-   }
-   if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PixelTexGenSGIX)( mode );
-   }
-}
-
-
 /* GL_ARB_texture_compression */
-static void
+static void GLAPIENTRY
 save_CompressedTexImage1DARB(GLenum target, GLint level,
                              GLenum internalFormat, GLsizei width,
                              GLint border, GLsizei imageSize,
@@ -3711,8 +3947,8 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
    GET_CURRENT_CONTEXT(ctx);
    if (target == GL_PROXY_TEXTURE_1D) {
       /* don't compile, execute immediately */
-      (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat,
-                                            width, border, imageSize, data);
+      CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat,
+                                            width, border, imageSize, data));
    }
    else {
       Node *n;
@@ -3739,14 +3975,14 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
          FREE(image);
       }
       if (ctx->ExecuteFlag) {
-         (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat,
-                                               width, border, imageSize, data);
+         CALL_CompressedTexImage1DARB(ctx->Exec, (target, level, internalFormat,
+                                               width, border, imageSize, data));
       }
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CompressedTexImage2DARB(GLenum target, GLint level,
                              GLenum internalFormat, GLsizei width,
                              GLsizei height, GLint border, GLsizei imageSize,
@@ -3755,8 +3991,8 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
    GET_CURRENT_CONTEXT(ctx);
    if (target == GL_PROXY_TEXTURE_2D) {
       /* don't compile, execute immediately */
-      (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat,
-                                       width, height, border, imageSize, data);
+      CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat,
+                                       width, height, border, imageSize, data));
    }
    else {
       Node *n;
@@ -3784,14 +4020,14 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
          FREE(image);
       }
       if (ctx->ExecuteFlag) {
-         (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat,
-                                      width, height, border, imageSize, data);
+         CALL_CompressedTexImage2DARB(ctx->Exec, (target, level, internalFormat,
+                                      width, height, border, imageSize, data));
       }
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CompressedTexImage3DARB(GLenum target, GLint level,
                              GLenum internalFormat, GLsizei width,
                              GLsizei height, GLsizei depth, GLint border,
@@ -3800,8 +4036,8 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
    GET_CURRENT_CONTEXT(ctx);
    if (target == GL_PROXY_TEXTURE_3D) {
       /* don't compile, execute immediately */
-      (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat,
-                                width, height, depth, border, imageSize, data);
+      CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat,
+                                width, height, depth, border, imageSize, data));
    }
    else {
       Node *n;
@@ -3830,14 +4066,14 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
          FREE(image);
       }
       if (ctx->ExecuteFlag) {
-         (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat,
-                                width, height, depth, border, imageSize, data);
+         CALL_CompressedTexImage3DARB(ctx->Exec, (target, level, internalFormat,
+                                width, height, depth, border, imageSize, data));
       }
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
                                 GLsizei width, GLenum format,
                                 GLsizei imageSize, const GLvoid *data)
@@ -3869,13 +4105,13 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CompressedTexSubImage1DARB)(target, level, xoffset,
-                                            width, format, imageSize, data);
+      CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset,
+                                            width, format, imageSize, data));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
                                 GLint yoffset, GLsizei width, GLsizei height,
                                 GLenum format, GLsizei imageSize,
@@ -3910,13 +4146,13 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CompressedTexSubImage2DARB)(target, level, xoffset, yoffset,
-                                       width, height, format, imageSize, data);
+      CALL_CompressedTexSubImage2DARB(ctx->Exec, (target, level, xoffset, yoffset,
+                                       width, height, format, imageSize, data));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
                                 GLint yoffset, GLint zoffset, GLsizei width,
                                 GLsizei height, GLsizei depth, GLenum format,
@@ -3953,14 +4189,14 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
       FREE(image);
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->CompressedTexSubImage3DARB)(target, level, xoffset, yoffset,
-                       zoffset, width, height, depth, format, imageSize, data);
+      CALL_CompressedTexSubImage3DARB(ctx->Exec, (target, level, xoffset, yoffset,
+                       zoffset, width, height, depth, format, imageSize, data));
    }
 }
 
 
 /* GL_ARB_multisample */
-static void
+static void GLAPIENTRY
 save_SampleCoverageARB(GLclampf value, GLboolean invert)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -3972,56 +4208,16 @@ save_SampleCoverageARB(GLclampf value, GLboolean invert)
       n[2].b = invert;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->SampleCoverageARB)( value, invert );
-   }
-}
-
-
-/* GL_SGIS_pixel_texture */
-
-static void
-save_PixelTexGenParameteriSGIS(GLenum target, GLint value)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   Node *n;
-   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 );
-   if (n) {
-      n[1].e = target;
-      n[2].i = value;
-   }
-   if (ctx->ExecuteFlag) {
-      (*ctx->Exec->PixelTexGenParameteriSGIS)( target, value );
+      CALL_SampleCoverageARB(ctx->Exec, ( value, invert ));
    }
 }
 
 
-static void
-save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value)
-{
-   save_PixelTexGenParameteriSGIS(target, (GLint) value);
-}
-
-
-static void
-save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value)
-{
-   save_PixelTexGenParameteriSGIS(target, *value);
-}
-
-
-static void
-save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value)
-{
-   save_PixelTexGenParameteriSGIS(target, (GLint) *value);
-}
-
-
 /*
  * GL_NV_vertex_program
  */
-#if FEATURE_NV_vertex_program
-static void
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+static void GLAPIENTRY
 save_BindProgramNV(GLenum target, GLuint id)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -4033,11 +4229,13 @@ save_BindProgramNV(GLenum target, GLuint id)
       n[2].ui = id;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->BindProgramNV)( target, id );
+      CALL_BindProgramNV(ctx->Exec, ( target, id ));
    }
 }
+#endif /* FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
 
-static void
+#if FEATURE_NV_vertex_program
+static void GLAPIENTRY
 save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -4053,12 +4251,12 @@ save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params)
       n[6].f = params[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ExecuteProgramNV)(target, id, params);
+      CALL_ExecuteProgramNV(ctx->Exec, (target, id, params));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramParameter4fNV(GLenum target, GLuint index,
                           GLfloat x, GLfloat y,
                           GLfloat z, GLfloat w)
@@ -4076,12 +4274,12 @@ save_ProgramParameter4fNV(GLenum target, GLuint index,
       n[6].f = w;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ProgramParameter4fNV)(target, index, x, y, z, w);
+      CALL_ProgramParameter4fNV(ctx->Exec, (target, index, x, y, z, w));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params)
 {
    save_ProgramParameter4fNV(target, index, params[0], params[1],
@@ -4089,7 +4287,7 @@ save_ProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat *params)
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramParameter4dNV(GLenum target, GLuint index,
                           GLdouble x, GLdouble y,
                           GLdouble z, GLdouble w)
@@ -4099,7 +4297,7 @@ save_ProgramParameter4dNV(GLenum target, GLuint index,
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramParameter4dvNV(GLenum target, GLuint index,
                            const GLdouble *params)
 {
@@ -4109,7 +4307,7 @@ save_ProgramParameter4dvNV(GLenum target, GLuint index,
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramParameters4dvNV(GLenum target, GLuint index,
                             GLuint num, const GLdouble *params)
 {
@@ -4120,7 +4318,7 @@ save_ProgramParameters4dvNV(GLenum target, GLuint index,
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramParameters4fvNV(GLenum target, GLuint index,
                             GLuint num, const GLfloat *params)
 {
@@ -4131,7 +4329,7 @@ save_ProgramParameters4fvNV(GLenum target, GLuint index,
 }
 
 
-static void
+static void GLAPIENTRY
 save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
                    const GLubyte *program)
 {
@@ -4155,18 +4353,17 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
       n[4].data = programCopy;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->LoadProgramNV)(target, id, len, program);
+      CALL_LoadProgramNV(ctx->Exec, (target, id, len, program));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_RequestResidentProgramsNV(GLsizei num, const GLuint *ids)
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   GLuint *idCopy;
-   idCopy = _mesa_malloc(num * sizeof(GLuint));
+   GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
    if (!idCopy) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
       return;
@@ -4179,12 +4376,12 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint *ids)
       n[2].data = idCopy;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->RequestResidentProgramsNV)(num, ids);
+      CALL_RequestResidentProgramsNV(ctx->Exec, (num, ids));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_TrackMatrixNV(GLenum target, GLuint address,
                    GLenum matrix, GLenum transform)
 {
@@ -4199,7 +4396,7 @@ save_TrackMatrixNV(GLenum target, GLuint address,
       n[4].e = transform;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->TrackMatrixNV)(target, address, matrix, transform);
+      CALL_TrackMatrixNV(ctx->Exec, (target, address, matrix, transform));
    }
 }
 #endif /* FEATURE_NV_vertex_program */
@@ -4209,7 +4406,7 @@ save_TrackMatrixNV(GLenum target, GLuint address,
  * GL_NV_fragment_program
  */
 #if FEATURE_NV_fragment_program
-static void
+static void GLAPIENTRY
 save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
                                 GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
@@ -4226,12 +4423,12 @@ save_ProgramLocalParameter4fARB(GLenum target, GLuint index,
       n[6].f = w;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ProgramLocalParameter4fARB)(target, index, x, y, z, w);
+      CALL_ProgramLocalParameter4fARB(ctx->Exec, (target, index, x, y, z, w));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
                                  const GLfloat *params)
 {
@@ -4248,12 +4445,12 @@ save_ProgramLocalParameter4fvARB(GLenum target, GLuint index,
       n[6].f = params[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ProgramLocalParameter4fvARB)(target, index, params);
+      CALL_ProgramLocalParameter4fvARB(ctx->Exec, (target, index, params));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
                                 GLdouble x, GLdouble y,
                                 GLdouble z, GLdouble w)
@@ -4271,12 +4468,12 @@ save_ProgramLocalParameter4dARB(GLenum target, GLuint index,
       n[6].f = (GLfloat) w;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ProgramLocalParameter4dARB)(target, index, x, y, z, w);
+      CALL_ProgramLocalParameter4dARB(ctx->Exec, (target, index, x, y, z, w));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
                                  const GLdouble *params)
 {
@@ -4293,19 +4490,17 @@ save_ProgramLocalParameter4dvARB(GLenum target, GLuint index,
       n[6].f = (GLfloat) params[3];
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ProgramLocalParameter4dvARB)(target, index, params);
+      CALL_ProgramLocalParameter4dvARB(ctx->Exec, (target, index, params));
    }
 }
 
-static void
+static void GLAPIENTRY
 save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
                                GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   GLubyte *nameCopy;
-
-   nameCopy = _mesa_malloc(len);
+   GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
    if (!nameCopy) {
       _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
       return;
@@ -4324,12 +4519,12 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
       n[7].f = w;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ProgramNamedParameter4fNV)(id, len, name, x, y, z, w);
+      CALL_ProgramNamedParameter4fNV(ctx->Exec, (id, len, name, x, y, z, w));
    }
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name,
                                 const float v[])
 {
@@ -4337,7 +4532,7 @@ save_ProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte *name,
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name,
                                GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
@@ -4346,7 +4541,7 @@ save_ProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte *name,
 }
 
 
-static void
+static void GLAPIENTRY
 save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name,
                                 const double v[])
 {
@@ -4360,7 +4555,7 @@ save_ProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte *name,
 
 
 /* GL_EXT_stencil_two_side */
-static void save_ActiveStencilFaceEXT( GLenum face )
+static void GLAPIENTRY save_ActiveStencilFaceEXT( GLenum face )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
@@ -4370,111 +4565,1056 @@ static void save_ActiveStencilFaceEXT( GLenum face )
       n[1].e = face;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->ActiveStencilFaceEXT)( face );
+      CALL_ActiveStencilFaceEXT(ctx->Exec, ( face ));
    }
 }
 
 
 /* GL_EXT_depth_bounds_test */
-static void save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
+static void GLAPIENTRY save_DepthBoundsEXT( GLclampd zmin, GLclampd zmax )
 {
    GET_CURRENT_CONTEXT(ctx);
    Node *n;
    ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
-   n = ALLOC_INSTRUCTION( ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 2 );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_DEPTH_BOUNDS_EXT, 2 );
    if (n) {
       n[1].f = (GLfloat) zmin;
       n[2].f = (GLfloat) zmax;
    }
    if (ctx->ExecuteFlag) {
-      (*ctx->Exec->DepthBoundsEXT)( zmin, zmax );
+      CALL_DepthBoundsEXT(ctx->Exec, ( zmin, zmax ));
    }
 }
 
 
 
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
 
-/* KW: Compile commands
- *
- * Will appear in the list before the vertex buffer containing the
- * command that provoked the error.  I don't see this as a problem.
- */
-void
-_mesa_save_error( GLcontext *ctx, GLenum error, const char *s )
+static void GLAPIENTRY
+save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
+                      const GLvoid *string)
 {
+   GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   n = ALLOC_INSTRUCTION( ctx, OPCODE_ERROR, 2 );
+   GLubyte *programCopy;
+
+   programCopy = (GLubyte *) _mesa_malloc(len);
+   if (!programCopy) {
+      _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
+      return;
+   }
+   _mesa_memcpy(programCopy, string, len);
+
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_STRING_ARB, 4 );
    if (n) {
-      n[1].e = error;
-      n[2].data = (void *) s;
+      n[1].e = target;
+      n[2].e = format;
+      n[3].i = len;
+      n[4].data = programCopy;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_ProgramStringARB(ctx->Exec, (target, format, len, string));
    }
-   /* execute already done */
 }
 
 
-/*
- * Compile an error into current display list.
- */
-void
-_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s )
+static void GLAPIENTRY
+save_ProgramEnvParameter4fARB(GLenum target, GLuint index,
+                              GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 {
-   if (ctx->CompileFlag)
-      _mesa_save_error( ctx, error, s );
-
-   if (ctx->ExecuteFlag)
-      _mesa_error( ctx, error, s );
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6 );
+   if (n) {
+      n[1].e = target;
+      n[2].ui = index;
+      n[3].f = x;
+      n[4].f = y;
+      n[5].f = z;
+      n[6].f = w;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_ProgramEnvParameter4fARB(ctx->Exec, ( target, index, x, y, z, w));
+   }
 }
 
 
+static void GLAPIENTRY
+save_ProgramEnvParameter4fvARB(GLenum target, GLuint index,
+                               const GLfloat *params)
+{
+   save_ProgramEnvParameter4fARB(target, index, params[0], params[1],
+                                 params[2], params[3]);
+}
 
-static GLboolean
-islist(GLcontext *ctx, GLuint list)
+
+static void GLAPIENTRY
+save_ProgramEnvParameter4dARB(GLenum target, GLuint index,
+                              GLdouble x, GLdouble y, GLdouble z, GLdouble w)
 {
-   if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) {
-      return GL_TRUE;
-   }
-   else {
-      return GL_FALSE;
-   }
+   save_ProgramEnvParameter4fARB(target, index,
+                                 (GLfloat) x,
+                                 (GLfloat) y,
+                                 (GLfloat) z,
+                                 (GLfloat) w);
 }
 
 
+static void GLAPIENTRY
+save_ProgramEnvParameter4dvARB(GLenum target, GLuint index,
+                               const GLdouble *params)
+{
+   save_ProgramEnvParameter4fARB(target, index,
+                                 (GLfloat) params[0],
+                                 (GLfloat) params[1],
+                                 (GLfloat) params[2],
+                                 (GLfloat) params[3]);
+}
 
-/**********************************************************************/
-/*                     Display list execution                         */
-/**********************************************************************/
+#endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */
 
 
-/*
- * Execute a display list.  Note that the ListBase offset must have already
- * been added before calling this function.  I.e. the list argument is
- * the absolute list number, not relative to ListBase.
- * \param list - display list number
- */
-static void
-execute_list( GLcontext *ctx, GLuint list )
+#ifdef FEATURE_ARB_occlusion_query
+
+static void GLAPIENTRY
+save_BeginQueryARB(GLenum target, GLuint id)
 {
+   GET_CURRENT_CONTEXT(ctx);
    Node *n;
-   GLboolean done;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN_QUERY_ARB, 2 );
+   if (n) {
+      n[1].e = target;
+      n[2].ui = id;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_BeginQueryARB(ctx->Exec, ( target, id ));
+   }
+}
 
-   if (list == 0 || !islist(ctx,list))
-      return;
 
-   if (ctx->Driver.BeginCallList)
-      ctx->Driver.BeginCallList( ctx, list );
+static void GLAPIENTRY
+save_EndQueryARB(GLenum target)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_END_QUERY_ARB, 1 );
+   if (n) {
+      n[1].e = target;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_EndQueryARB(ctx->Exec, ( target ));
+   }
+}
+
+#endif /* FEATURE_ARB_occlusion_query */
+
+
+static void GLAPIENTRY
+save_DrawBuffersARB(GLsizei count, const GLenum *buffers)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS );
+   if (n) {
+      GLint i;
+      n[1].i = count;
+      if (count > MAX_DRAW_BUFFERS)
+        count = MAX_DRAW_BUFFERS;
+      for (i = 0; i < count; i++) {
+        n[2 + i].e = buffers[i];
+      }
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_DrawBuffersARB(ctx->Exec, (count, buffers));
+   }
+}
+
+#if FEATURE_ATI_fragment_shader
+static void GLAPIENTRY
+save_BindFragmentShaderATI(GLuint id)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1);
+   if (n) {
+     n[1].ui = id;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_BindFragmentShaderATI(ctx->Exec, (id));
+   }
+}
+
+static void GLAPIENTRY
+save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value)
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5);
+   if (n) {
+     n[1].ui = dst;
+     n[2].f = value[0];
+     n[3].f = value[1];
+     n[4].f = value[2];
+     n[5].f = value[3];
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, value));
+   }
+}
+#endif
+
+static void save_Attr1fNV( GLenum attr, GLfloat x )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F_NV, 2 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 1;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib1fNV(ctx->Exec, ( attr, x ));
+   }
+}
+
+static void save_Attr2fNV( GLenum attr, GLfloat x, GLfloat y )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F_NV, 3 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+      n[3].f = y;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 2;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib2fNV(ctx->Exec, ( attr, x, y ));
+   }
+}
+
+static void save_Attr3fNV( GLenum attr, GLfloat x, GLfloat y, GLfloat z )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F_NV, 4 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+      n[3].f = y;
+      n[4].f = z;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 3;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib3fNV(ctx->Exec, ( attr, x, y, z ));
+   }
+}
+
+static void save_Attr4fNV( GLenum attr, GLfloat x, GLfloat y, GLfloat z,
+                           GLfloat w )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F_NV, 5 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+      n[3].f = y;
+      n[4].f = z;
+      n[5].f = w;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 4;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib4fNV(ctx->Exec, ( attr, x, y, z, w ));
+   }
+}
+
+
+static void save_Attr1fARB( GLenum attr, GLfloat x )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_1F_ARB, 2 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 1;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, 0, 0, 1);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib1fARB(ctx->Exec, ( attr, x ));
+   }
+}
+
+static void save_Attr2fARB( GLenum attr, GLfloat x, GLfloat y )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_2F_ARB, 3 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+      n[3].f = y;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 2;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, 0, 1);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib2fARB(ctx->Exec, ( attr, x, y ));
+   }
+}
+
+static void save_Attr3fARB( GLenum attr, GLfloat x, GLfloat y, GLfloat z )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_3F_ARB, 4 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+      n[3].f = y;
+      n[4].f = z;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 3;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, 1);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib3fARB(ctx->Exec, ( attr, x, y, z ));
+   }
+}
+
+static void save_Attr4fARB( GLenum attr, GLfloat x, GLfloat y, GLfloat z,
+                           GLfloat w )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ATTR_4F_ARB, 5 );
+   if (n) {
+      n[1].e = attr;
+      n[2].f = x;
+      n[3].f = y;
+      n[4].f = z;
+      n[5].f = w;
+   }
+
+   ASSERT(attr < VERT_ATTRIB_MAX);
+   ctx->ListState.ActiveAttribSize[attr] = 4;
+   ASSIGN_4V( ctx->ListState.CurrentAttrib[attr], x, y, z, w);
+
+   if (ctx->ExecuteFlag) {
+      CALL_VertexAttrib4fARB(ctx->Exec, ( attr, x, y, z, w ));
+   }
+}
+
+
+static void GLAPIENTRY save_EvalCoord1f( GLfloat x )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C1, 1 );
+   if (n) {
+      n[1].f = x;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_EvalCoord1f(ctx->Exec, ( x ));
+   }
+}
+
+static void GLAPIENTRY save_EvalCoord1fv( const GLfloat *v )
+{
+   save_EvalCoord1f( v[0] );
+}
+
+static void GLAPIENTRY save_EvalCoord2f( GLfloat x, GLfloat y )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_C2, 2 );
+   if (n) {
+      n[1].f = x;
+      n[2].f = y;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_EvalCoord2f(ctx->Exec, ( x, y ));
+   }
+}
+
+static void GLAPIENTRY save_EvalCoord2fv( const GLfloat *v )
+{
+   save_EvalCoord2f( v[0], v[1] );
+}
+
+
+static void GLAPIENTRY save_EvalPoint1( GLint x )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P1, 1 );
+   if (n) {
+      n[1].i = x;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_EvalPoint1(ctx->Exec, ( x ));
+   }
+}
+
+static void GLAPIENTRY save_EvalPoint2( GLint x, GLint y )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_EVAL_P2, 2 );
+   if (n) {
+      n[1].i = x;
+      n[2].i = y;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_EvalPoint2(ctx->Exec, ( x, y ));
+   }
+}
+
+static void GLAPIENTRY save_Indexf( GLfloat x )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_INDEX, 1 );
+   if (n) {
+      n[1].f = x;
+   }
+
+   ctx->ListState.ActiveIndex = 1;
+   ctx->ListState.CurrentIndex = x;
+
+   if (ctx->ExecuteFlag) {
+      CALL_Indexi(ctx->Exec, ( (GLint) x ));
+   }
+}
+
+static void GLAPIENTRY save_Indexfv( const GLfloat *v )
+{
+   save_Indexf( v[0] );
+}
+
+static void GLAPIENTRY save_EdgeFlag( GLboolean x )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_EDGEFLAG, 1 );
+   if (n) {
+      n[1].b = x;
+   }
+
+   ctx->ListState.ActiveEdgeFlag = 1;
+   ctx->ListState.CurrentEdgeFlag = x;
+
+   if (ctx->ExecuteFlag) {
+      CALL_EdgeFlag(ctx->Exec, ( x ));
+   }
+}
+
+static void GLAPIENTRY save_EdgeFlagv( const GLboolean *v )
+{
+   save_EdgeFlag( v[0] );
+}
+
+static void GLAPIENTRY save_Materialfv( GLenum face, GLenum pname, const GLfloat *param )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   int args, i;
+
+   SAVE_FLUSH_VERTICES( ctx );
+
+   switch (face) {
+   case GL_BACK:
+   case GL_FRONT:
+   case GL_FRONT_AND_BACK:
+      break;
+   default:
+      _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(face)" );
+      return;
+   }
+
+   switch (pname) {
+   case GL_EMISSION:
+   case GL_AMBIENT:
+   case GL_DIFFUSE:
+   case GL_SPECULAR:
+   case GL_AMBIENT_AND_DIFFUSE:
+      args = 4;
+      break;
+   case GL_SHININESS:
+      args = 1;
+      break;
+   case GL_COLOR_INDEXES:
+      args = 3;
+      break;
+   default:
+      _mesa_compile_error( ctx, GL_INVALID_ENUM, "material(pname)" );
+      return;
+   }
+
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_MATERIAL, 6 );
+   if (n) {
+      n[1].e = face;
+      n[2].e = pname;
+      for (i = 0 ; i < args ; i++)
+        n[3+i].f = param[i];
+   }
+
+   {
+      GLuint bitmask = _mesa_material_bitmask( ctx, face, pname, ~0, NULL );
+      for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) 
+        if (bitmask & (1<<i)) {
+           ctx->ListState.ActiveMaterialSize[i] = args;
+           COPY_SZ_4V( ctx->ListState.CurrentMaterial[i], args, param );
+        }
+   }
+
+   if (ctx->ExecuteFlag) {
+      CALL_Materialfv(ctx->Exec, ( face, pname, param ));
+   }
+}
+
+static void GLAPIENTRY save_Begin( GLenum mode )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   GLboolean error = GL_FALSE;
+
+   if (/*mode < GL_POINTS ||*/ mode > GL_POLYGON) {
+      _mesa_compile_error( ctx, GL_INVALID_ENUM, "Begin (mode)");
+      error = GL_TRUE;
+   }
+   else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
+      /* Typically the first begin.  This may raise an error on
+       * playback, depending on whether CallList is issued from inside
+       * a begin/end or not.
+       */
+      ctx->Driver.CurrentSavePrimitive = PRIM_INSIDE_UNKNOWN_PRIM;
+   }
+   else if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) {
+      ctx->Driver.CurrentSavePrimitive = mode;
+   }
+   else {
+      _mesa_compile_error( ctx, GL_INVALID_OPERATION, "recursive begin" );
+      error = GL_TRUE;
+   }
+
+   if (!error) {
+      /* Give the driver an opportunity to hook in an optimized
+       * display list compiler.
+       */
+      if (ctx->Driver.NotifySaveBegin( ctx, mode ))
+        return;
+
+      SAVE_FLUSH_VERTICES( ctx );
+      n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN, 1 );
+      if (n) {
+        n[1].e = mode;
+      }
+   }
+
+   if (ctx->ExecuteFlag) {
+      CALL_Begin(ctx->Exec, ( mode ));
+   }
+}
+
+static void GLAPIENTRY save_End( void )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   SAVE_FLUSH_VERTICES( ctx );
+   (void) ALLOC_INSTRUCTION( ctx, OPCODE_END, 0 );
+   ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END;
+   if (ctx->ExecuteFlag) {
+      CALL_End(ctx->Exec, ( ));
+   }
+}
+
+static void GLAPIENTRY save_Rectf( GLfloat a, GLfloat b, GLfloat c, GLfloat d )
+{
+   GET_CURRENT_CONTEXT(ctx);
+   Node *n;
+   SAVE_FLUSH_VERTICES( ctx );
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_RECTF, 4 );
+   if (n) {
+      n[1].f = a;
+      n[2].f = b;
+      n[3].f = c;
+      n[4].f = d;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_Rectf(ctx->Exec, ( a, b, c, d ));
+   }
+}
+
+
+static void GLAPIENTRY save_Vertex2f( GLfloat x, GLfloat y )
+{
+   save_Attr2fNV( VERT_ATTRIB_POS, x, y );
+}
+
+static void GLAPIENTRY save_Vertex2fv( const GLfloat *v )
+{
+   save_Attr2fNV( VERT_ATTRIB_POS, v[0], v[1] );
+}
+
+static void GLAPIENTRY save_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
+{
+   save_Attr3fNV( VERT_ATTRIB_POS, x, y, z );
+}
+
+static void GLAPIENTRY save_Vertex3fv( const GLfloat *v )
+{
+   save_Attr3fNV( VERT_ATTRIB_POS, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+   save_Attr4fNV( VERT_ATTRIB_POS, x, y, z, w );
+}
+
+static void GLAPIENTRY save_Vertex4fv( const GLfloat *v )
+{
+   save_Attr4fNV( VERT_ATTRIB_POS, v[0], v[1], v[2], v[3] );
+}
+
+static void GLAPIENTRY save_TexCoord1f( GLfloat x )
+{
+   save_Attr1fNV( VERT_ATTRIB_TEX0, x );
+}
+
+static void GLAPIENTRY save_TexCoord1fv( const GLfloat *v )
+{
+   save_Attr1fNV( VERT_ATTRIB_TEX0, v[0] );
+}
+
+static void GLAPIENTRY save_TexCoord2f( GLfloat x, GLfloat y )
+{
+   save_Attr2fNV( VERT_ATTRIB_TEX0, x, y );
+}
+
+static void GLAPIENTRY save_TexCoord2fv( const GLfloat *v )
+{
+   save_Attr2fNV( VERT_ATTRIB_TEX0, v[0], v[1] );
+}
+
+static void GLAPIENTRY save_TexCoord3f( GLfloat x, GLfloat y, GLfloat z )
+{
+   save_Attr3fNV( VERT_ATTRIB_TEX0, x, y, z );
+}
+
+static void GLAPIENTRY save_TexCoord3fv( const GLfloat *v )
+{
+   save_Attr3fNV( VERT_ATTRIB_TEX0, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_TexCoord4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+   save_Attr4fNV( VERT_ATTRIB_TEX0, x, y, z, w );
+}
+
+static void GLAPIENTRY save_TexCoord4fv( const GLfloat *v )
+{
+   save_Attr4fNV( VERT_ATTRIB_TEX0, v[0], v[1], v[2], v[3] );
+}
+
+static void GLAPIENTRY save_Normal3f( GLfloat x, GLfloat y, GLfloat z )
+{
+   save_Attr3fNV( VERT_ATTRIB_NORMAL, x, y, z );
+}
+
+static void GLAPIENTRY save_Normal3fv( const GLfloat *v )
+{
+   save_Attr3fNV( VERT_ATTRIB_NORMAL, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_FogCoordfEXT( GLfloat x )
+{
+   save_Attr1fNV( VERT_ATTRIB_FOG, x );
+}
+
+static void GLAPIENTRY save_FogCoordfvEXT( const GLfloat *v )
+{
+   save_Attr1fNV( VERT_ATTRIB_FOG, v[0] );
+}
+
+static void GLAPIENTRY save_Color3f( GLfloat x, GLfloat y, GLfloat z )
+{
+   save_Attr3fNV( VERT_ATTRIB_COLOR0, x, y, z );
+}
+
+static void GLAPIENTRY save_Color3fv( const GLfloat *v )
+{
+   save_Attr3fNV( VERT_ATTRIB_COLOR0, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_Color4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+   save_Attr4fNV( VERT_ATTRIB_COLOR0, x, y, z, w );
+}
+
+static void GLAPIENTRY save_Color4fv( const GLfloat *v )
+{
+   save_Attr4fNV( VERT_ATTRIB_COLOR0, v[0], v[1], v[2], v[3] );
+}
+
+static void GLAPIENTRY save_SecondaryColor3fEXT( GLfloat x, GLfloat y, GLfloat z )
+{
+   save_Attr3fNV( VERT_ATTRIB_COLOR1, x, y, z );
+}
+
+static void GLAPIENTRY save_SecondaryColor3fvEXT( const GLfloat *v )
+{
+   save_Attr3fNV( VERT_ATTRIB_COLOR1, v[0], v[1], v[2] );
+}
+
+
+/* Just call the respective ATTR for texcoord
+ */
+static void GLAPIENTRY save_MultiTexCoord1f( GLenum target, GLfloat x  )
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr1fNV( attr, x );
+}
+
+static void GLAPIENTRY save_MultiTexCoord1fv( GLenum target, const GLfloat *v )
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr1fNV( attr, v[0] );
+}
+
+static void GLAPIENTRY save_MultiTexCoord2f( GLenum target, GLfloat x, GLfloat y )
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr2fNV( attr, x, y );
+}
+
+static void GLAPIENTRY save_MultiTexCoord2fv( GLenum target, const GLfloat *v )
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr2fNV( attr, v[0], v[1] );
+}
+
+static void GLAPIENTRY save_MultiTexCoord3f( GLenum target, GLfloat x, GLfloat y,
+                                   GLfloat z)
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr3fNV( attr, x, y, z );
+}
+
+static void GLAPIENTRY save_MultiTexCoord3fv( GLenum target, const GLfloat *v )
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr3fNV( attr, v[0], v[1], v[2] );
+}
+
+static void GLAPIENTRY save_MultiTexCoord4f( GLenum target, GLfloat x, GLfloat y,
+                                 GLfloat z, GLfloat w )
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr4fNV( attr, x, y, z, w );
+}
+
+static void GLAPIENTRY save_MultiTexCoord4fv( GLenum target, const GLfloat *v )
+{
+   GLuint attr = (target & 0x7) + VERT_ATTRIB_TEX0;
+   save_Attr4fNV( attr, v[0], v[1], v[2], v[3] );
+}
+
+
+static void enum_error( void )
+{
+   GET_CURRENT_CONTEXT( ctx );
+   _mesa_error( ctx, GL_INVALID_ENUM, "VertexAttribfNV" );
+}
+
+/* First level for NV_vertex_program:
+ *
+ * Check for errors at compile time?.
+ */
+static void GLAPIENTRY save_VertexAttrib1fNV( GLuint index, GLfloat x )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr1fNV( index, x );
+   else
+      enum_error(); 
+}
+
+static void GLAPIENTRY save_VertexAttrib1fvNV( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr1fNV( index, v[0] );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr2fNV( index, x, y );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib2fvNV( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr2fNV( index, v[0], v[1] );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, 
+                                  GLfloat z )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr3fNV( index, x, y, z );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib3fvNV( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr3fNV( index, v[0], v[1], v[2] );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y,
+                                  GLfloat z, GLfloat w )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr4fNV( index, x, y, z, w );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY save_VertexAttrib4fvNV( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr4fNV( index, v[0], v[1], v[2], v[3] );
+   else
+      enum_error();
+}
+
+
+
+
+static void GLAPIENTRY
+save_VertexAttrib1fARB( GLuint index, GLfloat x )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr1fARB( index, x );
+   else
+      enum_error(); 
+}
+
+static void GLAPIENTRY
+save_VertexAttrib1fvARB( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr1fARB( index, v[0] );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib2fARB( GLuint index, GLfloat x, GLfloat y )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr2fARB( index, x, y );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib2fvARB( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr2fARB( index, v[0], v[1] );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib3fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr3fARB( index, x, y, z );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib3fvARB( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr3fARB( index, v[0], v[1], v[2] );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib4fARB( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr4fARB( index, x, y, z, w );
+   else
+      enum_error();
+}
+
+static void GLAPIENTRY
+save_VertexAttrib4fvARB( GLuint index, const GLfloat *v )
+{
+   if (index < VERT_ATTRIB_MAX)
+      save_Attr4fARB( index, v[0], v[1], v[2], v[3] );
+   else
+      enum_error();
+}
+
+
+
+
+
+/* KW: Compile commands
+ *
+ * Will appear in the list before the vertex buffer containing the
+ * command that provoked the error.  I don't see this as a problem.
+ */
+void
+_mesa_save_error( GLcontext *ctx, GLenum error, const char *s )
+{
+   Node *n;
+   n = ALLOC_INSTRUCTION( ctx, OPCODE_ERROR, 2 );
+   if (n) {
+      n[1].e = error;
+      n[2].data = (void *) s;
+   }
+   /* execute already done */
+}
+
+
+/*
+ * Compile an error into current display list.
+ */
+void
+_mesa_compile_error( GLcontext *ctx, GLenum error, const char *s )
+{
+   if (ctx->CompileFlag)
+      _mesa_save_error( ctx, error, s );
+
+   if (ctx->ExecuteFlag)
+      _mesa_error( ctx, error, s );
+}
+
+
+
+static GLboolean
+islist(GLcontext *ctx, GLuint list)
+{
+   if (list > 0 && _mesa_HashLookup(ctx->Shared->DisplayList, list)) {
+      return GL_TRUE;
+   }
+   else {
+      return GL_FALSE;
+   }
+}
+
+
+
+/**********************************************************************/
+/*                     Display list execution                         */
+/**********************************************************************/
+
+
+/*
+ * Execute a display list.  Note that the ListBase offset must have already
+ * been added before calling this function.  I.e. the list argument is
+ * the absolute list number, not relative to ListBase.
+ * \param list - display list number
+ */
+static void GLAPIENTRY
+execute_list( GLcontext *ctx, GLuint list )
+{
+   struct mesa_display_list *dlist;
+   Node *n;
+   GLboolean done;
+
+   if (list == 0 || !islist(ctx,list))
+      return;
+
+   if (ctx->ListState.CallDepth == MAX_LIST_NESTING) {
+      /* raise an error? */
+      return;
+   }
+
+
+   dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+   if (!dlist)
+      return;
+
+   ctx->ListState.CallStack[ctx->ListState.CallDepth++] = dlist;
 
-   ctx->CallDepth++;
+   if (ctx->Driver.BeginCallList)
+      ctx->Driver.BeginCallList( ctx, dlist );
 
-   n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+   n = dlist->node;
 
    done = GL_FALSE;
    while (!done) {
       OpCode opcode = n[0].opcode;
-      int i = (int)n[0].opcode - (int)OPCODE_DRV_0;
+      int i = (int)n[0].opcode - (int)OPCODE_EXT_0;
 
-      if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) {
-        ctx->listext.opcode[i].execute(ctx, &n[1]);
-        n += ctx->listext.opcode[i].size;
+      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;
       }
       else {
         switch (opcode) {
@@ -4482,38 +5622,38 @@ execute_list( GLcontext *ctx, GLuint list )
            _mesa_error( ctx, n[1].e, (const char *) n[2].data );
            break;
          case OPCODE_ACCUM:
-           (*ctx->Exec->Accum)( n[1].e, n[2].f );
+           CALL_Accum(ctx->Exec, ( n[1].e, n[2].f ));
            break;
          case OPCODE_ALPHA_FUNC:
-           (*ctx->Exec->AlphaFunc)( n[1].e, n[2].f );
+           CALL_AlphaFunc(ctx->Exec, ( n[1].e, n[2].f ));
            break;
          case OPCODE_BIND_TEXTURE:
-            (*ctx->Exec->BindTexture)( n[1].e, n[2].ui );
+            CALL_BindTexture(ctx->Exec, ( n[1].e, n[2].ui ));
             break;
         case OPCODE_BITMAP:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->Bitmap)( (GLsizei) n[1].i, (GLsizei) n[2].i,
-                 n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data );
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_Bitmap(ctx->Exec, ( (GLsizei) n[1].i, (GLsizei) n[2].i,
+                 n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data ));
                ctx->Unpack = save;  /* restore */
             }
            break;
         case OPCODE_BLEND_COLOR:
-           (*ctx->Exec->BlendColor)( n[1].f, n[2].f, n[3].f, n[4].f );
+           CALL_BlendColor(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f ));
            break;
         case OPCODE_BLEND_EQUATION:
-           (*ctx->Exec->BlendEquation)( n[1].e );
+           CALL_BlendEquation(ctx->Exec, ( n[1].e ));
            break;
-        case OPCODE_BLEND_FUNC:
-           (*ctx->Exec->BlendFunc)( n[1].e, n[2].e );
+        case OPCODE_BLEND_EQUATION_SEPARATE:
+           CALL_BlendEquationSeparateEXT(ctx->Exec, ( n[1].e, n[2].e ));
            break;
         case OPCODE_BLEND_FUNC_SEPARATE:
-           (*ctx->Exec->BlendFuncSeparateEXT)(n[1].e, n[2].e, n[3].e, n[4].e);
+           CALL_BlendFuncSeparateEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, n[4].e));
            break;
          case OPCODE_CALL_LIST:
            /* Generated by glCallList(), don't add ListBase */
-            if (ctx->CallDepth<MAX_LIST_NESTING) {
+            if (ctx->ListState.CallDepth<MAX_LIST_NESTING) {
                execute_list( ctx, n[1].ui );
             }
             break;
@@ -4523,27 +5663,27 @@ execute_list( GLcontext *ctx, GLuint list )
                /* user specified a bad data type at compile time */
                _mesa_error(ctx, GL_INVALID_ENUM, "glCallLists(type)");
             }
-            else if (ctx->CallDepth < MAX_LIST_NESTING) {
+            else if (ctx->ListState.CallDepth < MAX_LIST_NESTING) {
                execute_list( ctx, ctx->List.ListBase + n[1].ui );
             }
             break;
         case OPCODE_CLEAR:
-           (*ctx->Exec->Clear)( n[1].bf );
+           CALL_Clear(ctx->Exec, ( n[1].bf ));
            break;
         case OPCODE_CLEAR_COLOR:
-           (*ctx->Exec->ClearColor)( n[1].f, n[2].f, n[3].f, n[4].f );
+           CALL_ClearColor(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f ));
            break;
         case OPCODE_CLEAR_ACCUM:
-           (*ctx->Exec->ClearAccum)( n[1].f, n[2].f, n[3].f, n[4].f );
+           CALL_ClearAccum(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f ));
            break;
         case OPCODE_CLEAR_DEPTH:
-           (*ctx->Exec->ClearDepth)( (GLclampd) n[1].f );
+           CALL_ClearDepth(ctx->Exec, ( (GLclampd) n[1].f ));
            break;
         case OPCODE_CLEAR_INDEX:
-           (*ctx->Exec->ClearIndex)( (GLfloat) n[1].ui );
+           CALL_ClearIndex(ctx->Exec, ( (GLfloat) n[1].ui ));
            break;
         case OPCODE_CLEAR_STENCIL:
-           (*ctx->Exec->ClearStencil)( n[1].i );
+           CALL_ClearStencil(ctx->Exec, ( n[1].i ));
            break;
          case OPCODE_CLIP_PLANE:
             {
@@ -4552,21 +5692,21 @@ execute_list( GLcontext *ctx, GLuint list )
                eq[1] = n[3].f;
                eq[2] = n[4].f;
                eq[3] = n[5].f;
-               (*ctx->Exec->ClipPlane)( n[1].e, eq );
+               CALL_ClipPlane(ctx->Exec, ( n[1].e, eq ));
             }
             break;
         case OPCODE_COLOR_MASK:
-           (*ctx->Exec->ColorMask)( n[1].b, n[2].b, n[3].b, n[4].b );
+           CALL_ColorMask(ctx->Exec, ( n[1].b, n[2].b, n[3].b, n[4].b ));
            break;
         case OPCODE_COLOR_MATERIAL:
-           (*ctx->Exec->ColorMaterial)( n[1].e, n[2].e );
+           CALL_ColorMaterial(ctx->Exec, ( n[1].e, n[2].e ));
            break;
          case OPCODE_COLOR_TABLE:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->ColorTable)( n[1].e, n[2].e, n[3].i, n[4].e,
-                                         n[5].e, n[6].data );
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_ColorTable(ctx->Exec, ( n[1].e, n[2].e, n[3].i, n[4].e,
+                                         n[5].e, n[6].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
@@ -4577,7 +5717,7 @@ execute_list( GLcontext *ctx, GLuint list )
                params[1] = n[4].f;
                params[2] = n[5].f;
                params[3] = n[6].f;
-               (*ctx->Exec->ColorTableParameterfv)( n[1].e, n[2].e, params );
+               CALL_ColorTableParameterfv(ctx->Exec, ( n[1].e, n[2].e, params ));
             }
             break;
          case OPCODE_COLOR_TABLE_PARAMETER_IV:
@@ -4587,38 +5727,38 @@ execute_list( GLcontext *ctx, GLuint list )
                params[1] = n[4].i;
                params[2] = n[5].i;
                params[3] = n[6].i;
-               (*ctx->Exec->ColorTableParameteriv)( n[1].e, n[2].e, params );
+               CALL_ColorTableParameteriv(ctx->Exec, ( n[1].e, n[2].e, params ));
             }
             break;
          case OPCODE_COLOR_SUB_TABLE:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->ColorSubTable)( n[1].e, n[2].i, n[3].i,
-                                            n[4].e, n[5].e, n[6].data );
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_ColorSubTable(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
+                                            n[4].e, n[5].e, n[6].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
          case OPCODE_CONVOLUTION_FILTER_1D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->ConvolutionFilter1D)( n[1].e, n[2].i, n[3].i,
-                                                  n[4].e, n[5].e, n[6].data );
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_ConvolutionFilter1D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
+                                                  n[4].e, n[5].e, n[6].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
          case OPCODE_CONVOLUTION_FILTER_2D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->ConvolutionFilter2D)( n[1].e, n[2].i, n[3].i,
-                                       n[4].i, n[5].e, n[6].e, n[7].data );
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_ConvolutionFilter2D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
+                                       n[4].i, n[5].e, n[6].e, n[7].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
          case OPCODE_CONVOLUTION_PARAMETER_I:
-            (*ctx->Exec->ConvolutionParameteri)( n[1].e, n[2].e, n[3].i );
+            CALL_ConvolutionParameteri(ctx->Exec, ( n[1].e, n[2].e, n[3].i ));
             break;
          case OPCODE_CONVOLUTION_PARAMETER_IV:
             {
@@ -4627,11 +5767,11 @@ execute_list( GLcontext *ctx, GLuint list )
                params[1] = n[4].i;
                params[2] = n[5].i;
                params[3] = n[6].i;
-               (*ctx->Exec->ConvolutionParameteriv)( n[1].e, n[2].e, params );
+               CALL_ConvolutionParameteriv(ctx->Exec, ( n[1].e, n[2].e, params ));
             }
             break;
          case OPCODE_CONVOLUTION_PARAMETER_F:
-            (*ctx->Exec->ConvolutionParameterf)( n[1].e, n[2].e, n[3].f );
+            CALL_ConvolutionParameterf(ctx->Exec, ( n[1].e, n[2].e, n[3].f ));
             break;
          case OPCODE_CONVOLUTION_PARAMETER_FV:
             {
@@ -4640,76 +5780,76 @@ execute_list( GLcontext *ctx, GLuint list )
                params[1] = n[4].f;
                params[2] = n[5].f;
                params[3] = n[6].f;
-               (*ctx->Exec->ConvolutionParameterfv)( n[1].e, n[2].e, params );
+               CALL_ConvolutionParameterfv(ctx->Exec, ( n[1].e, n[2].e, params ));
             }
             break;
          case OPCODE_COPY_COLOR_SUB_TABLE:
-            (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i,
-                                             n[3].i, n[4].i, n[5].i );
+            CALL_CopyColorSubTable(ctx->Exec, ( n[1].e, n[2].i,
+                                             n[3].i, n[4].i, n[5].i ));
             break;
          case OPCODE_COPY_COLOR_TABLE:
-            (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i,
-                                             n[3].i, n[4].i, n[5].i );
+            CALL_CopyColorSubTable(ctx->Exec, ( n[1].e, n[2].i,
+                                             n[3].i, n[4].i, n[5].i ));
             break;
         case OPCODE_COPY_PIXELS:
-           (*ctx->Exec->CopyPixels)( n[1].i, n[2].i,
-                          (GLsizei) n[3].i, (GLsizei) n[4].i, n[5].e );
+           CALL_CopyPixels(ctx->Exec, ( n[1].i, n[2].i,
+                          (GLsizei) n[3].i, (GLsizei) n[4].i, n[5].e ));
            break;
          case OPCODE_COPY_TEX_IMAGE1D:
-           (*ctx->Exec->CopyTexImage1D)( n[1].e, n[2].i, n[3].e, n[4].i,
-                                         n[5].i, n[6].i, n[7].i );
+           CALL_CopyTexImage1D(ctx->Exec, ( n[1].e, n[2].i, n[3].e, n[4].i,
+                                         n[5].i, n[6].i, n[7].i ));
             break;
          case OPCODE_COPY_TEX_IMAGE2D:
-           (*ctx->Exec->CopyTexImage2D)( n[1].e, n[2].i, n[3].e, n[4].i,
-                                         n[5].i, n[6].i, n[7].i, n[8].i );
+           CALL_CopyTexImage2D(ctx->Exec, ( n[1].e, n[2].i, n[3].e, n[4].i,
+                                         n[5].i, n[6].i, n[7].i, n[8].i ));
             break;
          case OPCODE_COPY_TEX_SUB_IMAGE1D:
-           (*ctx->Exec->CopyTexSubImage1D)( n[1].e, n[2].i, n[3].i,
-                                            n[4].i, n[5].i, n[6].i );
+           CALL_CopyTexSubImage1D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
+                                            n[4].i, n[5].i, n[6].i ));
             break;
          case OPCODE_COPY_TEX_SUB_IMAGE2D:
-           (*ctx->Exec->CopyTexSubImage2D)( n[1].e, n[2].i, n[3].i,
-                                     n[4].i, n[5].i, n[6].i, n[7].i, n[8].i );
+           CALL_CopyTexSubImage2D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
+                                     n[4].i, n[5].i, n[6].i, n[7].i, n[8].i ));
             break;
          case OPCODE_COPY_TEX_SUB_IMAGE3D:
-            (*ctx->Exec->CopyTexSubImage3D)( n[1].e, n[2].i, n[3].i,
-                            n[4].i, n[5].i, n[6].i, n[7].i, n[8].i , n[9].i);
+            CALL_CopyTexSubImage3D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
+                            n[4].i, n[5].i, n[6].i, n[7].i, n[8].i , n[9].i));
             break;
         case OPCODE_CULL_FACE:
-           (*ctx->Exec->CullFace)( n[1].e );
+           CALL_CullFace(ctx->Exec, ( n[1].e ));
            break;
         case OPCODE_DEPTH_FUNC:
-           (*ctx->Exec->DepthFunc)( n[1].e );
+           CALL_DepthFunc(ctx->Exec, ( n[1].e ));
            break;
         case OPCODE_DEPTH_MASK:
-           (*ctx->Exec->DepthMask)( n[1].b );
+           CALL_DepthMask(ctx->Exec, ( n[1].b ));
            break;
         case OPCODE_DEPTH_RANGE:
-           (*ctx->Exec->DepthRange)( (GLclampd) n[1].f, (GLclampd) n[2].f );
+           CALL_DepthRange(ctx->Exec, ( (GLclampd) n[1].f, (GLclampd) n[2].f ));
            break;
         case OPCODE_DISABLE:
-           (*ctx->Exec->Disable)( n[1].e );
+           CALL_Disable(ctx->Exec, ( n[1].e ));
            break;
         case OPCODE_DRAW_BUFFER:
-           (*ctx->Exec->DrawBuffer)( n[1].e );
+           CALL_DrawBuffer(ctx->Exec, ( n[1].e ));
            break;
         case OPCODE_DRAW_PIXELS:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->DrawPixels)( n[1].i, n[2].i, n[3].e, n[4].e,
-                                        n[5].data );
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_DrawPixels(ctx->Exec, ( n[1].i, n[2].i, n[3].e, n[4].e,
+                                        n[5].data ));
                ctx->Unpack = save;  /* restore */
             }
            break;
         case OPCODE_ENABLE:
-           (*ctx->Exec->Enable)( n[1].e );
+           CALL_Enable(ctx->Exec, ( n[1].e ));
            break;
         case OPCODE_EVALMESH1:
-           (*ctx->Exec->EvalMesh1)( n[1].e, n[2].i, n[3].i );
+           CALL_EvalMesh1(ctx->Exec, ( n[1].e, n[2].i, n[3].i ));
            break;
         case OPCODE_EVALMESH2:
-           (*ctx->Exec->EvalMesh2)( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i );
+           CALL_EvalMesh2(ctx->Exec, ( n[1].e, n[2].i, n[3].i, n[4].i, n[5].i ));
            break;
         case OPCODE_FOG:
            {
@@ -4718,26 +5858,26 @@ execute_list( GLcontext *ctx, GLuint list )
               p[1] = n[3].f;
               p[2] = n[4].f;
               p[3] = n[5].f;
-              (*ctx->Exec->Fogfv)( n[1].e, p );
+              CALL_Fogfv(ctx->Exec, ( n[1].e, p ));
            }
            break;
         case OPCODE_FRONT_FACE:
-           (*ctx->Exec->FrontFace)( n[1].e );
+           CALL_FrontFace(ctx->Exec, ( n[1].e ));
            break;
          case OPCODE_FRUSTUM:
-            (*ctx->Exec->Frustum)( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
+            CALL_Frustum(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ));
             break;
         case OPCODE_HINT:
-           (*ctx->Exec->Hint)( n[1].e, n[2].e );
+           CALL_Hint(ctx->Exec, ( n[1].e, n[2].e ));
            break;
         case OPCODE_HISTOGRAM:
-           (*ctx->Exec->Histogram)( n[1].e, n[2].i, n[3].e, n[4].b );
+           CALL_Histogram(ctx->Exec, ( n[1].e, n[2].i, n[3].e, n[4].b ));
            break;
         case OPCODE_INDEX_MASK:
-           (*ctx->Exec->IndexMask)( n[1].ui );
+           CALL_IndexMask(ctx->Exec, ( n[1].ui ));
            break;
         case OPCODE_INIT_NAMES:
-           (*ctx->Exec->InitNames)();
+           CALL_InitNames(ctx->Exec, ());
            break;
          case OPCODE_LIGHT:
            {
@@ -4746,7 +5886,7 @@ execute_list( GLcontext *ctx, GLuint list )
               p[1] = n[4].f;
               p[2] = n[5].f;
               p[3] = n[6].f;
-              (*ctx->Exec->Lightfv)( n[1].e, n[2].e, p );
+              CALL_Lightfv(ctx->Exec, ( n[1].e, n[2].e, p ));
            }
            break;
          case OPCODE_LIGHT_MODEL:
@@ -4756,24 +5896,24 @@ execute_list( GLcontext *ctx, GLuint list )
               p[1] = n[3].f;
               p[2] = n[4].f;
               p[3] = n[5].f;
-              (*ctx->Exec->LightModelfv)( n[1].e, p );
+              CALL_LightModelfv(ctx->Exec, ( n[1].e, p ));
            }
            break;
         case OPCODE_LINE_STIPPLE:
-           (*ctx->Exec->LineStipple)( n[1].i, n[2].us );
+           CALL_LineStipple(ctx->Exec, ( n[1].i, n[2].us ));
            break;
         case OPCODE_LINE_WIDTH:
-           (*ctx->Exec->LineWidth)( n[1].f );
+           CALL_LineWidth(ctx->Exec, ( n[1].f ));
            break;
         case OPCODE_LIST_BASE:
-           (*ctx->Exec->ListBase)( n[1].ui );
+           CALL_ListBase(ctx->Exec, ( n[1].ui ));
            break;
         case OPCODE_LOAD_IDENTITY:
-            (*ctx->Exec->LoadIdentity)();
+            CALL_LoadIdentity(ctx->Exec, ());
             break;
         case OPCODE_LOAD_MATRIX:
            if (sizeof(Node)==sizeof(GLfloat)) {
-              (*ctx->Exec->LoadMatrixf)( &n[1].f );
+              CALL_LoadMatrixf(ctx->Exec, ( &n[1].f ));
            }
            else {
               GLfloat m[16];
@@ -4781,14 +5921,14 @@ execute_list( GLcontext *ctx, GLuint list )
               for (i=0;i<16;i++) {
                  m[i] = n[1+i].f;
               }
-              (*ctx->Exec->LoadMatrixf)( m );
+              CALL_LoadMatrixf(ctx->Exec, ( m ));
            }
            break;
         case OPCODE_LOAD_NAME:
-           (*ctx->Exec->LoadName)( n[1].ui );
+           CALL_LoadName(ctx->Exec, ( n[1].ui ));
            break;
         case OPCODE_LOGIC_OP:
-           (*ctx->Exec->LogicOp)( n[1].e );
+           CALL_LogicOp(ctx->Exec, ( n[1].e ));
            break;
         case OPCODE_MAP1:
             {
@@ -4797,8 +5937,8 @@ execute_list( GLcontext *ctx, GLuint list )
                GLint uorder = n[5].i;
                GLfloat u1 = n[2].f;
                GLfloat u2 = n[3].f;
-               (*ctx->Exec->Map1f)( target, u1, u2, ustride, uorder,
-                                   (GLfloat *) n[6].data );
+               CALL_Map1f(ctx->Exec, ( target, u1, u2, ustride, uorder,
+                                   (GLfloat *) n[6].data ));
             }
            break;
         case OPCODE_MAP2:
@@ -4812,26 +5952,26 @@ execute_list( GLcontext *ctx, GLuint list )
                GLint vstride = n[7].i;
                GLint uorder = n[8].i;
                GLint vorder = n[9].i;
-               (*ctx->Exec->Map2f)( target, u1, u2, ustride, uorder,
+               CALL_Map2f(ctx->Exec, ( target, u1, u2, ustride, uorder,
                                    v1, v2, vstride, vorder,
-                                   (GLfloat *) n[10].data );
+                                   (GLfloat *) n[10].data ));
             }
            break;
         case OPCODE_MAPGRID1:
-           (*ctx->Exec->MapGrid1f)( n[1].i, n[2].f, n[3].f );
+           CALL_MapGrid1f(ctx->Exec, ( n[1].i, n[2].f, n[3].f ));
            break;
         case OPCODE_MAPGRID2:
-           (*ctx->Exec->MapGrid2f)( n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f);
+           CALL_MapGrid2f(ctx->Exec, ( n[1].i, n[2].f, n[3].f, n[4].i, n[5].f, n[6].f));
            break;
          case OPCODE_MATRIX_MODE:
-            (*ctx->Exec->MatrixMode)( n[1].e );
+            CALL_MatrixMode(ctx->Exec, ( n[1].e ));
             break;
          case OPCODE_MIN_MAX:
-            (*ctx->Exec->Minmax)(n[1].e, n[2].e, n[3].b);
+            CALL_Minmax(ctx->Exec, (n[1].e, n[2].e, n[3].b));
             break;
         case OPCODE_MULT_MATRIX:
            if (sizeof(Node)==sizeof(GLfloat)) {
-              (*ctx->Exec->MultMatrixf)( &n[1].f );
+              CALL_MultMatrixf(ctx->Exec, ( &n[1].f ));
            }
            else {
               GLfloat m[16];
@@ -4839,26 +5979,26 @@ execute_list( GLcontext *ctx, GLuint list )
               for (i=0;i<16;i++) {
                  m[i] = n[1+i].f;
               }
-              (*ctx->Exec->MultMatrixf)( m );
+              CALL_MultMatrixf(ctx->Exec, ( m ));
            }
            break;
          case OPCODE_ORTHO:
-            (*ctx->Exec->Ortho)( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f );
+            CALL_Ortho(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f, n[5].f, n[6].f ));
             break;
         case OPCODE_PASSTHROUGH:
-           (*ctx->Exec->PassThrough)( n[1].f );
+           CALL_PassThrough(ctx->Exec, ( n[1].f ));
            break;
         case OPCODE_PIXEL_MAP:
-           (*ctx->Exec->PixelMapfv)( n[1].e, n[2].i, (GLfloat *) n[3].data );
+           CALL_PixelMapfv(ctx->Exec, ( n[1].e, n[2].i, (GLfloat *) n[3].data ));
            break;
         case OPCODE_PIXEL_TRANSFER:
-           (*ctx->Exec->PixelTransferf)( n[1].e, n[2].f );
+           CALL_PixelTransferf(ctx->Exec, ( n[1].e, n[2].f ));
            break;
         case OPCODE_PIXEL_ZOOM:
-           (*ctx->Exec->PixelZoom)( n[1].f, n[2].f );
+           CALL_PixelZoom(ctx->Exec, ( n[1].f, n[2].f ));
            break;
         case OPCODE_POINT_SIZE:
-           (*ctx->Exec->PointSize)( n[1].f );
+           CALL_PointSize(ctx->Exec, ( n[1].f ));
            break;
         case OPCODE_POINT_PARAMETERS:
            {
@@ -4866,71 +6006,80 @@ execute_list( GLcontext *ctx, GLuint list )
                params[0] = n[2].f;
                params[1] = n[3].f;
                params[2] = n[4].f;
-               (*ctx->Exec->PointParameterfvEXT)( n[1].e, params );
+               CALL_PointParameterfvEXT(ctx->Exec, ( n[1].e, params ));
            }
            break;
         case OPCODE_POLYGON_MODE:
-           (*ctx->Exec->PolygonMode)( n[1].e, n[2].e );
+           CALL_PolygonMode(ctx->Exec, ( n[1].e, n[2].e ));
            break;
         case OPCODE_POLYGON_STIPPLE:
-           (*ctx->Exec->PolygonStipple)( (GLubyte *) n[1].data );
+           CALL_PolygonStipple(ctx->Exec, ( (GLubyte *) n[1].data ));
            break;
         case OPCODE_POLYGON_OFFSET:
-           (*ctx->Exec->PolygonOffset)( n[1].f, n[2].f );
+           CALL_PolygonOffset(ctx->Exec, ( n[1].f, n[2].f ));
            break;
         case OPCODE_POP_ATTRIB:
-           (*ctx->Exec->PopAttrib)();
+           CALL_PopAttrib(ctx->Exec, ());
            break;
         case OPCODE_POP_MATRIX:
-           (*ctx->Exec->PopMatrix)();
+           CALL_PopMatrix(ctx->Exec, ());
            break;
         case OPCODE_POP_NAME:
-           (*ctx->Exec->PopName)();
+           CALL_PopName(ctx->Exec, ());
            break;
         case OPCODE_PRIORITIZE_TEXTURE:
-            (*ctx->Exec->PrioritizeTextures)( 1, &n[1].ui, &n[2].f );
+            CALL_PrioritizeTextures(ctx->Exec, ( 1, &n[1].ui, &n[2].f ));
            break;
         case OPCODE_PUSH_ATTRIB:
-           (*ctx->Exec->PushAttrib)( n[1].bf );
+           CALL_PushAttrib(ctx->Exec, ( n[1].bf ));
            break;
         case OPCODE_PUSH_MATRIX:
-           (*ctx->Exec->PushMatrix)();
+           CALL_PushMatrix(ctx->Exec, ());
            break;
         case OPCODE_PUSH_NAME:
-           (*ctx->Exec->PushName)( n[1].ui );
+           CALL_PushName(ctx->Exec, ( n[1].ui ));
            break;
         case OPCODE_RASTER_POS:
-            (*ctx->Exec->RasterPos4f)( n[1].f, n[2].f, n[3].f, n[4].f );
+            CALL_RasterPos4f(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f ));
            break;
         case OPCODE_READ_BUFFER:
-           (*ctx->Exec->ReadBuffer)( n[1].e );
+           CALL_ReadBuffer(ctx->Exec, ( n[1].e ));
            break;
          case OPCODE_RESET_HISTOGRAM:
-            (*ctx->Exec->ResetHistogram)( n[1].e );
+            CALL_ResetHistogram(ctx->Exec, ( n[1].e ));
             break;
          case OPCODE_RESET_MIN_MAX:
-            (*ctx->Exec->ResetMinmax)( n[1].e );
+            CALL_ResetMinmax(ctx->Exec, ( n[1].e ));
             break;
          case OPCODE_ROTATE:
-            (*ctx->Exec->Rotatef)( n[1].f, n[2].f, n[3].f, n[4].f );
+            CALL_Rotatef(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f ));
             break;
          case OPCODE_SCALE:
-            (*ctx->Exec->Scalef)( n[1].f, n[2].f, n[3].f );
+            CALL_Scalef(ctx->Exec, ( n[1].f, n[2].f, n[3].f ));
             break;
         case OPCODE_SCISSOR:
-           (*ctx->Exec->Scissor)( n[1].i, n[2].i, n[3].i, n[4].i );
+           CALL_Scissor(ctx->Exec, ( n[1].i, n[2].i, n[3].i, n[4].i ));
            break;
         case OPCODE_SHADE_MODEL:
-           (*ctx->Exec->ShadeModel)( n[1].e );
+           CALL_ShadeModel(ctx->Exec, ( n[1].e ));
            break;
         case OPCODE_STENCIL_FUNC:
-           (*ctx->Exec->StencilFunc)( n[1].e, n[2].i, n[3].ui );
+           CALL_StencilFunc(ctx->Exec, ( n[1].e, n[2].i, n[3].ui ));
            break;
         case OPCODE_STENCIL_MASK:
-           (*ctx->Exec->StencilMask)( n[1].ui );
+           CALL_StencilMask(ctx->Exec, ( n[1].ui ));
            break;
         case OPCODE_STENCIL_OP:
-           (*ctx->Exec->StencilOp)( n[1].e, n[2].e, n[3].e );
+           CALL_StencilOp(ctx->Exec, ( n[1].e, n[2].e, n[3].e ));
+           break;
+        case OPCODE_STENCIL_FUNC_SEPARATE:
+           CALL_StencilFuncSeparate(ctx->Exec, ( n[1].e, n[2].e, n[3].i, n[4].ui ));
+           break;
+        case OPCODE_STENCIL_MASK_SEPARATE:
+           CALL_StencilMaskSeparate(ctx->Exec, ( n[1].e, n[2].ui ));
+           break;
+        case OPCODE_STENCIL_OP_SEPARATE:
+           CALL_StencilOpSeparate(ctx->Exec, ( n[1].e, n[2].e, n[3].e, n[4].e ));
            break;
          case OPCODE_TEXENV:
             {
@@ -4939,7 +6088,7 @@ execute_list( GLcontext *ctx, GLuint list )
                params[1] = n[4].f;
                params[2] = n[5].f;
                params[3] = n[6].f;
-               (*ctx->Exec->TexEnvfv)( n[1].e, n[2].e, params );
+               CALL_TexEnvfv(ctx->Exec, ( n[1].e, n[2].e, params ));
             }
             break;
          case OPCODE_TEXGEN:
@@ -4949,7 +6098,7 @@ execute_list( GLcontext *ctx, GLuint list )
                params[1] = n[4].f;
                params[2] = n[5].f;
                params[3] = n[6].f;
-               (*ctx->Exec->TexGenfv)( n[1].e, n[2].e, params );
+               CALL_TexGenfv(ctx->Exec, ( n[1].e, n[2].e, params ));
             }
             break;
          case OPCODE_TEXPARAMETER:
@@ -4959,14 +6108,14 @@ execute_list( GLcontext *ctx, GLuint list )
                params[1] = n[4].f;
                params[2] = n[5].f;
                params[3] = n[6].f;
-               (*ctx->Exec->TexParameterfv)( n[1].e, n[2].e, params );
+               CALL_TexParameterfv(ctx->Exec, ( n[1].e, n[2].e, params ));
             }
             break;
         case OPCODE_TEX_IMAGE1D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->TexImage1D)(
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_TexImage1D(ctx->Exec, (
                                         n[1].e, /* target */
                                         n[2].i, /* level */
                                         n[3].i, /* components */
@@ -4974,15 +6123,15 @@ execute_list( GLcontext *ctx, GLuint list )
                                         n[5].e, /* border */
                                         n[6].e, /* format */
                                         n[7].e, /* type */
-                                        n[8].data );
+                                        n[8].data ));
                ctx->Unpack = save;  /* restore */
             }
            break;
         case OPCODE_TEX_IMAGE2D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->TexImage2D)(
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_TexImage2D(ctx->Exec, (
                                         n[1].e, /* target */
                                         n[2].i, /* level */
                                         n[3].i, /* components */
@@ -4991,15 +6140,15 @@ execute_list( GLcontext *ctx, GLuint list )
                                         n[6].e, /* border */
                                         n[7].e, /* format */
                                         n[8].e, /* type */
-                                        n[9].data );
+                                        n[9].data ));
                ctx->Unpack = save;  /* restore */
             }
            break;
          case OPCODE_TEX_IMAGE3D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->TexImage3D)(
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_TexImage3D(ctx->Exec, (
                                         n[1].e, /* target */
                                         n[2].i, /* level */
                                         n[3].i, /* components */
@@ -5009,95 +6158,91 @@ execute_list( GLcontext *ctx, GLuint list )
                                         n[7].e, /* border */
                                         n[8].e, /* format */
                                         n[9].e, /* type */
-                                        n[10].data );
+                                        n[10].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
          case OPCODE_TEX_SUB_IMAGE1D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->TexSubImage1D)( n[1].e, n[2].i, n[3].i,
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_TexSubImage1D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
                                            n[4].i, n[5].e,
-                                           n[6].e, n[7].data );
+                                           n[6].e, n[7].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
          case OPCODE_TEX_SUB_IMAGE2D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->TexSubImage2D)( n[1].e, n[2].i, n[3].i,
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_TexSubImage2D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
                                            n[4].i, n[5].e,
-                                           n[6].i, n[7].e, n[8].e, n[9].data );
+                                           n[6].i, n[7].e, n[8].e, n[9].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
          case OPCODE_TEX_SUB_IMAGE3D:
             {
-               struct gl_pixelstore_attrib save = ctx->Unpack;
-               ctx->Unpack = _mesa_native_packing;
-               (*ctx->Exec->TexSubImage3D)( n[1].e, n[2].i, n[3].i,
+               const struct gl_pixelstore_attrib save = ctx->Unpack;
+               ctx->Unpack = ctx->DefaultPacking;
+               CALL_TexSubImage3D(ctx->Exec, ( n[1].e, n[2].i, n[3].i,
                                            n[4].i, n[5].i, n[6].i, n[7].i,
                                            n[8].i, n[9].e, n[10].e,
-                                           n[11].data );
+                                           n[11].data ));
                ctx->Unpack = save;  /* restore */
             }
             break;
          case OPCODE_TRANSLATE:
-            (*ctx->Exec->Translatef)( n[1].f, n[2].f, n[3].f );
+            CALL_Translatef(ctx->Exec, ( n[1].f, n[2].f, n[3].f ));
             break;
         case OPCODE_VIEWPORT:
-           (*ctx->Exec->Viewport)(n[1].i, n[2].i,
-                                  (GLsizei) n[3].i, (GLsizei) n[4].i);
+           CALL_Viewport(ctx->Exec, (n[1].i, n[2].i,
+                                  (GLsizei) n[3].i, (GLsizei) n[4].i));
            break;
         case OPCODE_WINDOW_POS:
-            (*ctx->Exec->WindowPos4fMESA)( n[1].f, n[2].f, n[3].f, n[4].f );
+            CALL_WindowPos4fMESA(ctx->Exec, ( n[1].f, n[2].f, n[3].f, n[4].f ));
            break;
          case OPCODE_ACTIVE_TEXTURE:  /* GL_ARB_multitexture */
-            (*ctx->Exec->ActiveTextureARB)( n[1].e );
-            break;
-         case OPCODE_PIXEL_TEXGEN_SGIX:  /* GL_SGIX_pixel_texture */
-            (*ctx->Exec->PixelTexGenSGIX)( n[1].e );
-            break;
-         case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS:  /* GL_SGIS_pixel_texture */
-            (*ctx->Exec->PixelTexGenParameteriSGIS)( n[1].e, n[2].i );
+            CALL_ActiveTextureARB(ctx->Exec, ( n[1].e ));
             break;
          case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */
-            (*ctx->Exec->CompressedTexImage1DARB)(n[1].e, n[2].i, n[3].e,
-                                            n[4].i, n[5].i, n[6].i, n[7].data);
+            CALL_CompressedTexImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
+                                            n[4].i, n[5].i, n[6].i, n[7].data));
             break;
          case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */
-            (*ctx->Exec->CompressedTexImage2DARB)(n[1].e, n[2].i, n[3].e,
-                                    n[4].i, n[5].i, n[6].i, n[7].i, n[8].data);
+            CALL_CompressedTexImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
+                                    n[4].i, n[5].i, n[6].i, n[7].i, n[8].data));
             break;
          case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */
-            (*ctx->Exec->CompressedTexImage3DARB)(n[1].e, n[2].i, n[3].e,
-                            n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].data);
+            CALL_CompressedTexImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].e,
+                            n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].data));
             break;
          case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */
-            (*ctx->Exec->CompressedTexSubImage1DARB)(n[1].e, n[2].i, n[3].i,
-                                            n[4].i, n[5].e, n[6].i, n[7].data);
+            CALL_CompressedTexSubImage1DARB(ctx->Exec, (n[1].e, n[2].i, n[3].i,
+                                            n[4].i, n[5].e, n[6].i, n[7].data));
             break;
          case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */
-            (*ctx->Exec->CompressedTexSubImage2DARB)(n[1].e, n[2].i, n[3].i,
-                            n[4].i, n[5].i, n[6].i, n[7].e, n[8].i, n[9].data);
+            CALL_CompressedTexSubImage2DARB(ctx->Exec, (n[1].e, n[2].i, n[3].i,
+                            n[4].i, n[5].i, n[6].i, n[7].e, n[8].i, n[9].data));
             break;
          case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */
-            (*ctx->Exec->CompressedTexSubImage3DARB)(n[1].e, n[2].i, n[3].i,
+            CALL_CompressedTexSubImage3DARB(ctx->Exec, (n[1].e, n[2].i, n[3].i,
                                         n[4].i, n[5].i, n[6].i, n[7].i, n[8].i,
-                                        n[9].e, n[10].i, n[11].data);
+                                        n[9].e, n[10].i, n[11].data));
             break;
          case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
-            (*ctx->Exec->SampleCoverageARB)(n[1].f, n[2].b);
+            CALL_SampleCoverageARB(ctx->Exec, (n[1].f, n[2].b));
             break;
         case OPCODE_WINDOW_POS_ARB: /* GL_ARB_window_pos */
-            (*ctx->Exec->WindowPos3fMESA)( n[1].f, n[2].f, n[3].f );
+            CALL_WindowPos3fMESA(ctx->Exec, ( n[1].f, n[2].f, n[3].f ));
            break;
-#if FEATURE_NV_vertex_program
+#if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
          case OPCODE_BIND_PROGRAM_NV: /* GL_NV_vertex_program */
-            (*ctx->Exec->BindProgramNV)( n[1].e, n[2].ui );
+            CALL_BindProgramNV(ctx->Exec, ( n[1].e, n[2].ui ));
             break;
+#endif
+#if FEATURE_NV_vertex_program
          case OPCODE_EXECUTE_PROGRAM_NV:
             {
                GLfloat v[4];
@@ -5105,41 +6250,185 @@ execute_list( GLcontext *ctx, GLuint list )
                v[1] = n[4].f;
                v[2] = n[5].f;
                v[3] = n[6].f;
-               (*ctx->Exec->ExecuteProgramNV)(n[1].e, n[2].ui, v);
+               CALL_ExecuteProgramNV(ctx->Exec, (n[1].e, n[2].ui, v));
             }
             break;
          case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
-            (*ctx->Exec->RequestResidentProgramsNV)(n[1].ui, n[2].data);
+            CALL_RequestResidentProgramsNV(ctx->Exec, (n[1].ui,
+                                                    (GLuint *) n[2].data));
             break;
          case OPCODE_LOAD_PROGRAM_NV:
-            (*ctx->Exec->LoadProgramNV)(n[1].e, n[2].ui, n[3].i, n[4].data);
+            CALL_LoadProgramNV(ctx->Exec, (n[1].e, n[2].ui, n[3].i,
+                                        (const GLubyte *) n[4].data));
             break;
          case OPCODE_PROGRAM_PARAMETER4F_NV:
-            (*ctx->Exec->ProgramParameter4fNV)(n[1].e, n[2].ui, n[3].f,
-                                               n[4].f, n[5].f, n[6].f);
+            CALL_ProgramParameter4fNV(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
+                                               n[4].f, n[5].f, n[6].f));
             break;
          case OPCODE_TRACK_MATRIX_NV:
-            (*ctx->Exec->TrackMatrixNV)(n[1].e, n[2].ui, n[3].e, n[4].e);
+            CALL_TrackMatrixNV(ctx->Exec, (n[1].e, n[2].ui, n[3].e, n[4].e));
             break;
 #endif
 
 #if FEATURE_NV_fragment_program
          case OPCODE_PROGRAM_LOCAL_PARAMETER_ARB:
-            (*ctx->Exec->ProgramLocalParameter4fARB)(n[1].e, n[2].ui, n[3].f,
-                                                     n[4].f, n[5].f, n[6].f);
+            CALL_ProgramLocalParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
+                                                     n[4].f, n[5].f, n[6].f));
             break;
          case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
-            (*ctx->Exec->ProgramNamedParameter4fNV)(n[1].ui, n[2].i, n[3].data,
-                                               n[4].f, n[5].f, n[6].f, n[7].f);
+            CALL_ProgramNamedParameter4fNV(ctx->Exec, (n[1].ui, n[2].i,
+                                               (const GLubyte *) n[3].data,
+                                               n[4].f, n[5].f, n[6].f, n[7].f));
             break;
 #endif
 
          case OPCODE_ACTIVE_STENCIL_FACE_EXT:
-            (*ctx->Exec->ActiveStencilFaceEXT)(n[1].e);
+            CALL_ActiveStencilFaceEXT(ctx->Exec, (n[1].e));
             break;
          case OPCODE_DEPTH_BOUNDS_EXT:
-            (*ctx->Exec->DepthBoundsEXT)(n[1].f, n[2].f);
+            CALL_DepthBoundsEXT(ctx->Exec, (n[1].f, n[2].f));
+            break;
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+         case OPCODE_PROGRAM_STRING_ARB:
+            CALL_ProgramStringARB(ctx->Exec, (n[1].e, n[2].e, n[3].i, n[4].data));
+            break;
+         case OPCODE_PROGRAM_ENV_PARAMETER_ARB:
+            CALL_ProgramEnvParameter4fARB(ctx->Exec, (n[1].e, n[2].ui, n[3].f,
+                                                   n[4].f, n[5].f, n[6].f));
+            break;
+#endif
+#if FEATURE_ARB_occlusion_query
+         case OPCODE_BEGIN_QUERY_ARB:
+            CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui));
+            break;
+         case OPCODE_END_QUERY_ARB:
+            CALL_EndQueryARB(ctx->Exec, (n[1].e));
+            break;
+#endif
+         case OPCODE_DRAW_BUFFERS_ARB:
+           {
+              GLenum buffers[MAX_DRAW_BUFFERS];
+              GLint i, count = MIN2(n[1].i, MAX_DRAW_BUFFERS);
+              for (i = 0; i < count; i++)
+                 buffers[i] = n[2 + i].e;
+              CALL_DrawBuffersARB(ctx->Exec, (n[1].i, buffers));
+           }
             break;
+#if FEATURE_ATI_fragment_shader
+        case OPCODE_BIND_FRAGMENT_SHADER_ATI:
+           CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
+           break;
+        case OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI: 
+           {
+              GLfloat values[4];
+              GLuint i, dst = n[1].ui;
+              
+              for (i = 0; i < 4; i++)
+                 values[i] = n[1+i].f;
+              CALL_SetFragmentShaderConstantATI(ctx->Exec, (dst, values));
+           }
+           break;
+#endif
+        case OPCODE_ATTR_1F_NV:
+           CALL_VertexAttrib1fNV(ctx->Exec, (n[1].e, n[2].f));
+           break;
+        case OPCODE_ATTR_2F_NV:
+           /* Really shouldn't have to do this - the Node structure
+            * is convenient, but it would be better to store the data
+            * packed appropriately so that it can be sent directly
+            * on.  With x86_64 becoming common, this will start to
+            * matter more.
+            */
+           if (sizeof(Node)==sizeof(GLfloat)) 
+              CALL_VertexAttrib2fvNV(ctx->Exec, (n[1].e, &n[2].f));
+           else
+              CALL_VertexAttrib2fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f));
+           break;
+        case OPCODE_ATTR_3F_NV:
+           if (sizeof(Node)==sizeof(GLfloat)) 
+              CALL_VertexAttrib3fvNV(ctx->Exec, (n[1].e, &n[2].f));
+           else
+              CALL_VertexAttrib3fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
+                                             n[4].f));
+           break;
+        case OPCODE_ATTR_4F_NV:
+           if (sizeof(Node)==sizeof(GLfloat)) 
+              CALL_VertexAttrib4fvNV(ctx->Exec, (n[1].e, &n[2].f));
+           else
+              CALL_VertexAttrib4fNV(ctx->Exec, (n[1].e, n[2].f, n[3].f,
+                                             n[4].f, n[5].f));
+           break;
+        case OPCODE_ATTR_1F_ARB:
+           CALL_VertexAttrib1fARB(ctx->Exec, (n[1].e, n[2].f));
+           break;
+        case OPCODE_ATTR_2F_ARB:
+           /* Really shouldn't have to do this - the Node structure
+            * is convenient, but it would be better to store the data
+            * packed appropriately so that it can be sent directly
+            * on.  With x86_64 becoming common, this will start to
+            * matter more.
+            */
+           if (sizeof(Node)==sizeof(GLfloat)) 
+              CALL_VertexAttrib2fvARB(ctx->Exec, (n[1].e, &n[2].f));
+           else
+              CALL_VertexAttrib2fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f));
+           break;
+        case OPCODE_ATTR_3F_ARB:
+           if (sizeof(Node)==sizeof(GLfloat)) 
+              CALL_VertexAttrib3fvARB(ctx->Exec, (n[1].e, &n[2].f));
+           else
+              CALL_VertexAttrib3fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
+                                             n[4].f));
+           break;
+        case OPCODE_ATTR_4F_ARB:
+           if (sizeof(Node)==sizeof(GLfloat)) 
+              CALL_VertexAttrib4fvARB(ctx->Exec, (n[1].e, &n[2].f));
+           else
+              CALL_VertexAttrib4fARB(ctx->Exec, (n[1].e, n[2].f, n[3].f,
+                                             n[4].f, n[5].f));
+           break;
+        case OPCODE_MATERIAL:
+           if (sizeof(Node)==sizeof(GLfloat)) 
+              CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, &n[3].f));
+           else {
+              GLfloat f[4];
+              f[0] = n[3].f;
+              f[1] = n[4].f;
+              f[2] = n[5].f;
+              f[3] = n[6].f;
+              CALL_Materialfv(ctx->Exec, (n[1].e, n[2].e, f));
+           }
+           break;
+        case OPCODE_INDEX:
+           CALL_Indexi(ctx->Exec, (n[1].i));
+           break;
+        case OPCODE_EDGEFLAG:
+           CALL_EdgeFlag(ctx->Exec, (n[1].b));
+           break;
+        case OPCODE_BEGIN:
+           CALL_Begin(ctx->Exec, (n[1].e));
+           break;
+        case OPCODE_END:
+           CALL_End(ctx->Exec, ());
+           break;
+        case OPCODE_RECTF:
+           CALL_Rectf(ctx->Exec, (n[1].f, n[2].f, n[3].f, n[4].f));
+           break;
+        case OPCODE_EVAL_C1:
+           CALL_EvalCoord1f(ctx->Exec, (n[1].f));
+           break;
+        case OPCODE_EVAL_C2:
+           CALL_EvalCoord2f(ctx->Exec, (n[1].f, n[2].f));
+           break;
+        case OPCODE_EVAL_P1:
+           CALL_EvalPoint1(ctx->Exec, (n[1].i));
+           break;
+        case OPCODE_EVAL_P2:
+           CALL_EvalPoint2(ctx->Exec, (n[1].i, n[2].i));
+           break;
+
+
+
 
         case OPCODE_CONTINUE:
            n = (Node *) n[1].next;
@@ -5162,10 +6451,11 @@ execute_list( GLcontext *ctx, GLuint list )
         }
       }
    }
-   ctx->CallDepth--;
 
    if (ctx->Driver.EndCallList)
       ctx->Driver.EndCallList( ctx );
+
+   ctx->ListState.CallStack[ctx->ListState.CallDepth--] = NULL;
 }
 
 
@@ -5182,7 +6472,7 @@ execute_list( GLcontext *ctx, GLuint list )
 /*
  * Test if a display list number is valid.
  */
-GLboolean
+GLboolean GLAPIENTRY
 _mesa_IsList( GLuint list )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -5195,7 +6485,7 @@ _mesa_IsList( GLuint list )
 /*
  * Delete a sequence of consecutive display lists.
  */
-void
+void GLAPIENTRY
 _mesa_DeleteLists( GLuint list, GLsizei range )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -5218,7 +6508,7 @@ _mesa_DeleteLists( GLuint list, GLsizei range )
  * Return a display list number, n, such that lists n through n+range-1
  * are free.
  */
-GLuint
+GLuint GLAPIENTRY
 _mesa_GenLists(GLsizei range )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -5244,7 +6534,7 @@ _mesa_GenLists(GLsizei range )
       /* reserve the list IDs by with empty/dummy lists */
       GLint i;
       for (i=0; i<range; i++) {
-         _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list());
+         _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_list(base+i, 1));
       }
    }
 
@@ -5258,10 +6548,12 @@ _mesa_GenLists(GLsizei range )
 /*
  * Begin a new display list.
  */
-void
+void GLAPIENTRY
 _mesa_NewList( GLuint list, GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
+   GLint i;
+
    FLUSH_CURRENT(ctx, 0);      /* must be called before assert */
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
@@ -5279,20 +6571,34 @@ _mesa_NewList( GLuint list, GLenum mode )
       return;
    }
 
-   if (ctx->CurrentListPtr) {
+   if (ctx->ListState.CurrentListPtr) {
       /* already compiling a display list */
       _mesa_error( ctx, GL_INVALID_OPERATION, "glNewList" );
       return;
    }
 
-   /* Allocate new display list */
-   ctx->CurrentListNum = list;
-   ctx->CurrentBlock = (Node *) MALLOC( sizeof(Node) * BLOCK_SIZE );
-   ctx->CurrentListPtr = ctx->CurrentBlock;
-   ctx->CurrentPos = 0;
    ctx->CompileFlag = GL_TRUE;
    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.CurrentPos = 0;
+
+   /* Reset acumulated list state:
+    */
+   for (i = 0; i < VERT_ATTRIB_MAX; i++)
+      ctx->ListState.ActiveAttribSize[i] = 0;
+
+   for (i = 0; i < MAT_ATTRIB_MAX; i++)
+      ctx->ListState.ActiveMaterialSize[i] = 0;
+      
+   ctx->ListState.ActiveIndex = 0;
+   ctx->ListState.ActiveEdgeFlag = 0;
+
+   ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
    ctx->Driver.NewList( ctx, list, mode );
 
    ctx->CurrentDispatch = ctx->Save;
@@ -5302,22 +6608,20 @@ _mesa_NewList( GLuint list, GLenum mode )
 
 
 /*
- * End definition of current display list.  Is the current
- * ASSERT_OUTSIDE_BEGIN_END strong enough to really guarentee that
- * we are outside begin/end calls?
+ * End definition of current display list. 
  */
-void
+void GLAPIENTRY
 _mesa_EndList( void )
 {
    GET_CURRENT_CONTEXT(ctx);
-   FLUSH_CURRENT(ctx, 0);      /* must be called before assert */
+   SAVE_FLUSH_VERTICES(ctx);
    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 
    if (MESA_VERBOSE&VERBOSE_API)
       _mesa_debug(ctx, "glEndList\n");
 
    /* Check that a list is under construction */
-   if (!ctx->CurrentListPtr) {
+   if (!ctx->ListState.CurrentListPtr) {
       _mesa_error( ctx, GL_INVALID_OPERATION, "glEndList" );
       return;
    }
@@ -5325,28 +6629,29 @@ _mesa_EndList( void )
    (void) ALLOC_INSTRUCTION( ctx, OPCODE_END_OF_LIST, 0 );
 
    /* Destroy old list, if any */
-   _mesa_destroy_list(ctx, ctx->CurrentListNum);
+   _mesa_destroy_list(ctx, ctx->ListState.CurrentListNum);
    /* Install the list */
-   _mesa_HashInsert(ctx->Shared->DisplayList, ctx->CurrentListNum, ctx->CurrentListPtr);
+   _mesa_HashInsert(ctx->Shared->DisplayList, ctx->ListState.CurrentListNum, ctx->ListState.CurrentList);
 
 
    if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST)
-      mesa_print_display_list(ctx->CurrentListNum);
+      mesa_print_display_list(ctx->ListState.CurrentListNum);
+
+   ctx->Driver.EndList( ctx );
 
-   ctx->CurrentListNum = 0;
-   ctx->CurrentListPtr = NULL;
+   ctx->ListState.CurrentList = NULL;
+   ctx->ListState.CurrentListNum = 0;
+   ctx->ListState.CurrentListPtr = NULL;
    ctx->ExecuteFlag = GL_TRUE;
    ctx->CompileFlag = GL_FALSE;
 
-   ctx->Driver.EndList( ctx );
-
    ctx->CurrentDispatch = ctx->Exec;
    _glapi_set_dispatch( ctx->CurrentDispatch );
 }
 
 
 
-void
+void GLAPIENTRY
 _mesa_CallList( GLuint list )
 {
    GLboolean save_compile_flag;
@@ -5356,7 +6661,7 @@ _mesa_CallList( GLuint list )
    /* execute the display list, and restore the CompileFlag. */
 
    if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glCallList %d\n", list); 
+      _mesa_debug(ctx, "glCallList %d\n", list);
 
    if (list == 0) {
       _mesa_error(ctx, GL_INVALID_VALUE, "glCallList(list==0)");
@@ -5385,7 +6690,7 @@ _mesa_CallList( GLuint list )
 /*
  * Execute glCallLists:  call multiple display lists.
  */
-void
+void GLAPIENTRY
 _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -5394,7 +6699,7 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
    GLboolean save_compile_flag;
 
    if (MESA_VERBOSE & VERBOSE_API)
-      _mesa_debug(ctx, "glCallLists %d\n", n); 
+      _mesa_debug(ctx, "glCallLists %d\n", n);
 
    switch (type) {
       case GL_BYTE:
@@ -5439,7 +6744,7 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
 /*
  * Set the offset added to list numbers in glCallLists.
  */
-void
+void GLAPIENTRY
 _mesa_ListBase( GLuint base )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -5451,666 +6756,644 @@ _mesa_ListBase( GLuint base )
 
 /* Can no longer assume ctx->Exec->Func is equal to _mesa_Func.
  */
-static void exec_Finish( void )
+static void GLAPIENTRY exec_Finish( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->Finish();
+   CALL_Finish(ctx->Exec, ());
 }
 
-static void exec_Flush( void )
+static void GLAPIENTRY exec_Flush( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->Flush( );
+   CALL_Flush(ctx->Exec, ( ));
 }
 
-static void exec_GetBooleanv( GLenum pname, GLboolean *params )
+static void GLAPIENTRY exec_GetBooleanv( GLenum pname, GLboolean *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetBooleanv( pname, params );
+   CALL_GetBooleanv(ctx->Exec, ( pname, params ));
 }
 
-static void exec_GetClipPlane( GLenum plane, GLdouble *equation )
+static void GLAPIENTRY exec_GetClipPlane( GLenum plane, GLdouble *equation )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetClipPlane( plane, equation );
+   CALL_GetClipPlane(ctx->Exec, ( plane, equation ));
 }
 
-static void exec_GetDoublev( GLenum pname, GLdouble *params )
+static void GLAPIENTRY exec_GetDoublev( GLenum pname, GLdouble *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetDoublev(  pname, params );
+   CALL_GetDoublev(ctx->Exec, (  pname, params ));
 }
 
-static GLenum exec_GetError( void )
+static GLenum GLAPIENTRY exec_GetError( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   return ctx->Exec->GetError( );
+   return CALL_GetError(ctx->Exec, ( ));
 }
 
-static void exec_GetFloatv( GLenum pname, GLfloat *params )
+static void GLAPIENTRY exec_GetFloatv( GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetFloatv( pname, params );
+   CALL_GetFloatv(ctx->Exec, ( pname, params ));
 }
 
-static void exec_GetIntegerv( GLenum pname, GLint *params )
+static void GLAPIENTRY exec_GetIntegerv( GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetIntegerv( pname, params );
+   CALL_GetIntegerv(ctx->Exec, ( pname, params ));
 }
 
-static void exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
+static void GLAPIENTRY exec_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetLightfv( light, pname, params );
+   CALL_GetLightfv(ctx->Exec, ( light, pname, params ));
 }
 
-static void exec_GetLightiv( GLenum light, GLenum pname, GLint *params )
+static void GLAPIENTRY exec_GetLightiv( GLenum light, GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetLightiv( light, pname, params );
+   CALL_GetLightiv(ctx->Exec, ( light, pname, params ));
 }
 
-static void exec_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+static void GLAPIENTRY exec_GetMapdv( GLenum target, GLenum query, GLdouble *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMapdv( target, query, v );
+   CALL_GetMapdv(ctx->Exec, ( target, query, v ));
 }
 
-static void exec_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+static void GLAPIENTRY exec_GetMapfv( GLenum target, GLenum query, GLfloat *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMapfv( target, query, v );
+   CALL_GetMapfv(ctx->Exec, ( target, query, v ));
 }
 
-static void exec_GetMapiv( GLenum target, GLenum query, GLint *v )
+static void GLAPIENTRY exec_GetMapiv( GLenum target, GLenum query, GLint *v )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMapiv( target, query, v );
+   CALL_GetMapiv(ctx->Exec, ( target, query, v ));
 }
 
-static void exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
+static void GLAPIENTRY exec_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMaterialfv( face, pname, params );
+   CALL_GetMaterialfv(ctx->Exec, ( face, pname, params ));
 }
 
-static void exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
+static void GLAPIENTRY exec_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMaterialiv( face, pname, params );
+   CALL_GetMaterialiv(ctx->Exec, ( face, pname, params ));
 }
 
-static void exec_GetPixelMapfv( GLenum map, GLfloat *values )
+static void GLAPIENTRY exec_GetPixelMapfv( GLenum map, GLfloat *values )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetPixelMapfv( map,  values );
+   CALL_GetPixelMapfv(ctx->Exec, ( map,  values ));
 }
 
-static void exec_GetPixelMapuiv( GLenum map, GLuint *values )
+static void GLAPIENTRY exec_GetPixelMapuiv( GLenum map, GLuint *values )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetPixelMapuiv( map, values );
+   CALL_GetPixelMapuiv(ctx->Exec, ( map, values ));
 }
 
-static void exec_GetPixelMapusv( GLenum map, GLushort *values )
+static void GLAPIENTRY exec_GetPixelMapusv( GLenum map, GLushort *values )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetPixelMapusv( map, values );
+   CALL_GetPixelMapusv(ctx->Exec, ( map, values ));
 }
 
-static void exec_GetPolygonStipple( GLubyte *dest )
+static void GLAPIENTRY exec_GetPolygonStipple( GLubyte *dest )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetPolygonStipple( dest );
+   CALL_GetPolygonStipple(ctx->Exec, ( dest ));
 }
 
-static const GLubyte *exec_GetString( GLenum name )
+static const GLubyte * GLAPIENTRY exec_GetString( GLenum name )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   return ctx->Exec->GetString( name );
+   return CALL_GetString(ctx->Exec, ( name ));
 }
 
-static void exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+static void GLAPIENTRY exec_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexEnvfv( target, pname, params );
+   CALL_GetTexEnvfv(ctx->Exec, ( target, pname, params ));
 }
 
-static void exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+static void GLAPIENTRY exec_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexEnviv( target, pname, params );
+   CALL_GetTexEnviv(ctx->Exec, ( target, pname, params ));
 }
 
-static void exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
+static void GLAPIENTRY exec_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexGendv( coord, pname, params );
+   CALL_GetTexGendv(ctx->Exec, ( coord, pname, params ));
 }
 
-static void exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
+static void GLAPIENTRY exec_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexGenfv( coord, pname, params );
+   CALL_GetTexGenfv(ctx->Exec, ( coord, pname, params ));
 }
 
-static void exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
+static void GLAPIENTRY exec_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexGeniv( coord, pname, params );
+   CALL_GetTexGeniv(ctx->Exec, ( coord, pname, params ));
 }
 
-static void exec_GetTexImage( GLenum target, GLint level, GLenum format,
+static void GLAPIENTRY exec_GetTexImage( GLenum target, GLint level, GLenum format,
                    GLenum type, GLvoid *pixels )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexImage( target, level, format, type, pixels );
+   CALL_GetTexImage(ctx->Exec, ( target, level, format, type, pixels ));
 }
 
-static void exec_GetTexLevelParameterfv( GLenum target, GLint level,
+static void GLAPIENTRY exec_GetTexLevelParameterfv( GLenum target, GLint level,
                               GLenum pname, GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexLevelParameterfv( target, level, pname, params );
+   CALL_GetTexLevelParameterfv(ctx->Exec, ( target, level, pname, params ));
 }
 
-static void exec_GetTexLevelParameteriv( GLenum target, GLint level,
+static void GLAPIENTRY exec_GetTexLevelParameteriv( GLenum target, GLint level,
                               GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexLevelParameteriv( target, level, pname, params );
+   CALL_GetTexLevelParameteriv(ctx->Exec, ( target, level, pname, params ));
 }
 
-static void exec_GetTexParameterfv( GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetTexParameterfv( GLenum target, GLenum pname,
                                    GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexParameterfv( target, pname, params );
+   CALL_GetTexParameterfv(ctx->Exec, ( target, pname, params ));
 }
 
-static void exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
+static void GLAPIENTRY exec_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetTexParameteriv( target, pname, params );
+   CALL_GetTexParameteriv(ctx->Exec, ( target, pname, params ));
 }
 
-static GLboolean exec_IsEnabled( GLenum cap )
+static GLboolean GLAPIENTRY exec_IsEnabled( GLenum cap )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   return ctx->Exec->IsEnabled( cap );
+   return CALL_IsEnabled(ctx->Exec, ( cap ));
 }
 
-static void exec_PixelStoref( GLenum pname, GLfloat param )
+static void GLAPIENTRY exec_PixelStoref( GLenum pname, GLfloat param )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->PixelStoref( pname, param );
+   CALL_PixelStoref(ctx->Exec, ( pname, param ));
 }
 
-static void exec_PixelStorei( GLenum pname, GLint param )
+static void GLAPIENTRY exec_PixelStorei( GLenum pname, GLint param )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->PixelStorei( pname, param );
+   CALL_PixelStorei(ctx->Exec, ( pname, param ));
 }
 
-static void exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
+static void GLAPIENTRY exec_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
                  GLenum format, GLenum type, GLvoid *pixels )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->ReadPixels( x, y, width, height, format, type, pixels );
+   CALL_ReadPixels(ctx->Exec, ( x, y, width, height, format, type, pixels ));
 }
 
-static GLint exec_RenderMode( GLenum mode )
+static GLint GLAPIENTRY exec_RenderMode( GLenum mode )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   return ctx->Exec->RenderMode( mode );
+   return CALL_RenderMode(ctx->Exec, ( mode ));
 }
 
-static void exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
+static void GLAPIENTRY exec_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->FeedbackBuffer( size, type, buffer );
+   CALL_FeedbackBuffer(ctx->Exec, ( size, type, buffer ));
 }
 
-static void exec_SelectBuffer( GLsizei size, GLuint *buffer )
+static void GLAPIENTRY exec_SelectBuffer( GLsizei size, GLuint *buffer )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->SelectBuffer( size, buffer );
+   CALL_SelectBuffer(ctx->Exec, ( size, buffer ));
 }
 
-static GLboolean exec_AreTexturesResident(GLsizei n, const GLuint *texName,
+static GLboolean GLAPIENTRY exec_AreTexturesResident(GLsizei n, const GLuint *texName,
                                          GLboolean *residences)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   return ctx->Exec->AreTexturesResident( n, texName, residences);
+   return CALL_AreTexturesResident(ctx->Exec, ( n, texName, residences));
 }
 
-static void exec_ColorPointer(GLint size, GLenum type, GLsizei stride,
+static void GLAPIENTRY exec_ColorPointer(GLint size, GLenum type, GLsizei stride,
                              const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->ColorPointer( size, type, stride, ptr);
+   CALL_ColorPointer(ctx->Exec, ( size, type, stride, ptr));
 }
 
-static void exec_DeleteTextures( GLsizei n, const GLuint *texName)
+static void GLAPIENTRY exec_DeleteTextures( GLsizei n, const GLuint *texName)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->DeleteTextures( n, texName);
+   CALL_DeleteTextures(ctx->Exec, ( n, texName));
 }
 
-static void exec_DisableClientState( GLenum cap )
+static void GLAPIENTRY exec_DisableClientState( GLenum cap )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->DisableClientState( cap );
+   CALL_DisableClientState(ctx->Exec, ( cap ));
 }
 
-static void exec_EdgeFlagPointer(GLsizei stride, const void *vptr)
+static void GLAPIENTRY exec_EdgeFlagPointer(GLsizei stride, const GLvoid *vptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->EdgeFlagPointer( stride, vptr);
+   CALL_EdgeFlagPointer(ctx->Exec, ( stride, vptr));
 }
 
-static void exec_EnableClientState( GLenum cap )
+static void GLAPIENTRY exec_EnableClientState( GLenum cap )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->EnableClientState( cap );
+   CALL_EnableClientState(ctx->Exec, ( cap ));
 }
 
-static void exec_GenTextures( GLsizei n, GLuint *texName )
+static void GLAPIENTRY exec_GenTextures( GLsizei n, GLuint *texName )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GenTextures( n, texName );
+   CALL_GenTextures(ctx->Exec, ( n, texName ));
 }
 
-static void exec_GetPointerv( GLenum pname, GLvoid **params )
+static void GLAPIENTRY exec_GetPointerv( GLenum pname, GLvoid **params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetPointerv( pname, params );
+   CALL_GetPointerv(ctx->Exec, ( pname, params ));
 }
 
-static void exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
+static void GLAPIENTRY exec_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->IndexPointer( type, stride, ptr);
+   CALL_IndexPointer(ctx->Exec, ( type, stride, ptr));
 }
 
-static void exec_InterleavedArrays(GLenum format, GLsizei stride,
+static void GLAPIENTRY exec_InterleavedArrays(GLenum format, GLsizei stride,
                                   const GLvoid *pointer)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->InterleavedArrays( format, stride, pointer);
+   CALL_InterleavedArrays(ctx->Exec, ( format, stride, pointer));
 }
 
-static GLboolean exec_IsTexture( GLuint texture )
+static GLboolean GLAPIENTRY exec_IsTexture( GLuint texture )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   return ctx->Exec->IsTexture( texture );
+   return CALL_IsTexture(ctx->Exec, ( texture ));
 }
 
-static void exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
+static void GLAPIENTRY exec_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->NormalPointer( type, stride, ptr );
+   CALL_NormalPointer(ctx->Exec, ( type, stride, ptr ));
 }
 
-static void exec_PopClientAttrib(void)
+static void GLAPIENTRY exec_PopClientAttrib(void)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->PopClientAttrib();
+   CALL_PopClientAttrib(ctx->Exec, ());
 }
 
-static void exec_PushClientAttrib(GLbitfield mask)
+static void GLAPIENTRY exec_PushClientAttrib(GLbitfield mask)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->PushClientAttrib( mask);
+   CALL_PushClientAttrib(ctx->Exec, ( mask));
 }
 
-static void exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
+static void GLAPIENTRY exec_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
                                 const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->TexCoordPointer( size,  type,  stride, ptr);
+   CALL_TexCoordPointer(ctx->Exec, ( size,  type,  stride, ptr));
 }
 
-static void exec_GetCompressedTexImageARB(GLenum target, GLint level,
+static void GLAPIENTRY exec_GetCompressedTexImageARB(GLenum target, GLint level,
                                          GLvoid *img)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetCompressedTexImageARB( target, level, img);
+   CALL_GetCompressedTexImageARB(ctx->Exec, ( target, level, img));
 }
 
-static void exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
+static void GLAPIENTRY exec_VertexPointer(GLint size, GLenum type, GLsizei stride,
                               const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->VertexPointer( size, type, stride, ptr);
+   CALL_VertexPointer(ctx->Exec, ( size, type, stride, ptr));
 }
 
-static void exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
+static void GLAPIENTRY exec_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat,
                                         GLint x, GLint y, GLsizei width)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->CopyConvolutionFilter1D( target, internalFormat, x, y, width);
+   CALL_CopyConvolutionFilter1D(ctx->Exec, ( target, internalFormat, x, y, width));
 }
 
-static void exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
+static void GLAPIENTRY exec_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat,
                                         GLint x, GLint y, GLsizei width,
                                         GLsizei height)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->CopyConvolutionFilter2D( target, internalFormat, x, y, width,
-                                      height);
+   CALL_CopyConvolutionFilter2D(ctx->Exec, ( target, internalFormat, x, y, width,
+                                      height));
 }
 
-static void exec_GetColorTable( GLenum target, GLenum format,
+static void GLAPIENTRY exec_GetColorTable( GLenum target, GLenum format,
                                GLenum type, GLvoid *data )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetColorTable( target, format, type, data );
+   CALL_GetColorTable(ctx->Exec, ( target, format, type, data ));
 }
 
-static void exec_GetColorTableParameterfv( GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetColorTableParameterfv( GLenum target, GLenum pname,
                                           GLfloat *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetColorTableParameterfv( target, pname, params );
+   CALL_GetColorTableParameterfv(ctx->Exec, ( target, pname, params ));
 }
 
-static void exec_GetColorTableParameteriv( GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetColorTableParameteriv( GLenum target, GLenum pname,
                                           GLint *params )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetColorTableParameteriv( target, pname, params );
+   CALL_GetColorTableParameteriv(ctx->Exec, ( target, pname, params ));
 }
 
-static void exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
+static void GLAPIENTRY exec_GetConvolutionFilter(GLenum target, GLenum format, GLenum type,
                                      GLvoid *image)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetConvolutionFilter( target, format, type, image);
+   CALL_GetConvolutionFilter(ctx->Exec, ( target, format, type, image));
 }
 
-static void exec_GetConvolutionParameterfv(GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetConvolutionParameterfv(GLenum target, GLenum pname,
                                           GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetConvolutionParameterfv( target, pname, params);
+   CALL_GetConvolutionParameterfv(ctx->Exec, ( target, pname, params));
 }
 
-static void exec_GetConvolutionParameteriv(GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetConvolutionParameteriv(GLenum target, GLenum pname,
                                           GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetConvolutionParameteriv( target, pname, params);
+   CALL_GetConvolutionParameteriv(ctx->Exec, ( target, pname, params));
 }
 
-static void exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
+static void GLAPIENTRY exec_GetHistogram(GLenum target, GLboolean reset, GLenum format,
                              GLenum type, GLvoid *values)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetHistogram( target, reset, format, type, values);
+   CALL_GetHistogram(ctx->Exec, ( target, reset, format, type, values));
 }
 
-static void exec_GetHistogramParameterfv(GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetHistogramParameterfv(GLenum target, GLenum pname,
                                         GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetHistogramParameterfv( target, pname, params);
+   CALL_GetHistogramParameterfv(ctx->Exec, ( target, pname, params));
 }
 
-static void exec_GetHistogramParameteriv(GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetHistogramParameteriv(GLenum target, GLenum pname,
                                         GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetHistogramParameteriv( target, pname, params);
+   CALL_GetHistogramParameteriv(ctx->Exec, ( target, pname, params));
 }
 
-static void exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
+static void GLAPIENTRY exec_GetMinmax(GLenum target, GLboolean reset, GLenum format,
                           GLenum type, GLvoid *values)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMinmax( target, reset, format, type, values);
+   CALL_GetMinmax(ctx->Exec, ( target, reset, format, type, values));
 }
 
-static void exec_GetMinmaxParameterfv(GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetMinmaxParameterfv(GLenum target, GLenum pname,
                                      GLfloat *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMinmaxParameterfv( target, pname, params);
+   CALL_GetMinmaxParameterfv(ctx->Exec, ( target, pname, params));
 }
 
-static void exec_GetMinmaxParameteriv(GLenum target, GLenum pname,
+static void GLAPIENTRY exec_GetMinmaxParameteriv(GLenum target, GLenum pname,
                                      GLint *params)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetMinmaxParameteriv( target, pname, params);
+   CALL_GetMinmaxParameteriv(ctx->Exec, ( target, pname, params));
 }
 
-static void exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
+static void GLAPIENTRY exec_GetSeparableFilter(GLenum target, GLenum format, GLenum type,
                                    GLvoid *row, GLvoid *column, GLvoid *span)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetSeparableFilter( target, format, type, row, column, span);
+   CALL_GetSeparableFilter(ctx->Exec, ( target, format, type, row, column, span));
 }
 
-static void exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
+static void GLAPIENTRY exec_SeparableFilter2D(GLenum target, GLenum internalFormat,
                                   GLsizei width, GLsizei height, GLenum format,
                                   GLenum type, const GLvoid *row,
                                   const GLvoid *column)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->SeparableFilter2D( target, internalFormat, width, height, format,
-                                type, row, column);
-}
-
-static void exec_GetPixelTexGenParameterivSGIS(GLenum target, GLint *value)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetPixelTexGenParameterivSGIS( target, value);
-}
-
-static void exec_GetPixelTexGenParameterfvSGIS(GLenum target, GLfloat *value)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->GetPixelTexGenParameterfvSGIS( target, value);
+   CALL_SeparableFilter2D(ctx->Exec, ( target, internalFormat, width, height, format,
+                                type, row, column));
 }
 
-static void exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
+static void GLAPIENTRY exec_ColorPointerEXT(GLint size, GLenum type, GLsizei stride,
                                 GLsizei count, const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->ColorPointerEXT( size, type, stride, count, ptr);
+   CALL_ColorPointerEXT(ctx->Exec, ( size, type, stride, count, ptr));
 }
 
-static void exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count,
+static void GLAPIENTRY exec_EdgeFlagPointerEXT(GLsizei stride, GLsizei count,
                                    const GLboolean *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->EdgeFlagPointerEXT( stride, count, ptr);
+   CALL_EdgeFlagPointerEXT(ctx->Exec, ( stride, count, ptr));
 }
 
-static void exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+static void GLAPIENTRY exec_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
                       const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->IndexPointerEXT( type, stride, count, ptr);
+   CALL_IndexPointerEXT(ctx->Exec, ( type, stride, count, ptr));
 }
 
-static void exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
+static void GLAPIENTRY exec_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
                        const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->NormalPointerEXT( type, stride, count, ptr);
+   CALL_NormalPointerEXT(ctx->Exec, ( type, stride, count, ptr));
 }
 
-static void exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
+static void GLAPIENTRY exec_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
                                    GLsizei count, const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->TexCoordPointerEXT( size, type, stride, count, ptr);
+   CALL_TexCoordPointerEXT(ctx->Exec, ( size, type, stride, count, ptr));
 }
 
-static void exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
+static void GLAPIENTRY exec_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
                        GLsizei count, const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->VertexPointerEXT( size, type, stride, count, ptr);
-}
-
-static void exec_LockArraysEXT(GLint first, GLsizei count)
-{
-   GET_CURRENT_CONTEXT(ctx);
-   FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->LockArraysEXT( first, count);
+   CALL_VertexPointerEXT(ctx->Exec, ( size, type, stride, count, ptr));
 }
 
-static void exec_UnlockArraysEXT( void )
+static void GLAPIENTRY exec_LockArraysEXT(GLint first, GLsizei count)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->UnlockArraysEXT( );
+   CALL_LockArraysEXT(ctx->Exec, ( first, count));
 }
 
-static void exec_ResizeBuffersMESA( void )
+static void GLAPIENTRY exec_UnlockArraysEXT( void )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->ResizeBuffersMESA( );
+   CALL_UnlockArraysEXT(ctx->Exec, ( ));
 }
 
-
-static void exec_ClientActiveTextureARB( GLenum target )
+static void GLAPIENTRY exec_ClientActiveTextureARB( GLenum target )
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->ClientActiveTextureARB(target);
+   CALL_ClientActiveTextureARB(ctx->Exec, (target));
 }
 
-static void exec_SecondaryColorPointerEXT(GLint size, GLenum type,
+static void GLAPIENTRY exec_SecondaryColorPointerEXT(GLint size, GLenum type,
                               GLsizei stride, const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->SecondaryColorPointerEXT( size, type, stride, ptr);
+   CALL_SecondaryColorPointerEXT(ctx->Exec, ( size, type, stride, ptr));
 }
 
-static void exec_FogCoordPointerEXT(GLenum type, GLsizei stride,
+static void GLAPIENTRY exec_FogCoordPointerEXT(GLenum type, GLsizei stride,
                                    const GLvoid *ptr)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->FogCoordPointerEXT( type, stride, ptr);
+   CALL_FogCoordPointerEXT(ctx->Exec, ( type, stride, ptr));
 }
 
 /* GL_EXT_multi_draw_arrays */
-static void exec_MultiDrawArraysEXT(GLenum mode, GLint *first,
+static void GLAPIENTRY exec_MultiDrawArraysEXT(GLenum mode, GLint *first,
                                     GLsizei *count, GLsizei primcount)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->MultiDrawArraysEXT( mode, first, count, primcount );
+   CALL_MultiDrawArraysEXT(ctx->Exec, ( mode, first, count, primcount ));
 }
 
 /* GL_EXT_multi_draw_arrays */
-static void exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count,
+static void GLAPIENTRY exec_MultiDrawElementsEXT(GLenum mode, const GLsizei *count,
                                       GLenum type, const GLvoid **indices,
                                       GLsizei primcount)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->MultiDrawElementsEXT(mode, count, type, indices, primcount);
+   CALL_MultiDrawElementsEXT(ctx->Exec, (mode, count, type, indices, primcount));
 }
 
 /* GL_IBM_multimode_draw_arrays */
-static void exec_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first,
+static void GLAPIENTRY exec_MultiModeDrawArraysIBM(const GLenum *mode, const GLint *first,
                                        const GLsizei *count, GLsizei primcount,
                                        GLint modestride)
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->MultiModeDrawArraysIBM(mode, first, count, primcount, modestride);
+   CALL_MultiModeDrawArraysIBM(ctx->Exec, (mode, first, count, primcount, modestride));
 }
 
 /* GL_IBM_multimode_draw_arrays */
-static void exec_MultiModeDrawElementsIBM(const GLenum *mode,
+static void GLAPIENTRY exec_MultiModeDrawElementsIBM(const GLenum *mode,
                                          const GLsizei *count,
                                          GLenum type,
                                          const GLvoid * const *indices,
@@ -6118,14 +7401,15 @@ static void exec_MultiModeDrawElementsIBM(const GLenum *mode,
 {
    GET_CURRENT_CONTEXT(ctx);
    FLUSH_VERTICES(ctx, 0);
-   ctx->Exec->MultiModeDrawElementsIBM(mode, count, type, indices, primcount,
-                                      modestride);
+   CALL_MultiModeDrawElementsIBM(ctx->Exec, (mode, count, type, indices, primcount,
+                                      modestride));
 }
 
 
 
-/*
- * Assign all the pointers in <table> to point to Mesa's display list
+
+/**
+ * Setup the given dispatch table to point to Mesa's display list
  * building functions.
  *
  * This does not include any of the tnl functions - they are
@@ -6133,374 +7417,366 @@ static void exec_MultiModeDrawElementsIBM(const GLenum *mode,
  * struct.
  */
 void
-_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
+_mesa_init_dlist_table( struct _glapi_table *table )
 {
-   _mesa_init_no_op_table(table, tableSize);
-
-   _mesa_loopback_init_api_table( table, GL_TRUE );
+   _mesa_loopback_init_api_table( table );
 
    /* GL 1.0 */
-   table->Accum = save_Accum;
-   table->AlphaFunc = save_AlphaFunc;
-   table->Bitmap = save_Bitmap;
-   table->BlendFunc = save_BlendFunc;
-   table->CallList = _mesa_save_CallList;
-   table->CallLists = _mesa_save_CallLists;
-   table->Clear = save_Clear;
-   table->ClearAccum = save_ClearAccum;
-   table->ClearColor = save_ClearColor;
-   table->ClearDepth = save_ClearDepth;
-   table->ClearIndex = save_ClearIndex;
-   table->ClearStencil = save_ClearStencil;
-   table->ClipPlane = save_ClipPlane;
-   table->ColorMask = save_ColorMask;
-   table->ColorMaterial = save_ColorMaterial;
-   table->CopyPixels = save_CopyPixels;
-   table->CullFace = save_CullFace;
-   table->DeleteLists = _mesa_DeleteLists;
-   table->DepthFunc = save_DepthFunc;
-   table->DepthMask = save_DepthMask;
-   table->DepthRange = save_DepthRange;
-   table->Disable = save_Disable;
-   table->DrawBuffer = save_DrawBuffer;
-   table->DrawPixels = save_DrawPixels;
-   table->Enable = save_Enable;
-   table->EndList = _mesa_EndList;
-   table->EvalMesh1 = _mesa_save_EvalMesh1;
-   table->EvalMesh2 = _mesa_save_EvalMesh2;
-   table->Finish = exec_Finish;
-   table->Flush = exec_Flush;
-   table->Fogf = save_Fogf;
-   table->Fogfv = save_Fogfv;
-   table->Fogi = save_Fogi;
-   table->Fogiv = save_Fogiv;
-   table->FrontFace = save_FrontFace;
-   table->Frustum = save_Frustum;
-   table->GenLists = _mesa_GenLists;
-   table->GetBooleanv = exec_GetBooleanv;
-   table->GetClipPlane = exec_GetClipPlane;
-   table->GetDoublev = exec_GetDoublev;
-   table->GetError = exec_GetError;
-   table->GetFloatv = exec_GetFloatv;
-   table->GetIntegerv = exec_GetIntegerv;
-   table->GetLightfv = exec_GetLightfv;
-   table->GetLightiv = exec_GetLightiv;
-   table->GetMapdv = exec_GetMapdv;
-   table->GetMapfv = exec_GetMapfv;
-   table->GetMapiv = exec_GetMapiv;
-   table->GetMaterialfv = exec_GetMaterialfv;
-   table->GetMaterialiv = exec_GetMaterialiv;
-   table->GetPixelMapfv = exec_GetPixelMapfv;
-   table->GetPixelMapuiv = exec_GetPixelMapuiv;
-   table->GetPixelMapusv = exec_GetPixelMapusv;
-   table->GetPolygonStipple = exec_GetPolygonStipple;
-   table->GetString = exec_GetString;
-   table->GetTexEnvfv = exec_GetTexEnvfv;
-   table->GetTexEnviv = exec_GetTexEnviv;
-   table->GetTexGendv = exec_GetTexGendv;
-   table->GetTexGenfv = exec_GetTexGenfv;
-   table->GetTexGeniv = exec_GetTexGeniv;
-   table->GetTexImage = exec_GetTexImage;
-   table->GetTexLevelParameterfv = exec_GetTexLevelParameterfv;
-   table->GetTexLevelParameteriv = exec_GetTexLevelParameteriv;
-   table->GetTexParameterfv = exec_GetTexParameterfv;
-   table->GetTexParameteriv = exec_GetTexParameteriv;
-   table->Hint = save_Hint;
-   table->IndexMask = save_IndexMask;
-   table->InitNames = save_InitNames;
-   table->IsEnabled = exec_IsEnabled;
-   table->IsList = _mesa_IsList;
-   table->LightModelf = save_LightModelf;
-   table->LightModelfv = save_LightModelfv;
-   table->LightModeli = save_LightModeli;
-   table->LightModeliv = save_LightModeliv;
-   table->Lightf = save_Lightf;
-   table->Lightfv = save_Lightfv;
-   table->Lighti = save_Lighti;
-   table->Lightiv = save_Lightiv;
-   table->LineStipple = save_LineStipple;
-   table->LineWidth = save_LineWidth;
-   table->ListBase = save_ListBase;
-   table->LoadIdentity = save_LoadIdentity;
-   table->LoadMatrixd = save_LoadMatrixd;
-   table->LoadMatrixf = save_LoadMatrixf;
-   table->LoadName = save_LoadName;
-   table->LogicOp = save_LogicOp;
-   table->Map1d = save_Map1d;
-   table->Map1f = save_Map1f;
-   table->Map2d = save_Map2d;
-   table->Map2f = save_Map2f;
-   table->MapGrid1d = save_MapGrid1d;
-   table->MapGrid1f = save_MapGrid1f;
-   table->MapGrid2d = save_MapGrid2d;
-   table->MapGrid2f = save_MapGrid2f;
-   table->MatrixMode = save_MatrixMode;
-   table->MultMatrixd = save_MultMatrixd;
-   table->MultMatrixf = save_MultMatrixf;
-   table->NewList = save_NewList;
-   table->Ortho = save_Ortho;
-   table->PassThrough = save_PassThrough;
-   table->PixelMapfv = save_PixelMapfv;
-   table->PixelMapuiv = save_PixelMapuiv;
-   table->PixelMapusv = save_PixelMapusv;
-   table->PixelStoref = exec_PixelStoref;
-   table->PixelStorei = exec_PixelStorei;
-   table->PixelTransferf = save_PixelTransferf;
-   table->PixelTransferi = save_PixelTransferi;
-   table->PixelZoom = save_PixelZoom;
-   table->PointSize = save_PointSize;
-   table->PolygonMode = save_PolygonMode;
-   table->PolygonOffset = save_PolygonOffset;
-   table->PolygonStipple = save_PolygonStipple;
-   table->PopAttrib = save_PopAttrib;
-   table->PopMatrix = save_PopMatrix;
-   table->PopName = save_PopName;
-   table->PushAttrib = save_PushAttrib;
-   table->PushMatrix = save_PushMatrix;
-   table->PushName = save_PushName;
-   table->RasterPos2d = save_RasterPos2d;
-   table->RasterPos2dv = save_RasterPos2dv;
-   table->RasterPos2f = save_RasterPos2f;
-   table->RasterPos2fv = save_RasterPos2fv;
-   table->RasterPos2i = save_RasterPos2i;
-   table->RasterPos2iv = save_RasterPos2iv;
-   table->RasterPos2s = save_RasterPos2s;
-   table->RasterPos2sv = save_RasterPos2sv;
-   table->RasterPos3d = save_RasterPos3d;
-   table->RasterPos3dv = save_RasterPos3dv;
-   table->RasterPos3f = save_RasterPos3f;
-   table->RasterPos3fv = save_RasterPos3fv;
-   table->RasterPos3i = save_RasterPos3i;
-   table->RasterPos3iv = save_RasterPos3iv;
-   table->RasterPos3s = save_RasterPos3s;
-   table->RasterPos3sv = save_RasterPos3sv;
-   table->RasterPos4d = save_RasterPos4d;
-   table->RasterPos4dv = save_RasterPos4dv;
-   table->RasterPos4f = save_RasterPos4f;
-   table->RasterPos4fv = save_RasterPos4fv;
-   table->RasterPos4i = save_RasterPos4i;
-   table->RasterPos4iv = save_RasterPos4iv;
-   table->RasterPos4s = save_RasterPos4s;
-   table->RasterPos4sv = save_RasterPos4sv;
-   table->ReadBuffer = save_ReadBuffer;
-   table->ReadPixels = exec_ReadPixels;
-   table->RenderMode = exec_RenderMode;
-   table->Rotated = save_Rotated;
-   table->Rotatef = save_Rotatef;
-   table->Scaled = save_Scaled;
-   table->Scalef = save_Scalef;
-   table->Scissor = save_Scissor;
-   table->FeedbackBuffer = exec_FeedbackBuffer;
-   table->SelectBuffer = exec_SelectBuffer;
-   table->ShadeModel = save_ShadeModel;
-   table->StencilFunc = save_StencilFunc;
-   table->StencilMask = save_StencilMask;
-   table->StencilOp = save_StencilOp;
-   table->TexEnvf = save_TexEnvf;
-   table->TexEnvfv = save_TexEnvfv;
-   table->TexEnvi = save_TexEnvi;
-   table->TexEnviv = save_TexEnviv;
-   table->TexGend = save_TexGend;
-   table->TexGendv = save_TexGendv;
-   table->TexGenf = save_TexGenf;
-   table->TexGenfv = save_TexGenfv;
-   table->TexGeni = save_TexGeni;
-   table->TexGeniv = save_TexGeniv;
-   table->TexImage1D = save_TexImage1D;
-   table->TexImage2D = save_TexImage2D;
-   table->TexParameterf = save_TexParameterf;
-   table->TexParameterfv = save_TexParameterfv;
-   table->TexParameteri = save_TexParameteri;
-   table->TexParameteriv = save_TexParameteriv;
-   table->Translated = save_Translated;
-   table->Translatef = save_Translatef;
-   table->Viewport = save_Viewport;
+   SET_Accum(table, save_Accum);
+   SET_AlphaFunc(table, save_AlphaFunc);
+   SET_Bitmap(table, save_Bitmap);
+   SET_BlendFunc(table, _mesa_BlendFunc); /* loops-back to BlendFuncSeparate */
+   SET_CallList(table, _mesa_save_CallList);
+   SET_CallLists(table, _mesa_save_CallLists);
+   SET_Clear(table, save_Clear);
+   SET_ClearAccum(table, save_ClearAccum);
+   SET_ClearColor(table, save_ClearColor);
+   SET_ClearDepth(table, save_ClearDepth);
+   SET_ClearIndex(table, save_ClearIndex);
+   SET_ClearStencil(table, save_ClearStencil);
+   SET_ClipPlane(table, save_ClipPlane);
+   SET_ColorMask(table, save_ColorMask);
+   SET_ColorMaterial(table, save_ColorMaterial);
+   SET_CopyPixels(table, save_CopyPixels);
+   SET_CullFace(table, save_CullFace);
+   SET_DeleteLists(table, _mesa_DeleteLists);
+   SET_DepthFunc(table, save_DepthFunc);
+   SET_DepthMask(table, save_DepthMask);
+   SET_DepthRange(table, save_DepthRange);
+   SET_Disable(table, save_Disable);
+   SET_DrawBuffer(table, save_DrawBuffer);
+   SET_DrawPixels(table, save_DrawPixels);
+   SET_Enable(table, save_Enable);
+   SET_EndList(table, _mesa_EndList);
+   SET_EvalMesh1(table, _mesa_save_EvalMesh1);
+   SET_EvalMesh2(table, _mesa_save_EvalMesh2);
+   SET_Finish(table, exec_Finish);
+   SET_Flush(table, exec_Flush);
+   SET_Fogf(table, save_Fogf);
+   SET_Fogfv(table, save_Fogfv);
+   SET_Fogi(table, save_Fogi);
+   SET_Fogiv(table, save_Fogiv);
+   SET_FrontFace(table, save_FrontFace);
+   SET_Frustum(table, save_Frustum);
+   SET_GenLists(table, _mesa_GenLists);
+   SET_GetBooleanv(table, exec_GetBooleanv);
+   SET_GetClipPlane(table, exec_GetClipPlane);
+   SET_GetDoublev(table, exec_GetDoublev);
+   SET_GetError(table, exec_GetError);
+   SET_GetFloatv(table, exec_GetFloatv);
+   SET_GetIntegerv(table, exec_GetIntegerv);
+   SET_GetLightfv(table, exec_GetLightfv);
+   SET_GetLightiv(table, exec_GetLightiv);
+   SET_GetMapdv(table, exec_GetMapdv);
+   SET_GetMapfv(table, exec_GetMapfv);
+   SET_GetMapiv(table, exec_GetMapiv);
+   SET_GetMaterialfv(table, exec_GetMaterialfv);
+   SET_GetMaterialiv(table, exec_GetMaterialiv);
+   SET_GetPixelMapfv(table, exec_GetPixelMapfv);
+   SET_GetPixelMapuiv(table, exec_GetPixelMapuiv);
+   SET_GetPixelMapusv(table, exec_GetPixelMapusv);
+   SET_GetPolygonStipple(table, exec_GetPolygonStipple);
+   SET_GetString(table, exec_GetString);
+   SET_GetTexEnvfv(table, exec_GetTexEnvfv);
+   SET_GetTexEnviv(table, exec_GetTexEnviv);
+   SET_GetTexGendv(table, exec_GetTexGendv);
+   SET_GetTexGenfv(table, exec_GetTexGenfv);
+   SET_GetTexGeniv(table, exec_GetTexGeniv);
+   SET_GetTexImage(table, exec_GetTexImage);
+   SET_GetTexLevelParameterfv(table, exec_GetTexLevelParameterfv);
+   SET_GetTexLevelParameteriv(table, exec_GetTexLevelParameteriv);
+   SET_GetTexParameterfv(table, exec_GetTexParameterfv);
+   SET_GetTexParameteriv(table, exec_GetTexParameteriv);
+   SET_Hint(table, save_Hint);
+   SET_IndexMask(table, save_IndexMask);
+   SET_InitNames(table, save_InitNames);
+   SET_IsEnabled(table, exec_IsEnabled);
+   SET_IsList(table, _mesa_IsList);
+   SET_LightModelf(table, save_LightModelf);
+   SET_LightModelfv(table, save_LightModelfv);
+   SET_LightModeli(table, save_LightModeli);
+   SET_LightModeliv(table, save_LightModeliv);
+   SET_Lightf(table, save_Lightf);
+   SET_Lightfv(table, save_Lightfv);
+   SET_Lighti(table, save_Lighti);
+   SET_Lightiv(table, save_Lightiv);
+   SET_LineStipple(table, save_LineStipple);
+   SET_LineWidth(table, save_LineWidth);
+   SET_ListBase(table, save_ListBase);
+   SET_LoadIdentity(table, save_LoadIdentity);
+   SET_LoadMatrixd(table, save_LoadMatrixd);
+   SET_LoadMatrixf(table, save_LoadMatrixf);
+   SET_LoadName(table, save_LoadName);
+   SET_LogicOp(table, save_LogicOp);
+   SET_Map1d(table, save_Map1d);
+   SET_Map1f(table, save_Map1f);
+   SET_Map2d(table, save_Map2d);
+   SET_Map2f(table, save_Map2f);
+   SET_MapGrid1d(table, save_MapGrid1d);
+   SET_MapGrid1f(table, save_MapGrid1f);
+   SET_MapGrid2d(table, save_MapGrid2d);
+   SET_MapGrid2f(table, save_MapGrid2f);
+   SET_MatrixMode(table, save_MatrixMode);
+   SET_MultMatrixd(table, save_MultMatrixd);
+   SET_MultMatrixf(table, save_MultMatrixf);
+   SET_NewList(table, save_NewList);
+   SET_Ortho(table, save_Ortho);
+   SET_PassThrough(table, save_PassThrough);
+   SET_PixelMapfv(table, save_PixelMapfv);
+   SET_PixelMapuiv(table, save_PixelMapuiv);
+   SET_PixelMapusv(table, save_PixelMapusv);
+   SET_PixelStoref(table, exec_PixelStoref);
+   SET_PixelStorei(table, exec_PixelStorei);
+   SET_PixelTransferf(table, save_PixelTransferf);
+   SET_PixelTransferi(table, save_PixelTransferi);
+   SET_PixelZoom(table, save_PixelZoom);
+   SET_PointSize(table, save_PointSize);
+   SET_PolygonMode(table, save_PolygonMode);
+   SET_PolygonOffset(table, save_PolygonOffset);
+   SET_PolygonStipple(table, save_PolygonStipple);
+   SET_PopAttrib(table, save_PopAttrib);
+   SET_PopMatrix(table, save_PopMatrix);
+   SET_PopName(table, save_PopName);
+   SET_PushAttrib(table, save_PushAttrib);
+   SET_PushMatrix(table, save_PushMatrix);
+   SET_PushName(table, save_PushName);
+   SET_RasterPos2d(table, save_RasterPos2d);
+   SET_RasterPos2dv(table, save_RasterPos2dv);
+   SET_RasterPos2f(table, save_RasterPos2f);
+   SET_RasterPos2fv(table, save_RasterPos2fv);
+   SET_RasterPos2i(table, save_RasterPos2i);
+   SET_RasterPos2iv(table, save_RasterPos2iv);
+   SET_RasterPos2s(table, save_RasterPos2s);
+   SET_RasterPos2sv(table, save_RasterPos2sv);
+   SET_RasterPos3d(table, save_RasterPos3d);
+   SET_RasterPos3dv(table, save_RasterPos3dv);
+   SET_RasterPos3f(table, save_RasterPos3f);
+   SET_RasterPos3fv(table, save_RasterPos3fv);
+   SET_RasterPos3i(table, save_RasterPos3i);
+   SET_RasterPos3iv(table, save_RasterPos3iv);
+   SET_RasterPos3s(table, save_RasterPos3s);
+   SET_RasterPos3sv(table, save_RasterPos3sv);
+   SET_RasterPos4d(table, save_RasterPos4d);
+   SET_RasterPos4dv(table, save_RasterPos4dv);
+   SET_RasterPos4f(table, save_RasterPos4f);
+   SET_RasterPos4fv(table, save_RasterPos4fv);
+   SET_RasterPos4i(table, save_RasterPos4i);
+   SET_RasterPos4iv(table, save_RasterPos4iv);
+   SET_RasterPos4s(table, save_RasterPos4s);
+   SET_RasterPos4sv(table, save_RasterPos4sv);
+   SET_ReadBuffer(table, save_ReadBuffer);
+   SET_ReadPixels(table, exec_ReadPixels);
+   SET_RenderMode(table, exec_RenderMode);
+   SET_Rotated(table, save_Rotated);
+   SET_Rotatef(table, save_Rotatef);
+   SET_Scaled(table, save_Scaled);
+   SET_Scalef(table, save_Scalef);
+   SET_Scissor(table, save_Scissor);
+   SET_FeedbackBuffer(table, exec_FeedbackBuffer);
+   SET_SelectBuffer(table, exec_SelectBuffer);
+   SET_ShadeModel(table, save_ShadeModel);
+   SET_StencilFunc(table, save_StencilFunc);
+   SET_StencilMask(table, save_StencilMask);
+   SET_StencilOp(table, save_StencilOp);
+   SET_TexEnvf(table, save_TexEnvf);
+   SET_TexEnvfv(table, save_TexEnvfv);
+   SET_TexEnvi(table, save_TexEnvi);
+   SET_TexEnviv(table, save_TexEnviv);
+   SET_TexGend(table, save_TexGend);
+   SET_TexGendv(table, save_TexGendv);
+   SET_TexGenf(table, save_TexGenf);
+   SET_TexGenfv(table, save_TexGenfv);
+   SET_TexGeni(table, save_TexGeni);
+   SET_TexGeniv(table, save_TexGeniv);
+   SET_TexImage1D(table, save_TexImage1D);
+   SET_TexImage2D(table, save_TexImage2D);
+   SET_TexParameterf(table, save_TexParameterf);
+   SET_TexParameterfv(table, save_TexParameterfv);
+   SET_TexParameteri(table, save_TexParameteri);
+   SET_TexParameteriv(table, save_TexParameteriv);
+   SET_Translated(table, save_Translated);
+   SET_Translatef(table, save_Translatef);
+   SET_Viewport(table, save_Viewport);
 
    /* GL 1.1 */
-   table->AreTexturesResident = exec_AreTexturesResident;
-   table->AreTexturesResidentEXT = exec_AreTexturesResident;
-   table->BindTexture = save_BindTexture;
-   table->ColorPointer = exec_ColorPointer;
-   table->CopyTexImage1D = save_CopyTexImage1D;
-   table->CopyTexImage2D = save_CopyTexImage2D;
-   table->CopyTexSubImage1D = save_CopyTexSubImage1D;
-   table->CopyTexSubImage2D = save_CopyTexSubImage2D;
-   table->DeleteTextures = exec_DeleteTextures;
-   table->DisableClientState = exec_DisableClientState;
-   table->EdgeFlagPointer = exec_EdgeFlagPointer;
-   table->EnableClientState = exec_EnableClientState;
-   table->GenTextures = exec_GenTextures;
-   table->GenTexturesEXT = exec_GenTextures;
-   table->GetPointerv = exec_GetPointerv;
-   table->IndexPointer = exec_IndexPointer;
-   table->InterleavedArrays = exec_InterleavedArrays;
-   table->IsTexture = exec_IsTexture;
-   table->IsTextureEXT = exec_IsTexture;
-   table->NormalPointer = exec_NormalPointer;
-   table->PopClientAttrib = exec_PopClientAttrib;
-   table->PrioritizeTextures = save_PrioritizeTextures;
-   table->PushClientAttrib = exec_PushClientAttrib;
-   table->TexCoordPointer = exec_TexCoordPointer;
-   table->TexSubImage1D = save_TexSubImage1D;
-   table->TexSubImage2D = save_TexSubImage2D;
-   table->VertexPointer = exec_VertexPointer;
+   SET_AreTexturesResident(table, exec_AreTexturesResident);
+   SET_AreTexturesResidentEXT(table, exec_AreTexturesResident);
+   SET_BindTexture(table, save_BindTexture);
+   SET_ColorPointer(table, exec_ColorPointer);
+   SET_CopyTexImage1D(table, save_CopyTexImage1D);
+   SET_CopyTexImage2D(table, save_CopyTexImage2D);
+   SET_CopyTexSubImage1D(table, save_CopyTexSubImage1D);
+   SET_CopyTexSubImage2D(table, save_CopyTexSubImage2D);
+   SET_DeleteTextures(table, exec_DeleteTextures);
+   SET_DisableClientState(table, exec_DisableClientState);
+   SET_EdgeFlagPointer(table, exec_EdgeFlagPointer);
+   SET_EnableClientState(table, exec_EnableClientState);
+   SET_GenTextures(table, exec_GenTextures);
+   SET_GenTexturesEXT(table, exec_GenTextures);
+   SET_GetPointerv(table, exec_GetPointerv);
+   SET_IndexPointer(table, exec_IndexPointer);
+   SET_InterleavedArrays(table, exec_InterleavedArrays);
+   SET_IsTexture(table, exec_IsTexture);
+   SET_IsTextureEXT(table, exec_IsTexture);
+   SET_NormalPointer(table, exec_NormalPointer);
+   SET_PopClientAttrib(table, exec_PopClientAttrib);
+   SET_PrioritizeTextures(table, save_PrioritizeTextures);
+   SET_PushClientAttrib(table, exec_PushClientAttrib);
+   SET_TexCoordPointer(table, exec_TexCoordPointer);
+   SET_TexSubImage1D(table, save_TexSubImage1D);
+   SET_TexSubImage2D(table, save_TexSubImage2D);
+   SET_VertexPointer(table, exec_VertexPointer);
 
    /* GL 1.2 */
-   table->CopyTexSubImage3D = save_CopyTexSubImage3D;
-   table->TexImage3D = save_TexImage3D;
-   table->TexSubImage3D = save_TexSubImage3D;
+   SET_CopyTexSubImage3D(table, save_CopyTexSubImage3D);
+   SET_TexImage3D(table, save_TexImage3D);
+   SET_TexSubImage3D(table, save_TexSubImage3D);
+
+   /* GL 2.0 */
+   SET_StencilFuncSeparate(table, save_StencilFuncSeparate);
+   SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
+   SET_StencilOpSeparate(table, save_StencilOpSeparate);
 
    /* GL_ARB_imaging */
    /* Not all are supported */
-   table->BlendColor = save_BlendColor;
-   table->BlendEquation = save_BlendEquation;
-   table->ColorSubTable = save_ColorSubTable;
-   table->ColorTable = save_ColorTable;
-   table->ColorTableParameterfv = save_ColorTableParameterfv;
-   table->ColorTableParameteriv = save_ColorTableParameteriv;
-   table->ConvolutionFilter1D = save_ConvolutionFilter1D;
-   table->ConvolutionFilter2D = save_ConvolutionFilter2D;
-   table->ConvolutionParameterf = save_ConvolutionParameterf;
-   table->ConvolutionParameterfv = save_ConvolutionParameterfv;
-   table->ConvolutionParameteri = save_ConvolutionParameteri;
-   table->ConvolutionParameteriv = save_ConvolutionParameteriv;
-   table->CopyColorSubTable = save_CopyColorSubTable;
-   table->CopyColorTable = save_CopyColorTable;
-   table->CopyConvolutionFilter1D = exec_CopyConvolutionFilter1D;
-   table->CopyConvolutionFilter2D = exec_CopyConvolutionFilter2D;
-   table->GetColorTable = exec_GetColorTable;
-   table->GetColorTableEXT = exec_GetColorTable;
-   table->GetColorTableParameterfv = exec_GetColorTableParameterfv;
-   table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv;
-   table->GetColorTableParameteriv = exec_GetColorTableParameteriv;
-   table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv;
-   table->GetConvolutionFilter = exec_GetConvolutionFilter;
-   table->GetConvolutionFilterEXT = exec_GetConvolutionFilter;
-   table->GetConvolutionParameterfv = exec_GetConvolutionParameterfv;
-   table->GetConvolutionParameterfvEXT = exec_GetConvolutionParameterfv;
-   table->GetConvolutionParameteriv = exec_GetConvolutionParameteriv;
-   table->GetConvolutionParameterivEXT = exec_GetConvolutionParameteriv;
-   table->GetHistogram = exec_GetHistogram;
-   table->GetHistogramEXT = exec_GetHistogram;
-   table->GetHistogramParameterfv = exec_GetHistogramParameterfv;
-   table->GetHistogramParameterfvEXT = exec_GetHistogramParameterfv;
-   table->GetHistogramParameteriv = exec_GetHistogramParameteriv;
-   table->GetHistogramParameterivEXT = exec_GetHistogramParameteriv;
-   table->GetMinmax = exec_GetMinmax;
-   table->GetMinmaxEXT = exec_GetMinmax;
-   table->GetMinmaxParameterfv = exec_GetMinmaxParameterfv;
-   table->GetMinmaxParameterfvEXT = exec_GetMinmaxParameterfv;
-   table->GetMinmaxParameteriv = exec_GetMinmaxParameteriv;
-   table->GetMinmaxParameterivEXT = exec_GetMinmaxParameteriv;
-   table->GetSeparableFilter = exec_GetSeparableFilter;
-   table->GetSeparableFilterEXT = exec_GetSeparableFilter;
-   table->Histogram = save_Histogram;
-   table->Minmax = save_Minmax;
-   table->ResetHistogram = save_ResetHistogram;
-   table->ResetMinmax = save_ResetMinmax;
-   table->SeparableFilter2D = exec_SeparableFilter2D;
+   SET_BlendColor(table, save_BlendColor);
+   SET_BlendEquation(table, save_BlendEquation);
+   SET_ColorSubTable(table, save_ColorSubTable);
+   SET_ColorTable(table, save_ColorTable);
+   SET_ColorTableParameterfv(table, save_ColorTableParameterfv);
+   SET_ColorTableParameteriv(table, save_ColorTableParameteriv);
+   SET_ConvolutionFilter1D(table, save_ConvolutionFilter1D);
+   SET_ConvolutionFilter2D(table, save_ConvolutionFilter2D);
+   SET_ConvolutionParameterf(table, save_ConvolutionParameterf);
+   SET_ConvolutionParameterfv(table, save_ConvolutionParameterfv);
+   SET_ConvolutionParameteri(table, save_ConvolutionParameteri);
+   SET_ConvolutionParameteriv(table, save_ConvolutionParameteriv);
+   SET_CopyColorSubTable(table, save_CopyColorSubTable);
+   SET_CopyColorTable(table, save_CopyColorTable);
+   SET_CopyConvolutionFilter1D(table, exec_CopyConvolutionFilter1D);
+   SET_CopyConvolutionFilter2D(table, exec_CopyConvolutionFilter2D);
+   SET_GetColorTable(table, exec_GetColorTable);
+   SET_GetColorTableEXT(table, exec_GetColorTable);
+   SET_GetColorTableParameterfv(table, exec_GetColorTableParameterfv);
+   SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv);
+   SET_GetColorTableParameteriv(table, exec_GetColorTableParameteriv);
+   SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv);
+   SET_GetConvolutionFilter(table, exec_GetConvolutionFilter);
+   SET_GetConvolutionFilterEXT(table, exec_GetConvolutionFilter);
+   SET_GetConvolutionParameterfv(table, exec_GetConvolutionParameterfv);
+   SET_GetConvolutionParameterfvEXT(table, exec_GetConvolutionParameterfv);
+   SET_GetConvolutionParameteriv(table, exec_GetConvolutionParameteriv);
+   SET_GetConvolutionParameterivEXT(table, exec_GetConvolutionParameteriv);
+   SET_GetHistogram(table, exec_GetHistogram);
+   SET_GetHistogramEXT(table, exec_GetHistogram);
+   SET_GetHistogramParameterfv(table, exec_GetHistogramParameterfv);
+   SET_GetHistogramParameterfvEXT(table, exec_GetHistogramParameterfv);
+   SET_GetHistogramParameteriv(table, exec_GetHistogramParameteriv);
+   SET_GetHistogramParameterivEXT(table, exec_GetHistogramParameteriv);
+   SET_GetMinmax(table, exec_GetMinmax);
+   SET_GetMinmaxEXT(table, exec_GetMinmax);
+   SET_GetMinmaxParameterfv(table, exec_GetMinmaxParameterfv);
+   SET_GetMinmaxParameterfvEXT(table, exec_GetMinmaxParameterfv);
+   SET_GetMinmaxParameteriv(table, exec_GetMinmaxParameteriv);
+   SET_GetMinmaxParameterivEXT(table, exec_GetMinmaxParameteriv);
+   SET_GetSeparableFilter(table, exec_GetSeparableFilter);
+   SET_GetSeparableFilterEXT(table, exec_GetSeparableFilter);
+   SET_Histogram(table, save_Histogram);
+   SET_Minmax(table, save_Minmax);
+   SET_ResetHistogram(table, save_ResetHistogram);
+   SET_ResetMinmax(table, save_ResetMinmax);
+   SET_SeparableFilter2D(table, exec_SeparableFilter2D);
 
    /* 2. GL_EXT_blend_color */
 #if 0
-   table->BlendColorEXT = save_BlendColorEXT;
+   SET_BlendColorEXT(table, save_BlendColorEXT);
 #endif
 
    /* 3. GL_EXT_polygon_offset */
-   table->PolygonOffsetEXT = save_PolygonOffsetEXT;
+   SET_PolygonOffsetEXT(table, save_PolygonOffsetEXT);
 
    /* 6. GL_EXT_texture3d */
 #if 0
-   table->CopyTexSubImage3DEXT = save_CopyTexSubImage3D;
-   table->TexImage3DEXT = save_TexImage3DEXT;
-   table->TexSubImage3DEXT = save_TexSubImage3D;
+   SET_CopyTexSubImage3DEXT(table, save_CopyTexSubImage3D);
+   SET_TexImage3DEXT(table, save_TexImage3DEXT);
+   SET_TexSubImage3DEXT(table, save_TexSubImage3D);
 #endif
 
-   /* 15. GL_SGIX_pixel_texture */
-   table->PixelTexGenSGIX = save_PixelTexGenSGIX;
-
-   /* 15. GL_SGIS_pixel_texture */
-   table->PixelTexGenParameteriSGIS = save_PixelTexGenParameteriSGIS;
-   table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS;
-   table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS;
-   table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS;
-   table->GetPixelTexGenParameterivSGIS = exec_GetPixelTexGenParameterivSGIS;
-   table->GetPixelTexGenParameterfvSGIS = exec_GetPixelTexGenParameterfvSGIS;
-
    /* 30. GL_EXT_vertex_array */
-   table->ColorPointerEXT = exec_ColorPointerEXT;
-   table->EdgeFlagPointerEXT = exec_EdgeFlagPointerEXT;
-   table->IndexPointerEXT = exec_IndexPointerEXT;
-   table->NormalPointerEXT = exec_NormalPointerEXT;
-   table->TexCoordPointerEXT = exec_TexCoordPointerEXT;
-   table->VertexPointerEXT = exec_VertexPointerEXT;
+   SET_ColorPointerEXT(table, exec_ColorPointerEXT);
+   SET_EdgeFlagPointerEXT(table, exec_EdgeFlagPointerEXT);
+   SET_IndexPointerEXT(table, exec_IndexPointerEXT);
+   SET_NormalPointerEXT(table, exec_NormalPointerEXT);
+   SET_TexCoordPointerEXT(table, exec_TexCoordPointerEXT);
+   SET_VertexPointerEXT(table, exec_VertexPointerEXT);
 
    /* 37. GL_EXT_blend_minmax */
 #if 0
-   table->BlendEquationEXT = save_BlendEquationEXT;
+   SET_BlendEquationEXT(table, save_BlendEquationEXT);
 #endif
 
    /* 54. GL_EXT_point_parameters */
-   table->PointParameterfEXT = save_PointParameterfEXT;
-   table->PointParameterfvEXT = save_PointParameterfvEXT;
+   SET_PointParameterfEXT(table, save_PointParameterfEXT);
+   SET_PointParameterfvEXT(table, save_PointParameterfvEXT);
 
    /* 78. GL_EXT_paletted_texture */
 #if 0
-   table->ColorTableEXT = save_ColorTable;
-   table->ColorSubTableEXT = save_ColorSubTable;
+   SET_ColorTableEXT(table, save_ColorTable);
+   SET_ColorSubTableEXT(table, save_ColorSubTable);
 #endif
-   table->GetColorTableEXT = exec_GetColorTable;
-   table->GetColorTableParameterfvEXT = exec_GetColorTableParameterfv;
-   table->GetColorTableParameterivEXT = exec_GetColorTableParameteriv;
+   SET_GetColorTableEXT(table, exec_GetColorTable);
+   SET_GetColorTableParameterfvEXT(table, exec_GetColorTableParameterfv);
+   SET_GetColorTableParameterivEXT(table, exec_GetColorTableParameteriv);
 
    /* 97. GL_EXT_compiled_vertex_array */
-   table->LockArraysEXT = exec_LockArraysEXT;
-   table->UnlockArraysEXT = exec_UnlockArraysEXT;
+   SET_LockArraysEXT(table, exec_LockArraysEXT);
+   SET_UnlockArraysEXT(table, exec_UnlockArraysEXT);
 
    /* 145. GL_EXT_secondary_color */
-   table->SecondaryColorPointerEXT = exec_SecondaryColorPointerEXT;
+   SET_SecondaryColorPointerEXT(table, exec_SecondaryColorPointerEXT);
 
    /* 148. GL_EXT_multi_draw_arrays */
-   table->MultiDrawArraysEXT = exec_MultiDrawArraysEXT;
-   table->MultiDrawElementsEXT = exec_MultiDrawElementsEXT;
+   SET_MultiDrawArraysEXT(table, exec_MultiDrawArraysEXT);
+   SET_MultiDrawElementsEXT(table, exec_MultiDrawElementsEXT);
 
    /* 149. GL_EXT_fog_coord */
-   table->FogCoordPointerEXT = exec_FogCoordPointerEXT;
+   SET_FogCoordPointerEXT(table, exec_FogCoordPointerEXT);
 
    /* 173. GL_EXT_blend_func_separate */
-   table->BlendFuncSeparateEXT = save_BlendFuncSeparateEXT;
+   SET_BlendFuncSeparateEXT(table, save_BlendFuncSeparateEXT);
 
    /* 196. GL_MESA_resize_buffers */
-   table->ResizeBuffersMESA = exec_ResizeBuffersMESA;
+   SET_ResizeBuffersMESA(table, _mesa_ResizeBuffersMESA);
 
    /* 197. GL_MESA_window_pos */
-   table->WindowPos2dMESA = save_WindowPos2dMESA;
-   table->WindowPos2dvMESA = save_WindowPos2dvMESA;
-   table->WindowPos2fMESA = save_WindowPos2fMESA;
-   table->WindowPos2fvMESA = save_WindowPos2fvMESA;
-   table->WindowPos2iMESA = save_WindowPos2iMESA;
-   table->WindowPos2ivMESA = save_WindowPos2ivMESA;
-   table->WindowPos2sMESA = save_WindowPos2sMESA;
-   table->WindowPos2svMESA = save_WindowPos2svMESA;
-   table->WindowPos3dMESA = save_WindowPos3dMESA;
-   table->WindowPos3dvMESA = save_WindowPos3dvMESA;
-   table->WindowPos3fMESA = save_WindowPos3fMESA;
-   table->WindowPos3fvMESA = save_WindowPos3fvMESA;
-   table->WindowPos3iMESA = save_WindowPos3iMESA;
-   table->WindowPos3ivMESA = save_WindowPos3ivMESA;
-   table->WindowPos3sMESA = save_WindowPos3sMESA;
-   table->WindowPos3svMESA = save_WindowPos3svMESA;
-   table->WindowPos4dMESA = save_WindowPos4dMESA;
-   table->WindowPos4dvMESA = save_WindowPos4dvMESA;
-   table->WindowPos4fMESA = save_WindowPos4fMESA;
-   table->WindowPos4fvMESA = save_WindowPos4fvMESA;
-   table->WindowPos4iMESA = save_WindowPos4iMESA;
-   table->WindowPos4ivMESA = save_WindowPos4ivMESA;
-   table->WindowPos4sMESA = save_WindowPos4sMESA;
-   table->WindowPos4svMESA = save_WindowPos4svMESA;
+   SET_WindowPos2dMESA(table, save_WindowPos2dMESA);
+   SET_WindowPos2dvMESA(table, save_WindowPos2dvMESA);
+   SET_WindowPos2fMESA(table, save_WindowPos2fMESA);
+   SET_WindowPos2fvMESA(table, save_WindowPos2fvMESA);
+   SET_WindowPos2iMESA(table, save_WindowPos2iMESA);
+   SET_WindowPos2ivMESA(table, save_WindowPos2ivMESA);
+   SET_WindowPos2sMESA(table, save_WindowPos2sMESA);
+   SET_WindowPos2svMESA(table, save_WindowPos2svMESA);
+   SET_WindowPos3dMESA(table, save_WindowPos3dMESA);
+   SET_WindowPos3dvMESA(table, save_WindowPos3dvMESA);
+   SET_WindowPos3fMESA(table, save_WindowPos3fMESA);
+   SET_WindowPos3fvMESA(table, save_WindowPos3fvMESA);
+   SET_WindowPos3iMESA(table, save_WindowPos3iMESA);
+   SET_WindowPos3ivMESA(table, save_WindowPos3ivMESA);
+   SET_WindowPos3sMESA(table, save_WindowPos3sMESA);
+   SET_WindowPos3svMESA(table, save_WindowPos3svMESA);
+   SET_WindowPos4dMESA(table, save_WindowPos4dMESA);
+   SET_WindowPos4dvMESA(table, save_WindowPos4dvMESA);
+   SET_WindowPos4fMESA(table, save_WindowPos4fMESA);
+   SET_WindowPos4fvMESA(table, save_WindowPos4fvMESA);
+   SET_WindowPos4iMESA(table, save_WindowPos4iMESA);
+   SET_WindowPos4ivMESA(table, save_WindowPos4ivMESA);
+   SET_WindowPos4sMESA(table, save_WindowPos4sMESA);
+   SET_WindowPos4svMESA(table, save_WindowPos4svMESA);
 
    /* 200. GL_IBM_multimode_draw_arrays */
-   table->MultiModeDrawArraysIBM = exec_MultiModeDrawArraysIBM;
-   table->MultiModeDrawElementsIBM = exec_MultiModeDrawElementsIBM;
+   SET_MultiModeDrawArraysIBM(table, exec_MultiModeDrawArraysIBM);
+   SET_MultiModeDrawElementsIBM(table, exec_MultiModeDrawElementsIBM);
 
 #if FEATURE_NV_vertex_program
    /* 233. GL_NV_vertex_program */
@@ -6508,80 +7784,86 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
     * AreProgramsResidentNV, IsProgramNV, GenProgramsNV, DeleteProgramsNV,
     * VertexAttribPointerNV, GetProgram*, GetVertexAttrib*
     */
-   table->BindProgramNV = save_BindProgramNV;
-   table->DeleteProgramsNV = _mesa_DeleteProgramsNV;
-   table->ExecuteProgramNV = save_ExecuteProgramNV;
-   table->GenProgramsNV = _mesa_GenProgramsNV;
-   table->AreProgramsResidentNV = _mesa_AreProgramsResidentNV;
-   table->RequestResidentProgramsNV = save_RequestResidentProgramsNV;
-   table->GetProgramParameterfvNV = _mesa_GetProgramParameterfvNV;
-   table->GetProgramParameterdvNV = _mesa_GetProgramParameterdvNV;
-   table->GetProgramivNV = _mesa_GetProgramivNV;
-   table->GetProgramStringNV = _mesa_GetProgramStringNV;
-   table->GetTrackMatrixivNV = _mesa_GetTrackMatrixivNV;
-   table->GetVertexAttribdvNV = _mesa_GetVertexAttribdvNV;
-   table->GetVertexAttribfvNV = _mesa_GetVertexAttribfvNV;
-   table->GetVertexAttribivNV = _mesa_GetVertexAttribivNV;
-   table->GetVertexAttribPointervNV = _mesa_GetVertexAttribPointervNV;
-   table->IsProgramNV = _mesa_IsProgramNV;
-   table->LoadProgramNV = save_LoadProgramNV;
-   table->ProgramParameter4dNV = save_ProgramParameter4dNV;
-   table->ProgramParameter4dvNV = save_ProgramParameter4dvNV;
-   table->ProgramParameter4fNV = save_ProgramParameter4fNV;
-   table->ProgramParameter4fvNV = save_ProgramParameter4fvNV;
-   table->ProgramParameters4dvNV = save_ProgramParameters4dvNV;
-   table->ProgramParameters4fvNV = save_ProgramParameters4fvNV;
-   table->TrackMatrixNV = save_TrackMatrixNV;
-   table->VertexAttribPointerNV = _mesa_VertexAttribPointerNV;
+   SET_BindProgramNV(table, save_BindProgramNV);
+   SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
+   SET_ExecuteProgramNV(table, save_ExecuteProgramNV);
+   SET_GenProgramsNV(table, _mesa_GenPrograms);
+   SET_AreProgramsResidentNV(table, _mesa_AreProgramsResidentNV);
+   SET_RequestResidentProgramsNV(table, save_RequestResidentProgramsNV);
+   SET_GetProgramParameterfvNV(table, _mesa_GetProgramParameterfvNV);
+   SET_GetProgramParameterdvNV(table, _mesa_GetProgramParameterdvNV);
+   SET_GetProgramivNV(table, _mesa_GetProgramivNV);
+   SET_GetProgramStringNV(table, _mesa_GetProgramStringNV);
+   SET_GetTrackMatrixivNV(table, _mesa_GetTrackMatrixivNV);
+   SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
+   SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
+   SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
+   SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
+   SET_IsProgramNV(table, _mesa_IsProgram);
+   SET_LoadProgramNV(table, save_LoadProgramNV);
+   SET_ProgramParameter4dNV(table, save_ProgramParameter4dNV);
+   SET_ProgramParameter4dvNV(table, save_ProgramParameter4dvNV);
+   SET_ProgramParameter4fNV(table, save_ProgramParameter4fNV);
+   SET_ProgramParameter4fvNV(table, save_ProgramParameter4fvNV);
+   SET_ProgramParameters4dvNV(table, save_ProgramParameters4dvNV);
+   SET_ProgramParameters4fvNV(table, save_ProgramParameters4fvNV);
+   SET_TrackMatrixNV(table, save_TrackMatrixNV);
+   SET_VertexAttribPointerNV(table, _mesa_VertexAttribPointerNV);
+#endif
+
+   /* 245. GL_ATI_fragment_shader */
+#if FEATURE_ATI_fragment_shader
+   SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
+   SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
 #endif
 
    /* 282. GL_NV_fragment_program */
 #if FEATURE_NV_fragment_program
-   table->ProgramNamedParameter4fNV = save_ProgramNamedParameter4fNV;
-   table->ProgramNamedParameter4dNV = save_ProgramNamedParameter4dNV;
-   table->ProgramNamedParameter4fvNV = save_ProgramNamedParameter4fvNV;
-   table->ProgramNamedParameter4dvNV = save_ProgramNamedParameter4dvNV;
-   table->GetProgramNamedParameterfvNV = _mesa_GetProgramNamedParameterfvNV;
-   table->GetProgramNamedParameterdvNV = _mesa_GetProgramNamedParameterdvNV;
-   table->ProgramLocalParameter4dARB = save_ProgramLocalParameter4dARB;
-   table->ProgramLocalParameter4dvARB = save_ProgramLocalParameter4dvARB;
-   table->ProgramLocalParameter4fARB = save_ProgramLocalParameter4fARB;
-   table->ProgramLocalParameter4fvARB = save_ProgramLocalParameter4fvARB;
-   table->GetProgramLocalParameterdvARB = _mesa_GetProgramLocalParameterdvARB;
-   table->GetProgramLocalParameterfvARB = _mesa_GetProgramLocalParameterfvARB;
+   SET_ProgramNamedParameter4fNV(table, save_ProgramNamedParameter4fNV);
+   SET_ProgramNamedParameter4dNV(table, save_ProgramNamedParameter4dNV);
+   SET_ProgramNamedParameter4fvNV(table, save_ProgramNamedParameter4fvNV);
+   SET_ProgramNamedParameter4dvNV(table, save_ProgramNamedParameter4dvNV);
+   SET_GetProgramNamedParameterfvNV(table, _mesa_GetProgramNamedParameterfvNV);
+   SET_GetProgramNamedParameterdvNV(table, _mesa_GetProgramNamedParameterdvNV);
+   SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
+   SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
+   SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
+   SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
+   SET_GetProgramLocalParameterdvARB(table, _mesa_GetProgramLocalParameterdvARB);
+   SET_GetProgramLocalParameterfvARB(table, _mesa_GetProgramLocalParameterfvARB);
 #endif
 
    /* 262. GL_NV_point_sprite */
-   table->PointParameteriNV = save_PointParameteriNV;
-   table->PointParameterivNV = save_PointParameterivNV;
+   SET_PointParameteriNV(table, save_PointParameteriNV);
+   SET_PointParameterivNV(table, save_PointParameterivNV);
 
    /* 268. GL_EXT_stencil_two_side */
-   table->ActiveStencilFaceEXT = save_ActiveStencilFaceEXT;
+   SET_ActiveStencilFaceEXT(table, save_ActiveStencilFaceEXT);
 
    /* ???. GL_EXT_depth_bounds_test */
-   table->DepthBoundsEXT = save_DepthBoundsEXT;
+   SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
 
    /* ARB 1. GL_ARB_multitexture */
-   table->ActiveTextureARB = save_ActiveTextureARB;
-   table->ClientActiveTextureARB = exec_ClientActiveTextureARB;
+   SET_ActiveTextureARB(table, save_ActiveTextureARB);
+   SET_ClientActiveTextureARB(table, exec_ClientActiveTextureARB);
 
    /* ARB 3. GL_ARB_transpose_matrix */
-   table->LoadTransposeMatrixdARB = save_LoadTransposeMatrixdARB;
-   table->LoadTransposeMatrixfARB = save_LoadTransposeMatrixfARB;
-   table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB;
-   table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB;
+   SET_LoadTransposeMatrixdARB(table, save_LoadTransposeMatrixdARB);
+   SET_LoadTransposeMatrixfARB(table, save_LoadTransposeMatrixfARB);
+   SET_MultTransposeMatrixdARB(table, save_MultTransposeMatrixdARB);
+   SET_MultTransposeMatrixfARB(table, save_MultTransposeMatrixfARB);
 
    /* ARB 5. GL_ARB_multisample */
-   table->SampleCoverageARB = save_SampleCoverageARB;
+   SET_SampleCoverageARB(table, save_SampleCoverageARB);
 
    /* ARB 12. GL_ARB_texture_compression */
-   table->CompressedTexImage3DARB = save_CompressedTexImage3DARB;
-   table->CompressedTexImage2DARB = save_CompressedTexImage2DARB;
-   table->CompressedTexImage1DARB = save_CompressedTexImage1DARB;
-   table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB;
-   table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB;
-   table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB;
-   table->GetCompressedTexImageARB = exec_GetCompressedTexImageARB;
+   SET_CompressedTexImage3DARB(table, save_CompressedTexImage3DARB);
+   SET_CompressedTexImage2DARB(table, save_CompressedTexImage2DARB);
+   SET_CompressedTexImage1DARB(table, save_CompressedTexImage1DARB);
+   SET_CompressedTexSubImage3DARB(table, save_CompressedTexSubImage3DARB);
+   SET_CompressedTexSubImage2DARB(table, save_CompressedTexSubImage2DARB);
+   SET_CompressedTexSubImage1DARB(table, save_CompressedTexSubImage1DARB);
+   SET_GetCompressedTexImageARB(table, exec_GetCompressedTexImageARB);
 
    /* ARB 14. GL_ARB_point_parameters */
    /* aliased with EXT_point_parameters functions */
@@ -6590,11 +7872,67 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
    /* aliased with MESA_window_pos functions */
 
    /* ARB 26. GL_ARB_vertex_program */
-   /* XXX todo */
-   /* ARB 27. GL_ARB_vertex_program */
-   /* XXX todo */
+   /* ARB 27. GL_ARB_fragment_program */
+#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
+   /* glVertexAttrib* functions alias the NV ones, handled elsewhere */
+   SET_VertexAttribPointerARB(table, _mesa_VertexAttribPointerARB);
+   SET_EnableVertexAttribArrayARB(table, _mesa_EnableVertexAttribArrayARB);
+   SET_DisableVertexAttribArrayARB(table, _mesa_DisableVertexAttribArrayARB);
+   SET_ProgramStringARB(table, save_ProgramStringARB);
+   SET_BindProgramNV(table, save_BindProgramNV);
+   SET_DeleteProgramsNV(table, _mesa_DeletePrograms);
+   SET_GenProgramsNV(table, _mesa_GenPrograms);
+   SET_IsProgramNV(table, _mesa_IsProgram);
+   SET_GetVertexAttribdvNV(table, _mesa_GetVertexAttribdvNV);
+   SET_GetVertexAttribfvNV(table, _mesa_GetVertexAttribfvNV);
+   SET_GetVertexAttribivNV(table, _mesa_GetVertexAttribivNV);
+   SET_GetVertexAttribPointervNV(table, _mesa_GetVertexAttribPointervNV);
+   SET_ProgramEnvParameter4dARB(table, save_ProgramEnvParameter4dARB);
+   SET_ProgramEnvParameter4dvARB(table, save_ProgramEnvParameter4dvARB);
+   SET_ProgramEnvParameter4fARB(table, save_ProgramEnvParameter4fARB);
+   SET_ProgramEnvParameter4fvARB(table, save_ProgramEnvParameter4fvARB);
+   SET_ProgramLocalParameter4dARB(table, save_ProgramLocalParameter4dARB);
+   SET_ProgramLocalParameter4dvARB(table, save_ProgramLocalParameter4dvARB);
+   SET_ProgramLocalParameter4fARB(table, save_ProgramLocalParameter4fARB);
+   SET_ProgramLocalParameter4fvARB(table, save_ProgramLocalParameter4fvARB);
+   SET_GetProgramEnvParameterdvARB(table, _mesa_GetProgramEnvParameterdvARB);
+   SET_GetProgramEnvParameterfvARB(table, _mesa_GetProgramEnvParameterfvARB);
+   SET_GetProgramLocalParameterdvARB(table, _mesa_GetProgramLocalParameterdvARB);
+   SET_GetProgramLocalParameterfvARB(table, _mesa_GetProgramLocalParameterfvARB);
+   SET_GetProgramivARB(table, _mesa_GetProgramivARB);
+   SET_GetProgramStringARB(table, _mesa_GetProgramStringARB);
+#endif
+
    /* ARB 28. GL_ARB_vertex_buffer_object */
-   /* XXX todo */
+#if FEATURE_ARB_vertex_buffer_object
+   /* None of the extension's functions get compiled */
+   SET_BindBufferARB(table, _mesa_BindBufferARB);
+   SET_BufferDataARB(table, _mesa_BufferDataARB);
+   SET_BufferSubDataARB(table, _mesa_BufferSubDataARB);
+   SET_DeleteBuffersARB(table, _mesa_DeleteBuffersARB);
+   SET_GenBuffersARB(table, _mesa_GenBuffersARB);
+   SET_GetBufferParameterivARB(table, _mesa_GetBufferParameterivARB);
+   SET_GetBufferPointervARB(table, _mesa_GetBufferPointervARB);
+   SET_GetBufferSubDataARB(table, _mesa_GetBufferSubDataARB);
+   SET_IsBufferARB(table, _mesa_IsBufferARB);
+   SET_MapBufferARB(table, _mesa_MapBufferARB);
+   SET_UnmapBufferARB(table, _mesa_UnmapBufferARB);
+#endif
+
+#if FEATURE_ARB_occlusion_query
+   SET_BeginQueryARB(table, save_BeginQueryARB);
+   SET_EndQueryARB(table, save_EndQueryARB);
+   SET_GenQueriesARB(table, _mesa_GenQueriesARB);
+   SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB);
+   SET_IsQueryARB(table, _mesa_IsQueryARB);
+   SET_GetQueryivARB(table, _mesa_GetQueryivARB);
+   SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB);
+   SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB);
+#endif
+   SET_DrawBuffersARB(table, save_DrawBuffersARB);
+
+   /* 299. GL_EXT_blend_equation_separate */
+   SET_BlendEquationSeparateEXT(table, save_BlendEquationSeparateEXT);
 }
 
 
@@ -6612,28 +7950,34 @@ static const char *enum_string( GLenum k )
  * Print the commands in a display list.  For debugging only.
  * TODO: many commands aren't handled yet.
  */
-static void print_list( GLcontext *ctx, GLuint list )
+static void GLAPIENTRY print_list( GLcontext *ctx, GLuint list )
 {
+   struct mesa_display_list *dlist;
    Node *n;
    GLboolean done;
 
-   if (!glIsList(list)) {
+   if (!CALL_IsList(GET_DISPATCH(), (list))) {
       _mesa_printf("%u is not a display list ID\n", list);
       return;
    }
 
-   n = (Node *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+   dlist = (struct mesa_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list);
+   if (!dlist)
+      return;
 
+   n = dlist->node;
+   
    _mesa_printf("START-LIST %u, address %p\n", list, (void*)n );
 
    done = n ? GL_FALSE : GL_TRUE;
    while (!done) {
       OpCode opcode = n[0].opcode;
-      GLint i = (GLint) n[0].opcode - (GLint) OPCODE_DRV_0;
+      GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0;
 
-      if (i >= 0 && i < (GLint) ctx->listext.nr_opcodes) {
-        ctx->listext.opcode[i].print(ctx, &n[1]);
-        n += ctx->listext.opcode[i].size;
+      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;
       }
       else {
         switch (opcode) {
@@ -6744,12 +8088,12 @@ static void print_list( GLcontext *ctx, GLuint list )
                          _mesa_lookup_enum_by_nr(n[1].ui));
            break;
         case OPCODE_MAP1:
-           _mesa_printf("Map1 %s %.3f %.3f %d %d\n", 
+           _mesa_printf("Map1 %s %.3f %.3f %d %d\n",
                    _mesa_lookup_enum_by_nr(n[1].ui),
                    n[2].f, n[3].f, n[4].i, n[5].i);
            break;
         case OPCODE_MAP2:
-           _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n", 
+           _mesa_printf("Map2 %s %.3f %.3f %.3f %.3f %d %d %d %d\n",
                          _mesa_lookup_enum_by_nr(n[1].ui),
                          n[2].f, n[3].f, n[4].f, n[5].f,
                          n[6].i, n[7].i, n[8].i, n[9].i);
@@ -6759,7 +8103,7 @@ static void print_list( GLcontext *ctx, GLuint list )
                          n[1].i, n[2].f, n[3].f);
            break;
         case OPCODE_MAPGRID2:
-           _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n", 
+           _mesa_printf("MapGrid2 %d %.3f %.3f, %d %.3f %.3f\n",
                          n[1].i, n[2].f, n[3].f,
                          n[4].i, n[5].f, n[6].f);
            break;
@@ -6771,6 +8115,73 @@ static void print_list( GLcontext *ctx, GLuint list )
                          n[1].i, n[2].i, n[3].i, n[4].i);
            break;
 
+        case OPCODE_ATTR_1F_NV:
+           _mesa_printf("ATTR_1F_NV attr %d: %f\n",
+                        n[1].i, n[2].f);
+           break;
+        case OPCODE_ATTR_2F_NV:
+           _mesa_printf("ATTR_2F_NV attr %d: %f %f\n",
+                        n[1].i, n[2].f, n[3].f);
+           break;
+        case OPCODE_ATTR_3F_NV:
+           _mesa_printf("ATTR_3F_NV attr %d: %f %f %f\n",
+                        n[1].i, n[2].f, n[3].f, n[4].f);
+           break;
+        case OPCODE_ATTR_4F_NV:
+           _mesa_printf("ATTR_4F_NV attr %d: %f %f %f %f\n",
+                        n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
+           break;
+        case OPCODE_ATTR_1F_ARB:
+           _mesa_printf("ATTR_1F_ARB attr %d: %f\n",
+                        n[1].i, n[2].f);
+           break;
+        case OPCODE_ATTR_2F_ARB:
+           _mesa_printf("ATTR_2F_ARB attr %d: %f %f\n",
+                        n[1].i, n[2].f, n[3].f);
+           break;
+        case OPCODE_ATTR_3F_ARB:
+           _mesa_printf("ATTR_3F_ARB attr %d: %f %f %f\n",
+                        n[1].i, n[2].f, n[3].f, n[4].f);
+           break;
+        case OPCODE_ATTR_4F_ARB:
+           _mesa_printf("ATTR_4F_ARB attr %d: %f %f %f %f\n",
+                        n[1].i, n[2].f, n[3].f, n[4].f, n[5].f);
+           break;
+
+        case OPCODE_MATERIAL:
+           _mesa_printf("MATERIAL %x %x: %f %f %f %f\n",
+                        n[1].i, n[2].i, n[3].f, n[4].f, n[5].f, n[6].f);
+           break;
+        case OPCODE_INDEX:
+           _mesa_printf("INDEX: %f\n", n[1].f);
+           break;
+        case OPCODE_EDGEFLAG:
+           _mesa_printf("EDGEFLAG: %d\n", n[1].i);
+           break;
+        case OPCODE_BEGIN:
+           _mesa_printf("BEGIN %x\n", n[1].i);
+           break;
+        case OPCODE_END:
+           _mesa_printf("END\n");
+           break;
+        case OPCODE_RECTF:
+           _mesa_printf("RECTF %f %f %f %f\n", n[1].f, n[2].f, n[3].f, n[4].f);
+           break;
+        case OPCODE_EVAL_C1:
+           _mesa_printf("EVAL_C1 %f\n", n[1].f);
+           break;
+        case OPCODE_EVAL_C2:
+           _mesa_printf("EVAL_C2 %f %f\n", n[1].f, n[2].f);
+           break;
+        case OPCODE_EVAL_P1:
+           _mesa_printf("EVAL_P1 %d\n", n[1].i);
+           break;
+        case OPCODE_EVAL_P2:
+           _mesa_printf("EVAL_P2 %d %d\n", n[1].i, n[2].i);
+           break;
+
+
+
         /*
          * meta opcodes/commands
          */
@@ -6822,18 +8233,106 @@ void mesa_print_display_list( GLuint list )
 /*****                      Initialization                        *****/
 /**********************************************************************/
 
+
+void _mesa_save_vtxfmt_init( GLvertexformat *vfmt )
+{
+   vfmt->ArrayElement = _ae_loopback_array_elt;                /* generic helper */
+   vfmt->Begin = save_Begin;
+   vfmt->CallList = _mesa_save_CallList;
+   vfmt->CallLists = _mesa_save_CallLists;
+   vfmt->Color3f = save_Color3f;
+   vfmt->Color3fv = save_Color3fv;
+   vfmt->Color4f = save_Color4f;
+   vfmt->Color4fv = save_Color4fv;
+   vfmt->EdgeFlag = save_EdgeFlag;
+   vfmt->EdgeFlagv = save_EdgeFlagv;
+   vfmt->End = save_End;
+   vfmt->EvalCoord1f = save_EvalCoord1f;
+   vfmt->EvalCoord1fv = save_EvalCoord1fv;
+   vfmt->EvalCoord2f = save_EvalCoord2f;
+   vfmt->EvalCoord2fv = save_EvalCoord2fv;
+   vfmt->EvalPoint1 = save_EvalPoint1;
+   vfmt->EvalPoint2 = save_EvalPoint2;
+   vfmt->FogCoordfEXT = save_FogCoordfEXT;
+   vfmt->FogCoordfvEXT = save_FogCoordfvEXT;
+   vfmt->Indexf = save_Indexf;
+   vfmt->Indexfv = save_Indexfv;
+   vfmt->Materialfv = save_Materialfv;
+   vfmt->MultiTexCoord1fARB = save_MultiTexCoord1f;
+   vfmt->MultiTexCoord1fvARB = save_MultiTexCoord1fv;
+   vfmt->MultiTexCoord2fARB = save_MultiTexCoord2f;
+   vfmt->MultiTexCoord2fvARB = save_MultiTexCoord2fv;
+   vfmt->MultiTexCoord3fARB = save_MultiTexCoord3f;
+   vfmt->MultiTexCoord3fvARB = save_MultiTexCoord3fv;
+   vfmt->MultiTexCoord4fARB = save_MultiTexCoord4f;
+   vfmt->MultiTexCoord4fvARB = save_MultiTexCoord4fv;
+   vfmt->Normal3f = save_Normal3f;
+   vfmt->Normal3fv = save_Normal3fv;
+   vfmt->SecondaryColor3fEXT = save_SecondaryColor3fEXT;
+   vfmt->SecondaryColor3fvEXT = save_SecondaryColor3fvEXT;
+   vfmt->TexCoord1f = save_TexCoord1f;
+   vfmt->TexCoord1fv = save_TexCoord1fv;
+   vfmt->TexCoord2f = save_TexCoord2f;
+   vfmt->TexCoord2fv = save_TexCoord2fv;
+   vfmt->TexCoord3f = save_TexCoord3f;
+   vfmt->TexCoord3fv = save_TexCoord3fv;
+   vfmt->TexCoord4f = save_TexCoord4f;
+   vfmt->TexCoord4fv = save_TexCoord4fv;
+   vfmt->Vertex2f = save_Vertex2f;
+   vfmt->Vertex2fv = save_Vertex2fv;
+   vfmt->Vertex3f = save_Vertex3f;
+   vfmt->Vertex3fv = save_Vertex3fv;
+   vfmt->Vertex4f = save_Vertex4f;
+   vfmt->Vertex4fv = save_Vertex4fv;
+   vfmt->VertexAttrib1fNV = save_VertexAttrib1fNV;
+   vfmt->VertexAttrib1fvNV = save_VertexAttrib1fvNV;
+   vfmt->VertexAttrib2fNV = save_VertexAttrib2fNV;
+   vfmt->VertexAttrib2fvNV = save_VertexAttrib2fvNV;
+   vfmt->VertexAttrib3fNV = save_VertexAttrib3fNV;
+   vfmt->VertexAttrib3fvNV = save_VertexAttrib3fvNV;
+   vfmt->VertexAttrib4fNV = save_VertexAttrib4fNV;
+   vfmt->VertexAttrib4fvNV = save_VertexAttrib4fvNV;
+   vfmt->VertexAttrib1fARB = save_VertexAttrib1fARB;
+   vfmt->VertexAttrib1fvARB = save_VertexAttrib1fvARB;
+   vfmt->VertexAttrib2fARB = save_VertexAttrib2fARB;
+   vfmt->VertexAttrib2fvARB = save_VertexAttrib2fvARB;
+   vfmt->VertexAttrib3fARB = save_VertexAttrib3fARB;
+   vfmt->VertexAttrib3fvARB = save_VertexAttrib3fvARB;
+   vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB;
+   vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB;
+
+   vfmt->EvalMesh1 = _mesa_save_EvalMesh1;
+   vfmt->EvalMesh2 = _mesa_save_EvalMesh2;
+   vfmt->Rectf = save_Rectf;
+
+   /* The driver is required to implement these as
+    * 1) They can probably do a better job.
+    * 2) A lot of new mechanisms would have to be added to this module
+    *     to support it.  That code would probably never get used,
+    *     because of (1).
+    */
+#if 0
+   vfmt->DrawArrays = 0;
+   vfmt->DrawElements = 0;
+   vfmt->DrawRangeElements = 0;
+#endif
+}
+
+
+
 void _mesa_init_display_list( GLcontext * ctx )
 {
    /* Display list */
-   ctx->CallDepth = 0;
+   ctx->ListState.CallDepth = 0;
    ctx->ExecuteFlag = GL_TRUE;
    ctx->CompileFlag = GL_FALSE;
-   ctx->CurrentListPtr = NULL;
-   ctx->CurrentBlock = NULL;
-   ctx->CurrentListNum = 0;
-   ctx->CurrentPos = 0;
+   ctx->ListState.CurrentListPtr = NULL;
+   ctx->ListState.CurrentBlock = NULL;
+   ctx->ListState.CurrentListNum = 0;
+   ctx->ListState.CurrentPos = 0;
 
    /* Display List group */
    ctx->List.ListBase = 0;
 
+   _mesa_save_vtxfmt_init( &ctx->ListState.ListVtxfmt );
 }