Closed Bug 1918923 Opened 2 months ago Closed 14 days ago

conic-gradient with hsl interpolation contains weird line

Categories

(Core :: Graphics, defect)

Firefox 130
defect

Tracking

()

VERIFIED FIXED
133 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- wontfix
firefox131 --- wontfix
firefox132 --- wontfix
firefox133 --- verified
firefox134 --- verified

People

(Reporter: bugzilla, Assigned: jfkthame, NeedInfo)

References

(Regression)

Details

(Keywords: nightly-community, regression)

Attachments

(5 files)

Attached file test.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0

Steps to reproduce:

I was trying to create a color wheel using conic-gradient and hsl interpolation.
See the attached html file

Actual results:

most of the time the gradient renders as expected, but when resizing the window or zooming, sometimes a horizontal green line appears from the left edge to the center of the screen

Attached image screenshot.png

Not sure if it's the same as bug 1918865 (different gradient, same problem with a white line)

Component: Untriaged → Graphics
Product: Firefox → Core

I can reproduce the issue on Nightly132.0a1 Windows11.
It depends on the height of the viewport.

STR

  1. Open the test.html
  2. Reduce and/or increase the height of browser window

Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=4268f51cf410ef67d5cf253ab6df18bcf6bbba51&tochange=eb5eb6f5972ff537d2f189e3d2ebb2ba2d087857

Status: UNCONFIRMED → NEW
Ever confirmed: true
Regressed by: 1887837

:nical, since you are the author of the regressor, bug 1887837, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(nical.bugzilla)

I haven't had time to look into it yet, but here is a reduced wrench capture of the test case showing the issue.

I think that the issue also manifests itself with the downloads progress indicator icon in the UI. If a download is between 25% and 75%, I see a spurious blue line at the 75% mark.

Looking at the code in gfx/wr/webrender/res/ps_quad_conic_gradient.glsl, the function approx_atan2 ends with this:
r = r * sign(y);
That's problematic if y=0, because in that case sign(y)=0 and the function returns 0, whereas it should return pi. That explains why the radius at angle pi has the color meant for the angle 0.

Maybe it should do something like this instead:
r = if_then_else(float(y >= 0.0), r, -r);

I was able to reproduce this on my Windows machine (it's a bit intermittent, depending on the window size and screen resolution/zoom level, but playing about with the window size triggers it easily), and confirmed that Sébastien's diagnosis in comment 6 appears to be correct. Applying a simple fix to avoid the use of sign(y) there resolves the glitch.

(In reply to Francesco Lodolo [:flod] from comment #2)

Not sure if it's the same as bug 1918865 (different gradient, same problem with a white line)

This is specifically the conic-gradient shader, and there's no other use of the sign() function in the gfx/wr/webrender/res/*.glsl shaders, afaics. So although that does look like quite a similar glitch, it must be a somewhat different issue.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4d5d99a824eb Avoid conic-gradient rendering glitch due to evaluating sign(0.0). r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 14 days ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
Duplicate of this bug: 1919986

Reproducible on a 2024-09-15 Nightly build on Windows 10, using the testcase in Comment 0.
Verified as fixed on Firefox 133.0b3 and Firefox Nightly 134.0a1 on Windows 10, Ubuntu 22, macOS 14.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: