Unverified Commit 2fd82502 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] re-enable web shader compilation (#118461)

* [flutter_tools] re-enable web shader compilation

* update test cases
parent b4d72752
......@@ -427,8 +427,7 @@ class ManifestAssetBundle implements AssetBundle {
// For all platforms, include the shaders unconditionally. They are
// small, and whether they're used is determined only by the app source
// code and not by the Flutter manifest.
if (targetPlatform != TargetPlatform.web_javascript)
..._getMaterialShaders(),
..._getMaterialShaders(),
];
for (final _Asset asset in materialAssets) {
final File assetFile = asset.lookupAssetFile(_fileSystem);
......@@ -831,22 +830,18 @@ class ManifestAssetBundle implements AssetBundle {
}
}
// TODO(jonahwilliams): re-enable this feature once
// flutter web is using engine compiled canvaskit.
if (targetPlatform != TargetPlatform.web_javascript) {
for (final Uri shaderUri in flutterManifest.shaders) {
_parseAssetFromFile(
packageConfig,
flutterManifest,
assetBase,
cache,
result,
shaderUri,
packageName: packageName,
attributedPackage: attributedPackage,
assetKind: AssetKind.shader,
);
}
for (final Uri shaderUri in flutterManifest.shaders) {
_parseAssetFromFile(
packageConfig,
flutterManifest,
assetBase,
cache,
result,
shaderUri,
packageName: packageName,
attributedPackage: attributedPackage,
assetKind: AssetKind.shader,
);
}
for (final Uri modelUri in flutterManifest.models) {
......
......@@ -479,6 +479,7 @@ flutter:
'--spirv=$outputPath.spirv',
'--input=/$shaderPath',
'--input-type=frag',
'--remap-samplers',
'--include=/$assetsPath',
'--include=$shaderLibDir',
],
......@@ -548,7 +549,7 @@ flutter:
loggerOverride: testLogger,
targetPlatform: TargetPlatform.web_javascript,
);
expect((globals.processManager as FakeProcessManager).hasRemainingExpectations, false);
}, overrides: <Type, Generator>{
Artifacts: () => artifacts,
FileSystem: () => fileSystem,
......
......@@ -122,7 +122,7 @@ name: my_package
ProcessManager: () => FakeProcessManager.empty(),
});
testUsingContext('Does not bundles material shaders on web platforms', () async {
testUsingContext('Does bundle material shaders on web platforms', () async {
final String shaderPath = globals.fs.path.join(
Cache.flutterRoot!,
'packages', 'flutter', 'lib', 'src', 'material', 'shaders', 'ink_sparkle.frag'
......@@ -136,7 +136,7 @@ name: my_package
await asset.build(packagesPath: '.packages', targetPlatform: TargetPlatform.web_javascript);
expect(asset.entries.keys, isNot(contains('shaders/ink_sparkle.frag')));
expect(asset.entries.keys, contains('shaders/ink_sparkle.frag'));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
ProcessManager: () => FakeProcessManager.empty(),
......
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