Mesa (master): mapi_abi: Use GLES information from XML rather than gles_api .py.

Paul Berry stereotype441 at kemper.freedesktop.org
Tue Oct 16 19:06:04 UTC 2012


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Wed Oct 10 16:31:01 2012 -0700

mapi_abi: Use GLES information from XML rather than gles_api.py.

Note: mapi_abi can consume API information from either XML or a .csv
file.  A side effect of this change is that the ES1 and ES2 API
printers can only be used with XML input now.  That's ok, since the
.csv input format is only used for the OpenVG API.

Tested-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mapi/mapi/mapi_abi.py |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index b1b08a2..30ffe7b 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -36,7 +36,6 @@ import re
 from optparse import OptionParser
 import gl_XML
 import glX_XML
-from gles_api import es1_api, es2_api
 
 
 # number of dynamic entries
@@ -48,13 +47,14 @@ class ABIEntry(object):
     _match_c_param = re.compile(
             '^(?P<type>[\w\s*]+?)(?P<name>\w+)(\[(?P<array>\d+)\])?$')
 
-    def __init__(self, cols, attrs):
+    def __init__(self, cols, attrs, xml_data = None):
         self._parse(cols)
 
         self.slot = attrs['slot']
         self.hidden = attrs['hidden']
         self.alias = attrs['alias']
         self.handcode = attrs['handcode']
+        self.xml_data = xml_data
 
     def c_prototype(self):
         return '%s %s(%s)' % (self.c_return(), self.name, self.c_params())
@@ -177,7 +177,7 @@ def abi_parse_xml(xml):
             params = func.get_parameter_string(name)
             cols.extend([p.strip() for p in params.split(',')])
 
-            ent = ABIEntry(cols, attrs)
+            ent = ABIEntry(cols, attrs, func)
             entry_dict[ent.name] = ent
 
     entries = entry_dict.values()
@@ -744,7 +744,10 @@ class ES1APIPrinter(GLAPIPrinter):
         self.prefix_warn = 'gl'
 
     def _override_for_api(self, ent):
-        ent.hidden = ent.name not in es1_api
+        if ent.xml_data is None:
+            raise Exception('ES2 API printer requires XML input')
+        ent.hidden = ent.name not in \
+            ent.xml_data.entry_points_for_api_version('es1')
         ent.handcode = False
 
     def _get_c_header(self):
@@ -765,7 +768,10 @@ class ES2APIPrinter(GLAPIPrinter):
         self.prefix_warn = 'gl'
 
     def _override_for_api(self, ent):
-        ent.hidden = ent.name not in es2_api
+        if ent.xml_data is None:
+            raise Exception('ES2 API printer requires XML input')
+        ent.hidden = ent.name not in \
+            ent.xml_data.entry_points_for_api_version('es2')
         ent.handcode = False
 
     def _get_c_header(self):




More information about the mesa-commit mailing list