SDL_GL_SwapWindow blocks forever (SDL 2.0.6)

Hi,

I have a weird issue where the SDL_GL_SwapWindow function will block, effectively freezing the program when the window is being created on certain windows.

The computer has 4 monitors, where the window will only work on one of them. All other 3 will freeze on the SDL_GL_SwapWindow function. All monitors are connected to the same Geforce 1080 Ti video card.

After a bit of investigation, it seems that it is blocking on the Windows GDI function SwapBuffers (see screenshot at the bottom of this post).

The code seems to work fine with all of our other customers (400+), so my guess would be that this is something device specific.

I tried enabling/disabling Vsync both in SDL2 and in the video card settings.

Someone maybe with a hint on where to search or what to try? :slight_smile:

Corjan

This is a remote possibility, but are you always calling SDL_GL_SwapWindow from the main UI thread? Issues similar to what you describe can result from calling it from a different thread.

Hi,

I create a separate thread for each window. Each thread has it’s own openGL context.
If I’m correct, this should be possible?

But it seems to work fine on one particular monitor, so my guess would be that this is not the issue. Not sure though.

Corjan

At MSDN here it says “When you use multiple threads and multiple rendering contexts, you must be careful to synchronize their use. For example, use one thread only to call SwapBuffers after all threads finish drawing”. I don’t know if this applies in your case, but given the symptoms I wouldn’t be surprised if it is relevant.