Some frames disappeared mysteriously when VSync is on

We are the developer of a stage lighting application. We use OpenGL to visualize stage lighting in our application.

Our customers have issues with spotlight strobe effect with nVidia graphic cards when VSync is on. Spotlight strobe effect is turning on and off the spotlights continuously at high frequency. Strobe effect is very common in rock concerts and is important to be rendered correctly for our customers. In addition to our application, we are also able to modify nVidia’s FXAA directX sample and Cascade Shadow Maps OpenGL sample to show this artifact.

This is not a new issue as we have seen this artifact in the past years, and our previous attempts to fix this have not been successful. Many of our customers are NVIDIA customers with high end GTX cards (1080 TI, 1080, 1070, 980, 970, etc), and are very frustrated with this strobing issue, as it is preventing them from completing their work.

From our investigation, we found when a frame that takes a long time to render, followed by frames that takes a short time to render, the VSync may not display the frame that takes a long time to render. In our case, when all the spotlights are on, there are lots of computation and hence the frame takes a long time to render. Then, when all the spotlights are off, there are little computation and hence the frame takes a short time to render. When VSync is on, the frame with the spotlights on may not get displayed, and hence it looks like the spotlights are off for a long period of time. Currently, we can only recommend the affected customer to switch to AMD graphic cards as they can render the strobe effect correctly. Some customers have started to switch their hardware, but we’d like to offer a different resolution.

We are able to reproduce the issue by modifying the “Cascade Shadow Maps” sample in NVIDIA OpenGL SDK 10. Here are the steps to modify and reproduce the issue:

  1. In cascaded_shadow_maps.cpp, after swap buffers, we clear the buffer and swap it again right away to simulate the short-time-frame. The two red lines are what we added:

void display()
{
updateKeys();

   // 1. Make the shadow map
   makeShadowMap();

   // 2. Render the world by applying the shadow maps
   renderScene();

   // additionally, we can display information to aid the understanding
   // of what is going on
   if(show_depth_tex)
          showDepthTex();

   glutSwapBuffers();

   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

   glutSwapBuffers();

}

  1. Then in shadow_single_fragment.glsl, we sample the depth map many times instead of just once to simulate the long-time-frame. The red line are what we added to replace the blue line.

    // get the stored depth
    //float shadow_d = texture2DArray(stex, shadow_coord.xyz).x;
    float shadow_d = 0;
    // Increase the workload of GPU
    float count = 0;
    float numOfSample = 30;
    float sampleDist = 0.02 / numOfSample;
    for (float i = -0.01; i < 0.01; i += sampleDist)
    {
    for (float j = -0.01; j < 0.01; j += sampleDist)
    {
    shadow_d += texture2DArray(stex, shadow_coord.xyz + vec3(i,j,0)).x;
    count+=1.0;
    }
    }
    shadow_d /= count;

Note that you will need to adjust numOfSample for different graphic cards. In one of our systems with gtx760, we start to see the problem when numOfSample is 25; While in another system with gtx970, numOfSample has to set to 40 to see the issue.

  1. Then in NVIDIA Control Panel → Settings ->Manage 3D settings → Vertical sync, select “On” to force V-Sync.

  2. Run the sample
    Expected Result:

  • We should see the rendered scene and completely grey color alternating at 60 fps.

Actual Result:
When numOfSample is small, the rendering is correct. When numOfSample is big, we will see the view goes grey for a long period of time. That means frames that have the rendered scene keep go missing.

If there are any questions or further explanations needed, please let us know. We look forward to your reply.

Thanks in advance,
William Law

Here are the NVIDIA System Information reports of tested systems:
System 1:
[Display]
Operating System: Windows 10 Pro, 64-bit
DirectX version: 12.0
GPU processor: GeForce GTX 780
Driver version: 382.53
Direct3D API version: 12
Direct3D feature level: 11_0
CUDA Cores: 2304
Core clock: 980 MHz
Memory data rate: 6008 MHz
Memory interface: 384-bit
Memory bandwidth: 288.38 GB/s
Total available graphics memory: 7129 MB
Dedicated video memory: 3072 MB GDDR5
System video memory: 0 MB
Shared system memory: 4057 MB
Video BIOS version: 80.10.3A.00.80
IRQ: Not used
Bus: PCI Express x16 Gen2
Device Id: 10DE 1004 37843842
Part Number: 2083 0020

[Components]

NvGFTrayPluginr.dll 3.6.0.74 NVIDIA GeForce Experience
NvGFTrayPlugin.dll 3.6.0.74 NVIDIA GeForce Experience
nvui.dll 8.17.13.8253 NVIDIA User Experience Driver Component
nvxdplcy.dll 8.17.13.8253 NVIDIA User Experience Driver Component
nvxdbat.dll 8.17.13.8253 NVIDIA User Experience Driver Component
nvxdapix.dll 8.17.13.8253 NVIDIA User Experience Driver Component
NVCPL.DLL 8.17.13.8253 NVIDIA User Experience Driver Component
nvCplUIR.dll 8.1.970.0 NVIDIA Control Panel
nvCplUI.exe 8.1.970.0 NVIDIA Control Panel
nvWSSR.dll 6.14.13.8253 NVIDIA Workstation Server
nvWSS.dll 6.14.13.8253 NVIDIA Workstation Server
nvViTvSR.dll 6.14.13.8253 NVIDIA Video Server
nvViTvS.dll 6.14.13.8253 NVIDIA Video Server
nvLicensingS.dll 6.14.13.8253 NVIDIA Licensing Server
NVSTVIEW.EXE 7.17.13.8253 NVIDIA 3D Vision Photo Viewer
NVSTTEST.EXE 7.17.13.8253 NVIDIA 3D Vision Test Application
NVSTRES.DLL 7.17.13.8253 NVIDIA 3D Vision Module
nvDispSR.dll 6.14.13.8253 NVIDIA Display Server
NVMCTRAY.DLL 8.17.13.8253 NVIDIA Media Center Library
nvDispS.dll 6.14.13.8253 NVIDIA Display Server
PhysX 09.17.0329 NVIDIA PhysX
NVCUDA.DLL 6.14.13.8253 NVIDIA CUDA 8.0.0 driver
nvGameSR.dll 6.14.13.8253 NVIDIA 3D Settings Server
nvGameS.dll 6.14.13.8253 NVIDIA 3D Settings Server

System 2:
[Display]
Operating System: Windows 7 Professional, 64-bit (Service Pack 1)
DirectX version: 11.0
GPU processor: GeForce GTX 970
Driver version: 385.41
Direct3D API version: 11
Direct3D feature level: 11_1
CUDA Cores: 1664
Core clock: 1190 MHz
Memory data rate: 7010 MHz
Memory interface: 256-bit
Memory bandwidth: 224.32 GB/s
Total available graphics memory: 9953 MB
Dedicated video memory: 4096 MB GDDR5
System video memory: 0 MB
Shared system memory: 5857 MB
Video BIOS version: 84.04.36.00.72
IRQ: Not used
Bus: PCI Express x16 Gen2
Device Id: 10DE 13C2 39753842
Part Number: G401 0010

[Components]

nvui.dll 8.17.13.8541 NVIDIA User Experience Driver Component
nvxdplcy.dll 8.17.13.8541 NVIDIA User Experience Driver Component
nvxdbat.dll 8.17.13.8541 NVIDIA User Experience Driver Component
nvxdapix.dll 8.17.13.8541 NVIDIA User Experience Driver Component
NVCPL.DLL 8.17.13.8541 NVIDIA User Experience Driver Component
nvCplUIR.dll 8.1.970.0 NVIDIA Control Panel
nvCplUI.exe 8.1.970.0 NVIDIA Control Panel
nvWSSR.dll 6.14.13.8541 NVIDIA Workstation Server
nvWSS.dll 6.14.13.8541 NVIDIA Workstation Server
nvViTvSR.dll 6.14.13.8541 NVIDIA Video Server
nvViTvS.dll 6.14.13.8541 NVIDIA Video Server
nvLicensingS.dll 6.14.13.8541 NVIDIA Licensing Server
NVSTVIEW.EXE 7.17.13.8541 NVIDIA 3D Vision Photo Viewer
NVSTTEST.EXE 7.17.13.8541 NVIDIA 3D Vision Test Application
NVSTRES.DLL 7.17.13.8541 NVIDIA 3D Vision Module
nvDispSR.dll 6.14.13.8541 NVIDIA Display Server
NVMCTRAY.DLL 8.17.13.8541 NVIDIA Media Center Library
nvDispS.dll 6.14.13.8541 NVIDIA Display Server
PhysX 09.17.0524 NVIDIA PhysX
NVCUDA.DLL 6.14.13.8541 NVIDIA CUDA 9.0.163 driver
nvGameSR.dll 6.14.13.8541 NVIDIA 3D Settings Server
nvGameS.dll 6.14.13.8541 NVIDIA 3D Settings Server

System 3:
[Display]
Operating System: Windows 7 Professional N, 64-bit (Service Pack 1)
DirectX version: 11.0
GPU processor: GeForce GTX 760
Driver version: 385.41
Direct3D API version: 11
Direct3D feature level: 11_0
CUDA Cores: 1152
Core clock: 1006 MHz
Memory data rate: 6008 MHz
Memory interface: 256-bit
Memory bandwidth: 192.26 GB/s
Total available graphics memory: 5886 MB
Dedicated video memory: 2048 MB GDDR5
System video memory: 0 MB
Shared system memory: 3838 MB
Video BIOS version: 80.04.BF.00.09
IRQ: Not used
Bus: PCI Express x16 Gen2
Device Id: 10DE 1187 28481462
Part Number: 2004 0010

[Components]

nvui.dll 8.17.13.8541 NVIDIA User Experience Driver Component
nvxdplcy.dll 8.17.13.8541 NVIDIA User Experience Driver Component
nvxdbat.dll 8.17.13.8541 NVIDIA User Experience Driver Component
nvxdapix.dll 8.17.13.8541 NVIDIA User Experience Driver Component
NVCPL.DLL 8.17.13.8541 NVIDIA User Experience Driver Component
nvCplUIR.dll 8.1.970.0 NVIDIA Control Panel
nvCplUI.exe 8.1.970.0 NVIDIA Control Panel
nvWSSR.dll 6.14.13.8541 NVIDIA Workstation Server
nvWSS.dll 6.14.13.8541 NVIDIA Workstation Server
nvViTvSR.dll 6.14.13.8541 NVIDIA Video Server
nvViTvS.dll 6.14.13.8541 NVIDIA Video Server
nvLicensingS.dll 6.14.13.8541 NVIDIA Licensing Server
NVSTVIEW.EXE 7.17.13.8541 NVIDIA 3D Vision Photo Viewer
NVSTTEST.EXE 7.17.13.8541 NVIDIA 3D Vision Test Application
NVSTRES.DLL 7.17.13.8541 NVIDIA 3D Vision Module
nvDispSR.dll 6.14.13.8541 NVIDIA Display Server
NVMCTRAY.DLL 8.17.13.8541 NVIDIA Media Center Library
nvDispS.dll 6.14.13.8541 NVIDIA Display Server
PhysX 09.17.0524 NVIDIA PhysX
NVCUDA.DLL 6.14.13.8541 NVIDIA CUDA 9.0.163 driver
nvGameSR.dll 6.14.13.8541 NVIDIA 3D Settings Server
nvGameS.dll 6.14.13.8541 NVIDIA 3D Settings Server