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