summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-05 17:39:49 -0800
committerEric Anholt <eric@anholt.net>2013-12-05 17:40:16 -0800
commit26ca6ac8e864ef004194e35b0c9e4e9c4e81a188 (patch)
tree298f22cdc05111bfda6e462fbebeb6204e4ee86f /src
parent1626703ca5b0255dcd4bacd8a0d71a976e3724a9 (diff)
Add missing #defines for GL versions and extensions.
Not having them broke some piglit ES2 compat tests.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gen_dispatch.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py
index 8e99dcb..525d425 100755
--- a/src/gen_dispatch.py
+++ b/src/gen_dispatch.py
@@ -116,6 +116,14 @@ class Generator(object):
self.typedefs = ''
self.out_file = None
+ # GL versions named in the registry, which we should generate
+ # #defines for.
+ self.supported_versions = set()
+
+ # Extensions named in the registry, which we should generate
+ # #defines for.
+ self.supported_extensions = set()
+
# Dictionary mapping human-readable names of providers to a C
# enum token that will be used to reference those names, to
# reduce generated binary size.
@@ -261,6 +269,8 @@ class Generator(object):
m = re.match('([0-9])\.([0-9])', feature.get('number'))
version = int(m.group(1)) * 10 + int(m.group(2))
+ self.supported_versions.add(feature.get('name'))
+
if api == 'gl':
human_name = 'Desktop OpenGL {0}'.format(feature.get('number'))
condition = 'epoxy_is_desktop_gl()'
@@ -312,6 +322,9 @@ class Generator(object):
for extension in reg.findall('extensions/extension'):
extname = extension.get('name')
+
+ self.supported_extensions.add(extname)
+
# 'supported' is a set of strings like gl, gles1, gles2, or glx, which are
# separated by '|'
apis = extension.get('supported').split('|')
@@ -361,6 +374,14 @@ class Generator(object):
self.outln(' * ' + line)
def write_enums(self):
+ for name in sorted(self.supported_versions):
+ self.outln('#define {0} 1'.format(name))
+ self.outln('')
+
+ for name in sorted(self.supported_extensions):
+ self.outln('#define {0} 1'.format(name))
+ self.outln('')
+
for name, value in self.enums.items():
self.outln('#define ' + name.ljust(self.max_enum_name_len + 3) + value + '')