launching the same exe over and over is only fast if the name is changed

Not sure if this is the right place to post this problem but I’ve been stuck for a while and it seems to be related to nvidia cards.

Basically if I open the same opengl exe over and over, it takes longer and longer to start. But if I make a copy of the exe and rename it, that exe starts instantly even if the original exe has a number of copies running. To further complicate things, two copies of the exe with the same name but in different directories will also cause each other to start slowly.

The only other mention of this problem I could find is here: https://stackoverflow.com/questions/43378891/multiple-instances-of-opengl-exe-take-longer-and-longer-to-initialize

But there are no solutions.

You can confirm if this happens on your machine by trying one of the exes here: Gordon Wetzstein - OpenGL Examples

The window will stay white longer and longer each time it’s started. The same happens on the opengl apps I’ve made.

The only workaround I’ve come up with is a rather awkward batch file that makes a unique copy the exe and launches the copy each time rather than the original.

I’ve tried it on 2 machines with nvidia cards (win7 & win10) with the same results, but everything works as expected on my laptop with an intel card. Could it be a driver bug?

Any help debugging or finding more information is much appreciated!

Thanks

Possibly related to my issue as well

Please NVIDIA developers try to find a solution for this :D

Yes, that sounds like the same issue.

I started to try and dig into this further by creating a stripped-down example program with a timer. Every instance already running adds 1 second to the startup time, just as you saw.

Here is a minimal example (100 lines of code): opengl-win-timer/app.cpp at minimal · pvan/opengl-win-timer · GitHub
And here is a longer example: opengl-win-timer/app.cpp at master · pvan/opengl-win-timer · GitHub

I ended up switching my project over to directx, so I didn’t do very thorough testing. But it seemed like the delay was caused by the first call to glCompileShader, although sometimes my timer only showed the delay after a couple SwapBuffers calls were also made.

If the same exe is ran with a different name, it does not add to the delay.
If the same exe is ran with the same name, but in different directories, it does add to the delay.

I’m out of my depth with this bug, but it does seem to me like there are three possible explanations:

A bug in our code.
A bug in windows.
A bug in the nvidia drivers.

The fact that we haven’t yet found code where this doesn’t occur (I’ll admit to not looking extensively), and that it works fine on intel and amd cards, leads me to think it’s a bug in the nvidia drivers.

This is probably very important, thank you for doing the testing to isolate it sir.