SwapBuffers blocks for multiple windows

Hello,

I have several double-buffered windows, and I display them by calling the corresponding SwapBuffers() one after another. I observe that starting from the second window, the SwapBuffers() call blocks, although it displays each time a different window!

How can I overcome this?

Should WGL_NV_swap_group extension enable doing this?

Thanks.

Couple methods.

  1. Disable sync to vblank and do your own sync. This is undesirable since it can result in tearing.

  2. Or as you suggest, put the windows in the same swap group. Potential con: NVidia specific, and potentially NVidia-Quadro with GSync specific. Not sure.

  3. Or Use SwapInterval if supported (SGI_swap_control/EXT_swap_control). Note sure but may be able to trick the driver to swap/noswap/swap/noswap/etc. Haven’t used it myself.

  4. Also I wonder about using multiple threads, one per window, and having each sync-to-vblank. Yeah, you’ve got the thread/context swap overhead, but maybe the driver syncs for each thread/context separately.

Thanks for the reply.
Can you please elaborate about option 3 ?

3 is prbably something like :

set interval to 0 (=no vsync)
draw window 1
swap
draw window 2
swap
set interval to 1 (=vsync)
draw window 2
swap

Thanks. But how this may help (improve swap time without tearing)?

This will (hopefully always) do the following:
quickly draw to windows 1-2-3 for 2ms, wait for vsync (16ms). Every next time, we’ll be sure to have enough spare time (14ms) till update of front-buffer, and also properly wait for vsync. Thus, no tearing.

But make 10+ windows, and your app will crawl. I’m kinda in the same boat as you, and temporarily chose to make virtual windowing, with heavy clipping (using early-z)

Swap groups extension will not work: I was told by nVidia that currently only 1 window per a graphic card can be a part of a group, because the main purpose of this extension is to synchronize windows on several graphic cards (possibly on different computers).