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'; ...@@ -22,13 +22,13 @@ 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('--runtime-stage-gles'), impellerAndroid(<String>['--runtime-stage-gles', '--runtime-stage-vulkan']),
impelleriOS('--runtime-stage-metal'), impelleriOS(<String>['--runtime-stage-metal']),
sksl('--sksl'); 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. /// A wrapper around [ShaderCompiler] to support hot reload of shader sources.
...@@ -177,7 +177,7 @@ class ShaderCompiler { ...@@ -177,7 +177,7 @@ class ShaderCompiler {
final String shaderLibPath = _fs.path.join(impellerc.parent.absolute.path, 'shader_lib'); final String shaderLibPath = _fs.path.join(impellerc.parent.absolute.path, 'shader_lib');
final List<String> cmd = <String>[ final List<String> cmd = <String>[
impellerc.path, impellerc.path,
target.target, ...target.stages,
'--iplr', '--iplr',
if (json) if (json)
'--json', '--json',
......
...@@ -536,6 +536,7 @@ void main() { ...@@ -536,6 +536,7 @@ void main() {
const FakeCommand(command: <String>[ const FakeCommand(command: <String>[
'HostArtifact.impellerc', 'HostArtifact.impellerc',
'--runtime-stage-gles', '--runtime-stage-gles',
'--runtime-stage-vulkan',
'--iplr', '--iplr',
'--sl=out/flutter_assets/shader.glsl', '--sl=out/flutter_assets/shader.glsl',
'--spirv=out/flutter_assets/shader.glsl.spirv', '--spirv=out/flutter_assets/shader.glsl.spirv',
......
...@@ -118,12 +118,13 @@ void main() { ...@@ -118,12 +118,13 @@ void main() {
expect(fileSystem.file(outputPath).existsSync(), true); 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>[ final FakeProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
FakeCommand( FakeCommand(
command: <String>[ command: <String>[
impellerc, impellerc,
'--runtime-stage-gles', '--runtime-stage-gles',
'--runtime-stage-vulkan',
'--iplr', '--iplr',
'--sl=$outputPath', '--sl=$outputPath',
'--spirv=$outputPath.spirv', '--spirv=$outputPath.spirv',
...@@ -292,6 +293,7 @@ void main() { ...@@ -292,6 +293,7 @@ void main() {
command: <String>[ command: <String>[
impellerc, impellerc,
'--runtime-stage-gles', '--runtime-stage-gles',
'--runtime-stage-vulkan',
'--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