[Piglit] [PATCH 07/14] glapi: Allow one function name to be in multiple categories.
Eric Anholt
eric at anholt.net
Wed Jun 5 16:14:24 PDT 2013
The gl.spec file doesn't list the same function name in multiple
categories even when it should (such as glGenQueries between core nad
GL_EXT_timer_query), so it hasn't been handled, even though it is a
bug in piglit_dispatch. With the gl2ext.h parsing for GLES2 our data
source will be giving us instances of this that we need to handle
successfully, so add support for it now.
This also means we'll be able to add annotation of gl.spec for
additional categories for functions if we find we need to.
---
glapi/parse_glspec.py | 20 +++++++++++++-------
tests/util/gen_dispatch.py | 10 +++++-----
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py
index e93f0d9..5b05e43 100644
--- a/glapi/parse_glspec.py
+++ b/glapi/parse_glspec.py
@@ -104,7 +104,7 @@
# },
# "functions": {
# <function name, without "gl" prefix>: {
-# "category": <category in which this function appears>,
+# "categories": <list of categories in which this function appears>,
# "param_names": <list of param names>,
# "param_types": <list of param types>,
# "return_type": <type, or "void" if no return>
@@ -340,12 +340,18 @@ class Api(object):
category, additional_data = translate_category(category_string)
if category not in self.categories:
self.categories[category] = additional_data
- self.functions[name] = {
- 'return_type': return_type,
- 'param_names': param_names,
- 'param_types': param_types,
- 'category': category,
- }
+
+ if name not in self.functions:
+ self.functions[name] = {
+ 'return_type': return_type,
+ 'param_names': param_names,
+ 'param_types': param_types,
+ 'categories': [category],
+ }
+ else:
+ if category not in self.functions[name]['categories']:
+ self.functions[name]['categories'].append(category)
+
self.synonyms.add_singleton(name)
# Process the data in gl.spec, and populate self.functions,
diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
index 545eb84..3a4179f 100644
--- a/tests/util/gen_dispatch.py
+++ b/tests/util/gen_dispatch.py
@@ -45,7 +45,7 @@
# },
# "functions": {
# <function name, without "gl" prefix>: {
-# "category": <category in which this function appears>,
+# "categories": <list of categories in which this function appears>,
# "param_names": <list of param names>,
# "param_types": <list of param types>,
# "return_type": <type, or "void" if no return>
@@ -246,7 +246,7 @@ class Function(object):
fixup_param_name(x) for x in json_data['param_names']]
self.param_types = json_data['param_types']
self.return_type = json_data['return_type']
- self.category = json_data['category']
+ self.categories = json_data['categories']
# Name of the function, with the 'gl' prefix.
@property
@@ -314,9 +314,9 @@ class DispatchSet(object):
self.cat_fn_pairs = []
for function_name in synonym_set:
function = all_functions[function_name]
- category_name = function.category
- category = all_categories[category_name]
- self.cat_fn_pairs.append((category, function))
+ for category_name in function.categories:
+ category = all_categories[category_name]
+ self.cat_fn_pairs.append((category, function))
# Sort by category, with GL categories preceding extensions.
self.cat_fn_pairs.sort(key = self.__sort_key)
--
1.8.3.rc0
More information about the Piglit
mailing list