Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 19 additions & 39 deletions impeller/tools/build_metal_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down
4 changes: 0 additions & 4 deletions impeller/tools/impeller.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
Expand Down