Merge remote branch 'origin/master' into pipe-video
[mesa.git] / src / mapi / glapi / glapi_getproc.c
index 3c134f929d6350973b672d4b3131b284dbcdbe67..47a01176d5a242a2162dbe98d35c6409ba148260 100644 (file)
  */
 
 
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#include "glapi/mesa.h"
-#else
-#include "main/glheader.h"
-#include "main/compiler.h"
-#endif
-
-#include "glapi/glapi.h"
 #include "glapi/glapi_priv.h"
 #include "glapi/glapitable.h"
-#include "glapi/glapioffsets.h"
+
+
+#define FIRST_DYNAMIC_OFFSET (sizeof(struct _glapi_table) / sizeof(void *))
 
 
 /**********************************************************************
@@ -391,7 +384,7 @@ int
 _glapi_add_dispatch( const char * const * function_names,
                     const char * parameter_signature )
 {
-   static int next_dynamic_offset = _gloffset_FIRST_DYNAMIC;
+   static int next_dynamic_offset = FIRST_DYNAMIC_OFFSET;
    const char * const real_sig = (parameter_signature != NULL)
      ? parameter_signature : "";
    struct _glapi_function * entry[8];
@@ -585,15 +578,6 @@ _glapi_get_proc_name(GLuint offset)
  */
 
 
-/*
- * The dispatch table size (number of entries) is the size of the
- * _glapi_table struct plus the number of dynamic entries we can add.
- * The extra slots can be filled in by DRI drivers that register new extension
- * functions.
- */
-#define DISPATCH_TABLE_SIZE (sizeof(struct _glapi_table) / sizeof(void *) + MAX_EXTENSION_FUNCS)
-
-
 /**
  * Return size of dispatch table struct as number of functions (or
  * slots).
@@ -601,7 +585,13 @@ _glapi_get_proc_name(GLuint offset)
 GLuint
 _glapi_get_dispatch_table_size(void)
 {
-   return DISPATCH_TABLE_SIZE;
+   /*
+    * The dispatch table size (number of entries) is the size of the
+    * _glapi_table struct plus the number of dynamic entries we can add.
+    * The extra slots can be filled in by DRI drivers that register new
+    * extension functions.
+    */
+   return FIRST_DYNAMIC_OFFSET + MAX_EXTENSION_FUNCS;
 }
 
 
@@ -637,56 +627,48 @@ _glapi_check_table(const struct _glapi_table *table)
       GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
       char *BeginFunc = (char*) &table->Begin;
       GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
-      assert(BeginOffset == _gloffset_Begin);
       assert(BeginOffset == offset);
    }
    {
       GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
       char *viewportFunc = (char*) &table->Viewport;
       GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
-      assert(viewportOffset == _gloffset_Viewport);
       assert(viewportOffset == offset);
    }
    {
       GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
       char *VertexPointerFunc = (char*) &table->VertexPointer;
       GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
-      assert(VertexPointerOffset == _gloffset_VertexPointer);
       assert(VertexPointerOffset == offset);
    }
    {
       GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
       char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
       GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
-      assert(ResetMinMaxOffset == _gloffset_ResetMinmax);
       assert(ResetMinMaxOffset == offset);
    }
    {
       GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
       char *blendColorFunc = (char*) &table->BlendColor;
       GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
-      assert(blendColorOffset == _gloffset_BlendColor);
       assert(blendColorOffset == offset);
    }
    {
       GLuint secondaryColor3fOffset = _glapi_get_proc_offset("glSecondaryColor3fEXT");
       char *secondaryColor3fFunc = (char*) &table->SecondaryColor3fEXT;
       GLuint offset = (secondaryColor3fFunc - (char *) table) / sizeof(void *);
-      assert(secondaryColor3fOffset == _gloffset_SecondaryColor3fEXT);
       assert(secondaryColor3fOffset == offset);
    }
    {
       GLuint pointParameterivOffset = _glapi_get_proc_offset("glPointParameterivNV");
       char *pointParameterivFunc = (char*) &table->PointParameterivNV;
       GLuint offset = (pointParameterivFunc - (char *) table) / sizeof(void *);
-      assert(pointParameterivOffset == _gloffset_PointParameterivNV);
       assert(pointParameterivOffset == offset);
    }
    {
       GLuint setFenceOffset = _glapi_get_proc_offset("glSetFenceNV");
       char *setFenceFunc = (char*) &table->SetFenceNV;
       GLuint offset = (setFenceFunc - (char *) table) / sizeof(void *);
-      assert(setFenceOffset == _gloffset_SetFenceNV);
       assert(setFenceOffset == offset);
    }
 #else