Bug 239518 - ANGLE_instanced_arrays has poor performance, Intel
Summary: ANGLE_instanced_arrays has poor performance, Intel
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: Safari 15
Hardware: Mac (Intel) macOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: anglemetalregr
  Show dependency treegraph
 
Reported: 2022-04-19 14:20 PDT by MrMartian
Modified: 2022-04-26 14:21 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description MrMartian 2022-04-19 14:20:53 PDT
I'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.
Comment 1 Kimmo Kinnunen 2022-04-21 22:59:12 PDT
I can repro on same hardware.
Slow on integrated Intel, fast on dgpu AMD.
Fast on OpenGL, slow on Metal.
Comment 2 Kimmo Kinnunen 2022-04-21 23:06:27 PDT
Note, though: At least initially I could not see a difference with "use instancing" on, off. both were slow.
Comment 3 Kenneth Russell 2022-04-22 15:35:39 PDT
Could this have the same root cause as performance Bug 239015?
Comment 4 MrMartian 2022-04-26 01:31:58 PDT
(In reply to Kenneth Russell from comment #3)
> 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?
Comment 5 MrMartian 2022-04-26 01:44:55 PDT
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 "drawArraysInstanced", switch to calling something else like "drawArrays", then go back to "drawArraysInstanced" in the same frame/batch of calls, it seizes up.
Comment 6 MrMartian 2022-04-26 01:54:32 PDT
Scratch my last comment -_- I was accidentally on WebGL2 again.

100% getting 60FPS consistently with WebGL1 and it's an awesome feeling.

Terrible performance on WebGL2, but I can avoid it with Safari for now.
Comment 7 Radar WebKit Bug Importer 2022-04-26 14:21:13 PDT
<rdar://problem/92357654>