Mesa (master): mesa: Fix build of ES overlay.

Chia-I Wu olv at kemper.freedesktop.org
Wed May 5 03:58:24 UTC 2010


Module: Mesa
Branch: master
Commit: a6ec153830ea25958f8cb5f5b5ae7a3433d61bbc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6ec153830ea25958f8cb5f5b5ae7a3433d61bbc

Author: Chia-I Wu <olv at lunarg.com>
Date:   Wed May  5 10:59:44 2010 +0800

mesa: Fix build of ES overlay.

ES overlay is built with FEATURE_ES1 or FEATURE_ES2, and is built
without FEATURE_GL.  Fix the build by always building OpenGL ES sources,
but test for FEATURE_ES1 or FEATURE_ES2.  Also, define symbols that are
missing because FEATURE_GL is not defined.

---

 configs/autoconf.in           |    1 -
 configure.ac                  |    6 ------
 src/mesa/main/es_generator.py |   14 ++++++++++++--
 src/mesa/main/get_gen_es.py   |   20 ++++++++++++++++++--
 src/mesa/sources.mak          |    9 ++++-----
 5 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 5301908..ba99fe0 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -36,7 +36,6 @@ LLVM_LIBS = @LLVM_LIBS@
 # Source selection
 MESA_ASM_SOURCES = @MESA_ASM_SOURCES@
 GLAPI_ASM_SOURCES = @GLAPI_ASM_SOURCES@
-ES_SOURCES = @ES1_SOURCES@ @ES2_SOURCES@
 
 # Misc tools and flags
 MAKE = @MAKE@
diff --git a/configure.ac b/configure.ac
index 5a0ee13..b2e49a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -748,8 +748,6 @@ AC_ARG_ENABLE([gles2],
 
 API_DEFINES=""
 APIS=""
-ES1_SOURCES=""
-ES2_SOURCES=""
 if test "x$enable_opengl" = xno; then
     API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
 else
@@ -759,20 +757,16 @@ fi
 if test "x$enable_gles1" = xyes; then
     API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
     APIS="$APIS es1"
-    ES1_SOURCES='$(ES1_SOURCES)'
 fi
 if test "x$enable_gles2" = xyes; then
     API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
     APIS="$APIS es2"
-    ES2_SOURCES='$(ES2_SOURCES)'
 fi
 if test "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
     SRC_DIRS="$SRC_DIRS gles"
 fi
 AC_SUBST([API_DEFINES])
 AC_SUBST([APIS])
-AC_SUBST([ES1_SOURCES])
-AC_SUBST([ES2_SOURCES])
 
 dnl If $with_dri_drivers is yes, directories will be added through
 dnl platform checks
diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py
index 8f08a3a..12f03a5 100644
--- a/src/mesa/main/es_generator.py
+++ b/src/mesa/main/es_generator.py
@@ -190,7 +190,10 @@ print """/* DO NOT EDIT *************************************************
 print """
 #include "%s"
 #include "%s"
-""" % (versionHeader, versionExtHeader)
+#include "main/mfeatures.h"
+
+#if FEATURE_%s
+""" % (versionHeader, versionExtHeader, shortname.upper())
 
 # Everyone needs these types.
 print """
@@ -211,16 +214,20 @@ extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
 #include "main/api_exec.h"
 #include "main/remap.h"
 
+/* cannot include main/dispatch.h here */
 #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
 
+#if !FEATURE_GL
+int driDispatchRemapTable[driDispatchRemapTable_size];
+#endif
+
 #define need_MESA_remap_table
 
 #include "es/glapi/glapi-%s/main/remap_helper.h"
@@ -728,3 +735,6 @@ for func in keys:
 print ""
 print "   return exec;"
 print "}"
+
+print """
+#endif /* FEATURE_%s */""" % (shortname.upper())
diff --git a/src/mesa/main/get_gen_es.py b/src/mesa/main/get_gen_es.py
index 5fadfee..0c45b3d 100644
--- a/src/mesa/main/get_gen_es.py
+++ b/src/mesa/main/get_gen_es.py
@@ -584,6 +584,7 @@ def EmitGetFunction(stateVars, returnType, API):
 		function = "_es%d_GetFixedv" % API
 	else:
 		abort()
+	mesa_function = "_mesa_" + function[5:]
 
 	print "void GLAPIENTRY"
 	print "%s( GLenum pname, %s *params )" % (function, strType)
@@ -634,11 +635,20 @@ def EmitGetFunction(stateVars, returnType, API):
 	print "   }"
 	print "}"
 	print ""
+
+	print "#if !FEATURE_GL"
+	print "/* define _mesa_ version for internal use */"
+	print "void GLAPIENTRY"
+	print "%s( GLenum pname, %s *params )" % (mesa_function, strType)
+	print "{"
+	print "   %s(pname, params);" % (function)
+	print "}"
+	print "#endif /* !FEATURE_GL */"
 	return
 
 
 
-def EmitHeader():
+def EmitHeader(API):
 	"""Print the get.c file header."""
 	print """
 /***
@@ -656,8 +666,11 @@ def EmitHeader():
 #include "main/state.h"
 #include "main/texcompress.h"
 #include "main/framebuffer.h"
+"""
 
+	print "#if FEATURE_ES%d" % (API)
 
+	print """
 /* ES1 tokens that should be in gl.h but aren't */
 #define GL_MAX_ELEMENTS_INDICES             0x80E9
 #define GL_MAX_ELEMENTS_VERTICES            0x80E8
@@ -778,13 +791,16 @@ static GLenum compressed_formats[] = {
 
 
 def EmitAll(stateVars, API):
-	EmitHeader()
+	EmitHeader(API)
 	EmitGetFunction(stateVars, GLboolean, API)
 	EmitGetFunction(stateVars, GLfloat, API)
 	EmitGetFunction(stateVars, GLint, API)
 	if API == 1:
 		EmitGetFunction(stateVars, GLfixed, API)
 
+        # close the #if emitted in EmitHeader
+	print "#endif /* FEATURE_ES%d */" % (API)
+
 
 def main(args):
 	# Determine whether to generate ES1 or ES2 queries
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index be859e4..02f65cb 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -1,11 +1,10 @@
 ### Lists of source files, included by Makefiles
 
-ES1_SOURCES = \
+# this is part of MAIN_SOURCES
+MAIN_ES_SOURCES = \
 	main/api_exec_es1.c \
-	main/get_es1.c
-
-ES2_SOURCES = \
 	main/api_exec_es2.c \
+	main/get_es1.c \
 	main/get_es2.c
 
 MAIN_SOURCES = \
@@ -96,7 +95,7 @@ MAIN_SOURCES = \
 	main/version.c \
 	main/viewport.c \
 	main/vtxfmt.c \
-	$(ES_SOURCES)
+	$(MAIN_ES_SOURCES)
 
 GLAPI_SOURCES = \
 	glapi/glapi.c \




More information about the mesa-commit mailing list