I’m experiencing a strange performance problem on MacOS which I think is related to deferred rendering occlusion culling. On Windows, my scene hits 120+ FPS but on MacOS I’m getting terrible frame-rates, less than 15 FPS. I ran the game through the new UE 5.2 profiler and reviewed the results in Unreal Insights:
As you can see, it is spending nearly 60ms in a foreach loop for the static meshes in the level on MacOS (top), but < 1ms on windows (bottom).
The scene is relatively static - the game is a single-screen platform - so the camera doesn’t move and most of the level geometry is simply the same block repeated over and over with a couple of different materials applied to it. There are some moving static meshes and a few Niagara particle FX as well, but those don’t seem to be a problem. The block meshes are about 170 vertexes each and textures are 2k. Here’s a screenshot of the level on Windows (the background is an image plane):
The Mac I’m testing on is a Mac Mini M2 with 16GB of RAM. The CPU is super-fast and profiling shows the GPU is totally green - no GPU skips or hitches and total GPU time is 3ms per frame.
Any suggestions what to look into here? I’m thinking maybe memory use is causing the primitive cache to get flushed to disk, so it needs to be reloaded frequently?
So I downloaded the Lyra sample project and did a developer build for testing. With medium quality settings, I got 60 fps on the Mac mini and it was quite playable. Time per frame for FetchVisibilityForPrimitives was about 12ms. Going to try changing some of the Mac platform and rendering settings to the Lyra project settings and see how it goes.
Not yet. What Mac do you have? I’m on an M2 mini with 8 CPU cores, 10 CPU cores, 16GB of RAM and 512GB HDD. Connected to an old 5k LG (pre-‘Studio’) monitor. Only really use it for building and testing my game.
Agreed. Some progress over the weekend, but no resolution yet. I disabled Occlusion Culling from project settings - my game is a single-screen platformer, so nothing is really every occluded and the camera never moves, which kind of makes this a waste of time.
Unfortunately, this just shifted the waits into WaitUntilTasksComplete() and GameThreadWaitForTask(), which indicates that the Occlusion Culling check was probably stacked up and waiting on something else.
Continuing to dig…would be nice if somebody from Epic jumped in here!
So, I think I finally found my problem. I was forcing either TSR or TUAA anti-aliasing methods, both of which don’t run well on Apple Silicon. I switched to FXAA and my frame rate jumped back to normal. I haven’t re-run a profile yet, but might get a chance to do that tomorrow. If this shows the lag in wait for tasks, then I’ll call it a solution.
Ok, this issue is now RESOLVED! If you have the FSR 2.x plugin from AMD in your project, you MUST disable it either from the Project settings or very early in startup (execute console command “r.FidelityFX.FSR2.Enabled 0”) and ONLY enable it when you actually detect a supported AMD GPU on a supported platform with supported drivers (with the execute console command: “r.FidelityFX.FSR2.Enabled 1”). In any other case, it goes crazy! Not sure exactly what it is doing, but enabling in on my Apple Silicon Mac, despite not having a supported GPU decreases frame rates by > 80%!