diff --git a/impeller/tools/build_metal_library.py b/impeller/tools/build_metal_library.py index 08a3a4d83d942..8556042e5c186 100644 --- a/impeller/tools/build_metal_library.py +++ b/impeller/tools/build_metal_library.py @@ -38,12 +38,6 @@ def main(): required=True, help='The source file to compile. Can be specified multiple times.' ) - parser.add_argument( - '--optimize', - action='store_true', - default=False, - help='If available optimizations must be applied to the compiled Metal sources.' - ) parser.add_argument( '--platform', required=True, @@ -59,73 +53,59 @@ def main(): 'xcrun', ] + # Select the SDK. + command += ['-sdk'] if args.platform == 'mac': command += [ - '-sdk', 'macosx', ] elif args.platform == 'ios': command += [ - '-sdk', 'iphoneos', ] elif args.platform == 'ios-simulator': command += [ - '-sdk', 'iphonesimulator', ] + else: + raise 'Unknown target platform' command += [ 'metal', - # These warnings are from generated code and would make no sense to the GLSL - # author. + # These warnings are from generated code and would make no sense to the + # GLSL author. '-Wno-unused-variable', # Both user and system header will be tracked. '-MMD', + # Like -Os (and thus -O2), but reduces code size further. + '-Oz', + # Allow aggressive, lossy floating-point optimizations. + '-ffast-math', '-MF', args.depfile, '-o', args.output, ] + # Select the Metal standard and the minimum supported OS versions. # The Metal standard must match the specification in impellerc. if args.platform == 'mac': command += [ '--std=macos-metal1.2', + '-mmacos-version-min=10.14', ] - - if args.optimize: + elif args.platform == 'ios': command += [ - # Like -Os (and thus -O2), but reduces code size further. - '-Oz', - # Allow aggressive, lossy floating-point optimizations. - '-ffast-math', - # limiting to ios-metal1.2 disables shader debug symbols, only - # enabling these in optimize mode. - # see https://github.com/flutter/flutter/issues/106066 '--std=ios-metal1.2', + '-mios-version-min=10.0', ] - if args.platform == 'ios': - command += [ - '-mios-version-min=10.0', - ] - elif args.platform == 'ios-simulator': - command += [ - '-miphonesimulator-version-min=11.0', - ] - else: + elif args.platform == 'ios-simulator': command += [ - # Embeds both sources and driver options in the output. This aids in - # debugging but should be removed from release builds. - # TODO(chinmaygarde): Use -frecord-sources when CI upgrades to - # Xcode 13. - '-MO', - # Assist the sampling profiler. - '-gline-tables-only', - '-g', - # Optimize for debuggability. - '-Og', + '--std=ios-metal1.2', + '-miphonesimulator-version-min=11.0', ] + else: + raise 'Unknown target platform' command += args.source diff --git a/impeller/tools/impeller.gni b/impeller/tools/impeller.gni index aeb3f162a172d..320efc9fcb29c 100644 --- a/impeller/tools/impeller.gni +++ b/impeller/tools/impeller.gni @@ -135,10 +135,6 @@ template("metal_library") { rebase_path(depfile), ] - if (!is_debug) { - args += [ "--optimize" ] - } - if (is_ios) { if (use_ios_simulator) { args += [ "--platform=ios-simulator" ]