[flutter_tool] Build shaders as .iplr and use FragmentProgram.fromAsset for ink_sparkle (#108071)
This commit is contained in:
@@ -443,14 +443,17 @@ flutter:
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
impellerc,
|
||||
'--flutter-spirv',
|
||||
'--spirv=$outputPath',
|
||||
'--sksl',
|
||||
'--iplr',
|
||||
'--sl=$outputPath',
|
||||
'--spirv=$outputPath.spirv',
|
||||
'--input=/$shaderPath',
|
||||
'--input-type=frag',
|
||||
'--include=/$assetsPath',
|
||||
],
|
||||
onRun: () {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file('$outputPath.spirv').createSync(recursive: true);
|
||||
},
|
||||
),
|
||||
]),
|
||||
|
||||
@@ -13,7 +13,8 @@ import '../../../src/fake_process_manager.dart';
|
||||
const String fragDir = '/shaders';
|
||||
const String fragPath = '/shaders/my_shader.frag';
|
||||
const String notFragPath = '/shaders/not_a_frag.file';
|
||||
const String outputPath = '/output/shaders/my_shader.spv';
|
||||
const String outputSpirvPath = '/output/shaders/my_shader.frag.spirv';
|
||||
const String outputPath = '/output/shaders/my_shader.frag';
|
||||
|
||||
void main() {
|
||||
late BufferLogger logger;
|
||||
@@ -37,14 +38,17 @@ void main() {
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
impellerc,
|
||||
'--flutter-spirv',
|
||||
'--spirv=$outputPath',
|
||||
'--sksl',
|
||||
'--iplr',
|
||||
'--sl=$outputPath',
|
||||
'--spirv=$outputSpirvPath',
|
||||
'--input=$fragPath',
|
||||
'--input-type=frag',
|
||||
'--include=$fragDir',
|
||||
],
|
||||
onRun: () {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file(outputSpirvPath).createSync(recursive: true);
|
||||
},
|
||||
),
|
||||
]);
|
||||
@@ -63,6 +67,7 @@ void main() {
|
||||
true,
|
||||
);
|
||||
expect(fileSystem.file(outputPath).existsSync(), true);
|
||||
expect(fileSystem.file(outputSpirvPath).existsSync(), false);
|
||||
});
|
||||
|
||||
testWithoutContext('compileShader invokes impellerc for non-.frag files', () async {
|
||||
@@ -70,14 +75,17 @@ void main() {
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
impellerc,
|
||||
'--flutter-spirv',
|
||||
'--spirv=$outputPath',
|
||||
'--sksl',
|
||||
'--iplr',
|
||||
'--sl=$outputPath',
|
||||
'--spirv=$outputSpirvPath',
|
||||
'--input=$notFragPath',
|
||||
'--input-type=frag',
|
||||
'--include=$fragDir',
|
||||
],
|
||||
onRun: () {
|
||||
fileSystem.file(outputPath).createSync(recursive: true);
|
||||
fileSystem.file(outputSpirvPath).createSync(recursive: true);
|
||||
},
|
||||
),
|
||||
]);
|
||||
@@ -96,6 +104,7 @@ void main() {
|
||||
true,
|
||||
);
|
||||
expect(fileSystem.file(outputPath).existsSync(), true);
|
||||
expect(fileSystem.file(outputSpirvPath).existsSync(), false);
|
||||
});
|
||||
|
||||
testWithoutContext('compileShader throws an exception when impellerc fails', () async {
|
||||
@@ -103,8 +112,10 @@ void main() {
|
||||
FakeCommand(
|
||||
command: <String>[
|
||||
impellerc,
|
||||
'--flutter-spirv',
|
||||
'--spirv=$outputPath',
|
||||
'--sksl',
|
||||
'--iplr',
|
||||
'--sl=$outputPath',
|
||||
'--spirv=$outputSpirvPath',
|
||||
'--input=$notFragPath',
|
||||
'--input-type=frag',
|
||||
'--include=$fragDir',
|
||||
|
||||
Reference in New Issue
Block a user