---
 src/mapi/glapi/gen/gen_mesa_data.py | 62 +++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100755 src/mapi/glapi/gen/gen_mesa_data.py

diff --git a/src/mapi/glapi/gen/gen_mesa_data.py 
b/src/mapi/glapi/gen/gen_mesa_data.py
new file mode 100755
index 00000000000..6e9d0629660
--- /dev/null
+++ b/src/mapi/glapi/gen/gen_mesa_data.py
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+
+from __future__ import print_function
+import xml.etree.ElementTree as et
+from xml.etree import ElementInclude
+
+import mesa_data
+import static_data
+
+
+def main():
+    tree = et.parse('gl_and_es_API.xml')
+    root = tree.getroot()
+    ElementInclude.include(root)
+    ElementInclude.include(root)
+
+    print('_FUNCTIONS = [')
+
+    for elem in root.findall('.//function'):
+        name = elem.attrib['name']
+        attribs = {}
+        if 'exec' in elem.attrib:
+            if elem.attrib['exec'] == 'dynamic':
+                attribs['exectype'] = mesa_data.ExecType.DYNAMIC
+            elif elem.attrib['exec'] == 'skip':
+                attribs['exectype'] = mesa_data.ExecType.SKIP
+            else:
+                raise Exception('Unknown ExecType: ' + elem.attrib['exec'])
+
+        if 'marshal' in elem.attrib:
+            if elem.attrib['marshal'] == 'custom':
+                attribs['marshal'] = mesa_data.MarshalType.CUSTOM
+            elif elem.attrib['marshal'] == 'sync':
+                attribs['marshal'] = mesa_data.MarshalType.SYNC
+            elif elem.attrib['marshal'] == 'async':
+                attribs['marshal'] = mesa_data.MarshalType.ASYNC
+            elif elem.attrib['marshal'] == 'draw':
+                attribs['marshal'] = mesa_data.MarshalType.DRAW
+            else:
+                raise Exception('Unknown MarshalType: ' + 
elem.attrib['marshal'])
+
+        if 'alias' in elem.attrib:
+            attribs['alias'] = True
+
+        attribs['offset'] = static_data.offsets.get(name)
+
+        params = []
+        for param in elem.findall('./param'):
+            params.append(mesa_data.Parameter(
+                param.attrib['name'],
+                bool(param.get('output', False)),
+                bool(param.get('img_null_flag', False))))
+
+        print('    ', end='')
+        print(str(mesa_data.Function(name, params, **attribs)), end=',\n')
+
+    print(']')
+    print('FUNCTIONS = {f.name: f for f in _FUNCTIONS}', end='')
+
+
+if __name__ == '__main__':
+    main()
-- 
2.19.2

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to