2
$\begingroup$

I'm out of my wits. I've been working an a voxel game for the last couple of years, written in C# and OpenTK (=OpenGL backend)

I've been struggling to achieve a stable frame rate and one of the major issues I can see after countless hours of frame profiling, is that the windows 10 nvidia graphics driver seems to act in some really strange ways.

It almost seems as if my card is in some sort of low power mode by default in which it renders at arbitrarily changing speeds, but once its put under load it renders reliably again.

I can reliably reproduce this by launching my game with non-demanding graphics setting, then up the GPU load with dynamic shadows, god rays and such, then lowering the demands again.

This is all with VSync enabled (and in the nvidia control panel the vsync option is set to "Let the application decide")

Here are some frame rate graphs:

Low gpu load, draw calls randomly take a few milliseconds longer, then it almost seems to overcompensate by drawing the next frame too fast.

enter image description here

Then I increase the gpu load for a few seconds and lower it again. The frame rate gets buttery smooth:

enter image description here

As mentioned I carefully profiled this issue and it always seems that the time is spend on various draw calls (usually GLMultiDrawElements), but highly inconsistent.

Anyone have an idea what the heck is going on here and how I can fix this?

Is there any call I could make to NVAPI to force it into this hypothetical high power mode?

$\endgroup$
2
  • $\begingroup$ This is speculation on my part, but is this a laptop or a desktop system? Laptops sometimes have two GPUs ( e.g. superuser.com/questions/908824/… ). Second idle thought is could it be using triple buffering? That might account for a later frame being displayed sooner than expected? $\endgroup$
    – Simon F
    Nov 13, 2019 at 14:01
  • $\begingroup$ This could also occur if your thread has delays waking up from its wait-for-vsync.The next frames wait for vsync then starts earlier than expected, even though the 2 frames end up at the display evenly paced. $\endgroup$
    – PaulHK
    Nov 14, 2019 at 14:09

1 Answer 1

1
$\begingroup$

Ok so setting the "power management mode" to "prefer maximum performance" in the nvidia control panel seems to fix it.

Since I already create an optimus profile automatically through code all I had to do was to set this value as well.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.