We test a rendered scene without much computational logic. In iPhone13 (iOS 16.2) iPhoneX (16.3) safari, it can be seen that the frame rate is very low, only 12 fps. Demo: https://www.oooceanworld.com/testgame/rendercase1
After repeated attempts, the frame rate will be increased several times(fps12–>60!!) by disabling the WebGL on Metal option of safari.
Use safari to remote attach and look at the timeline, you can see that it takes 100ms+ from requestAnimationFrame request to actual execution (such as frame269)
Using the Instrument activity monitor, you can see that the usage of the GPU process is significantly higher, and it will be less than 5% when disabled WebGL via metal
Use the Instrument Metal System Trace tool to detect the GPU process, and you can see that the data between the two is very different. Enable WebGL on Metal
I know Apple is slowly picking away at some long standing WebGL Metal performance issues and errors. We got this one fixed after a year, https://bugs.chromium.org/p/angleproject/issues/detail?id=7189#c11.The results of that fix should have a big impact on performance as well. Fingers crossed it gets out to iOS asap and improves these issues.
That issue seems to be related to “too many uniforms”. How to confirm what is the cause of my case? Is there any more accurate means of webkit analysis or workaround solution from the game logic?
@brendanduncan_u3d , The safari rendering of Unity games on iOS/macOS still has serious performance problems. When WebGL Via Metal is turned on and off, there is a clear gap. I submitted an issue to webkit, can you help me find the reason?
@OceanX000 I know Apple has been slowly working on fixing a major issue with larger uniform buffers causing WebGL Metal to come to a crawl because of the way they translated WebGL buffers to the buffer packing needed for Metal. I believe they have it solved now, or mostly solved. But the other problem with Apple is that even when they have it solved in the Webkit source, it takes an undefined amount of time for those fixes to roll into the release builds that go out into iOS updates. So we are completely at their mercy, and it’s awful.
In our case the metal backend for webgl siltently crashes/restarts our application after a short time running. So I’m assuming the fixed bug mentioned above still didn’t hit latest safari? I’m on ios 16.5