Repository navigation
[wimp] Adds wimp-heavy variant for non-chrome browsers - #189953
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. 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. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request introduces support for a heavy variant of the Wimp renderer, 'wimp_heavy', by updating build targets, artifact copying steps, and the Web SDK configuration. Additionally, the loader logic in 'skwasm_loader.js' is updated to resolve 'wimp_heavy' when a heavy build is required and Wimp is enabled. Feedback suggests using optional chaining on the 'config' object in the loader to prevent potential runtime errors if 'config' is undefined.
| const needsHeavy = (!browserEnvironment.hasImageCodecs || !browserEnvironment.hasChromiumBreakIterators) | ||
| const fileStem = needsHeavy | ||
| ? 'skwasm_heavy' | ||
| ? (config.enableWimp ? 'wimp_heavy' : 'skwasm_heavy') |
There was a problem hiding this comment.
To prevent potential runtime errors if the config object is null or undefined (for example, in certain test environments or custom embeddings), consider using optional chaining (config?.enableWimp) when checking the configuration.
| ? (config.enableWimp ? 'wimp_heavy' : 'skwasm_heavy') | |
| ? (config?.enableWimp ? 'wimp_heavy' : 'skwasm_heavy') |
eyebrowsoffire
left a comment
There was a problem hiding this comment.
We will actually need some kind of solution for how to deal with image decoding. As of right now, just flipping the heavy flag just compiles in SkAnimatedImage, which will have skia do image decoding for us on non-Chrome browsers. But that just produces an SkImage, which is incompatible with wimp, and will basically cause things to crash if the web engine attempts to render an image this way.
The reason the "light" version of skwasm/wimp gets away with this is because on Chrome, all code paths on the dart side use the browser-based ImageDecoder API to produce an ImageBitmap and so the animated image path is never used. I think the newest versions of Firefox and Safari support this API now, so theoretically we could do the same there, but in practice we haven't turned that on on the dart side for browsers other than Chrome. In the past we used to feature gate things by the existence of the browser API rather than explicitly turning it on per-browser, but we got burned by that when browsers would release a buggy version of their API that we hadn't vetted yet and we were left scrambling to put a patch in to disable it.
If it turns out that both Firefox's and Safari's ImageDecoder APIs are actually ready for prime time and available in all supported versions of our browser, we could consider completely removing the SkAnimatedImage path and then it's one less vector to worry about for the heavy vs. light conversation. But we'll need to talk to the other web folks to move forward on that and make sure we change things on the dart side to always use the browser-based ImageDecoder API.
|
@eyebrowsoffire okay, that probably explains the weird errors I've been trying to get to the bottom of.
I don't actually think that is the case for Safari: https://developer.mozilla.org/en-US/docs/Web/API/ImageDecoder It is an explicit omission on safari. |
|
@eyebrowsoffire I'll look into the ImageDecoder in a separate PR. This actually renders something in firefox, whereas before this it rendered nothing. |
Actually the problem was the one fixed in #189958. Firefox webgl2 is stricter in this case. |
|
Chatted with @eyebrowsoffire offline. He would like a fallback path for image decoding and enabling some felt integration tests as part of this pr. His notes:
|
|
rebasing to get our opengles fix (#189958) |
|
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
4d7cf65 to
d6bd418
Compare
@eyebrowsoffire I'm circling back to this. In 2b5ef64fc41 you mention "Firefox+ui doesn't work because our Linux bots have no GPU and therefore no WebGL2 support, so that one is disabled." You can see that in the diff too here. It sounds like there is no existing CI setup that can run wimp on firefox? What are your expectations for this PR with respect to felt testing? |
8d28bc9 to
7e2f726
Compare
|
@eyebrowsoffire okay, I've stubbed in the image decoding and added a felt test config. The image decoding returns a static image for animated images on safari and returns an empty image on firefox. I didn't dig deep into why, but they don't crash as requested. The tests don't all pass, this appears to be an existing bug we can address in future PRs. The tests aren't tied to CI, this matches the behavior of existing comparable test suites. Hopefully we can get them running on CI in the future but that seems out of scope of this PR considering it wasn't tackled yet in other suites, like |
eyebrowsoffire
left a comment
There was a problem hiding this comment.
This is looking good, but I think there's something slightly wrong with the boolean logic on the codec stuff.
# Conflicts: # engine/src/flutter/lib/web_ui/test/felt_config.yaml
issue: flutter#187212 This gets wimp_heavy loading on firefox. There are still some webgl errors though. ## video Before this change nothing rendered for counter, now it works as long as you don't hover over the floating button. https://github.com/user-attachments/assets/e68facbe-50a4-4d19-80a3-6967aba2691f ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
issue: #187212
This gets wimp_heavy loading on firefox. There are still some webgl errors though.
video
Before this change nothing rendered for counter, now it works as long as you don't hover over the floating button.
firefox.mov
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.