Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question WebGL performance issue on MacOS on Chrome and Safari

Discussion in 'Web' started by rdev02, Oct 4, 2023.

  1. rdev02

    rdev02

    Joined:
    Oct 4, 2023
    Posts:
    3
    I'm having some considerable performance issues when running my WebGL game on MacOS on Chrome (v117.0.5938.132) and Safari (v15.6.1), it lags pretty badly on those two browsers and the game is unplayable. But on Firefox (v118.0.1) and Edge (v 117.0.2045.47) it runs smoothly without issues.

    I'm wondering if there are any specific browser settings I need to look at, something specific to Chrome/Safari, or anything else I might have missed. I'm pretty new at investigating WebGL performance so a bit of guidance on where and what to look at will be appreciated.

    Ideally we want to encourage our users to use Chrome as it provides the widest support for our functionalities. For my Windows work mates it runs smoothly on Chrome.

    Unity version: 2021.3.19f1
    MacBook specs: M1 MacBook Pro, retina display, 8‑core CPU, 8‑core GPU and 16‑core Neural Engine,16GB unified memory, Monterey v12.6

    Any advice appreciated!
     
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    Something you can try in Chrome is to go to page "about:flags", then find an advanced setting for ANGLE's default rendering backend, and then change it to Metal instead of OpenGL.

    If that improves rendering performance, it is a performance limitation with macOS OpenGL subsystem in Chrome. We have seen a few of those.

    In that case, you could try opening a performance bug report against Chrome about it, and see if they would be able to use a test case to improve the OpenGL rendering backend there. I hear that Chrome is looking to switch to Metal by default on macOS, but hasn't just yet been able to do so.
     
  3. rdev02

    rdev02

    Joined:
    Oct 4, 2023
    Posts:
    3
    That seemed to have improved the performance a little bit by a few frames, but still not to an acceptable level. Thanks for the suggestions anyway though
     
  4. brendanduncan_u3d

    brendanduncan_u3d

    Unity Technologies

    Joined:
    Jul 30, 2019
    Posts:
    407
    If both the GL and Metal WebGL back-ends have the performance problem, then it could possibly be a WASM issue rather than a graphics issue. What is curious is that you say Edge does not have the issue, because Edge is built on top of Chromium. All of those browsers except for Firefox use the same WebGL implementation library (ANGLE).

    Does Chrome Canary (https://www.google.com/chrome/canary/) or Chromium (https://www.chromium.org/getting-involved/download-chromium) have the same issue? Do you have access to an updated MacOS? It's likely either a WASM or an ANGLE performance bug, but it's hard to say without more investigation. Is it a project you would be able to share in a bug report?
     
  5. jerricko

    jerricko

    Joined:
    Oct 11, 2016
    Posts:
    1
    I am also having the same issue with the latest version of Chrome (117.0.5938.149) on MacOS. It used to run smooth, but since the latest update, our game runs very sluggish. I changed the ANGLE backend and found that OpenGL actually made it run smooth again while Metal made it sluggish, so I'm assuming that one of these Chrome updates must have changed the default to Metal since they are deprecating OpenGL.

    Edit: After more research, it seems to be only on URP. I switched my game to the built-in pipeline and it is running fine on both ANGLE modes. Safari also runs great on built-in, but poorly on URP. My scene was a high poly town that is 100% static with baked lighting and light probes with a simple character walking around.
     
    Last edited: Oct 7, 2023
  6. rdev02

    rdev02

    Joined:
    Oct 4, 2023
    Posts:
    3
    Sorry for the late response - I've tested it on Canary and the performance was similar to Microsoft Edge (acceptable).

    I've also updated Google Chrome to the newest MacOS version today (Version 118.0.5993.70 (Official Build) (arm64)), it was laggy on Metal ANGLE backend, but like @jerricko when I changed it back to OpenGL the performance improved drastically. Similar performance to Canary and Edge.

    Out of all browsers, Firefox still runs the smoothest.