st/wgl: pseudo-implementation of WGL_EXT_swap_control
authorBrian Paul <brianp@vmware.com>
Tue, 4 Apr 2017 19:11:44 +0000 (13:11 -0600)
committerBrian Paul <brianp@vmware.com>
Fri, 7 Apr 2017 19:46:43 +0000 (13:46 -0600)
commitc78fc70e8c8931c28dfa8be1ea9522fe7b16687b
tree54080da1a6fa050a6e16af1bc42ebe3aa565d191
parentab96d1baf40d67b4ea9e685e4f5ea5c90f77d269
st/wgl: pseudo-implementation of WGL_EXT_swap_control

This implementation is based on querying the time just before swap/present
and doing a Sleep() if needed.  There is no sync to vblank or actual
coordination with the GPU.  This isn't perfect, but basically works.

We've had some request for this functionality, and it sounds like there
are some Windows GL apps that refuse to start if the driver doesn't
advertise this extension.

Note: NVIDIA's Windows OpenGL driver advertises the WGL_EXT_swap_control
string both with wglGetExtensionsStringEXT() and with
glGetString(GL_EXTENSIONS).  We're only advertising it with the former at
this time.

Tested with asst. Mesa demos, Google Earth, Lightsmark, etc.

VMware bug 1591534.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
src/gallium/state_trackers/wgl/stw_device.c
src/gallium/state_trackers/wgl/stw_device.h
src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c
src/gallium/state_trackers/wgl/stw_ext_swapinterval.c
src/gallium/state_trackers/wgl/stw_framebuffer.c
src/gallium/state_trackers/wgl/stw_framebuffer.h
src/gallium/state_trackers/wgl/stw_getprocaddress.c