From 9a80c8511180570716adcc1cc9344d8a5e09e76a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 26 Oct 2016 22:02:23 +0300 Subject: [PATCH] Pick the correct source for an extension function if there's multiple --- scripts/extgen.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/extgen.py b/scripts/extgen.py index 0ea8b8ee..fd239d70 100755 --- a/scripts/extgen.py +++ b/scripts/extgen.py @@ -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") -- 2.45.2