Unverified Commit 637e5bce authored by Brandon DeRosier's avatar Brandon DeRosier Committed by GitHub

[Impeller] Build Impeller iOS runtime stage shaders when Impeller is enabled (#113689)

parent 9ac2cd6d
...@@ -32,6 +32,7 @@ Future<Depfile> copyAssets( ...@@ -32,6 +32,7 @@ Future<Depfile> copyAssets(
required TargetPlatform targetPlatform, required TargetPlatform targetPlatform,
BuildMode? buildMode, BuildMode? buildMode,
required ShaderTarget shaderTarget, required ShaderTarget shaderTarget,
List<File> additionalInputs = const <File>[],
}) async { }) async {
// Check for an SkSL bundle. // Check for an SkSL bundle.
final String? shaderBundlePath = environment.defines[kBundleSkSLPath] ?? environment.inputs[kBundleSkSLPath]; final String? shaderBundlePath = environment.defines[kBundleSkSLPath] ?? environment.inputs[kBundleSkSLPath];
...@@ -65,6 +66,7 @@ Future<Depfile> copyAssets( ...@@ -65,6 +66,7 @@ Future<Depfile> copyAssets(
// An asset manifest with no assets would have zero inputs if not // An asset manifest with no assets would have zero inputs if not
// for this pubspec file. // for this pubspec file.
pubspecFile, pubspecFile,
...additionalInputs,
]; ];
final List<File> outputs = <File>[]; final List<File> outputs = <File>[];
......
...@@ -10,7 +10,7 @@ import '../../base/common.dart'; ...@@ -10,7 +10,7 @@ import '../../base/common.dart';
import '../../base/file_system.dart'; import '../../base/file_system.dart';
import '../../base/io.dart'; import '../../base/io.dart';
import '../../build_info.dart'; import '../../build_info.dart';
import '../../globals.dart' as globals show xcode; import '../../globals.dart' as globals;
import '../../macos/xcode.dart'; import '../../macos/xcode.dart';
import '../../project.dart'; import '../../project.dart';
import '../../reporting/reporting.dart'; import '../../reporting/reporting.dart';
...@@ -509,12 +509,28 @@ abstract class IosAssetBundle extends Target { ...@@ -509,12 +509,28 @@ abstract class IosAssetBundle extends Target {
.copySync(dsymOutputBinary.path); .copySync(dsymOutputBinary.path);
} }
final FlutterProject flutterProject = FlutterProject.fromDirectory(environment.projectDir);
bool isImpellerEnabled() {
if (!flutterProject.ios.infoPlist.existsSync()) {
return false;
}
final Map<String, Object> info = globals.plistParser.parseFile(flutterProject.ios.infoPlist.path);
final Object? enableImpeller = info['FLTEnableImpeller'];
return enableImpeller is bool && enableImpeller;
}
// Copy the assets. // Copy the assets.
final Depfile assetDepfile = await copyAssets( final Depfile assetDepfile = await copyAssets(
environment, environment,
assetDirectory, assetDirectory,
targetPlatform: TargetPlatform.ios, targetPlatform: TargetPlatform.ios,
shaderTarget: ShaderTarget.sksl, shaderTarget: isImpellerEnabled() ? ShaderTarget.impelleriOS : ShaderTarget.sksl,
additionalInputs: <File>[
flutterProject.ios.infoPlist,
flutterProject.ios.appFrameworkInfoPlist,
],
); );
final DepfileService depfileService = DepfileService( final DepfileService depfileService = DepfileService(
fileSystem: environment.fileSystem, fileSystem: environment.fileSystem,
...@@ -526,8 +542,6 @@ abstract class IosAssetBundle extends Target { ...@@ -526,8 +542,6 @@ abstract class IosAssetBundle extends Target {
); );
// Copy the plist from either the project or module. // Copy the plist from either the project or module.
// TODO(zanderso): add plist to inputs
final FlutterProject flutterProject = FlutterProject.fromDirectory(environment.projectDir);
flutterProject.ios.appFrameworkInfoPlist flutterProject.ios.appFrameworkInfoPlist
.copySync(environment.outputDir .copySync(environment.outputDir
.childDirectory('App.framework') .childDirectory('App.framework')
......
...@@ -21,8 +21,8 @@ import '../build_system.dart'; ...@@ -21,8 +21,8 @@ import '../build_system.dart';
/// The output shader format that should be used by the [ShaderCompiler]. /// The output shader format that should be used by the [ShaderCompiler].
enum ShaderTarget { enum ShaderTarget {
impellerAndroid('--opengl-es'), impellerAndroid('--runtime-stage-gles'),
impelleriOS('--metal-ios'), impelleriOS('--runtime-stage-metal'),
sksl('--sksl'); sksl('--sksl');
const ShaderTarget(this.target); const ShaderTarget(this.target);
......
...@@ -131,6 +131,8 @@ class IosProject extends XcodeBasedProject { ...@@ -131,6 +131,8 @@ class IosProject extends XcodeBasedProject {
File get appFrameworkInfoPlist => _flutterLibRoot.childDirectory('Flutter').childFile('AppFrameworkInfo.plist'); File get appFrameworkInfoPlist => _flutterLibRoot.childDirectory('Flutter').childFile('AppFrameworkInfo.plist');
File get infoPlist => _editableDirectory.childDirectory('Runner').childFile('Info.plist');
Directory get symlinks => _flutterLibRoot.childDirectory('.symlinks'); Directory get symlinks => _flutterLibRoot.childDirectory('.symlinks');
/// True, if the app project is using swift. /// True, if the app project is using swift.
......
...@@ -81,7 +81,7 @@ void main() { ...@@ -81,7 +81,7 @@ void main() {
FakeCommand( FakeCommand(
command: <String>[ command: <String>[
impellerc, impellerc,
'--metal-ios', '--runtime-stage-metal',
'--iplr', '--iplr',
'--sl=$outputPath', '--sl=$outputPath',
'--spirv=$outputPath.spirv', '--spirv=$outputPath.spirv',
...@@ -117,7 +117,7 @@ void main() { ...@@ -117,7 +117,7 @@ void main() {
FakeCommand( FakeCommand(
command: <String>[ command: <String>[
impellerc, impellerc,
'--opengl-es', '--runtime-stage-gles',
'--iplr', '--iplr',
'--sl=$outputPath', '--sl=$outputPath',
'--spirv=$outputPath.spirv', '--spirv=$outputPath.spirv',
...@@ -275,7 +275,7 @@ void main() { ...@@ -275,7 +275,7 @@ void main() {
FakeCommand( FakeCommand(
command: <String>[ command: <String>[
impellerc, impellerc,
'--opengl-es', '--runtime-stage-gles',
'--iplr', '--iplr',
'--sl=/.tmp_rand0/0.8255140718871702.temp', '--sl=/.tmp_rand0/0.8255140718871702.temp',
'--spirv=/.tmp_rand0/0.8255140718871702.temp.spirv', '--spirv=/.tmp_rand0/0.8255140718871702.temp.spirv',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment