summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-04-22 20:26:51 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-04-27 19:27:49 -0400
commitea0c7e71638a4a72a4eae962e6cc471bd33a5605 (patch)
tree5229269112efc701323ffe1ed500d22583bea63b /src/mesa
parent1741ddb747ca0be284315adb4b6fe67ddf292d03 (diff)
downloadexternal_mesa3d-ea0c7e71638a4a72a4eae962e6cc471bd33a5605.zip
external_mesa3d-ea0c7e71638a4a72a4eae962e6cc471bd33a5605.tar.gz
external_mesa3d-ea0c7e71638a4a72a4eae962e6cc471bd33a5605.tar.bz2
mesa: Move api_exec_es*.c into mesa/main
This requires renaming a few functions to have unique names so that they can all live within the same driver.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/Makefile6
-rw-r--r--src/mesa/es/Makefile8
-rw-r--r--src/mesa/es/sources.mak2
-rw-r--r--src/mesa/main/APIspec.dtd (renamed from src/mesa/es/main/APIspec.dtd)0
-rw-r--r--src/mesa/main/APIspec.py (renamed from src/mesa/es/main/APIspec.py)0
-rw-r--r--src/mesa/main/APIspec.xml (renamed from src/mesa/es/main/APIspec.xml)0
-rw-r--r--src/mesa/main/APIspecutil.py (renamed from src/mesa/es/main/APIspecutil.py)0
-rw-r--r--src/mesa/main/api_exec.h6
-rw-r--r--src/mesa/main/context.c48
-rw-r--r--src/mesa/main/es_generator.py (renamed from src/mesa/es/main/es_generator.py)41
-rw-r--r--src/mesa/main/remap.h33
-rw-r--r--src/mesa/sources.mak2
12 files changed, 114 insertions, 32 deletions
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index 8c0ebf8..7dcde52 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -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:
diff --git a/src/mesa/es/Makefile b/src/mesa/es/Makefile
index 8b48485..b095620 100644
--- a/src/mesa/es/Makefile
+++ b/src/mesa/es/Makefile
@@ -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 > $@
diff --git a/src/mesa/es/sources.mak b/src/mesa/es/sources.mak
index b08069b..0f682f5 100644
--- a/src/mesa/es/sources.mak
+++ b/src/mesa/es/sources.mak
@@ -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 \
diff --git a/src/mesa/es/main/APIspec.dtd b/src/mesa/main/APIspec.dtd
index efcfa31..efcfa31 100644
--- a/src/mesa/es/main/APIspec.dtd
+++ b/src/mesa/main/APIspec.dtd
diff --git a/src/mesa/es/main/APIspec.py b/src/mesa/main/APIspec.py
index 6947f73..6947f73 100644
--- a/src/mesa/es/main/APIspec.py
+++ b/src/mesa/main/APIspec.py
diff --git a/src/mesa/es/main/APIspec.xml b/src/mesa/main/APIspec.xml
index 7e77eb7..7e77eb7 100644
--- a/src/mesa/es/main/APIspec.xml
+++ b/src/mesa/main/APIspec.xml
diff --git a/src/mesa/es/main/APIspecutil.py b/src/mesa/main/APIspecutil.py
index 27a8fe8..27a8fe8 100644
--- a/src/mesa/es/main/APIspecutil.py
+++ b/src/mesa/main/APIspecutil.py
diff --git a/src/mesa/main/api_exec.h b/src/mesa/main/api_exec.h
index dd8d500..29c953f 100644
--- a/src/mesa/main/api_exec.h
+++ b/src/mesa/main/api_exec.h
@@ -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
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8d71cef..0963e75 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -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;
diff --git a/src/mesa/es/main/es_generator.py b/src/mesa/main/es_generator.py
index 8dedafb..1282a1c 100644
--- a/src/mesa/es/main/es_generator.py
+++ b/src/mesa/main/es_generator.py
@@ -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_"
diff --git a/src/mesa/main/remap.h b/src/mesa/main/remap.h
index dda1a6b..7afdee3 100644
--- a/src/mesa/main/remap.h
+++ b/src/mesa/main/remap.h
@@ -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 */
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index d9ebb51..72b46e9 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -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 \