Strange VSync issues on a GTX 1060 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.



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



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?
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.