X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=scripts%2Fextgen.py;h=45094a4df35df26fe2608e0f07a4005378ec125e;hp=ec57e2efb912fd9287185d7d5f0ab5bd9aa8609c;hb=55dbeb5e04516699b8415104e346243d5e4c48c9;hpb=bdced13c0814d1a860573a0ac19964da2ac4d5e1 diff --git a/scripts/extgen.py b/scripts/extgen.py index ec57e2ef..45094a4d 100755 --- a/scripts/extgen.py +++ b/scripts/extgen.py @@ -31,7 +31,9 @@ if sys.argv[i].startswith("gl"): i += 1 target_ext = sys.argv[i] +backport_ext = None out_base = None +ignore_things = [] if target_ext.endswith(".glext"): fn = target_ext target_ext = None @@ -46,6 +48,10 @@ if target_ext.endswith(".glext"): core_version = parts[2] elif parts[0]=="secondary": secondary.append(parts[1]) + elif parts[0]=="backport": + backport_ext = parts[1] + elif parts[0]=="ignore": + ignore_things.append(parts[1]) if i+11: + print "Warning: multiple backport extension candidates: %s"%(" ".join(e.name for e in backport_ext_candidates)) + + for e in backport_ext_candidates: + if e.base_name==target_ext.base_name: + backport_ext = e + + if not backport_ext and len(backport_ext_candidates)==1: + print "Warning: potential backport extension has mismatched name: %s"%backport_ext_candidates[0].name for f in funcs: f.typedef = "FPtr_%s"%f.name @@ -459,7 +490,7 @@ if core_version: for f in funcs: if target_api in f.supported_apis: gpa_suffix = "" - if f.version<=[1, 1]: + if f.version is not None and f.version<=[1, 1]: gpa_suffix = "_1_1" out.write("\t\t%s = reinterpret_cast<%s>(GET_PROC_ADDRESS%s(%s));\n"%(f.name, f.typedef, gpa_suffix, f.name)) out.write("\t\treturn Extension::CORE;\n") @@ -467,11 +498,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")