Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skwasm scene #40330

Merged
merged 46 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
cfccaa7
WIP add screenshot goldens to ui_tests
harryterkelsen Feb 15, 2023
294cff9
Started implementing skwasm scene stuff.
eyebrowsoffire Mar 13, 2023
6dc5144
Scene builder mostly coded up.
eyebrowsoffire Mar 14, 2023
13816e4
Stuff.
eyebrowsoffire Mar 15, 2023
ab7e937
Running into TFA issues.
eyebrowsoffire Mar 15, 2023
6184bec
More scene changes.
eyebrowsoffire Mar 21, 2023
fd915b3
Merge branch 'main' into skwasm_scene
eyebrowsoffire Mar 21, 2023
aade26b
We drawing now.
eyebrowsoffire Mar 22, 2023
d49f73d
Copy stuff, but skwasm.worker.js doesn't copy yet.
eyebrowsoffire Mar 22, 2023
c473192
Add a few flags.
eyebrowsoffire Mar 23, 2023
bbd206b
Bundle skwasm.
eyebrowsoffire Mar 23, 2023
b651d65
Use newer buildroot.
eyebrowsoffire Mar 23, 2023
6fbb8d0
Merge branch 'main' into skwasm_scene
eyebrowsoffire Mar 23, 2023
4796b64
Merge branch 'main' into skwasm_scene
eyebrowsoffire Mar 29, 2023
d79c143
Use the normal toolchain so we get LTO.
eyebrowsoffire Mar 29, 2023
8350e48
Merge remote-tracking branch 'hterkelsen/ui-golden-tests' into skwasm…
eyebrowsoffire Mar 29, 2023
d8bfb0f
Analyzer cleanup and Kevin's comments.
eyebrowsoffire Mar 29, 2023
f7a22db
Update license golden.
eyebrowsoffire Mar 29, 2023
ad64278
Some fixes for goldens, although skwasm renderer has async issues.
eyebrowsoffire Mar 29, 2023
17a8e6c
Some async stuff.
eyebrowsoffire Mar 29, 2023
c89584c
Merge branch 'main' into skwasm_scene
eyebrowsoffire Mar 29, 2023
d446202
Fixed cull rect calculation.
eyebrowsoffire Mar 30, 2023
4ca5636
Update licenses and fix an analyzer issue.
eyebrowsoffire Mar 30, 2023
4f85df1
Wrote unit tests that cover the remainder of what skwasm has implemen…
eyebrowsoffire Mar 31, 2023
a722c25
Merge branch 'main' into skwasm_scene
eyebrowsoffire Mar 31, 2023
b4f98fc
Update README
eyebrowsoffire Mar 31, 2023
a5d798d
Merge branch 'main' into skwasm_scene
eyebrowsoffire Mar 31, 2023
1cb3514
Wait one frame after rendering to ensure the screenshot captures prop…
eyebrowsoffire Mar 31, 2023
6cb0f12
Use switch expression.
eyebrowsoffire Mar 31, 2023
32299b2
Merge branch 'main' into skwasm_scene
eyebrowsoffire Mar 31, 2023
c2ca50c
Tweak build parameters for skwasm.
eyebrowsoffire Mar 31, 2023
64d5728
Update lib/web_ui/lib/src/engine/skwasm/skwasm_impl/surface.dart
eyebrowsoffire Apr 4, 2023
a239266
Address some comments from Mouad.
eyebrowsoffire Apr 4, 2023
3d90da0
Merge branch 'main' into skwasm_scene
eyebrowsoffire Apr 4, 2023
da3be30
Fix formatting.
eyebrowsoffire Apr 4, 2023
e0892d6
Change name of variable for clarity.
eyebrowsoffire Apr 4, 2023
07f6f75
Fix async semantics of skwasm surface.
eyebrowsoffire Apr 4, 2023
0d94512
Reinstate old transformRect algorithm.
eyebrowsoffire Apr 4, 2023
cd56076
Merge branch 'main' into skwasm_scene
eyebrowsoffire Apr 4, 2023
85674bc
Shift cullRect by offset when using opacity layer.
eyebrowsoffire Apr 5, 2023
457059f
Renderer.renderScene should return FutureOr.
eyebrowsoffire Apr 5, 2023
a0dbca2
Merge branch 'main' into skwasm_scene
eyebrowsoffire Apr 5, 2023
a6f8d1e
Merge branch 'main' into skwasm_scene
eyebrowsoffire Apr 6, 2023
26a54c0
Get rid of duplicate `skwasm_group` definitino from merge.
eyebrowsoffire Apr 6, 2023
6a41070
Merge branch 'main' into skwasm_scene
eyebrowsoffire Apr 6, 2023
2d52b90
Merge branch 'main' into skwasm_scene
eyebrowsoffire Apr 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 20 additions & 2 deletions lib/web_ui/dev/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'pipeline.dart';
import 'utils.dart';

enum RuntimeMode {
debug,
profile,
release,
}
Expand Down Expand Up @@ -45,6 +46,12 @@ class BuildCommand extends Command<bool> with ArgUtils<bool> {
'output will be located at "out/wasm_profile".\nThis only applies to '
'the wasm build. The host build is always built in release mode.',
);
argParser.addFlag(
kevmoo marked this conversation as resolved.
Show resolved Hide resolved
'debug',
help: 'Build in debug mode instead of release mode. In this mode, the '
'output will be located at "out/wasm_debug".\nThis only applies to '
'the wasm build. The host build is always built in release mode.',
);
}

@override
Expand All @@ -57,8 +64,15 @@ class BuildCommand extends Command<bool> with ArgUtils<bool> {

bool get host => boolArg('host');

RuntimeMode get runtimeMode =>
boolArg('profile') ? RuntimeMode.profile : RuntimeMode.release;
RuntimeMode get runtimeMode {
if (boolArg('profile')) {
return RuntimeMode.profile;
} else if (boolArg('debug')) {
return RuntimeMode.debug;
} else {
return RuntimeMode.release;
}
}

List<String> get targets => argResults?.rest ?? <String>[];

Expand Down Expand Up @@ -114,6 +128,8 @@ class GnPipelineStep extends ProcessStep {

String get runtimeModeFlag {
switch (runtimeMode) {
kevmoo marked this conversation as resolved.
Show resolved Hide resolved
case RuntimeMode.debug:
return 'debug';
case RuntimeMode.profile:
return 'profile';
case RuntimeMode.release:
Expand Down Expand Up @@ -170,6 +186,8 @@ class NinjaPipelineStep extends ProcessStep {
return environment.hostDebugUnoptDir.path;
}
switch (runtimeMode) {
case RuntimeMode.debug:
kevmoo marked this conversation as resolved.
Show resolved Hide resolved
return environment.wasmDebugOutDir.path;
case RuntimeMode.profile:
return environment.wasmProfileOutDir.path;
case RuntimeMode.release:
Expand Down
7 changes: 7 additions & 0 deletions lib/web_ui/dev/environment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class Environment {
io.Directory(pathlib.join(outDir.path, 'wasm_release'));
final io.Directory wasmProfileOutDir =
io.Directory(pathlib.join(outDir.path, 'wasm_profile'));
final io.Directory wasmDebugOutDir =
io.Directory(pathlib.join(outDir.path, 'wasm_debug'));
final io.Directory hostDebugUnoptDir =
io.Directory(pathlib.join(outDir.path, 'host_debug_unopt'));
final io.Directory dartSdkDir = dartExecutable.parent.parent;
Expand All @@ -57,6 +59,7 @@ class Environment {
outDir: outDir,
wasmReleaseOutDir: wasmReleaseOutDir,
wasmProfileOutDir: wasmProfileOutDir,
wasmDebugOutDir: wasmDebugOutDir,
hostDebugUnoptDir: hostDebugUnoptDir,
dartSdkDir: dartSdkDir,
);
Expand All @@ -71,6 +74,7 @@ class Environment {
required this.outDir,
required this.wasmReleaseOutDir,
required this.wasmProfileOutDir,
required this.wasmDebugOutDir,
required this.hostDebugUnoptDir,
required this.dartSdkDir,
});
Expand Down Expand Up @@ -103,6 +107,9 @@ class Environment {
/// The output directory for the wasm_profile build.
final io.Directory wasmProfileOutDir;

/// The output directory for the wasm_debug build.
final io.Directory wasmDebugOutDir;

/// The output directory for the host_debug_unopt build.
final io.Directory hostDebugUnoptDir;

Expand Down
6 changes: 6 additions & 0 deletions lib/web_ui/lib/src/engine/skwasm/skwasm_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

@DefaultAsset('skwasm')
// The web_sdk/sdk_rewriter.dart uses this directive.
// ignore: unnecessary_library_directive
library skwasm_impl;

import 'dart:ffi';

export 'skwasm_impl/canvas.dart';
export 'skwasm_impl/font_collection.dart';
export 'skwasm_impl/image.dart';
export 'skwasm_impl/layers.dart';
export 'skwasm_impl/paint.dart';
export 'skwasm_impl/paragraph.dart';
export 'skwasm_impl/path.dart';
Expand All @@ -22,5 +27,6 @@ export 'skwasm_impl/raw/raw_path_metrics.dart';
export 'skwasm_impl/raw/raw_picture.dart';
export 'skwasm_impl/raw/raw_surface.dart';
export 'skwasm_impl/renderer.dart';
export 'skwasm_impl/scene_builder.dart';
export 'skwasm_impl/surface.dart';
export 'skwasm_impl/vertices.dart';
4 changes: 2 additions & 2 deletions lib/web_ui/lib/src/engine/skwasm/skwasm_impl/canvas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class SkwasmCanvas implements ui.Canvas {

@override
void drawParagraph(ui.Paragraph uiParagraph, ui.Offset offset) {
throw UnimplementedError();
// TODO(jacksongardner): implement this
}

@override
Expand Down Expand Up @@ -260,7 +260,7 @@ class SkwasmCanvas implements ui.Canvas {
double elevation,
bool transparentOccluder,
) {
throw UnimplementedError();
// TODO(jacksongardner): implement this
}

@override
Expand Down
41 changes: 41 additions & 0 deletions lib/web_ui/lib/src/engine/skwasm/skwasm_impl/font_collection.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:async';

import 'dart:typed_data';

import 'package:ui/src/engine.dart';

class SkwasmFontCollection implements FlutterFontCollection {
@override
void clear() {
// TODO: implement clear
print('SkwasmFontCollection.clear()');
}

@override
FutureOr<void> debugDownloadTestFonts() {
// TODO: implement debugDownloadTestFonts
print('SkwasmFontCollection.debugDownloadTestFonts()');
}

@override
Future<void> downloadAssetFonts(AssetManager assetManager) async {
// TODO: implement downloadAssetFonts
print('SkwasmFontCollection.downloadAssetFonts($assetManager)');
}

@override
Future<void> loadFontFromList(Uint8List list, {String? fontFamily}) async {
// TODO: implement loadFontFromList
print('SkwasmFontCollection.loadFontFromList($list, $fontFamily)');
}

@override
void registerDownloadedFonts() {
// TODO: implement registerDownloadedFonts
print('SkwasmFontCollection.registerDownloadedFonts()');
}
}