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