secondlife / viewer

🖥️ Second Life's official client
GNU Lesser General Public License v2.1
198 stars 46 forks source link

Improve PBR viewer performance on Apple Silicon #1527

Open canny[bot] opened 1 month ago

canny[bot] commented 1 month ago

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

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. bf7ca1dd7e306f779727fea514d998a2

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.

Environment Second Life Release 7.1.7.8974243247 (64bit) You are at [REDACTED] Second Life Server 2024-04-13.8669470296 CPU: Apple M2 Max (2400 MHz) Memory: 32768 MB OS Version: Mac OS X 14.5.0 Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 x86_64 Graphics Card Vendor: Apple Graphics Card: Apple M2 Max OpenGL Version: 4.1 Metal - 88.1 Window size: 2294x1297 Font Size Adjustment: 96pt UI Scaling: 1.2 Draw distance: 64m Bandwidth: 4000kbit/s LOD factor: 1.125 Render quality: 0 Texture memory: 10922MB Disk cache: Max size 819.2 MB (99.9% used) HiDPI display mode: 0 J2C Decoder Version: KDU v7.10.4 Audio Driver Version: FMOD Studio 2.02.20 Dullahan: 1.14.0.202310131309 CEF: 118.4.1+g3dd6078+chromium-118.0.5993.54 Chromium: 118.0.5993.54 LibVLC Version: 3.0.16 Voice Server Version: Not Connected Packets Lost: 931/845010 (0.1%) May 18 2024 15:17:23

https://secondlife.canny.io/admin/board/bug-reports/p/improve-pbr-viewer-performance-on-apple-silicon

canny[bot] commented 1 month ago

This issue has been linked to a Canny post: Improve PBR viewer performance on Apple Silicon :tada:

RunitaiLinden commented 3 weeks ago

Fixed.

High risk change to LLVertexBuffer.cpp was required -- there are about 5 different ways to copy geometry to VRAM and which one performs well changes from one year to the next. Apple now seems to prefer GL_STATIC_DRAW and never copying to the same VBO twice. We now have a lot of #ifdef LL_DARWIN going on in LLVertexBuffer.cpp to make mac happy when streaming lots of geometry to the GPU (like when updating UI or showing selection outlines).