<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>237230</bug_id>
          
          <creation_ts>2022-02-25 15:54:16 -0800</creation_ts>
          <short_desc>REGRESSION (iOS 15.4 beta) - WebGL race condition between clearing depth buffer and switching framebuffers</short_desc>
          <delta_ts>2022-06-23 15:44:17 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebGL</component>
          <version>Safari 15</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>237113</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>237113</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Christoph Bartschat">christoph</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>dino</cc>
    
    <cc>johncunningham</cc>
    
    <cc>kbr</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>kpiddington</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1846224</commentid>
    <comment_count>0</comment_count>
    <who name="Christoph Bartschat">christoph</who>
    <bug_when>2022-02-25 15:54:16 -0800</bug_when>
    <thetext>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 &quot;WebGL via Metal&quot; in &quot;Experimental WebKit Features&quot; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1846226</commentid>
    <comment_count>1</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2022-02-25 15:56:10 -0800</bug_when>
    <thetext>+Kyle and John in case they can help triage this. Wonder whether it was fixed in the most recent ANGLE roll.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1846931</commentid>
    <comment_count>2</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2022-02-28 23:42:37 -0800</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1848438</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-03-04 15:55:17 -0800</bug_when>
    <thetext>&lt;rdar://problem/89839163&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1856446</commentid>
    <comment_count>4</comment_count>
    <who name="Christoph Bartschat">christoph</who>
    <bug_when>2022-03-30 10:29:06 -0700</bug_when>
    <thetext>Now that bug 237113 has been closed, do we have confirmation that the problem described here has also been fixed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1877946</commentid>
    <comment_count>5</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-06-23 15:44:17 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 237113 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>