View Full Version : SwapBuffers blocks for multiple windows
09-01-2008, 02:46 AM
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?
09-01-2008, 07:46 AM
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?
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.
09-02-2008, 05:03 AM
Thanks for the reply.
Can you please elaborate about option 3 ?
09-02-2008, 12:13 PM
3 is prbably something like :
set interval to 0 (=no vsync)
draw window 1
draw window 2
set interval to 1 (=vsync)
draw window 2
09-02-2008, 11:21 PM
Thanks. But how this may help (improve swap time without tearing)?
09-03-2008, 02:25 PM
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)
09-03-2008, 10:58 PM
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).
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.