Bug 82412

Summary: compositing/webgl/webgl-nonpremultiplied-blend.html is flaky on Lion
Product: WebKit Reporter: Dirk Pranke <dpranke>
Component: WebGLAssignee: Kenneth Russell <kbr>
Status: RESOLVED FIXED    
Severity: Normal CC: cc-bugs, enne, jamesr, jbauman, kbr, mazda, nduca, senorblanco, twiz, vangelis, webkit.review.bot, zmo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Comment 1 Dirk Pranke 2012-03-27 18:44:32 PDT
Note that there is a separate bug 55968 filed for this failing on mac and win in debug mode ...
Comment 2 Kenneth Russell 2012-03-28 14:11:55 PDT
From the flakiness dashboard results it looks to me like it's failing all the time rather than flaky. Needs investigation.
Comment 3 Dirk Pranke 2012-03-28 14:20:43 PDT
important note about the flakiness dashboard: if we retry the test and it passes, *that does not show up in the dashboard* :).

That's a whole separate, confusing issue that I'm working on w/ Ojan.
Comment 4 Yasuhiro Matsuda 2012-07-03 16:25:55 PDT
Another bug was filed for Snow Leopard (https://bugs.webkit.org/show_bug.cgi?id=89998).
This test started failing on Snow Leopard as well after http://trac.webkit.org/changeset/121267, so maybe this workaround (https://bugs.webkit.org/show_bug.cgi?id=79735) is causing this failure?
Comment 5 Kenneth Russell 2012-07-04 13:49:44 PDT
I think I see the problem. Because of how the premultiplied blend function of (ONE, ONE_MINUS_SRC_ALPHA) works, the premultipliedAlpha=false case for compositing of WebGL canvases is generally the first time the compositor will output anything except 1.0 for the alpha channel -- even when WebGL content is rendered with an alpha channel less than 1.0! A solution to this problem which seems correct to me is to disable writes to the alpha channel when drawing these canvases' output. This should cause the layout test results to be completely opaque on all platforms and fix any problems with weird content showing up blended behind them.
Comment 6 Kenneth Russell 2012-07-04 13:53:43 PDT
*** Bug 55968 has been marked as a duplicate of this bug. ***
Comment 7 Kenneth Russell 2012-07-04 14:04:50 PDT
Created attachment 150842 [details]
Patch
Comment 8 Adrienne Walker 2012-07-10 11:31:46 PDT
Comment on attachment 150842 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=150842&action=review

> Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:1024
> +        GLC(context(), context()->colorMask(true, true, true, false));

We used to do this for the opaque root layer, due to problems with native Windows controls having bad alpha values due to GDI.  However, this caused performance problems on ChromeOS and Android (see bug 72452) and so we switched to using a shader that always output an alpha value of 1.

I think glBlendFuncSeparate might be a better option here.
Comment 9 Kenneth Russell 2012-07-10 18:41:35 PDT
Created attachment 151572 [details]
Patch
Comment 10 Kenneth Russell 2012-07-10 18:42:52 PDT
Redid patch in terms of blendFuncSeparate and re-tested.

I have a feeling the CQ might reject this because the diff to LayoutTests/ChangeLog doesn't start at line 1, but I tried "git diff --precise" and it still didn't do the right thing.
Comment 11 Adrienne Walker 2012-07-10 20:05:57 PDT
Comment on attachment 151572 [details]
Patch

R=me.
Comment 12 WebKit Review Bot 2012-07-11 00:22:34 PDT
Comment on attachment 151572 [details]
Patch

Clearing flags on attachment: 151572

Committed r122306: <http://trac.webkit.org/changeset/122306>
Comment 13 WebKit Review Bot 2012-07-11 00:22:40 PDT
All reviewed patches have been landed.  Closing bug.