Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

eyebrowsoffire
Copy link
Contributor

@eyebrowsoffire eyebrowsoffire commented Jun 20, 2023

This implements platform views in Skwasm. There are a number of substantial changes rolled up in this change, including:

  • Reworked the rendering system to use multiple canvases with a single WebGL context, via ImageBitmap rendering.
  • Reworked our object management and bindings to use the __externref_t construct in C code.
  • Upgraded emscripten to a much newer version
  • Generified skwasm's scene builder to be able to work with any renderer that can produce ImageBitmap objects from Pictures, and whose Canvas, Picture and ImageFilter objects conform to SceneCanvas/ScenePicture/SceneImageFilter

For platform views themselves, most stuff is implemented except for clipping. I plan on doing that in a subsequent change.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jun 20, 2023
Copy link
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! LGTM with nits

}

@override
PlatformViewStyling createPlatformViewStyling() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo it would be cleaner to separate out the clip styling into a separate class. I don't think the layers should have this logic in them


scene.beginRender();
final List<LayerSlice> slices = scene.rootLayer.slices;
final Iterable<Future<DomImageBitmap?>> renderFutures = slices.map(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: might be cleaner to use whereType to filter out the PlatformViewSlices rather than make a list of nullable futures

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I did it this way is so that I can extract them by index when I'm iterating the slices themselves. If we use whereType there is no simple way to correlate the image bitmap with the slice it was rendered from.

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 28, 2023
@auto-submit auto-submit bot merged commit f720a03 into flutter:main Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 28, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 28, 2023
…133508)

flutter/engine@91522a1...a7a4c1c

2023-08-28 [email protected] Explain how to update the embedder/fixtures golden outputs. (flutter/engine#45184)
2023-08-28 [email protected] Roll Skia from ded5d08a9999 to 83f6fbad8a38 (1 revision) (flutter/engine#45183)
2023-08-28 [email protected] [Impeller] Simplify color source + text with new Skia API. (flutter/engine#45090)
2023-08-28 [email protected] Re-write docs for DlSkCanvas{Adapter|Dispatcher}. (flutter/engine#44961)
2023-08-28 [email protected] Roll Skia from 5baa2c74fbc6 to ded5d08a9999 (1 revision) (flutter/engine#45181)
2023-08-28 [email protected] Roll Skia from 651ada29fcb0 to 5baa2c74fbc6 (2 revisions) (flutter/engine#45178)
2023-08-28 [email protected] Roll Skia from 477659e6f41b to 651ada29fcb0 (3 revisions) (flutter/engine#45176)
2023-08-28 [email protected] [Impeller] Only enable captures in debug builds. (flutter/engine#45174)
2023-08-28 [email protected] Roll Skia from ce99ad7b587e to 477659e6f41b (1 revision) (flutter/engine#45173)
2023-08-28 [email protected] Skwasm platform views (flutter/engine#43011)
2023-08-28 [email protected] Roll Skia from df783b542165 to ce99ad7b587e (2 revisions) (flutter/engine#45172)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
This implements platform views in Skwasm. There are a number of substantial changes rolled up in this change, including:
* Reworked the rendering system to use multiple canvases with a single WebGL context, via ImageBitmap rendering.
* Reworked our object management and bindings to use the `__externref_t` construct in C code.
* Upgraded emscripten to a much newer version
* Generified skwasm's scene builder to be able to work with any renderer that can produce `ImageBitmap` objects from Pictures, and whose `Canvas`, `Picture` and `ImageFilter` objects conform to `SceneCanvas`/`ScenePicture`/`SceneImageFilter`

For platform views themselves, most stuff is implemented except for clipping. I plan on doing that in a subsequent change.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine will affect goldens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants