FXAA/SMAA Severe Performance issue Mac M2
tracked
observeur Resident
In the latest build, 7.1.12.13550888671 (64bit), enabling FXAA or SMAA divides the performance by 2 on my macbook Pro M2 (it used to have a negligible impact).
Log In
Korach Resident
I can duplicate this performance hit on the FS Viewer 7.1.12 Beta as well, on a MacBook M4Pro.
observeur Resident
Korach Resident I noticed that, if you enable DOF, it removes the issue.. but if course it's not a solution ;) Still it might help the people working on this.
Atlas Linden
tracked
observeur Resident
Atlas Linden i found the problem and fixed it. I'll keep doing tests and sending you details later (or i might do a pull request). The fix is simple. 1 line. EDIT: i made a pull request on develop branch.
Frankk Parisi
observeur ResidentCould we get an update on this please LL (or obs if you know?) i heard something about the fix bieng rejected? but dont know why, Atlas Linden if you could share any more with us it would be really appreciated as this bug is a right pain given the performance degredation it causes on Mac. Sure we can turn off AA, but then we have to live with jagged edges :-) (which are definately not good in, for example, photo work), thanks
observeur Resident
Frankk Parisi Technically, they rejected my fix because the luminance map which is a framebuffer object was using mipmap generation, which i disabled without noticeable effect, beside "fixing" the AA slow down. But it happens the mipmap generation was intended by the developer. The same issue with mipmap generation happens in other parts of the code such as the one related to the reflection probes. There is also a texture copy operation seems to cause a delay also. (those explaining the periodic gigantic spikes in the frametime). I suspect this is some memory access conflict that causes the slow down in both cases. (as the mipmap generation applies to a relatively small texture and in my own tests, changing parameters wouldn't improve the delay. So I've been studying this for many days, but i had to refocus on my work in SL, because this is what makes me eat ;) I do plan to continue my investigations, with a fresh eye on this, and as for LL developers, i don't know if they have been working on it.
Frankk Parisi
observeur ResidentThanks for the update - your efforts are really appreciated! Atlas Linden Please could you give us an update - the issue status is tracked but surely is a priority for the mac viewer? Thanks
Atlas Linden
Hi Frankk,
Unfortunately there have been no recent updates towards this issue due to other higher priority bugs.
Future updates to this will either be mentioned here or in the GitHub issue: https://github.com/secondlife/viewer/issues/3828
Atlas Linden
Thanks for the extra info, observeur!
This now appears to be reproducing on my M1 on both the 2025.03 Beta (7.1.13) and Current release: ForeverFPS (7.1.12). It appears to be somewhat evident in the release prior to that: ExtraFPS (7.1.11) although the performance drop isn't nearly as much.
This is now being tracked here for further investigation: https://github.com/secondlife/viewer/issues/3828
observeur Resident
Atlas Linden
I started having this issue with the release version of ForeverFPS. And i didn't have it in earlier betas of ForeverFPS, or older viewers .. even though it was more complicated to compare since hdr was always active.
It really seems related to the chain of framebuffers binding / flushing in the pipeline, with the fact it's happening with hdr & emissive only .. I measured the duration of each step of the pipeline, and depending on the option i activate or deactivate, there will always be one step that will take more time, independently of the processing it requires, that step isn't the same depending on the options.
Anyway, i am sure someone in your team with a good knowledge of SL deferred pipeline will certainly understand this better than me :)
Atlas Linden
under review
Dan Linden
needs info
observeur Resident
Dan Linden I identified the origin of this issue. It comes from the new water exclusion feature. (EDIT: it's more complicated than that .. see my next comments) If i revert back to the older pipeline.cpp so before this feature was added, the issue doesn't occur. Now i haven't figured "why" .. but this should give your developers a hint. Also the DOF option seems similarly impacted (same thing : when hdr & emissive is ticked).
observeur Resident
Dan Linden I tried to narrow this down. First of all, it's not related to actual "computation", but most probably to the frame buffer mechanisms. Something with llrendertarget bindTarget() and flush() .. seems the driver is "waiting" at some point .. now why only with hdr & emissive options? I first though of something with the pixel formats, but not convinced, as i made different combinations, also made tests without rendering anything, with the same result. So maybe when using hdr & emissive it creates more buffers overall, kinda reaching a driver limit ? ..
in pipeline.cpp / Apply FXAA:
mFXAAMap.bindTarget();
mFXAAMap.clear(GL_COLOR_BUFFER_BIT);
// ... commented rendering calls -> no positive effect
mFXAAMap.flush();
or in doWaterExclusionMask()
mWaterExclusionMask.bindTarget();
glClearColor(1, 1, 1, 1);
mWaterExclusionMask.clear();
// mWaterExclusionPool->render();
mWaterExclusionMask.flush();
glClearColor(0, 0, 0, 0);
If i completely disable doWaterExclusionMask() then FXAA is fine (but it doesn't render water ofc).
If i just comment mWaterExclusionPool->render();, FXAA slowed down (delayed i guess)
I hope those observations would help. I will keep digging int he meantime.
observeur Resident
Dan Linden If i comment the call to generateExposure(&mLuminanceMap, &mExposureMap); in LLPipeline::renderFinalize() the performance issue with AA is gone as well.
And same thing, if i only keep the calls to dst->bindTarget(); and Flush(), without rendering anything, the problem is back.
observeur Resident
Dan Linden Some additional informations:
In llviewerdisplay.cpp, i measured the duration of those calls : render_ui() and swap(). ( render_ui() calls for gPipeline.renderFinalize(); )
without hdr & emissive :
-> render_ui() : about 1200 microseconds
-> swap() : less than 300 microseconds
without hdr & with AA
-> render_ui() : about 1200 microseconds
-> swap(): about 300 microseconds
with hdr & No AA
-> render_ui() : about 1200 microseconds
-> swap(): about 430 microseconds
with hdr & emissive / AA (fxaa or smaa ..) :
-> render_ui() : 1400 microseconds
-> swap(): 6500 microseconds (6 to 7 ms !)
----------
worth noting (maybe) those warnings in the debug window when changing the graphics settings : "GL Error happens before reading back texture. Error code: 1280" coming from readBackRaw();
Dan Linden
Hi observeur.
I'm not able to reproduce this bug, but I am on a M1.
Would you rename your settings.xml file to settings.bak (which will reset all the setting and debug settings) and see if this bug still reproduces? If that fixes it, we'll want to see your old settings file. The settings.xml file is located in
/Users/<username>/Library/Application Support/SecondLife/user_settings
We did notice that your cache size is rather low. The default size is 4096. Setting my cache size to 1024 did not reproduce the performance issue.
observeur Resident
Dan Linden I will do that. I first noticed this on our last build of megapahit based on your last build, and i checked on SLv to know for sure, and indeed, the problem occurred in SLv. Someone with a M2 Pro says it doesn't happen to him, so, maybe with reseted settings it would work normally. I let you know.
EDIT:
I will send you the settings.xml but for now i'm investigating which setting is causing this, and i found one at least -> HDR and Emissive. If this one is disabled, then the antialiasing has no performance penalty. If it's activated, then the penalty happens (from 105fps to 65fps). this is from a "cleaned settings". so it doesn't seem to be related to debug options.
The difference is more important if reflection coverage is set to Manual only at least (so not "none").
Also on SLv the difference in fps isn't always as important (compared to megapahit), the reason being rosetta having an important penalty already. But it's there, and it's between 10 to 20 fps (or more) penalty when activating any antialiasing option, in combination with "hdr and emissive", and "reflection coverage set to something higher than none".
It really is a new issue from the latest build, as before that i never saw any performance penalty with antialiasing on (or 1 or 2 fps max).
(as about the cache size, it's unrelated, i am doing tests with that too, but if it may slow down the sim loading, then after a moment it doesn't affect performance).
I added 4 screenshots with SLV, with and without the hdr and emissive option, aa on and off. I also added 2 screenshots with a native arm viewer, as the penalty is even bigger here.
EDIT march 10th: Someone told me he doesn't see a difference on his mac mini M2 Pro. The notable difference is that he is using macos Ventura, and i am using Sequoia. so the issue might not happen in older. The origin of the issue should be quite easy to spot though, it has to be related to a recent commit related to hdr & emissive and antialiasing shaders.
EDIT March 21st: It also happens on a macbook M4 Pro
Also affects 7.1.13.13906285233 - 2025.03