Closed Bug 1575119 Opened 4 months ago Closed 4 months ago

SVG FeFuncA type="table" does not correctly invert opacity, in WebRender

Categories

(Core :: Graphics: WebRender, defect, P3)

68 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- disabled
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- fixed

People

(Reporter: michael.mullany, Assigned: tnikkel)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36

Steps to reproduce:

I created a test case showing 4 rect elements with blue fill at 100%, 75%, 25% and 0% opacity, and applied a filter with feFuncA type="table" tableValues="1 0".
https://codepen.io/mullany/pen/OJLROPb

Actual results:

All shapes with any opacity > 0 were set to 0 opacity

Expected results:

The result should have been four shapes at zero, 25%, 75% and 100% blue filled opacity.

A similar issue occurs with tableValues="0 1" - which should be the identity primitive.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Layout: Tables
Product: Firefox → Core
Component: Layout: Tables → SVG

(In reply to michael.mullany from comment #0)

Actual results:
All shapes with any opacity > 0 were set to 0 opacity

Can you be more specific about which part (visually) is incorrect?

For me in Firefox nightly on Linux, the testcase renders the same as in Chrome. (First row has 3 fading-shades-of-blue rects and a white rect, and second row has white/lightblue/darkerblue/black)

A guess: if I enable WebRender, I do see something broken -- the bottom row shows the middle two rects as white rather than shades of blue. Is that the problem you're reporting, or is there something else that's wrong as well?

(If that matches the bug you're seeing: could you check whether the bug goes away if you type "about:config" into your URL bar, and then type gfx.webrender.force-disabled into that page's search box, and double-click that row to set it to true, and restart Firefox?)

Flags: needinfo?(michael.mullany)
Status: UNCONFIRMED → NEW
Component: SVG → Graphics: WebRender
Ever confirmed: true

Confirmed - this bug goes away when I force-disable WebRender

(it still doesn't invert a 0% opacity blue square properly (renders black instead of blue - but at least that makes it behave the same as Chrome - and I think merits a separate bug)

Summary: FeFuncA - type="table" does not correctly invert opacity → SVG FeFuncA type="table" does not correctly invert opacity, in WebRender
Blocks: wr-69
Priority: -- → P3

Hey Nical - can you let me know what you think?

Flags: needinfo?(nical.bugzilla)

Pretty sure this was regressed by bug 1505871. Confirming that now. I'll take a look at this bug.

Flags: needinfo?(tnikkel)

(In reply to Timothy Nikkel (:tnikkel) from comment #5)

Pretty sure this was regressed by bug 1505871. Confirming that now. I'll take a look at this bug.

Indeed -- midair'ed.

mozregression --pref gfx.webrender.all:true tells me the regression range was https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=f38de0791ab52be4c8d754e64c5c6a924fc65563&tochange=44192297e3ae55473fbe669a681f937191a54b81

--> regression from bug 1505871

It looks like the issue occurs when we unpremultiply the color in the brush_blend shader.
https://searchfox.org/mozilla-central/rev/597a69c70a5cce6f42f159eb54ad1ef6745f5432/gfx/wr/webrender/res/brush_blend.glsl#272
(also needs to be fixed here https://searchfox.org/mozilla-central/source/gfx/wr/webrender/res/cs_svg_filter.glsl#573)

When unpremultiplying we should only divide the rgb components of the color by the alpha, but we were also dividing the alpha by itself which results in the alpha component always being 1 (unless it was originally 0).

(In reply to Connor Brewster [:cbrewster] from comment #7)

It looks like the issue occurs when we unpremultiply the color in the brush_blend shader.
https://searchfox.org/mozilla-central/rev/597a69c70a5cce6f42f159eb54ad1ef6745f5432/gfx/wr/webrender/res/brush_blend.glsl#272
(also needs to be fixed here https://searchfox.org/mozilla-central/source/gfx/wr/webrender/res/cs_svg_filter.glsl#573)

Thanks for the find!

It looks like cs_svg_filter.glsl was already doing the right thing: it computed colora incorrectly, but it never used that variable, instead using the correctly calculated Ca.

Flags: needinfo?(tnikkel)
Flags: needinfo?(nical.bugzilla)
Assignee: nobody → tnikkel
Pushed by tnikkel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/44b7392be405
In brush_blend.glsl shader don't unpremultiply the alpha, only the colors. r=gw
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

This isn't a new issue and we're out of betas for Fx69 -> wontfix.

Flags: in-testsuite+
Regressed by: 1505871
No longer regressions: 1505871
You need to log in before you can comment on or make changes to this bug.