Bug 221330 - [WPE][GTK] Wrong rendering when using opacity filters on hw accelerated layers
Summary: [WPE][GTK] Wrong rendering when using opacity filters on hw accelerated layers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Miguel Gomez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-03 06:30 PST by Miguel Gomez
Modified: 2021-02-04 00:42 PST (History)
6 users (show)

See Also:


Attachments
Patch (8.50 KB, patch)
2021-02-03 06:36 PST, Miguel Gomez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Gomez 2021-02-03 06:30:59 PST
I found this while I was looking for a fix to bug 184143. I've put a test case in https://people.igalia.com/magomez/opacity/index.html so the problem is visible: both columns show the images with opacity filters (opacity grows as we go down). The left column doesn't use GraphicsLayers for the images (and it produces the correct output), but the right column uses them and the result is wrong.

There's a test for this css3/filters/effect-opacity-hw.html but we have a custom png result for GTK (which is wrong) and no png for WPE. There's also a txt result, but that's fine both for GTK and WPE. The GTK png must be updated when this is fixed.

The problem is in the fragment shader, in how applyOpacityFilter() applies the opacity to the layer. It just applies it to the alpha channel, and not the colors. But we need the alpha to be premultiplied in order to perform a correct blending (check how applyOpacity() applies the value to the colors as well). If the colors are not premultiplied, then the alpha of the source texture is not taken into account (which means that a texture with 0 alpha will become visible when blending).
Comment 1 Miguel Gomez 2021-02-03 06:36:17 PST
Created attachment 419131 [details]
Patch
Comment 2 EWS 2021-02-04 00:42:12 PST
Committed r272361: <https://trac.webkit.org/changeset/272361>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419131 [details].