summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/GL/Makefile.am8
-rw-r--r--src/GLdispatch/vnd-glapi/Makefile.am2
-rw-r--r--src/OpenGL/Makefile.am2
-rw-r--r--src/generate/genCommon.py32
-rwxr-xr-xsrc/generate/gen_gldispatch_mapi.py15
-rwxr-xr-xsrc/generate/gen_libOpenGL_exports.py7
-rw-r--r--src/generate/glvnd_gen.mk15
7 files changed, 51 insertions, 30 deletions
diff --git a/src/GL/Makefile.am b/src/GL/Makefile.am
index 1055696..93415e0 100644
--- a/src/GL/Makefile.am
+++ b/src/GL/Makefile.am
@@ -33,7 +33,7 @@ GLAPI = $(MAPI)/glapi
noinst_HEADERS = \
libgl.h \
- glapi_mapi_tmp.h
+ g_glapi_mapi_gl_tmp.h
include $(top_srcdir)/src/GLdispatch/vnd-glapi/entry_files.mk
@@ -44,11 +44,11 @@ libGL_la_SOURCES = \
g_libglglxwrapper.c \
$(top_srcdir)/src/util/utils_misc.c
-BUILT_SOURCES = glapi_mapi_tmp.h g_libglglxwrapper.c
+BUILT_SOURCES = g_glapi_mapi_gl_tmp.h g_libglglxwrapper.c
CLEANFILES = $(BUILT_SOURCES)
include $(top_srcdir)/src/generate/glvnd_gen.mk
-glapi_mapi_tmp.h : $(glapi_gen_mapi_deps)
+g_glapi_mapi_gl_tmp.h : $(glapi_gen_mapi_deps)
$(call glapi_gen_mapi, gl)
g_libglglxwrapper.c : $(glapi_gen_libglglxstubs_deps)
@@ -73,7 +73,7 @@ AM_CPPFLAGS = \
-I$(TOP)/src/GLdispatch \
-I$(TOP)/src/util \
-I$(TOP)/src/util/glvnd_pthread \
- -DMAPI_ABI_HEADER=\"$(builddir)/glapi_mapi_tmp.h\" \
+ -DMAPI_ABI_HEADER=\"$(builddir)/g_glapi_mapi_gl_tmp.h\" \
-DSTATIC_DISPATCH_ONLY
libGL_la_LIBADD = ../GLX/libGLX.la
diff --git a/src/GLdispatch/vnd-glapi/Makefile.am b/src/GLdispatch/vnd-glapi/Makefile.am
index 8460411..f45ff14 100644
--- a/src/GLdispatch/vnd-glapi/Makefile.am
+++ b/src/GLdispatch/vnd-glapi/Makefile.am
@@ -35,7 +35,7 @@ libglapi_la_LDFLAGS = -no-undefined
include $(top_srcdir)/src/generate/glvnd_gen.mk
glapi_mapi_tmp.h : $(glapi_gen_mapi_deps)
- $(call glapi_gen_mapi, gl)
+ $(call glapi_gen_mapi, gldispatch)
g_glapi_inittable.c: $(glapi_gen_initdispatch_deps)
$(call glapi_gen_initdispatch)
diff --git a/src/OpenGL/Makefile.am b/src/OpenGL/Makefile.am
index 2e43c16..e692088 100644
--- a/src/OpenGL/Makefile.am
+++ b/src/OpenGL/Makefile.am
@@ -49,7 +49,7 @@ glapi_mapi_opengl_tmp.h : $(glapi_gen_mapi_deps)
$(call glapi_gen_mapi, opengl)
opengl_exports.sym : $(glapi_gen_libopengl_exports_deps)
- $(call glapi_gen_libopengl_exports)
+ $(call glapi_gen_libopengl_exports, opengl)
libOpenGL_la_CFLAGS = \
-I$(top_srcdir)/include
diff --git a/src/generate/genCommon.py b/src/generate/genCommon.py
index dfd7823..66e721c 100644
--- a/src/generate/genCommon.py
+++ b/src/generate/genCommon.py
@@ -32,12 +32,17 @@ import xml.etree.cElementTree as etree
MAPI_TABLE_NUM_DYNAMIC = 4096
-_LIBOPENGL_FEATURE_NAMES = frozenset(( "GL_VERSION_1_0", "GL_VERSION_1_1",
- "GL_VERSION_1_2", "GL_VERSION_1_3", "GL_VERSION_1_4", "GL_VERSION_1_5",
- "GL_VERSION_2_0", "GL_VERSION_2_1", "GL_VERSION_3_0", "GL_VERSION_3_1",
- "GL_VERSION_3_2", "GL_VERSION_3_3", "GL_VERSION_4_0", "GL_VERSION_4_1",
- "GL_VERSION_4_2", "GL_VERSION_4_3", "GL_VERSION_4_4", "GL_VERSION_4_5",
-))
+_LIBRARY_FEATURE_NAMES = {
+ # libGL and libGLdiapatch both include every function.
+ "gl" : None,
+ "gldispatch" : None,
+ "opengl" : frozenset(( "GL_VERSION_1_0", "GL_VERSION_1_1",
+ "GL_VERSION_1_2", "GL_VERSION_1_3", "GL_VERSION_1_4", "GL_VERSION_1_5",
+ "GL_VERSION_2_0", "GL_VERSION_2_1", "GL_VERSION_3_0", "GL_VERSION_3_1",
+ "GL_VERSION_3_2", "GL_VERSION_3_3", "GL_VERSION_4_0", "GL_VERSION_4_1",
+ "GL_VERSION_4_2", "GL_VERSION_4_3", "GL_VERSION_4_4", "GL_VERSION_4_5",
+ )),
+}
def getFunctions(xmlFiles):
"""
@@ -67,15 +72,22 @@ def getFunctionsFromRoots(roots):
return functions
-def getLibOpenGLNamesFromRoots(roots):
+def getExportNamesFromRoots(target, roots):
"""
- Goes through the <feature> tags from gl.xml and returns a set of names
- that libOpenGL.so should export.
+ Goes through the <feature> tags from gl.xml and returns a set of OpenGL
+ functions that a library should export.
+
+ target should be one of "gl", "gldispatch", "opengl", "glesv1", or
+ "glesv2".
"""
+ featureNames = _LIBRARY_FEATURE_NAMES[target]
+ if (featureNames == None):
+ return set(func.name for func in getFunctionsFromRoots(roots))
+
names = set()
for root in roots:
for featElem in root.findall("feature"):
- if (featElem.get("name") in _LIBOPENGL_FEATURE_NAMES):
+ if (featElem.get("name") in featureNames):
for commandElem in featElem.findall("require/command"):
names.add(commandElem.get("name"))
return names
diff --git a/src/generate/gen_gldispatch_mapi.py b/src/generate/gen_gldispatch_mapi.py
index 8afc646..a2fad38 100755
--- a/src/generate/gen_gldispatch_mapi.py
+++ b/src/generate/gen_gldispatch_mapi.py
@@ -41,18 +41,15 @@ def _main():
target = sys.argv[1]
xmlFiles = sys.argv[2:]
- if (target not in ("opengl", "gl")):
- raise ValueError("Invalid target: %r" % (target,))
-
roots = [ etree.parse(filename).getroot() for filename in xmlFiles ]
allFunctions = genCommon.getFunctionsFromRoots(roots)
- if (target == "opengl"):
- names = genCommon.getLibOpenGLNamesFromRoots(roots)
- functions = [f for f in allFunctions if(f.name in names)]
- else:
- assert(target == "gl")
- functions = allFunctions
+ names = genCommon.getExportNamesFromRoots(target, roots)
+ functions = [f for f in allFunctions if(f.name in names)]
+
+ if (target in ("gl", "gldispatch")):
+ assert(len(functions) == len(allFunctions))
+ assert(all(functions[i] == allFunctions[i] for i in xrange(len(functions))))
print(r"""
/* This file is automatically generated by mapi_abi.py. Do not modify. */
diff --git a/src/generate/gen_libOpenGL_exports.py b/src/generate/gen_libOpenGL_exports.py
index 8077274..92e4e7f 100755
--- a/src/generate/gen_libOpenGL_exports.py
+++ b/src/generate/gen_libOpenGL_exports.py
@@ -35,8 +35,11 @@ import xml.etree.cElementTree as etree
import genCommon
def _main():
- root = etree.parse(sys.argv[1]).getroot()
- names = genCommon.getLibOpenGLNamesFromRoots([root])
+ target = sys.argv[1]
+ xmlFiles = sys.argv[2:]
+ roots = [ etree.parse(filename).getroot() for filename in xmlFiles ]
+
+ names = genCommon.getExportNamesFromRoots(target, roots)
for name in sorted(names):
print(name)
diff --git a/src/generate/glvnd_gen.mk b/src/generate/glvnd_gen.mk
index b754b29..639fa8f 100644
--- a/src/generate/glvnd_gen.mk
+++ b/src/generate/glvnd_gen.mk
@@ -21,8 +21,13 @@ glapi_gen_mapi_deps := \
# glapi_gen_mapi:
# Generates the header file that's used to define all of the public entrypoint
# functions in libGLdispatch.so, libOpenGL.so, and libGL.so.
-# $(1) specifies which set of functions to include. It should be either
-# "opengl" for libOpenGL.so or "gl" for libGL.so and libGLdispatch.so.
+# $(1) specifies which library we're building, which defines the set of
+# functions to include. It should be one of:
+# "opengl" for libOpenGL.so
+# "gl" for libGL.so
+# "gldispatch" for libGLdispatch.so
+# "glesv1" for libGLESv1_CM.so
+# "glesv2" for libGLESv2.so
define glapi_gen_mapi
@mkdir -p $(dir $@)
$(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) \
@@ -51,6 +56,10 @@ $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_initdispatch_script) \
$(glapi_gen_gl_xml) > $@
endef
+# glapi_gen_libopengl_exports:
+# Generates an export list for an entrypoint library.
+# $(1) specifies which library we're building, using the same names as
+# glapi_gen_mapi.
glapi_gen_libopengl_exports_script := $(top_srcdir)/src/generate/gen_libOpenGL_exports.py
glapi_gen_libopengl_exports_deps := \
$(glapi_gen_libopengl_exports_script) \
@@ -59,7 +68,7 @@ glapi_gen_libopengl_exports_deps := \
define glapi_gen_libopengl_exports
@mkdir -p $(dir $@)
$(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_libopengl_exports_script) \
- $(top_srcdir)/src/generate/xml/gl.xml > $@
+ $(1) $(top_srcdir)/src/generate/xml/gl.xml > $@
endef
glapi_gen_libglglxstubs_script := $(top_srcdir)/src/generate/gen_libgl_glxstubs.py