OSDN Git Service

mesa: Move api_exec_es*.c into mesa/main
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 23 Apr 2010 00:26:51 +0000 (20:26 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 27 Apr 2010 23:27:49 +0000 (19:27 -0400)
This requires renaming a few functions to have unique names so that
they can all live within the same driver.

12 files changed:
src/mesa/Makefile
src/mesa/es/Makefile
src/mesa/es/sources.mak
src/mesa/main/APIspec.dtd [moved from src/mesa/es/main/APIspec.dtd with 100% similarity]
src/mesa/main/APIspec.py [moved from src/mesa/es/main/APIspec.py with 100% similarity]
src/mesa/main/APIspec.xml [moved from src/mesa/es/main/APIspec.xml with 100% similarity]
src/mesa/main/APIspecutil.py [moved from src/mesa/es/main/APIspecutil.py with 100% similarity]
src/mesa/main/api_exec.h
src/mesa/main/context.c
src/mesa/main/es_generator.py [moved from src/mesa/es/main/es_generator.py with 98% similarity]
src/mesa/main/remap.h
src/mesa/sources.mak

index 8c0ebf8..7dcde52 100644 (file)
@@ -24,6 +24,12 @@ default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
        libglapi.a driver_subdirs
 
 
+main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
+       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
+
+main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
+       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
+
 
 ######################################################################
 # Helper libraries used by many drivers:
index 8b48485..b095620 100644 (file)
@@ -83,17 +83,9 @@ libes2api.a: $(ES2_API_OBJECTS)
        @$(MKLIB) -o es2api -static $(ES2_API_OBJECTS)
 
 GENERATED_SOURCES :=           \
-       main/api_exec_es1.c     \
-       main/api_exec_es2.c     \
        main/get_es1.c          \
        main/get_es2.c
 
-main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
-       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
-
-main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
-       $(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
-
 main/get_es1.c: main/get_gen.py
        $(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
 
index b08069b..0f682f5 100644 (file)
@@ -3,7 +3,6 @@ include $(MESA)/sources.mak
 # LOCAL sources
 
 LOCAL_ES1_SOURCES :=                   \
-       main/api_exec_es1.c             \
        main/get_es1.c                  \
        main/drawtex.c                  \
        main/es_cpaltex.c               \
@@ -28,7 +27,6 @@ LOCAL_ES1_INCLUDES :=                 \
        -I$(MESA)/state_tracker
 
 LOCAL_ES2_SOURCES :=                   \
-       main/api_exec_es2.c             \
        main/get_es2.c                  \
        main/es_cpaltex.c               \
        main/es_fbo.c                   \
index dd8d500..29c953f 100644 (file)
@@ -35,5 +35,11 @@ _mesa_alloc_dispatch_table(int size);
 extern struct _glapi_table *
 _mesa_create_exec_table(void);
 
+extern struct _glapi_table *
+_mesa_create_exec_table_es1(void);
+
+extern struct _glapi_table *
+_mesa_create_exec_table_es2(void);
+
 
 #endif
index 8d71cef..0963e75 100644 (file)
@@ -394,7 +394,25 @@ one_time_init( GLcontext *ctx )
 
       _mesa_get_cpu_features();
 
-      _mesa_init_remap_table();
+      switch (ctx->API) {
+#if FEATURE_GL
+      case API_OPENGL:
+        _mesa_init_remap_table();
+        break;
+#endif
+#if FEATURE_ES1
+      case API_OPENGLES:
+        _mesa_init_remap_table_es1();
+        break;
+#endif
+#if FEATURE_ES2
+      case API_OPENGLES2:
+        _mesa_init_remap_table_es2();
+        break;
+#endif
+      default:
+        break;
+      }
 
       _mesa_init_sqrt_table();
 
@@ -812,9 +830,6 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
    assert(driverFunctions->NewTextureObject);
    assert(driverFunctions->FreeTexImageData);
 
-   /* misc one-time initializations */
-   one_time_init(ctx);
-
    ctx->API = api;
    ctx->Visual = *visual;
    ctx->DrawBuffer = NULL;
@@ -822,6 +837,9 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
    ctx->WinSysDrawBuffer = NULL;
    ctx->WinSysReadBuffer = NULL;
 
+   /* misc one-time initializations */
+   one_time_init(ctx);
+
    /* Plug in driver functions and context pointer here.
     * This is important because when we call alloc_shared_state() below
     * we'll call ctx->Driver.NewTextureObject() to create the default
@@ -853,7 +871,27 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
 
 #if FEATURE_dispatch
    /* setup the API dispatch tables */
-   ctx->Exec = _mesa_create_exec_table();
+   switch (ctx->API) {
+#if FEATURE_GL
+   case API_OPENGL:
+      ctx->Exec = _mesa_create_exec_table();
+      break;
+#endif
+#if FEATURE_ES1
+   case API_OPENGLES:
+      ctx->Exec = _mesa_create_exec_table_es1();
+      break;
+#endif
+#if FEATURE_ES2
+   case API_OPENGLES2:
+      ctx->Exec = _mesa_create_exec_table_es2();
+      break;
+#endif
+   default:
+      _mesa_problem(ctx, "unknown or unsupported API");
+      break;
+   }
+
    if (!ctx->Exec) {
       _mesa_release_shared_state(ctx, ctx->Shared);
       return GL_FALSE;
similarity index 98%
rename from src/mesa/es/main/es_generator.py
rename to src/mesa/main/es_generator.py
index 8dedafb..1282a1c 100644 (file)
@@ -103,11 +103,13 @@ VersionSpecificValues = {
         'description' : 'GLES1.1 functions',
         'header' : 'GLES/gl.h',
         'extheader' : 'GLES/glext.h',
+        'shortname' : 'es1'
     },
     'GLES2.0': {
         'description' : 'GLES2.0 functions',
         'header' : 'GLES2/gl2.h',
         'extheader' : 'GLES2/gl2ext.h',
+        'shortname' : 'es2'
     }
 }
 
@@ -164,6 +166,7 @@ if not VersionSpecificValues.has_key(version):
 # Grab the version-specific items we need to use
 versionHeader = VersionSpecificValues[version]['header']
 versionExtHeader = VersionSpecificValues[version]['extheader']
+shortname = VersionSpecificValues[version]['shortname']
 
 # If we get to here, we're good to go.  The "version" parameter
 # directs GetDispatchedFunctions to only allow functions from
@@ -206,22 +209,24 @@ extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
 
 #include "main/compiler.h"
 #include "main/api_exec.h"
-
-#include "main/dispatch.h"
-
-#if FEATURE_remap_table
-
 #include "main/remap.h"
 
 #ifdef IN_DRI_DRIVER
 #define _GLAPI_USE_REMAP_TABLE
 #endif
 
+#include "es/glapi/glapi-%s/glapi/glapitable.h"
+#include "es/glapi/glapi-%s/glapi/glapioffsets.h"
+#include "es/glapi/glapi-%s/glapi/glapidispatch.h"
+
+#if FEATURE_remap_table
+
 #define need_MESA_remap_table
-#include "main/remap_helper.h"
+
+#include "es/glapi/glapi-%s/main/remap_helper.h"
 
 void
-_mesa_init_remap_table(void)
+_mesa_init_remap_table_%s(void)
 {
    _mesa_do_init_remap_table(_mesa_function_pool,
                              driDispatchRemapTable_size,
@@ -229,14 +234,14 @@ _mesa_init_remap_table(void)
 }
 
 void
-_mesa_map_static_functions(void)
+_mesa_map_static_functions_%s(void)
 {
 }
 
 #endif
 
 typedef void (*_glapi_proc)(void); /* generic function pointer */
-"""
+""" % (shortname, shortname, shortname, shortname, shortname, shortname);
 
 # Finally we get to the all-important functions
 print """/*************************************************************
@@ -693,14 +698,16 @@ for funcName in keys:
 
 # end for each function
 
-print "struct _glapi_table *"
-print "_mesa_create_exec_table(void)"
-print "{"
-print "   struct _glapi_table *exec;"
-print "   exec = _mesa_alloc_dispatch_table(sizeof *exec);"
-print "   if (exec == NULL)"
-print "      return NULL;"
-print ""
+print """
+struct _glapi_table *
+_mesa_create_exec_table_%s(void)
+{
+   struct _glapi_table *exec;
+   exec = _mesa_alloc_dispatch_table(sizeof *exec);
+   if (exec == NULL)
+      return NULL;
+
+""" % shortname
 
 for func in keys:
     prefix = "_es_" if func not in allSpecials else "_check_"
index dda1a6b..7afdee3 100644 (file)
@@ -59,6 +59,12 @@ extern void
 _mesa_map_static_functions(void);
 
 extern void
+_mesa_map_static_functions_es1(void);
+
+extern void
+_mesa_map_static_functions_es2(void);
+
+extern void
 _mesa_do_init_remap_table(const char *pool,
                          int size,
                          const struct gl_function_pool_remap *remap);
@@ -66,6 +72,12 @@ _mesa_do_init_remap_table(const char *pool,
 extern void
 _mesa_init_remap_table(void);
 
+extern void
+_mesa_init_remap_table_es1(void);
+
+extern void
+_mesa_init_remap_table_es2(void);
+
 #else /* FEATURE_remap_table */
 
 static INLINE const char *
@@ -90,6 +102,17 @@ _mesa_map_static_functions(void)
 {
 }
 
+
+static INLINE void
+_mesa_map_static_functions_es1(void)
+{
+}
+
+static INLINE void
+_mesa_map_static_functions_es2(void)
+{
+}
+
 static INLINE void
 _mesa_do_init_remap_table(const char *pool,
                          int size,
@@ -102,6 +125,16 @@ _mesa_init_remap_table(void)
 {
 }
 
+static INLINE void
+_mesa_init_remap_table_es1(void)
+{
+}
+
+static INLINE void
+_mesa_init_remap_table_es2(void)
+{
+}
+
 #endif /* FEATURE_remap_table */
 
 
index d9ebb51..72b46e9 100644 (file)
@@ -3,6 +3,8 @@
 MAIN_SOURCES = \
        main/api_arrayelt.c \
        main/api_exec.c \
+       main/api_exec_es1.c \
+       main/api_exec_es2.c \
        main/api_loopback.c \
        main/api_noop.c \
        main/api_validate.c \