]> git.tdb.fi Git - libs/gl.git/blobdiff - scripts/extgen.py
Properly handle the legacy replacement of fragment shader output
[libs/gl.git] / scripts / extgen.py
index e6edd42bf944aad566c811202873282dc730f072..b3319e5937d401c2b5ed08e5cd645a041e2a03b3 100755 (executable)
@@ -500,7 +500,7 @@ if funcs:
 #define GET_PROC_ADDRESS(x) get_proc_address(#x)
 #endif
 
-#ifdef WIN32
+#ifdef _WIN32
 #define GET_PROC_ADDRESS_1_1(x) &::x
 #else
 #define GET_PROC_ADDRESS_1_1(x) GET_PROC_ADDRESS(x)
@@ -517,17 +517,15 @@ for f in funcs:
 
 out.write("\nExtension::SupportLevel init_%s()\n{\n"%target_ext.name.lower())
 if core_version:
+       out.write("\tif(is_disabled(\"GL_%s\"))\n\t\treturn Extension::UNSUPPORTED;\n"%target_ext.name)
+       out.write("#if !defined(__APPLE__) || defined(GL_VERSION_%d_%d)\n"%tuple(core_version))
        out.write("\tif(")
-       if deprecated_version and backport_ext:
-               out.write("(")
-       out.write("is_version_at_least(%d, %d)"%tuple(core_version))
-       if deprecated_version:
-               out.write(" && (get_gl_profile()!=CORE_PROFILE || !is_version_at_least(%d, %d))"%tuple(deprecated_version))
-               if backport_ext:
-                       out.write(")")
        if backport_ext:
-               out.write(" || is_supported(\"GL_%s\")"%backport_ext.name)
-       out.write(")\n\t{\n")
+               out.write("is_supported(\"GL_%s\") || "%backport_ext.name)
+       out.write("is_supported(Version(%d, %d)"%tuple(core_version))
+       if deprecated_version:
+               out.write(", Version(%d, %d)"%tuple(deprecated_version))
+       out.write("))\n\t{\n")
        for f in funcs:
                if target_api in f.supported_apis:
                        gpa_suffix = ""
@@ -536,7 +534,9 @@ if core_version:
                        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")
        out.write("\t}\n")
+       out.write("#endif\n")
 if source_ext and source_ext!=backport_ext:
+       out.write("#if !defined(__APPLE__) || defined(GL_%s)\n"%target_ext.name)
        out.write("\tif(is_supported(\"GL_%s\"))\n\t{\n"%(source_ext.name))
        for f in funcs:
                if f.sources:
@@ -556,6 +556,7 @@ if source_ext and source_ext!=backport_ext:
                        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("#endif\n")
 out.write("\treturn Extension::UNSUPPORTED;\n")
 out.write("}\n")