gfx.WaitForPresent causing performance drops?
Hi!
Nihad Nasupovic here, art director / co-founder of the game Raindrop (raindropgame.com). I’m a longtime user / advocate for Unity, and I’ve run into an issue that I can’t seem to solve.
I’ve been working a lot on huge environments / terrain – although I’ve run into this issue with near-empty scenes. A quick look at the profiler reveals the culprit:
gfx.WaitForPresent
It chews up around 50-70% of my processor cycles, taking about 40-60ms to calculate. I’ve done a bit of research into this (THREAD), and it looks like there’s some kind of stall between the GPU and CPU, where the GPU is actually waiting for the CPU to finish jobs. Let’s start with the simple stuff. I’m pretty sure my machine is up to par:
Windows 10 Professional 64-bit Intel Core i7-6700K @ 4.00 GHz nVidia GeForce GTX 970 / GC:1177 MHz /MDT: 7010 MHz/ 4096MB GDDR5 (Driver Vers.: 364.51) 32 GB RAM 2x 480 GB SSD Samsung 28" 4K Monitor (3840x2160)
I’ve built the terrain of my scene with TerrainComposer, and populated it with some basic custom vegetation made in Speedtree. The terrain has a size of 4000x4000 units with a 4k heightmap, generated out of World Machine. I have extended the standard Terrain shaders with the Relief Terrain Pack from the brilliant Thomasz Stobierski. I have had no problems with this package at all in Unity 4.
However, even after narrowing down my scene to a simple plane and some cubes, the problem still persists. I have disabled Vsync, I’ve tried disabling Smooth LOD’s on Speedtrees – per suggestions from various forums – to no avail. Switching between DirectX versions hasn’t helped either.
I’ve put together a little video that highlights the problem – both in the more complex scene, and in the simple scene.
(You may have to download the video to see it in full resolution, dropbox likes to reduce the quality for online streaming.)
Another forum member, with similar system specs, has even run into this issue (THREAD).
What am I missing here?
Thanks for your time, and have a wonderful day!
Best, Nihad
Answer by GarethNoyce · Apr 05, 2016 at 01:11 PM
I've just had the same problem and as far as I can tell this is a driver issue. Reverting back to Driver version: 362.00 solves all my WaitForPresent issues.
Your answer
Follow this Question
Related Questions
GPU usages 100% 1 Answer
How to deal with 10,000s immobile gameobjects at once? 0 Answers
PostLateUpdate.FinishFrameRendering 2 Answers
Very Bad performance(High GPU Usage and Low Frame Rate) with unity 2020.3.1f1 and URP 2 Answers
Massive Rendering spike in profiler when unloading the scene 0 Answers