glapi: Avoid hardcoded category names in remap helper script.
authorChia-I Wu <olvaffe@gmail.com>
Tue, 20 Oct 2009 06:15:45 +0000 (14:15 +0800)
committerBrian Paul <brianp@vmware.com>
Fri, 6 Nov 2009 03:04:10 +0000 (20:04 -0700)
The output of the script is unchanged.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
src/mesa/glapi/remap_helper.py

index 2a1f5ad..d93c7a4 100644 (file)
@@ -123,18 +123,26 @@ class PrintGlRemap(gl_XML.gl_print_base):
                print '};'
                print ''
 
-               abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
+               # collect functions by versions/extensions
                extension_functions = {}
-
-               # collect non-ABI functions
+               abi_extensions = []
                for f in api.functionIterateAll():
                        for n in f.entry_points:
                                category, num = api.get_category_for_name(n)
-                               if category not in abi:
-                                       c = gl_XML.real_category_name(category)
+                               # consider only GL_VERSION_X_Y or extensions
+                               c = gl_XML.real_category_name(category)
+                               if c.startswith("GL_"):
                                        if not extension_functions.has_key(c):
                                                extension_functions[c] = []
                                        extension_functions[c].append(f)
+                                       # remember the ext names of the ABI
+                                       if (f.is_abi() and n == f.name and
+                                               c not in abi_extensions):
+                                               abi_extensions.append(c)
+               # ignore the ABI itself
+               for ext in abi_extensions:
+                       extension_functions.pop(ext)
+
                extensions = extension_functions.keys()
                extensions.sort()
 
@@ -144,8 +152,8 @@ class PrintGlRemap(gl_XML.gl_print_base):
                for ext in extensions:
                        funcs = []
                        for f in extension_functions[ext]:
-                               # test if the function is in the ABI
-                               if f.is_abi():
+                               # test if the function is in the ABI and has alt names
+                               if f.is_abi() and len(f.entry_points) > 1:
                                        funcs.append(f)
                        if not funcs:
                                continue
@@ -171,7 +179,7 @@ class PrintGlRemap(gl_XML.gl_print_base):
                                        remapped.append(f)
                                else:
                                        # these functions are either in the
-                                        # abi, or have offset -1
+                                       # abi, or have offset -1
                                        funcs.append(f)
 
                        print '#if defined(need_%s)' % (ext)