]> git.tdb.fi Git - libs/gl.git/commitdiff
Pick the correct source for an extension function if there's multiple
authorMikko Rasa <tdb@tdb.fi>
Wed, 26 Oct 2016 19:02:23 +0000 (22:02 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 26 Oct 2016 19:02:23 +0000 (22:02 +0300)
scripts/extgen.py

index 0ea8b8ee3c7ac8355b3d85ba1db6a62890bb976e..fd239d7077de3344f998bd6ffab84f22007c01ac 100755 (executable)
@@ -492,11 +492,21 @@ if core_version:
 if source_ext and source_ext!=backport_ext:
        out.write("\tif(is_supported(\"GL_%s\"))\n\t{\n"%(source_ext.name))
        for f in funcs:
-               s = f
                if f.sources:
-                       s = f.sources[0]
-               if target_api in s.supported_apis:
-                       out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS(%s));\n"%(f.name, f.typedef, s.name))
+                       src = None
+                       for s in f.sources:
+                               if s.name.endswith(source_ext.ext_type):
+                                       src = s
+                                       break
+                       if not src:
+                               src = f.sources[0]
+               else:
+                       src = f
+
+               if target_api in src.supported_apis:
+                       if not src.name.endswith(source_ext.ext_type):
+                               print "Warning: %s does not match extension type %s"%(src.name, source_ext.ext_type)
+                       out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS(%s));\n"%(f.name, f.typedef, src.name))
        out.write("\t\treturn Extension::EXTENSION;\n")
        out.write("\t}\n")
 out.write("\treturn Extension::UNSUPPORTED;\n")