Bug 239518

Summary: ANGLE_instanced_arrays has poor performance, Intel
Product: WebKit Reporter: MrMartian <oconnorct1>
Component: WebGLAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: dino, kbr, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Mac (Intel)   
OS: macOS 12   
See Also: https://bugs.webkit.org/show_bug.cgi?id=239015
Bug Depends on:    
Bug Blocks: 231180    

MrMartian
Reported 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.
Attachments
Kimmo Kinnunen
Comment 1 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.
Kimmo Kinnunen
Comment 2 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.
Kenneth Russell
Comment 3 2022-04-22 15:35:39 PDT
Could this have the same root cause as performance Bug 239015?
MrMartian
Comment 4 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?
MrMartian
Comment 5 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.
MrMartian
Comment 6 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.
Radar WebKit Bug Importer
Comment 7 2022-04-26 14:21:13 PDT
Note You need to log in before you can comment on or make changes to this bug.