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

[canvaskit] Fall back to multi-context rendering on Firefox and Safari #49572

Merged

Conversation

harryterkelsen
Copy link
Contributor

This PR refactors rasterization to support two different modes, single GL context mode backed by a single OffscreenCanvas (Chrome), and multi-context mode which uses many GL contexts and canvases.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jan 5, 2024
@harryterkelsen harryterkelsen force-pushed the canvaskit-refactor-rasterization branch from b5bd3ec to 9222b8e Compare January 10, 2024 23:45
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #49572 at sha 09ebf43

@harryterkelsen
Copy link
Contributor Author

Will fix goldens tomorrow

@harryterkelsen harryterkelsen force-pushed the canvaskit-refactor-rasterization branch from 09ebf43 to 408d8f6 Compare January 11, 2024 22:02
@@ -13,11 +13,13 @@ void main() {
}

void testMain() {
group('$RenderCanvasFactory', () {
group('$OverlayCanvasFactory', () {
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we test the two strategies? We want to make sure tests cover single and multi context modes.

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 only difference between those modes is the factory function which creates the DisplayCanvas. This test is just for the functions of DisplayCanvas itself, so it should be agnostic to what kinds of DisplayCanvases are actually made. I refactored the test a bit to clarify that.

Copy link
Contributor Author

@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.

Thanks! PTAL

@@ -13,11 +13,13 @@ void main() {
}

void testMain() {
group('$RenderCanvasFactory', () {
group('$OverlayCanvasFactory', () {
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 only difference between those modes is the factory function which creates the DisplayCanvas. This test is just for the functions of DisplayCanvas itself, so it should be agnostic to what kinds of DisplayCanvases are actually made. I refactored the test a bit to clarify that.

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #49572 at sha d440403

@harryterkelsen harryterkelsen changed the title [WIP][canvaskit] Fall back to multi-context rendering on Firefox and Safari [canvaskit] Fall back to multi-context rendering on Firefox and Safari Jan 17, 2024
@harryterkelsen
Copy link
Contributor Author

PTAL. I also added a test for the off-by-one blurriness issue in surface_test.dart.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

lgtm

@harryterkelsen
Copy link
Contributor Author

Fixes flutter/flutter#140748

@parlough
Copy link
Member

Thanks @harryterkelsen!! Hope this will end up being temporary 🤞

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 18, 2024
…141800)

flutter/engine@75400c4...f4a4f04

2024-01-18 [email protected] [canvaskit] Fall back to multi-context rendering on Firefox and Safari (flutter/engine#49572)
2024-01-18 [email protected] Use any mac machine available for orchestrator run. (flutter/engine#49845)

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://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@tomekit
Copy link

tomekit commented Mar 2, 2024

Just a question, how do I check whether this landed in stable channel or perhaps if you know if this will end up somewhere in the 3.19.x?

@mreinfurt
Copy link

Just a question, how do I check whether this landed in stable channel or perhaps if you know if this will end up somewhere in the 3.19.x?

Looking for the same information here. Would be awesome if this landed in a hotfix.

harryterkelsen added a commit to harryterkelsen/engine that referenced this pull request Apr 15, 2024
flutter#49572)

This PR refactors rasterization to support two different modes, single
GL context mode backed by a single OffscreenCanvas (Chrome), and
multi-context mode which uses many GL contexts and canvases.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
auto-submit bot pushed a commit that referenced this pull request Apr 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-web Code specifically for the web engine will affect goldens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants