-
Notifications
You must be signed in to change notification settings - Fork 27.9k
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] ColorScheme.fromImageProvider
always produces the same result
#141326
Comments
@parlough Are you still seeing this issue on the master branch? When I was working on getting the framework unit test working with Skwasm, I originally saw some unit test failures related to this code path ( |
@eyebrowsoffire Sorry for the late response. I just tested on latest You can see this on |
I went to verify this again and it's still occurring, but I noticed that if I call |
I was doing some testing and it turns out that Here is the code I tested with: https://dartpad.dev/?id=3b81fc3ac996af3d44c329d731bfad61 . On Flutter web (stable), it works just fine. On Flutter desktop I get the default light color scheme. |
Edit: It seems to work on channel beta. So it's probably not relevant. |
It turns out there are two issues here. I am working on a fix on the flutter side, but I discovered a skia bug that is also contributing to this issue: https://g-issues.skia.org/issues/349201915 I think I have a workaround for the skia bug in the meantime, and I'm working on correctly implementing the workaround now in skwasm. |
There were two issues here: 1) We have to stop using the emscripten thread scheduling APIs, as they can be invoked out of order from the rest of the messages that are posted. In some cases, out of order message handling can cause the request for reading pixels in an image to be serviced before some of the texture sources have been transfered to the web worker. 2) Skia's `readPixels` fails if there is is a lazy picture image made from a picture that contains a lazy texture image. The pertinent bug is here: https://g-issues.skia.org/issues/349201915 To work around the Skia bug, we just render the image itself onto our scratch canvas and pull the pixels out with `glReadPixels`. This fixes flutter/flutter#141326
There were two issues here: 1) We have to stop using the emscripten thread scheduling APIs, as they can be invoked out of order from the rest of the messages that are posted. In some cases, out of order message handling can cause the request for reading pixels in an image to be serviced before some of the texture sources have been transfered to the web worker. 2) Skia's `readPixels` fails if there is is a lazy picture image made from a picture that contains a lazy texture image. The pertinent bug is here: https://g-issues.skia.org/issues/349201915 To work around the Skia bug, we just render the image itself onto our scratch canvas and pull the pixels out with `glReadPixels`. This fixes flutter/flutter#141326
Thanks so much for tackling this @eyebrowsoffire! Sounds like it ended up being quite the investigation. I'll try the fix out with the Material 3 demo, and see if we can start deploying it with JS/Wasm switching :D |
I personally tested it with the Material 3 Demo and it seems to fix the issue! But I'd love a second verification whenever you get a chance. |
I tried this out w/ the material demo and saw NO change. We should sync up. |
I just tried it out now that the engine commit rolled into the framework and it's working as I expect! Thanks :D |
Confirmed deploy here! https://flutterweb-wasm.web.app/ |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
No matter what image is provided, the same
ColorScheme
is being created byColorScheme.fromImageProvider
.I haven't looked too deeply, but seems to be something going wrong in the
_imageProviderToScaled
method or how it interacts withui_web/painting
.The text was updated successfully, but these errors were encountered: