Bug 237230

Summary: REGRESSION (iOS 15.4 beta) - WebGL race condition between clearing depth buffer and switching framebuffers
Product: WebKit Reporter: Christoph Bartschat <christoph>
Component: WebGLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: bfulgham, dino, johncunningham, kbr, kkinnunen, kpiddington, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: iPhone / iPad   
OS: iOS 15   
Bug Depends on: 237113    
Bug Blocks:    

Description Christoph Bartschat 2022-02-25 15:54:16 PST
This is a regression between iOS 15.3.1 and 15.4.

As can be see in this demo: https://codepen.io/cmb8/pen/GROXmKp

We should see two gears spinning normally, but instead we get visual artifacts that obscure the objects from getting properly rendered.

This behavior is caused by calling:
context.clear(context.DEPTH_BUFFER_BIT)

then immediately calling:
context.bindFramebuffer(...)   

If we add a finish() call between the two calls, the issue does not occur.

This problem affects many 8th Wall projects that use three.js, like

our sample project here: https://8thwall.8thwall.app/unitcube-threejs/
or more recently, this Super Bowl promotional tie-in from Kia: https://www.kiadogmentedreality.com

Disabling "WebGL via Metal" in "Experimental WebKit Features" and relaunching Safari fixes the behavior.

Video of expected behavior: https://www.youtube.com/watch?v=SAp_RXDD7_0

Video of unexpected behavior: https://www.youtube.com/watch?v=d8cr-LP40hs
Comment 1 Kenneth Russell 2022-02-25 15:56:10 PST
+Kyle and John in case they can help triage this. Wonder whether it was fixed in the most recent ANGLE roll.
Comment 2 Kimmo Kinnunen 2022-02-28 23:42:37 PST
Thanks for the report. 
I think this has the same root cause as bug  237113.
In order to workaround, you can try if you can rework the rendering so that it does not need the `autoClear = false`. I.e. use `autoClear = true`.

Leaving this in until fix for bug 237113 is testable.
Comment 3 Radar WebKit Bug Importer 2022-03-04 15:55:17 PST
<rdar://problem/89839163>
Comment 4 Christoph Bartschat 2022-03-30 10:29:06 PDT
Now that bug 237113 has been closed, do we have confirmation that the problem described here has also been fixed?
Comment 5 Brent Fulgham 2022-06-23 15:44:17 PDT

*** This bug has been marked as a duplicate of bug 237113 ***