Regular and high frametime spikes on mac
tracked
observeur Resident
By observing the fast timers console, i noticed big regular frametime spikes (those frames have a double duration compared to other frames approximately).
The spikes happen with a shorter period when reflection coverage is set to manual vs none (with the option set to none, this is the sim general probe that is updated, so it happens less often).
This doesn't happen on Windows, or Linux.
I joined a couple screenshots, one with reflection coverage set to none, one set to manual only.
note 1: the frametime in ms indicated in the fast timers window isn't correct on macs with Apple silicon. But it's not very important here, what matters is the shape of the frames over time.
note 2: you might notice my disk cache is set to a low value. This is intended, and has no impact in this current test.
Log In
Dan Linden
tracked
Dan Linden
Thank you for the report, observeur!
Issue tracked at https://github.com/secondlife/viewer/issues/3904. We have no estimate when it may be implemented. Please see future updates here.
observeur Resident
Dan Linden I've been investigating some more, and i am sharing my observations here, this might help:
1) the heart of the issue seems located to this method : LLReflectionMapManager::updateProbeFace
and more specifically, when it renders the radiance map (as if i disable the call for it, the stutter disappears .. and naturally it makes the scene dark).
2) i've been tweaking the RadianceGenF shader, and more specifically the prefilterEnvMap() function. I first made it not enter into the loop (based numSamples), and return a constant value, the problem persists. So i'm feeling like it's when accessing the reflectionProbes samplerCubeArray that it .. stalls ? If i don't call this function and just make the shader return a fixed color value, then the stutter disappears.
Also one worth thing to mention that leaded me to analyse the LLReflectionMapManager::updateProbeFace() method is :
When reflection coverage is set to none, then this is the sim global probe only that is used and updated not as often as the other probes, so the spikes happens regularly but with a larger interval. When reflection coverage is set to manual, and i'm in a building with a reflection probe for instance, then the spikes happen more often, due to the fact this radiance map is calculated more often.
Many hints also made me think this all might be related to llrendertarget (framebuffer) and how apple opengl driver (which is a wrapper to metal in fact) handles those opengl objects internally.
Also, the spikes are way bigger when using hidpi. So it seems dependant to the rendering resolution. (when using hidpi, and setting RenderResolutionDivisor to 2 for instance, the spikes are there but less pronounced).
The feedback i wrote about antialiasing slowing down the viewer seems related to the same issue.
(side not: I must say i am not a specialist in all this, but i am learning and willing to understand what's going on. That is why i am investigating all this in the first place, and to help solving the issue because mac users deserve the same quality experience as all other users :) )
observeur Resident
Dan Linden A bit of overview about this issue : There are 2 distincts issues :
One is more of a Mac issue, that is related to how the cubemap mipmaps are generated .. i think, causing those regular spikes.
Second issue is on all platforms: In certain sims with a high density of geometry to render in a rather close areas, such as the example i gave in my previous post, the viewer just can't handle such amount of geometry, no matter what the power of the machine. I attached a frametime graph (modified so it shows the geometry and deferred shading impact),
I also limited the number of probes to 2 (renderReflectionProbesCount) , to be sure it's not a matter of "too many probes", and the issue persists. Also i played with the resolution parameter, this doesn't help that much. However the draw distance parameter helps a lot. It confirms the fact that there is just too much geometry here to render (6 times).
If this can't be easily optimised .. Maybe you might consider some sort of dynamic setting for that reflection probes draw distance .. lowering it if the viewer detects abnormal rendering time. That could be part of the performance tool ? or just .. automatic ..
observeur Resident
Complementary informations:
After modifying the llrendertarget bindTarget() method to use proper syntax for read/write, read only and write only access, and adjusting the calls in the code, i saw a drastic improvement as shown in those 2 captures. However, this wasn't noticeable in this sim, but in other sims i noticed the reflection probes were broken somehow (resulting to black / very dark parts in the image).
So i'm still investigating and you might have a better idea yourself.
info 1: those spikes are more .. spiky.. when using a higher resolution (hidpi on the mac). On lower resolutions it's not as easy to notice those regular spikes. Also to make things more complicated, there is a bit of randomness here, as this doesn't happen everywhere everytime..
info 2:
On the PC using the AMD integrated gpu (680m), the graph is very smooth and regular, no matter the settings.
On the PC using the NVidia 3080m gpu : the graph is more chaotic compared to AMD. There are spikes too .. but there aren't as regular as on the Mac.
Overall, activating reflection probes on the mac has a stronger penalty compared to the PC. With coverage set to "none", the mac shows 120fps, the PC 90fps. When setting this to manual, the PC will go in the 80s, while the mac will already be under 80 fps in the same scenario.
info 3 (important):
If i look closely at the mac frametimes, i notice the big spikes are followed by a very short frametime. I think it might be important, as it might indicate either a "measure effect", that would kinda invalidate my point (partially) .. or something else ...
observeur Resident
Additional information (July 2025):
I found a good spot to reproduce the issue: http://maps.secondlife.com/secondlife/Jhaeros/119/142/2095
When you log in at this spot, you might not observe the issue right away (probably because reflection probes don't activate right away until you move around), but walk around and back to this spot, and the issue will occur (badly).
I attached 2 screenshots of the frametime graph, one with reflection coverage set to none, one set to "static only".
EDIT: I tested the same scene on my older PC laptop under windows, the situation at this particular place isn't better. While using the integrated AMD gpu, the frametime graph is awful, and when i use the dedicated nvidia gpu (gtx 1660ti), the frametime is also pretty bad.
I added 2 more screenshots: 4) NVidia with threaded optimisation set to on, 5) NVidia with threaded optimisations set to OFF. You notice that in this last case, the frametime is quite similar to the Mac graph.
(Threaded optimisations is a preference in the NVidia Control Panel that often benefits to SL performance).
I tested on my newer PC laptop (windows, rtx 3080m) and i have the exact same behavior.
(As a side note, every 8 or 10 seconds, it shows a huge spike during about 10 frames, and about 10x higher than the mean value (more than 200ms). But this seems like a different issue, probably related to texture decoding? because this one also happens when reflection coverage is set to none. This also happens on my both PCs)