-
Notifications
You must be signed in to change notification settings - Fork 6k
fix: web canvaskit fragment shaders were not using updated uniform values #53246
Conversation
|
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. |
|
I'll get to writing tests (if possible for gl related issues on the web?) and add it here soon. |
|
|
|
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. |
|
The golden is incorrect and so far I'm not sure why. I assume it's a bug on my side but I'd also like to know if as a rule in this flutter engine golden test system you can't re-use a golden test file in a single test like I am for this one? |
|
I've confirmed on my local machine that this is not a bug on my side. But the golden tests are producing different results in CI than Chrome is showing per-frame on my local machine. Does the golden system have some kind of restriction where you aren't allowed to use multiple of the same golden file? |
|
@Moncader just stumbled across your PR after running into this issue. currently using the new |
|
@IntensiCode The support and fix is complete. I'm waiting on someone to give some insight on how the golden test system works due to the test saying there's a diff when there isn't actually a diff when confirmed locally. I'm asking over on discord as well. |
e65456a to
7a0dfcc
Compare
|
Golden file changes are available for triage from new commit, Click here to view. |
|
The goldens seem to indicate that this issue exists in the skwasm renderer as well and needs to be fixed. I can look into that in a followup though. |
|
I'll check it out first actually. I don't mind getting my feet wet there. (assuming the issue ends up being a simple fix like this one was) |
|
I think the fix for the skwasm side should just be here: https://github.com/flutter/engine/blob/main/lib/web_ui/skwasm/shaders.cpp#L134 Instead of doing |
| class CkFragmentShader implements ui.FragmentShader, CkShader { | ||
| CkFragmentShader(this.name, this.effect, int floatCount, int textureCount) | ||
| : floats = List<double>.filled(floatCount + textureCount * 2, 0), | ||
| : floats = mallocFloat32List(floatCount + textureCount * 2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we malloc'd this list, we also need to free it in dispose
This is what I was thinking as well, but wasn't sure if it's safe to use the reference like that. |
|
Golden file changes are available for triage from new commit, Click here to view. |
It's managed by a smart pointer |
|
Golden file changes are available for triage from new commit, Click here to view. |
|
The test looks good now. Seems I don't have permission to say OK to the golden though? |
eyebrowsoffire
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and approved the goldens. Thanks for the fix!
yjbanov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…150797) flutter/engine@62e0b5f...94023d7 2024-06-25 [email protected] [skwasm] Fixes for getting pixels from an image. (flutter/engine#53561) 2024-06-25 [email protected] fix: web canvaskit fragment shaders were not using updated uniform values (flutter/engine#53246) 2024-06-25 [email protected] Roll Dart SDK from b5fc85cfcf1b to 65ab2f2cf0d3 (1 revision) (flutter/engine#53565) 2024-06-25 [email protected] Roll Skia from e4e4feb97a54 to da1ea4eb0270 (4 revisions) (flutter/engine#53563) 2024-06-25 [email protected] [DisplayList] Switch to recording DrawVertices objects by reference (flutter/engine#53548) 2024-06-25 [email protected] Roll Skia from 5f21260470cf to e4e4feb97a54 (1 revision) (flutter/engine#53559) 2024-06-25 [email protected] [impeller] Cleanup blur (flutter/engine#53543) 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

This fixes an issue where in CanvasKit builds, uniforms set in setFloat function in the Paint class don't get updated after the initial render.
For example, like in the issue linked below, having a shader that animates a value over time and you want to reuse the Paint object that the shader is set to.
I'm no expert with CanvasKit nor with the Flutter Engine, but from what I could tell it seemed that the uniforms were only being sent to Skia on creation of the shader via _makeEffect.
However, any uniforms set afterwords were just stored in a local dart-side List and forgotten about.
This PR changes the List to use a WASM backed SkFloat32List to keep the references to the uniforms linked to dart-side.
fixes flutter/flutter#149800
Pre-launch Checklist
///).