mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Impeller] Build Impeller iOS runtime stage shaders when Impeller is enabled (#113689)
This commit is contained in:
parent
9ac2cd6d8e
commit
637e5bce66
@ -32,6 +32,7 @@ Future<Depfile> copyAssets(
|
||||
required TargetPlatform targetPlatform,
|
||||
BuildMode? buildMode,
|
||||
required ShaderTarget shaderTarget,
|
||||
List<File> additionalInputs = const <File>[],
|
||||
}) async {
|
||||
// Check for an SkSL bundle.
|
||||
final String? shaderBundlePath = environment.defines[kBundleSkSLPath] ?? environment.inputs[kBundleSkSLPath];
|
||||
@ -65,6 +66,7 @@ Future<Depfile> copyAssets(
|
||||
// An asset manifest with no assets would have zero inputs if not
|
||||
// for this pubspec file.
|
||||
pubspecFile,
|
||||
...additionalInputs,
|
||||
];
|
||||
final List<File> outputs = <File>[];
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ import '../../base/common.dart';
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/io.dart';
|
||||
import '../../build_info.dart';
|
||||
import '../../globals.dart' as globals show xcode;
|
||||
import '../../globals.dart' as globals;
|
||||
import '../../macos/xcode.dart';
|
||||
import '../../project.dart';
|
||||
import '../../reporting/reporting.dart';
|
||||
@ -509,12 +509,28 @@ abstract class IosAssetBundle extends Target {
|
||||
.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.
|
||||
final Depfile assetDepfile = await copyAssets(
|
||||
environment,
|
||||
assetDirectory,
|
||||
targetPlatform: TargetPlatform.ios,
|
||||
shaderTarget: ShaderTarget.sksl,
|
||||
shaderTarget: isImpellerEnabled() ? ShaderTarget.impelleriOS : ShaderTarget.sksl,
|
||||
additionalInputs: <File>[
|
||||
flutterProject.ios.infoPlist,
|
||||
flutterProject.ios.appFrameworkInfoPlist,
|
||||
],
|
||||
);
|
||||
final DepfileService depfileService = DepfileService(
|
||||
fileSystem: environment.fileSystem,
|
||||
@ -526,8 +542,6 @@ abstract class IosAssetBundle extends Target {
|
||||
);
|
||||
|
||||
// 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
|
||||
.copySync(environment.outputDir
|
||||
.childDirectory('App.framework')
|
||||
|
||||
@ -21,8 +21,8 @@ import '../build_system.dart';
|
||||
|
||||
/// The output shader format that should be used by the [ShaderCompiler].
|
||||
enum ShaderTarget {
|
||||
impellerAndroid('--opengl-es'),
|
||||
impelleriOS('--metal-ios'),
|
||||
impellerAndroid('--runtime-stage-gles'),
|
||||
impelleriOS('--runtime-stage-metal'),
|
||||
sksl('--sksl');
|
||||
|
||||
const ShaderTarget(this.target);
|
||||
|
||||
@ -131,6 +131,8 @@ class IosProject extends XcodeBasedProject {
|
||||
|
||||
File get appFrameworkInfoPlist => _flutterLibRoot.childDirectory('Flutter').childFile('AppFrameworkInfo.plist');
|
||||
|
||||
File get infoPlist => _editableDirectory.childDirectory('Runner').childFile('Info.plist');
|
||||
|
||||
Directory get symlinks => _flutterLibRoot.childDirectory('.symlinks');
|
||||
|
||||
/// True, if the app project is using swift.
|
||||
|
||||
@ -81,7 +81,7 @@ void main() {
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
impellerc,
|
||||
'--metal-ios',
|
||||
'--runtime-stage-metal',
|
||||
'--iplr',
|
||||
'--sl=$outputPath',
|
||||
'--spirv=$outputPath.spirv',
|
||||
@ -117,7 +117,7 @@ void main() {
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
impellerc,
|
||||
'--opengl-es',
|
||||
'--runtime-stage-gles',
|
||||
'--iplr',
|
||||
'--sl=$outputPath',
|
||||
'--spirv=$outputPath.spirv',
|
||||
@ -275,7 +275,7 @@ void main() {
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
impellerc,
|
||||
'--opengl-es',
|
||||
'--runtime-stage-gles',
|
||||
'--iplr',
|
||||
'--sl=/.tmp_rand0/0.8255140718871702.temp',
|
||||
'--spirv=/.tmp_rand0/0.8255140718871702.temp.spirv',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user