Improve PBR viewer performance on Apple Silicon
complete
Lou Netizen
PBR viewer performance on Apple Silicon—even on high-end Macs—is objectively abysmal. Viewer often drops below 1fps—making it impossible to type, move, edit or select objects, adjust camera, etc.—even with low or absolutely lowest graphics settings. Scenes need not be very complicated for this to happen, but the more complex a scene is, the more likely users will encounter an unusable scenario.
• Run a PBR-enabled LL viewer on Apple Silicon
• Set graphics to LOW
• For giggles, go to a Yavascript pod station and see the results of trying to ride a Pod on mainland roads. Here's one: https://maps.secondlife.com/secondlife/Monowai/8/146/71. Sit on an available pod, then click it. It will depart in one minute.
• Observe the world on LOW
RESULT: On LOW, on an M2 Max with 12-core CPU, 38-core GPU (hardly a "potato"):
• FPS in World > Improve Graphics Speed peaks at 12 fps
• Entire viewer visibly freezes once a second, every second
• Any text input (chat, inventory filter, etc.) is significantly delayed such that characters only appear many seconds after they have been typed.
• Opening windows (map, inventory, World > Improve Graphics Speed, anything) takes several seconds
* At no point are any of the Mac's efficiency or performance CPU cores straining. At all. The GPU, however, is pegged.
I can easily direct folks to places where FPS will drop below 1, even if the viewer is somehow reporting 50+ fps. Here, try one: http://maps.secondlife.com/secondlife/Green/37/184/23. For extra fun, set your graphics to, say, one notch above LOW and try to, I dunno. Walk. Type. Move your camera.
I've tried these experiments on several machines, including stock configurations. Results are consistent.
LL seems to have stopped permitting logins from its pre-PBR viewers. At this point it is effectively impossible for me to do my work or attend meetings/events in SL on an LL viewer. I doubt I am alone.
Log In
This post was marked as
complete
observeur Resident
Hello Lou. There are indeed performance issues on Apple Silicon Macs in cluttered scenes, or in proximity of poorly optimized meshes (causing high stutter when looking around, or walking).
EDIT ABOUT IMMEDIATE RENDERING :
_________________________________________
One thing to mention is the 2D ui elements slowing down the viewer abnormally. After studying this behavior, i now understand the main reason for this: the Apple gpu was originally designed as a mobile gpu. for that reason it was designed to take benefit of so called "modern" opengl, based on vertex buffers and shaders, and it highly suffers from the usage of "immediate" draw calls or poorly optimized data exchange (cpu->gpu) and context switches.
In SL, 2D UI, and also several 3D UI parts (like the tracker beacons) are based on an old fashion rendering method, that got redirected to a more modern method (immediate draw calls are being redirected to buffers). This helps, and avoided to rewrite completely some parts of the code, but it's not optimal. The Apple gpu suffers more from this than more common desktop gpus.
SL carries on a long history, and while some parts of the code have been modernized (such as the world rendering, object and avatars..), some other parts would still need a big refresh. Once this work will be done, SL will run like a charm on Apple Silicon machines. It already shows when those older parts aren't inteferring, performance is pretty good then.
Your examples however aren't the most representative, as it's running fine on my own macbook M2 Pro. The Pod place is interesting stress test as it keeps loading new items all over. so it will show some frame drops here and there making the viewer freeze for short moments, but is kinda common.
The ruin door scene is quite light and doesn't show heavy stutter on my end.
However, there are things to take into account, because if you have some 1fps drops .. it could be for one of those reasons:
+ There is a bug with "beacons" that will make the viewer unusable until you disable the beacon (i reported this, also see my comment about immediate rendering on Apple GPUs).
+ There is a bug with autocorrect spelling in the mac version that makes all text input windows extremely sluggish (personally i disabled the spell checker to prevent this) (note: certainly also related to immediate rendering).
+ The pod sim is loading assets all over and this can be slowed down by a poor quality internet.
+ your own avatar might have some bad quality attachment, and avatars at proximity can also cause heavy frame drops. (this is specially noticeable on Mac M1,2 ..
note: Using the fps display from the "improve speed" window is a good idea because if you were using the statistics window, that shows a realtime graph, it also causes the viewer to sometimes lose 80% of it's performance (on mac with Apple GPUs => again, due to immediate rendering).
Anyway, this doesn't invalidate what you say, on the contrary, as i've been doing numerous benchmarks in many places (also comparing with windows and linux). And what appears is the Apple Silicon chips are capable of extraordinary good performance in some light places while it suffers quite abnormally in some other places, or in proximity of some avatars using really bad mesh.
here is an overall challenging sim that gives the mac some touble :
moving and looking around feels very stuttery, while on windows, amd iGpu or Nvidia dGpu, it's quite smooth. The mac just doesn't feel comfy with those cluttered sims.
As a comparison, this next sim gives wings to the Mac:
(the macbook Pro M2 actually outperforms an amd Ryzen + nvidia 3080m laptop, when using an arm native build fork of SLv, and still runs perfectly smoothly and fast on the official SL viewer).
Problem is those well optimized sims aren't the most common sims in SL.
Also, LL team is aware of all this, and i think they (might) just lack of a dedicated Mac specialist to sort those issues out as fast as they wish. But i'm confident those issues will be fixed and truth is, beside that, the experience on Mac can really be a good experience.
As a side not, native arm build exists as the form of a 3rd party viewer and already improves this by a lot, yet there are still some performance issues that aren't directly related to this but most likely rendering methods that became obsolete with apple silicon chips, and overall the lack of actual optimization dedicated to the apple chips, considering those are quite different than the popular desktop gpus brands such as AMD or NVidia.
Personal thought :
One thing to mention is that Apple designed their own API, Metal, that is highly optimized for their own gpu architecture design, and would allow much finer optimization. As LL will likely adopt Vulkan eventually, they will have to reorganize SL code to help with the transition, also, they will have to get rid of the older rendering methods used for UI elements (mostly), or , most probably rewrite the UI code as an independant layer, maybe even by using some third part UI library. This would solve some of the slow down issues, but also, as the code will be reorganized, this will certainly make it easier for themselves .. or .. third party viewers developers, to actually offer a native Metal rendering. This won't be today or tomorrow, as it's some big task, but after the rendering code will be reorganized, this won't be such an impossible task. The reorganizing part will actually be the biggest task.
Lou Netizen
observeur Resident
Thank your for your thoughtful (and extensive) reply. Apparently Canny doesn't inform users of replies, so I only noticed because I swung back through.
Thank you for the information about 2D UI and things like tracker beacons: I never looked into the implementation behind that, but your description matches my impressions.
On lowest possible graphics settings on an M2 Max, I can barely walk in the "Mysterious Isle" region; I continue to see the viewer freeze once a second, every second (I know because there's a ticking clock in the room), although the viewer claims to be achieving more than 60fps. I can't claim my examples are representative of SL as a whole, merely of my own experience since using my parcel, attempting to travel mainland routes is quite a lot of my SL, and go anywhere that isn't a bare prim in the sky is quite a lot of my SL. The "quite light" parcel on Green continues to drag the viewer to 1fps and less for me, effectively locking me out of my own land.
I'm happy your experience is better than mine, but I can reproduce my results on stock Macs with no other non-standard software installed. From your comments and Dan Linden's note, I'm guessing I'm SOL for years, not months. At some point sooner than later, I will have to evaluate my participation in SL based upon that.
observeur Resident
Lou Netizen hey Lou. normally you should see a notification on the top of the site, when something happens in a post you created or voted for. What you describe seems very like the beacon issue. when you open the map and click on it to go a a certain destination, it creates a beacon, visible inworld, and this is causing an extreme lag on apple gpus. I commited a fix to LL, and it's being under review. In the meantime i would recommend you open the debug settings in the advanced menu, look for renderTrackerBeacon and set it to false.
The Mysterious Isle region is currently designed by Cica and this is a very well optimized sim, one of those that runs the best on my M2 Pro. So i really think this is the tracker "beacon" that is causing it. if you see it appearing you can click on the lil red arrow to make it disappear (or the hide beacon button near the toolbar, in SLv), it will go back to normal.
Also, do NOT use the lowest preset, as it's also buggy, and slower than any other presets. (i also made a comment about it as i found out why it was doing so). You prefer using the low-mid or mid setting.
Lou Netizen
observeur Resident
I don't normally stay logged in to Canny, so I hadn't been seeing any indicator. I log in only if I have a specific task. I guess I was expecting email notifications, since Canny seems to liberally send me other things via email.
I do have to use beacons for some of the work I do, but I have not had any beacons showing for these tests. Reading your comments, another thought I had was property lines (which I also often have to use). I don't recall if I had them enabled in earlier tests, but I didn't have them on for these most-recent attempts and it doesn't seem to have made a difference.
observeur Resident
Lou Netizen Yes, as we discussed yesterday, there is something going on on your side that i can't spot, since i couldn't reproduce the same issue with you.
Lou Netizen
observeur Resident
I'm not sure what it could be on my end—I've tried this on my own Macs (three of them), stock Macs at retailers (I think I'm up to five now), and on my main account and testing account. I think those eliminate thesethe variables:
a) my hardware setup
b) my Internet connections
c) something amiss with my account (e.g., inventory corruption or similar).
Results are basically indistinguishable across the board (although, as we found, if I remove all attachments my 1fps situations can become 2fps situations, which…isn't much, but is arguably a 100% improvement). I don't doubt you aren't able to replicate the problem—you've certainly put the effort into it!—but I'm at a loss for what I might be doing that you're not, or vice versa.
observeur Resident
Lou Netizen when i met you, it was on a platform with pretty much nothing that could explain the low fps, your avatar didn't cause any issue, and i had 220fps smooth with the SL viewer, with a macbook Pro M2 Pro (a gpu that is morethan twice slower than yours). Certainly in a lower resolution but still.. I recommend you test on a third party viewer first. That could teach us something. Because as much as the mac viewer has some issues, it doesn't go as bad as 1fps. In all your tests, there must be something in common that causes the issue. I thought of the connected screen. Anyway, i'm sure we will figure out, if an idea comes to my mind i will let you know inworld. but i guess this is not the place here to discuss this :)
Beq Janus
Lou, just out of interest, have you tried this on the latest OSX where (so long as you are running fullscreen) the Mac will select "game mode" and prioritise resources. This works on the LL viewer and also on the latest FS PBR Beta (and thus in the next formal release), I would expect it to be available in other viewers too, but don't have any specific knowledge.
Lou Netizen
Beq Janus
Running SL full screen on M2 Max under Sonoma 14.5 (23F79) makes no perceivable difference, even on the absolute lowest graphics settings. Cannot move, type, etc.
However, I would never run SL (or anything else) full screen.
Beq Janus
Lou Netizen that's a shame, was worth a go. Others have reported some benefits. Just to clarify, as much for other readers of this than anything else, The Full screen requirement is not something FS and LL have conjured up, it is part of how the game mode is triggered, a feature of MacOS Sonoma
Lou Netizen
Beq Janus
Understood. I'm aware of the fullscreen/Game Mode thing from my RL macOS development work. I agree it was worth a shot.
If I wasn't able to reproduce these issues on stock Macs (literally: just install the viewer, log in, and…ding, can't move or type) I might suspect it had something to do with my monitor setups, which typically feature two or three displays.
Dan Linden
tracked
Dan Linden
Thank you for the report, Lou!
Issue tracked. We have no estimate when it may be implemented. Please see future updates here.
observeur Resident
Dan Linden I have an important update about this. I've been working on the issue for some time, and i now managed to get a general fix for most .. if not ALL Mac with apple gpu performance issues. This includes world rendering stuttering, and 2D and 3D UI slugishness. I'm working with a third party viewer dedicated to Mac with Apple SIlicon and Linux and Unix. We are about to deploy this fix soon, and have it tested on different platforms so see if and how it affects amd, intel and nvidia cards. (This might actually also improve performance on other paltforms) As soon as we will have tested this enough, we will commit to Second Life viewer.
observeur Resident
As i was going to share the optimised code today, i noticed the develop branch of the secondlife viewer already contains a similar yet not identical way to fix the different performance issues seen on Apple gpus. I noticed it's set as a conditional code for DARWIN, while i am not sure it will benefit to non Apple gpus hardware (macs wish AMD or NVidia gpus). I'll be doing more tests in the regard. LL modifications implies disabling the VBO pools, my own method didn't imply this. also it was based on an Apple gpu detection on runtime. As for the performance, LL fix seems to have a similar beneficial impact as my own modifications on an Apple gpu mac. So for now, i'm going to hold on and proceed with more tests and benchmarks.