<?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>218949</bug_id>
          
          <creation_ts>2020-11-14 18:44:02 -0800</creation_ts>
          <short_desc>WebGL instanced draw calls are very slow on iPhone 12 Pro</short_desc>
          <delta_ts>2021-09-20 22:05:20 -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 14</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>Other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>220896</dependson>
          <blocked>223434</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Akihiko Kusanagi">nagi</reporter>
          <assigned_to name="Kimmo Kinnunen">kkinnunen</assigned_to>
          <cc>dino</cc>
    
    <cc>frank</cc>
    
    <cc>gary</cc>
    
    <cc>geofflang</cc>
    
    <cc>jdarpinian</cc>
    
    <cc>jhurliman</cc>
    
    <cc>jonahr</cc>
    
    <cc>kbr</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>kpiddington</cc>
    
    <cc>lasse</cc>
    
    <cc>msokalski</cc>
    
    <cc>ppicachu</cc>
    
    <cc>stevebriscoe123</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wg-3d-iphone-12-pefor-aaaaddel322apcnrrpy4bofp3i</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1707557</commentid>
    <comment_count>0</comment_count>
    <who name="Akihiko Kusanagi">nagi</who>
    <bug_when>2020-11-14 18:44:02 -0800</bug_when>
    <thetext>WebGL instanced draw calls are very slow in any browser on iPhone 12 Pro. There is no performance issue in the same browser/OS versions on my old iPhone 8 Plus. Initially I noticed this in deck.gl code, but later realized that this issue is not deck.gl specific as a simple three.js program that uses instanced draw calls has the same issue.

How to reproduce:
- Instancing example (https://cdn.rawgit.com/pailhead/three.js/instancing-part2/examples/webgl_interactive_cubes.html) in this article: https://medium.com/@pailhead011/instancing-with-three-js-part-2-3be34ae83c57
- Deck.gl examples (GeoJsonLayer(Polygons), GeoJsonLayer(Paths), ...) in this page: https://deck.gl/examples

Environment:
- Browser: Safari 14, Chrome (for iOS) 86.0.4240.93 and FireFox (for iOS) 29.1
- OS: iOS 14.1 and 14.2
- Device: iPhone 12 Pro</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1707569</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-11-14 21:25:20 -0800</bug_when>
    <thetext>&lt;rdar://problem/71408222&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1707993</commentid>
    <comment_count>2</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2020-11-16 14:20:43 -0800</bug_when>
    <thetext>Hmm, that&apos;s interesting. Certainly unrelated, but coincidentally, there was an instancing performance regression in Qualcomm&apos;s Adreno driver in Android R: http://crbug.com/1123700 . It was fixed in a subsequent driver release.

Kimmo or Dean, can either of you confirm whether this is a regression from the switch to ANGLE? Or is it hardware-specific and unrelated to ANGLE?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1708140</commentid>
    <comment_count>3</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2020-11-16 23:52:16 -0800</bug_when>
    <thetext>Thanks for the report!

https://threejs.org/examples/webgl_interactive_cubes.html
iPhone Xr iOS 14.2 60fps
iPhone 12 iOS 14.2 18fps

It appears to be HW-specific regression.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1708292</commentid>
    <comment_count>4</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2020-11-17 10:53:37 -0800</bug_when>
    <thetext>Thanks for confirming Kimmo. Can this performance regression be reported to Apple&apos;s OpenGL ES driver team?

Raising to Major severity - in recent years most WebGL applications have transitioned to using instanced draw calls to achieve better scaling, and this regression will adversely affect the entire ecosystem.

Kimmo, could you perhaps track progress of this report through Apple&apos;s internal bug tracker?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1713172</commentid>
    <comment_count>5</comment_count>
    <who name="Akihiko Kusanagi">nagi</who>
    <bug_when>2020-12-09 08:46:04 -0800</bug_when>
    <thetext>Is there any update on this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1724616</commentid>
    <comment_count>6</comment_count>
    <who name="Toni Martí">ppicachu</who>
    <bug_when>2021-02-02 04:28:44 -0800</bug_when>
    <thetext>Ping! How it&apos;s going with this issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1728496</commentid>
    <comment_count>7</comment_count>
    <who name="Akihiko Kusanagi">nagi</who>
    <bug_when>2021-02-12 01:42:36 -0800</bug_when>
    <thetext>I still see this regression on iOS 14.4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1734250</commentid>
    <comment_count>8</comment_count>
    <who name="Akihiko Kusanagi">nagi</who>
    <bug_when>2021-02-27 19:46:36 -0800</bug_when>
    <thetext>This performance regression is seen on all A14 Bionic devices.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1740751</commentid>
    <comment_count>9</comment_count>
    <who name="Marcin">msokalski</who>
    <bug_when>2021-03-17 09:57:13 -0700</bug_when>
    <thetext>I can&apos;t reproduce it on iPad Air 2020 (A14 Bionic) with iPadOS 14.4.1

Repro case https://threejs.org/examples/webgl_interactive_cubes.html runs easily at 60fps</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1741064</commentid>
    <comment_count>10</comment_count>
    <who name="Akihiko Kusanagi">nagi</who>
    <bug_when>2021-03-18 00:50:10 -0700</bug_when>
    <thetext>&gt; I can&apos;t reproduce it on iPad Air 2020 (A14 Bionic) with iPadOS 14.4.1
&gt;
&gt; Repro case https://threejs.org/examples/webgl_interactive_cubes.html runs easily at 60fps

It&apos;s the original three.js example which runs with no problem. I see a performance regression in https://cdn.rawgit.com/pailhead/three.js/instancing-part2/examples/webgl_interactive_cubes.html, the instancing version of it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1741099</commentid>
    <comment_count>11</comment_count>
    <who name="Marcin">msokalski</who>
    <bug_when>2021-03-18 02:05:37 -0700</bug_when>
    <thetext>Confirmed, https://cdn.rawgit.com/pailhead/three.js/instancing-part2/examples/webgl_interactive_cubes.html
runs 18fps on iPad Air 2020, iPadOS 14.4.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1746006</commentid>
    <comment_count>12</comment_count>
    <who name="Gary Herman">gary</who>
    <bug_when>2021-04-01 06:42:29 -0700</bug_when>
    <thetext>We are also seeing significant performance issues in our WebGL application at https://human.biodigital.com on these devices.  Has Apple acknowledged this issue? As more people get iPhone 12 we are seeing an increase in the number of complaints from our users.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1749323</commentid>
    <comment_count>13</comment_count>
    <who name="Frank Sculli">frank</who>
    <bug_when>2021-04-12 12:29:37 -0700</bug_when>
    <thetext>Here are two videos clearly showing the regression in FPS going from the iPhone 11 to the same 3D graphics running on the iPhone 12. 

iPhone 11
https://human.biodigital.com/tmp/rpreplay_final1617998863.mp4

iPhone 12
https://human.biodigital.com/tmp/rpreplay_final1617998786.mp4

And a link to the same model if you would like to try it:

https://human.biodigital.com/viewer/?be=4Ima&amp;ui-info=true&amp;ui-search=true&amp;ui-undo=true&amp;ui-fullscreen=true&amp;ui-nav=true&amp;ui-tools=true&amp;ui-help=true&amp;ui-chapter-list=false&amp;ui-label-list=true&amp;ui-anatomy-descriptions=false&amp;ui-tutorial=false&amp;ui-loader=circle&amp;ui-whiteboard=true&amp;ui-layers=true&amp;ui-anatomy-labels=true&amp;disable-scroll=false&amp;dk=4b331fad5eef5d6a1677a2d5fa1f7c373cbba0be&amp;load-rotate=6

@Kimmo do you know if Apple is looking into this?

thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1749633</commentid>
    <comment_count>14</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2021-04-13 03:27:39 -0700</bug_when>
    <thetext>The enablement of ANGLE Metal backend on iPhone seems to fix the immediate performance issue here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1749782</commentid>
    <comment_count>15</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2021-04-13 12:12:13 -0700</bug_when>
    <thetext>To the reporters: we&apos;re collaborating as quickly as possible to shake out the bugs from ANGLE&apos;s Metal backend that Apple&apos;s made tremendous improvements to. That sounds like it will be the fastest resolution to this device-specific performance issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750571</commentid>
    <comment_count>16</comment_count>
    <who name="Lasse Laakkonen">lasse</who>
    <bug_when>2021-04-15 04:22:26 -0700</bug_when>
    <thetext>This https://cdn.rawgit.com/pailhead/three.js/instancing-part2/examples/webgl_interactive_cubes.html should probably not be used for any testing, it seems to be running ThreeJS revision &quot;97dev&quot; from 2018: https://github.com/mrdoob/three.js/releases?after=r98

Also:

Assuming that the issue is on all devices with A14 Bionic chips.

1. Since Kimmo was able to reproduce the issue on 2020-11-16 in https://threejs.org/examples/webgl_interactive_cubes.html using an iPhone 12 and now the issue can not be reproduced on that page with a iPad Air 4th gen 2020, it would mean that issue would have been fixed in Three.js?

2. Since for example all of these work at FPS 60 on an iPad Air 4th gen 2020, Three.js has fixed / worked around the issue somehow?

  - https://threejs.org/examples/webgl_interactive_cubes.html
  - https://threejs.org/examples/#webgl_instancing_dynamic
  - https://threejs.org/examples/#webgl_instancing_performance
  - https://threejs.org/examples/#webgl_instancing_raycast
  - https://threejs.org/examples/#webgl_instancing_scatter</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1750596</commentid>
    <comment_count>17</comment_count>
    <who name="Akihiko Kusanagi">nagi</who>
    <bug_when>2021-04-15 06:35:41 -0700</bug_when>
    <thetext>I replaced three.js in https://cdn.rawgit.com/pailhead/three.js/instancing-part2/examples/webgl_interactive_cubes.html with the latest version (r127), but FPS is still around 18. See the codepen:
https://codepen.io/nagixx/full/RwKJRQy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1761896</commentid>
    <comment_count>18</comment_count>
    <who name="Steven Briscoe">stevebriscoe123</who>
    <bug_when>2021-05-20 04:15:32 -0700</bug_when>
    <thetext>Is there any movement on this issue? I&apos;m facing this same issue and we have customers complaining due to the performance being really bad. All other iOS devices seem unaffected but the iPhone 12 seems particularly bad.

This seems to be the same issue here: https://github.com/visgl/deck.gl/issues/5101

Appreciate the help!
Steve</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1761898</commentid>
    <comment_count>19</comment_count>
    <who name="Steven Briscoe">stevebriscoe123</who>
    <bug_when>2021-05-20 04:21:31 -0700</bug_when>
    <thetext>(In reply to Steven Briscoe from comment #18)
&gt; Is there any movement on this issue? I&apos;m facing this same issue and we have
&gt; customers complaining due to the performance being really bad. All other iOS
&gt; devices seem unaffected but the iPhone 12 seems particularly bad.
&gt; 
&gt; This seems to be the same issue here:
&gt; https://github.com/visgl/deck.gl/issues/5101
&gt; 
&gt; Appreciate the help!
&gt; Steve

Quick edit: I&apos;ve also been told that iOS 14.6 does not address this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1768750</commentid>
    <comment_count>20</comment_count>
    <who name="Frank Sculli">frank</who>
    <bug_when>2021-06-10 14:53:18 -0700</bug_when>
    <thetext>Following up on Steve&apos;s comment above, as more people have the iPhone 12 we are now receiving a ton of complaints.

Is it possible to provide some insight into the status of this fix? Much appreciated!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1795408</commentid>
    <comment_count>21</comment_count>
    <who name="Akihiko Kusanagi">nagi</who>
    <bug_when>2021-09-20 22:05:20 -0700</bug_when>
    <thetext>Today I updated my iPhone 12 Pro to iOS 15, and I confirmed that this instancing performance issue was fixed! At least, my application and deck.gl examples all work smoothly, so I set this bug to RESOLVED.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>