<?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>239518</bug_id>
          
          <creation_ts>2022-04-19 14:20:53 -0700</creation_ts>
          <short_desc>ANGLE_instanced_arrays has poor performance, Intel</short_desc>
          <delta_ts>2022-04-26 14:21:13 -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>Mac (Intel)</rep_platform>
          <op_sys>macOS 12</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=239015</see_also>
          <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>
          
          <blocked>231180</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="MrMartian">oconnorct1</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dino</cc>
    
    <cc>kbr</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1862723</commentid>
    <comment_count>0</comment_count>
    <who name="MrMartian">oconnorct1</who>
    <bug_when>2022-04-19 14:20:53 -0700</bug_when>
    <thetext>I&apos;m on MacOS Monterey 12.3 (21E230)
MacBook Pro (15-inch, 2017)
Radeon Pro 560 4 GB
Intel HD Graphics 630 1536 MB

After getting feedback from Kenneth Russel I was going to try and find time to build a demo of why instanced arrays perform poorly in both WebGL and WebGL2 but I found an example online that drops frame rates with a very basic low CPU/GPU effort example.

Initial discussion
https://bugs.webkit.org/show_bug.cgi?id=205663

A blog discussing the use of instanced arrays:
https://blog.tojicode.com/2013/07/webgl-instancing-with.html

The example:
http://media.tojicode.com/webgl-samples/instancing.html

If you full screen in safari and move around (click down and drag), you will see Safari performs poorly with instanced arrays.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1863553</commentid>
    <comment_count>1</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2022-04-21 22:59:12 -0700</bug_when>
    <thetext>I can repro on same hardware.
Slow on integrated Intel, fast on dgpu AMD.
Fast on OpenGL, slow on Metal.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1863554</commentid>
    <comment_count>2</comment_count>
    <who name="Kimmo Kinnunen">kkinnunen</who>
    <bug_when>2022-04-21 23:06:27 -0700</bug_when>
    <thetext>Note, though: At least initially I could not see a difference with &quot;use instancing&quot; on, off. both were slow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1863794</commentid>
    <comment_count>3</comment_count>
    <who name="Kenneth Russell">kbr</who>
    <bug_when>2022-04-22 15:35:39 -0700</bug_when>
    <thetext>Could this have the same root cause as performance Bug 239015?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1864383</commentid>
    <comment_count>4</comment_count>
    <who name="MrMartian">oconnorct1</who>
    <bug_when>2022-04-26 01:31:58 -0700</bug_when>
    <thetext>(In reply to Kenneth Russell from comment #3)
&gt; Could this have the same root cause as performance Bug 239015?

WOW! I tested it and got perfect frames in WebGL 1 !!!
In WebGL2 I still get frame drops but not as bad.. sitting around 20fps rather than 1-5. So there is still some kind of problem with Angle. My own project is not open source, but if I put an example online (both Webgl1 and webgl2 versions) is it possible to gather anything meaningful?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1864388</commentid>
    <comment_count>5</comment_count>
    <who name="MrMartian">oconnorct1</who>
    <bug_when>2022-04-26 01:44:55 -0700</bug_when>
    <thetext>Whoops. Seems I jumped the gun.

Many calls to drawArraysInstanced causes the whole thing to crash and burn again.

Meanwhile, if there is only one drawArraysInstanced call, the performance is outstanding.

I *think* the problem is primarily if I call &quot;drawArraysInstanced&quot;, switch to calling something else like &quot;drawArrays&quot;, then go back to &quot;drawArraysInstanced&quot; in the same frame/batch of calls, it seizes up.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1864390</commentid>
    <comment_count>6</comment_count>
    <who name="MrMartian">oconnorct1</who>
    <bug_when>2022-04-26 01:54:32 -0700</bug_when>
    <thetext>Scratch my last comment -_- I was accidentally on WebGL2 again.

100% getting 60FPS consistently with WebGL1 and it&apos;s an awesome feeling.

Terrible performance on WebGL2, but I can avoid it with Safari for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1864625</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-04-26 14:21:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/92357654&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>