summaryrefslogtreecommitdiffstats
path: root/src/mapi
diff options
context:
space:
mode:
authorPaul Berry <stereotype441@gmail.com>2012-10-10 16:48:08 -0700
committerPaul Berry <stereotype441@gmail.com>2012-10-16 12:03:55 -0700
commitcd4ce16c450d2cf99fb508d1be1a111a2b1f9423 (patch)
tree58efa1c9e2276e3cda8db47b2ff2b936ee673e45 /src/mapi
parent81a7f5078130c66855c56afc6c9803c89bf05ee8 (diff)
downloadexternal_mesa3d-cd4ce16c450d2cf99fb508d1be1a111a2b1f9423.zip
external_mesa3d-cd4ce16c450d2cf99fb508d1be1a111a2b1f9423.tar.gz
external_mesa3d-cd4ce16c450d2cf99fb508d1be1a111a2b1f9423.tar.bz2
glapi: Read GLES information from XML.
Tested-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mapi')
-rw-r--r--src/mapi/glapi/gen/gl_XML.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index f956730..ef7ed51 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -25,6 +25,7 @@
# Authors:
# Ian Romanick <idr@us.ibm.com>
+from decimal import Decimal
import libxml2
import re, sys, string
import typeexpr
@@ -606,6 +607,16 @@ class gl_function( gl_item ):
self.initialized = 0
self.images = []
+ # self.entry_point_api_map[name][api] is a decimal value
+ # indicating the earliest version of the given API in which
+ # each entry point exists. Every entry point is included in
+ # the first level of the map; the second level of the map only
+ # lists APIs which contain the entry point in at least one
+ # version. For example,
+ # self.entry_point_gles_map['ClipPlanex'] == { 'es1':
+ # Decimal('1.1') }.
+ self.entry_point_api_map = {}
+
self.assign_offset = 0
self.static_entry_points = []
@@ -634,6 +645,14 @@ class gl_function( gl_item ):
self.static_entry_points.append(name)
self.entry_points.append( name )
+
+ self.entry_point_api_map[name] = {}
+ for api in ('es1', 'es2'):
+ version_str = element.nsProp(api, None)
+ assert version_str is not None
+ if version_str != 'none':
+ self.entry_point_api_map[name][api] = Decimal(version_str)
+
if alias:
true_name = alias
else:
@@ -779,6 +798,22 @@ class gl_function( gl_item ):
else:
return "_dispatch_stub_%u" % (self.offset)
+ def entry_points_for_api_version(self, api, version = None):
+ """Return a list of the entry point names for this function
+ which are supported in the given API (and optionally, version).
+
+ Use the decimal.Decimal type to precisely express non-integer
+ versions.
+ """
+ result = []
+ for entry_point, api_to_ver in self.entry_point_api_map.iteritems():
+ if api not in api_to_ver:
+ continue
+ if version is not None and version < api_to_ver[api]:
+ continue
+ result.append(entry_point)
+ return result
+
class gl_item_factory(object):
"""Factory to create objects derived from gl_item."""
@@ -825,6 +860,19 @@ class gl_api(object):
self.functions_by_name = functions_by_name
+ def filter_functions_by_api(self, api, version = None):
+ """Filter out entry points not in the given API (or
+ optionally, not in the given version of the given API).
+ """
+ functions_by_name = {}
+ for func in self.functions_by_name.itervalues():
+ entry_points = func.entry_points_for_api_version(api, version)
+ if entry_points:
+ func.filter_entry_points(entry_points)
+ functions_by_name[func.name] = func
+
+ self.functions_by_name = functions_by_name
+
def process_element(self, doc):
element = doc.children
while element.type != "element" or element.name != "OpenGLAPI":