Performance problem with packaged build
I’m close to finishing my VR experience for the Oculus Rift, but I now cannot release it because of a strange performance problem. In the editor everything works fine, but when I run a packaged build the problem occurs. The oculus performance HUD shows application frames being dropped constantly, and there is stuttering. The performance headroom is fine though, so I don’t think there is a problem with the GPU not being able to render fast enough. The problem seems to be in the game thread.
I’ll just sum up the details:
- Changing vr.PixelDensity to 0.1 does not fix the problem
- Turning everything (static meshes, particles, landscape, etc) off with showflag commands does not fix the problem
- Using “stat engine” I see a big entry for “Redraw viewports” (only in the packaged build), and the profiler confirms that a lot of time is spent in this entry. From the profiler it looks as if this entry is the one tipping the game thread time to >11ms.
- By diving into the source of the engine and adding more cycle counters I’ve narrowed this down to the ovrp_WaitToBeginFrame call in FOculusHMD::StartRenderFrame_GameThread(). Why would this call take 8, 9 ms and why only in packaged builds? Is this a significant finding? Or is this more like missing a frame, and then blaming vsync for waiting?
- In emulate stereo mode with vsync off there is no problem and all threads run at <5ms per frame
- The stuttering is not visible on the mirrored screen. I’ve even captured 60fps footage for the trailer while this problem was occuring in the HMD.
- The problem comes and goes. Today I might have the problem, but in 2 weeks the exact same builds might work fine for a short while.
- When the problem is occuring the Oculus validator fails at the TestFrameRate test. When the problem is (temporarily) gone it succeeds at TestFrameRate.
- I’m using 4.19, but the problem also occurs when I upgrade to 4.20 or 4.21.
I don’t know what to try anymore, but I also don’t feel like simply discarding the project. I’ve worked on it for many months.