Unverified Commit 9f2e681e authored by Dan Field's avatar Dan Field Committed by GitHub

[Tool][Impeller] Make impellerc produce Vulkan and GLES shaders for Android. (#140976)

This should wait for some upstream work, just don't want to lose it locally for now. I'll switch this from draft and update the description when it's ready.
parent f5fb61b9
......@@ -22,13 +22,13 @@ import '../build_system.dart';
/// The output shader format that should be used by the [ShaderCompiler].
enum ShaderTarget {
impellerAndroid('--runtime-stage-gles'),
impelleriOS('--runtime-stage-metal'),
sksl('--sksl');
impellerAndroid(<String>['--runtime-stage-gles', '--runtime-stage-vulkan']),
impelleriOS(<String>['--runtime-stage-metal']),
sksl(<String>['--sksl']);
const ShaderTarget(this.target);
const ShaderTarget(this.stages);
final String target;
final List<String> stages;
}
/// A wrapper around [ShaderCompiler] to support hot reload of shader sources.
......@@ -177,7 +177,7 @@ class ShaderCompiler {
final String shaderLibPath = _fs.path.join(impellerc.parent.absolute.path, 'shader_lib');
final List<String> cmd = <String>[
impellerc.path,
target.target,
...target.stages,
'--iplr',
if (json)
'--json',
......
......@@ -536,6 +536,7 @@ void main() {
const FakeCommand(command: <String>[
'HostArtifact.impellerc',
'--runtime-stage-gles',
'--runtime-stage-vulkan',
'--iplr',
'--sl=out/flutter_assets/shader.glsl',
'--spirv=out/flutter_assets/shader.glsl.spirv',
......
......@@ -118,12 +118,13 @@ void main() {
expect(fileSystem.file(outputPath).existsSync(), true);
});
testWithoutContext('compileShader invokes impellerc for .frag files and opengl es', () async {
testWithoutContext('compileShader invokes impellerc for .frag files and Android', () async {
final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand(
command: <String>[
impellerc,
'--runtime-stage-gles',
'--runtime-stage-vulkan',
'--iplr',
'--sl=$outputPath',
'--spirv=$outputPath.spirv',
......@@ -292,6 +293,7 @@ void main() {
command: <String>[
impellerc,
'--runtime-stage-gles',
'--runtime-stage-vulkan',
'--iplr',
'--sl=/.tmp_rand0/0.8255140718871702.temp',
'--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