Chrome Mac extremely slow

I don’t think this is a Babylon bug

My game https://tuggowar.io is extremely slow on MacOS Chrome (5 fps) and Safari (3 fps), but not on Brave! (60+ fps)
on Windows Chrome I’m having no issues either (144+ fps).

The second listed fps (top left corner) is the uncapped babylon fps, which is still fast as normal.

I’ve narrowed it down to:

  • it works on Mac Chromium v116
  • it breaks on Mac Chromium v117
  • I’m using the latest Babylon v6.45.1
  • it also breaks on way older Babylon versions (v5)

I am absolutely clueless how to proceed, any ideas?
What is a good standard playground to test fps with?

Have you ever seen something like this @sebavan ?

if anyone has a Mac, please report your browser and fps (see top left of screen after loading the game)

image

some more info (and confirmation that at least both Chrome and Brave are using the good GPU)

Brave (good fps):
renderer: Google Inc. (ATI Technologies Inc.) ANGLE (ATI Technologies Inc., AMD Radeon Pro 555X OpenGL Engine, OpenGL 4.1) WebGL 2.0 (OpenGL ES 3.0 Chromium)
userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Chrome (bad fps):
renderer: Google Inc. (AMD) ANGLE (AMD, ANGLE Metal Renderer: AMD Radeon Pro 555X, Unspecified Version) WebGL 2.0 (OpenGL ES 3.0 Chromium)
userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Safari (bad fps):
renderer: Apple Inc. Apple GPU WebGL 2.0
userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15

image

thats my 2018 mac mini , chrome version 116.0.5845.179

1 Like

Screenshot 2024-03-04 at 18.59.41

chrome version 122.0.6261.94

ok, so I noticed there is actually a difference in “renderer”, and it coincides completely with the fps results:

Brave 122 | good fps: Google Inc. (ATI Technologies Inc.) ANGLE (ATI Technologies Inc., AMD Radeon Pro 555X OpenGL Engine, OpenGL 4.1) WebGL 2.0 (OpenGL ES 3.0 Chromium)

Chromium 115- | good fps: Google Inc. (ATI Technologies Inc.) ANGLE (ATI Technologies Inc., AMD Radeon Pro 555X OpenGL Engine, OpenGL 4.1) WebGL 2.0 (OpenGL ES 3.0 Chromium)

Chromium 117+ | bad fps: Google Inc. (AMD) ANGLE (AMD, ANGLE Metal Renderer: AMD Radeon Pro 555X, Unspecified Version) WebGL 2.0 (OpenGL ES 3.0 Chromium)

Does this ring any bells? :grimacing:
Why is there a change from OpenGL 4.1 to Metal, and why is Metal so bad?

edit:
This Chromium issue may be related: Chromium
That specific issue was fixed on Nov 20 but in Chrome Canary v124 the fps is still bad.

Since it’s also bad in Safari, it seems more like an Apple/Metal/WebGL problem doesn’t it?

but my v116 was using metal according to what you posted now ? anyway i dont know enough about all that to actually give any insight into it. I will say the base fps was the same for both my versions , only the uncapped was lower on v122. getting ~47-54 fps on this machine is expected as it is very weak.

yeah, I put then down in the wrong order, fixed now

ok cool , still its not 3-5 fps as you mention in your first post , so that is good news , because its not completely broken everywhere but that is also bad news … because its not completely broken everywhere… harder to debug and fix ( if fixable )

I recently had to discover SSAO2 just doesnt work properly on Safari on MacOS - and it cannot be fixed. ( precision issue in depth buffer ) I just have to wait until apple decides to put on their big boy pants and come play with the rest of the kids

( im not a mac dev at all … I only own mac devices for testing my applications as well )

So my conclusion is that Metal + WebGL on MacOS is severely less performant than OpenGL, at least on my Mac.
Currently Chrome and Safari use Metal, while Brave still uses OpenGL (Firefox and Edge untested).
A workaround is to force OpenGL on the client, but this not a useful workaround in production.

I still have a lot of questions. I’m trying to answer them myself, but help is appreciated:

  • is this a known issue? (The Babylon dev team uses Macs right?)
  • how widespread is it? (Macs are pretty standardized)
  • is forcing the integrated GPU a workaround?
  • is using WebGPU a workaround?
  • is Apple aware of this? if not: can someone help with this, because this seems serious and I don’t feel like they would take me all that seriously.

I did find similar bugreports, but most are pretty old or ignored, so that is not hopeful.

Yes! Although WebGPU has its own issues, it doesn’t suffer from the Metal issue.
So this is a workaround for Chrome, unfortunately not for Safari.

I haven’t checked WebGPU in a while because of issues + no gains, so now I will have to get into those issues (I will create new posts), but in short:

  • in compat mode there are dropped frames (eventhough it runs at 60fps, 200 uncapped)
  • in non-compat mode there are meshes appearing and dissapearing when they shouldn’t

Could you create an issue in the chromium bug tracker as it could be an angle issue with metal backend ?

Hi @sebavan :), why do you think it’s a Chromium issue? the issue presents itself in Safari as well, so isn’t it a MacOS issue?

Before we create any reports, can we get more data on how widespread this is? Can you ask some of the devs with Macs to compare the fps in my game (see link in OP) or their favorite webgl playgrounds in Metal vs OpenGL (Chrome vs Brave)?

  • my Mac is not special
  • my calls to WebGL are not special
  • I have a fresh install of Chromium / Safari

How could it be that this does not affect thousands of websites and millions of users?
It feels like I’m missing something here.

I have a MacBookPro 2019 with Intel UHD Graphics and the framerate seems okay with Safari or Chrome.

Thanks @bghgary. Maybe it’s because you’re not using the dedicated GPU? You have the same Macbook as me, I thought those always have the Radeon, are you not using it?

edit: Safari doesn’t say which renderer it’s using

Mine doesn’t have a dedicated GPU.

neither does mine :wink: i posted the specs , mac mini 2018 … has onboard graphics only and it was hitting ~54 fps. I did question that to you because I mentioned its not exactly the problem first mentioned , where you were talking about frame rates in the single digits.

infact my onboard gpu is identical to your macbookpro specs you posted. Intel UHD 630 , i just have half the ram and a weaker processor

I have an Apple MacBook Pro with an M3 chip, and I’ve been using the Brave browser. For the last couple of days, I started to get 60 fps on my external Dell 32-inch monitor, whereas it used to be 120 fps. There is something wrong for sure.

I periodically changed the gui properties(TextBlock.left ... TextBlock.top) in iOS using onAfterRenderObservable, but this became a problem so I removed it. If you have a similar case, check the speed after removing it.