From d072b64415abd87ca07e34eea00546774823f322 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 20 Oct 2014 11:16:55 +0300 Subject: [PATCH] Emit warnings if an extension can't be fully supported --- scripts/extgen.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/scripts/extgen.py b/scripts/extgen.py index fbb66815..c5bc219a 100755 --- a/scripts/extgen.py +++ b/scripts/extgen.py @@ -341,6 +341,33 @@ else: else: source_ext = None +if funcs or enums: + any_supported = False + all_supported = True + for t in itertools.chain(funcs, enums): + if target_api in t.supported_apis: + any_supported = True + else: + all_supported = False + + if not any_supported: + print "Warning: %s is not supported by the target API"%target_ext.name + elif not all_supported: + print "Warning: %s is only partially supported by the target API"%target_ext.name + unsupported = "" + label = "Warning: Unsupported tokens: " + for t in itertools.chain(funcs, enums): + if target_api not in t.supported_apis: + if unsupported and len(label)+len(unsupported)+2+len(t.name)>78: + print label+unsupported + label = " "*len(label) + unsupported = "" + if unsupported: + unsupported += ", " + unsupported += t.name + if unsupported: + print label+unsupported + ### Output ### out = file(out_base+".h", "w") @@ -424,7 +451,7 @@ if core_version: out.write(" || is_supported(\"GL_%s\")"%backport_ext.name) out.write(")\n\t{\n") for f in funcs: - if f.version or target_api in f.supported_apis: + if target_api in f.supported_apis: out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS(%s));\n"%(f.name, f.typedef, f.name)) out.write("\t\treturn Extension::CORE;\n") out.write("\t}\n") @@ -434,7 +461,7 @@ if source_ext and source_ext!=backport_ext: s = f if f.sources: s = f.sources[0] - if s.version or target_api in s.supported_apis: + 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)) out.write("\t\treturn Extension::EXTENSION;\n") out.write("\t}\n") -- 2.45.2