Bug 179368

Summary: REGRESSION (r222961): Clear function not clearing whole screen when antialias is set to false
Product: WebKit Reporter: adrian
Component: WebGLAssignee: Dean Jackson <dino>
Status: RESOLVED FIXED    
Severity: Major CC: dino, jonlee, kdmitrenko, sam, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: Mac   
OS: macOS 10.13   
See Also: https://bugs.webkit.org/show_bug.cgi?id=177903
Attachments:
Description Flags
Issue as described, see how the clear colour is only around the primitives on screen
none
Patch sam: review+

Description adrian 2017-11-07 01:45:04 PST
Created attachment 326201 [details]
Issue as described, see how the clear colour is only around the primitives on screen

When using WebGL in safari in high sierra, it seems gl.clear() no longer functions as expected.  It only seems to clear around items that have been drawn to the screen and not the whole context like it does in every other browser and in previous safari in sierra.  The attached screenshot is a modified version of our application, simplified (framebuffers removed, running extra clears to be certain etc) and with the clear colour set to black.  As you can see the clear is happening only around the items on the screen and not the whole context.  This webgl app also shows the same artifacts http://3dflipbook.net/.   This issue only occurs when antialias is disabled when creating the context, as we use shader based antialiasing for performance reasons it is not acceptable workaround to enable it.
Comment 1 Jon Lee 2017-11-07 12:38:28 PST
(In reply to adrian from comment #0)
> This webgl app also shows the same
> artifacts http://3dflipbook.net/.

Have you tried this on the latest 10.13.2 beta or STP 43? I am unable to reproduce.
Comment 2 adrian 2017-11-08 02:10:13 PST
It only happens in High Sierra with Safari Version 11.0.1 (13604.3.5).  STP Release 43 (Safari 11.1, WebKit 13605.1.12) works fine but I can't tell my customers to use a technical preview.
Comment 3 Alexey Proskuryakov 2017-11-08 19:16:51 PST
Marking as fixed, as this must be fixe in WebKit trunk based on your STP testing. We can't track integration of fixes into shipping Apple products here in Bugzilla.
Comment 4 Kirill S. Dmitrenko 2017-12-18 10:11:58 PST
The issue is still present on MacBook Pro (15-inch, 2017) with macOS 10.12.6 running Safari 11.0.2 and 11.0.3. Here's a test page: https://codepen.io/dmikis/full/BJjqxY/. Canvas expected to be black, but it's white (or transparent).
Comment 5 Jon Lee 2017-12-18 11:32:48 PST
(In reply to Kirill S. Dmitrenko from comment #4)
> The issue is still present on MacBook Pro (15-inch, 2017) with macOS 10.12.6
> running Safari 11.0.2 and 11.0.3. Here's a test page:
> https://codepen.io/dmikis/full/BJjqxY/. Canvas expected to be black, but
> it's white (or transparent).

I can reproduce this on a recent build. Reopening.
Comment 6 Radar WebKit Bug Importer 2017-12-18 11:33:01 PST
<rdar://problem/36111549>
Comment 7 Jon Lee 2018-01-02 17:15:27 PST
*** Bug 181208 has been marked as a duplicate of this bug. ***
Comment 8 Jon Lee 2018-01-02 17:15:45 PST
Another test page: https://codepen.io/PavelDoGreat/pen/zdWzEL
Comment 9 Kirill S. Dmitrenko 2018-01-25 10:56:31 PST
(In reply to Kirill S. Dmitrenko from comment #4)
> https://codepen.io/dmikis/full/BJjqxY/

I've accidentally removed the page, here's another one: https://codepen.io/dmikis/full/PErxRr/
Comment 10 Dean Jackson 2018-01-25 14:27:46 PST
Things are quite crazy.

We actually have a test for this: LayoutTests/fast/canvas/webgl/context-attributes-alpha.html
(although that doesn't actually cover everything that is wrong here - it doesn't clear after drawing or toggle antialiasing)

It works ok on some hardware with alpha: false, but then fails when antialias: false.

On other hardware it fails with alpha: false.
Comment 11 Dean Jackson 2018-01-26 16:39:55 PST
Created attachment 332428 [details]
Patch
Comment 12 Dean Jackson 2018-01-26 16:46:27 PST
Committed r227702: <https://trac.webkit.org/changeset/227702>