-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] Apply color filters on the CPU for solid colors & gradients. #43519
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Let's see those goldens. |
d9bb8f8
to
e00247f
Compare
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. |
Those goldens are looking mighty fine. |
b11a61d
to
ec19ef0
Compare
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.
How does this work with decal gradients + color blending that changes transparent black?
I'm not really sure what the correct result should be in this case, but I think If you apply a color filter to a decal texture you can observe the transparent black pixels getting changed, where a CPU blend afterwards might not do that? |
Not sure if I'm fully answering your question, but: Today, when applying a color blend to the color source, pixels that lie outside the geometry can be affected, which is incorrect behavior. This patch fixes that behavior for solid colors and gradients. Fixing it for the other drawing ops will require more expensive tricks. For example, tracking the geometry mask as a separate texture and compositing post-blend (this is pretty much our only option if a mask blur is present), or drawing the geometry outline to a stencil and then using it inside the GPU blend filter. |
Here is an example of what I'm talking about: https://dartpad.dev/?id=80d0af639ec8952a3e31bac084fb202b With decal and certain gradient parameters you can inset the color source in the geometry, and in that case you'd need to handle blending being done with transparent black pixels |
Ah yeah, that needs to be fixed. I'll fix it by throwing the blended border color in the shader uniforms. It makes sense to allow the border color to be set in our emulated decal anyhow. Metal allows this, for example. |
Great catch, btw. :) |
439bd30
to
f794f94
Compare
f794f94
to
482fb4c
Compare
Golden file changes are available for triage from new commit, Click here to view. |
Goldens are good. |
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.
LGTM
At some point we'll need to reckon with how complex we've made gradients...
…130357) flutter/engine@59f2346...e2df016 2023-07-11 [email protected] Roll Skia from 68bcc4470230 to 47a37395ee40 (12 revisions) (flutter/engine#43568) 2023-07-11 [email protected] Remove stray semicolons from embedded_views.cc (flutter/engine#43566) 2023-07-11 [email protected] [Impeller] Apply color filters on the CPU for solid colors & gradients. (flutter/engine#43519) 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] 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
…s. (flutter#43519) Apply color filters on the CPU for solid colors and gradients. This fixes flutter/flutter#127232 for the purely color-based color sources. We still need to make the other special color blending paths respect the geometry mask in order to fully resolve the underlying issue: * SaveLayers (if they have an interesting matrix filter -- without a matrix filter, it'll always work today) * TiledTextureContents * TextContents * VerticesContents * AtlasContents
Resolves flutter/flutter#132936. * In some cases, mask blurs were getting applied twice. * Coverage hint clipping was too aggressive on the second pass of the gaussian blur. * Rework the mask blur applicator to support gracefully falling back to GPU-based color filters when necessary. This fix requires us to cherry-pick: #43519 Going a revert-based route to fix all of these problems would also be pretty complex. https://github.com/flutter/engine/assets/919017/9ee5e856-af7a-42b9-b135-ea268c2ba53f
…s. (flutter#43519) Apply color filters on the CPU for solid colors and gradients. This fixes flutter/flutter#127232 for the purely color-based color sources. We still need to make the other special color blending paths respect the geometry mask in order to fully resolve the underlying issue: * SaveLayers (if they have an interesting matrix filter -- without a matrix filter, it'll always work today) * TiledTextureContents * TextContents * VerticesContents * AtlasContents (cherry picked from commit 81d5adb)
…er#45079) Resolves flutter/flutter#132936. * In some cases, mask blurs were getting applied twice. * Coverage hint clipping was too aggressive on the second pass of the gaussian blur. * Rework the mask blur applicator to support gracefully falling back to GPU-based color filters when necessary. This fix requires us to cherry-pick: flutter#43519 Going a revert-based route to fix all of these problems would also be pretty complex. https://github.com/flutter/engine/assets/919017/9ee5e856-af7a-42b9-b135-ea268c2ba53f (cherry picked from commit 53595c9)
…er#45079) Resolves flutter/flutter#132936. * In some cases, mask blurs were getting applied twice. * Coverage hint clipping was too aggressive on the second pass of the gaussian blur. * Rework the mask blur applicator to support gracefully falling back to GPU-based color filters when necessary. This fix requires us to cherry-pick: flutter#43519 Going a revert-based route to fix all of these problems would also be pretty complex. https://github.com/flutter/engine/assets/919017/9ee5e856-af7a-42b9-b135-ea268c2ba53f (cherry picked from commit 53595c9)
…er#45079) Resolves flutter/flutter#132936. * In some cases, mask blurs were getting applied twice. * Coverage hint clipping was too aggressive on the second pass of the gaussian blur. * Rework the mask blur applicator to support gracefully falling back to GPU-based color filters when necessary. This fix requires us to cherry-pick: flutter#43519 Going a revert-based route to fix all of these problems would also be pretty complex. https://github.com/flutter/engine/assets/919017/9ee5e856-af7a-42b9-b135-ea268c2ba53f
Apply color filters on the CPU for solid colors and gradients. This fixes flutter/flutter#127232 for the purely color-based color sources.
We still need to make the other special color blending paths respect the geometry mask in order to fully resolve the underlying issue: