mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Use the impellerc GLES output flag when compiling shaders for Android (#120647)
This commit is contained in:
parent
99dcaa2d9c
commit
8d150833b0
@ -67,7 +67,7 @@ abstract class AndroidAssetBundle extends Target {
|
||||
outputDirectory,
|
||||
targetPlatform: TargetPlatform.android,
|
||||
buildMode: buildMode,
|
||||
shaderTarget: ShaderTarget.sksl,
|
||||
shaderTarget: ShaderTarget.impellerAndroid,
|
||||
);
|
||||
final DepfileService depfileService = DepfileService(
|
||||
fileSystem: environment.fileSystem,
|
||||
|
||||
@ -501,4 +501,59 @@ void main() {
|
||||
|
||||
expect(depfile.outputs[2].path, '/out/abi1/app.so-4.part.so');
|
||||
});
|
||||
|
||||
testUsingContext('DebugAndroidApplication with impeller and shader compilation', () async {
|
||||
// Create impellerc to work around fallback detection logic.
|
||||
fileSystem.file(artifacts.getHostArtifact(HostArtifact.impellerc)).createSync(recursive: true);
|
||||
|
||||
final Environment environment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
outputDir: fileSystem.directory('out')..createSync(),
|
||||
defines: <String, String>{
|
||||
kBuildMode: 'debug',
|
||||
},
|
||||
processManager: processManager,
|
||||
artifacts: artifacts,
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
);
|
||||
environment.buildDir.createSync(recursive: true);
|
||||
|
||||
// create pre-requisites.
|
||||
environment.buildDir.childFile('app.dill')
|
||||
.writeAsStringSync('abcd');
|
||||
fileSystem
|
||||
.file(artifacts.getArtifactPath(Artifact.vmSnapshotData, mode: BuildMode.debug))
|
||||
.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file(artifacts.getArtifactPath(Artifact.isolateSnapshotData, mode: BuildMode.debug))
|
||||
.createSync(recursive: true);
|
||||
fileSystem.file('pubspec.yaml').writeAsStringSync('name: hello\nflutter:\n shaders:\n - shader.glsl');
|
||||
fileSystem.file('.packages').writeAsStringSync('\n');
|
||||
fileSystem.file('shader.glsl').writeAsStringSync('test');
|
||||
|
||||
processManager.addCommands(<FakeCommand>[
|
||||
const FakeCommand(command: <String>[
|
||||
'HostArtifact.impellerc',
|
||||
'--runtime-stage-gles',
|
||||
'--iplr',
|
||||
'--sl=out/flutter_assets/shader.glsl',
|
||||
'--spirv=out/flutter_assets/shader.glsl.spirv',
|
||||
'--input=/shader.glsl',
|
||||
'--input-type=frag',
|
||||
'--include=/',
|
||||
'--include=/./shader_lib',
|
||||
]),
|
||||
]);
|
||||
|
||||
await const DebugAndroidApplication().build(environment);
|
||||
expect(processManager, hasNoRemainingExpectations);
|
||||
|
||||
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'isolate_snapshot_data')).existsSync(), true);
|
||||
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'vm_snapshot_data')).existsSync(), true);
|
||||
expect(fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'kernel_blob.bin')).existsSync(), true);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => processManager,
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user