Commit a7346e9f authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

winex11.drv: Enhance the wrapper functions for WGL_EXT_swap_control.

parent 0f050b3e
......@@ -505,9 +505,11 @@ static BOOL has_opengl(void)
/* It doesn't matter if these fail. They'll only be used if the driver reports
the associated extension is available (and if a driver reports the extension
is available but fails to provide the functions, it's quite broken) */
#define LOAD_FUNCPTR(f) p##f = (void*)pglXGetProcAddressARB((const unsigned char*)#f)
#define LOAD_FUNCPTR(f) p##f = pglXGetProcAddressARB((const GLubyte *)#f)
/* ARB GLX Extension */
LOAD_FUNCPTR(glXCreateContextAttribsARB);
/* SGI GLX Extension */
LOAD_FUNCPTR(glXSwapIntervalSGI);
/* NV GLX Extension */
LOAD_FUNCPTR(glXAllocateMemoryNV);
LOAD_FUNCPTR(glXFreeMemoryNV);
......@@ -3400,7 +3402,9 @@ static const char * WINAPI X11DRV_wglGetExtensionsStringEXT(void) {
* WGL_EXT_swap_control: wglGetSwapIntervalEXT
*/
static int WINAPI X11DRV_wglGetSwapIntervalEXT(VOID) {
FIXME("(),stub!\n");
/* GLX_SGI_swap_control doesn't have any provisions for getting the swap
* interval, so the swap interval has to be tracked. */
TRACE("()\n");
return swap_interval;
}
......@@ -3413,13 +3417,37 @@ static BOOL WINAPI X11DRV_wglSwapIntervalEXT(int interval) {
BOOL ret = TRUE;
TRACE("(%d)\n", interval);
swap_interval = interval;
if (NULL != pglXSwapIntervalSGI) {
wine_tsx11_lock();
ret = !pglXSwapIntervalSGI(interval);
wine_tsx11_unlock();
if (interval < 0)
{
SetLastError(ERROR_INVALID_DATA);
return FALSE;
}
else if (interval == 0)
{
/* wglSwapIntervalEXT considers an interval value of zero to mean that
* vsync should be disabled, but glXSwapIntervalSGI considers such a
* value to be an error. Just silently ignore the request for now. */
WARN("Request to disable vertical sync is not handled\n");
swap_interval = 0;
}
else
{
if (pglXSwapIntervalSGI)
{
wine_tsx11_lock();
ret = !pglXSwapIntervalSGI(interval);
wine_tsx11_unlock();
}
else
WARN("GLX_SGI_swap_control extension is not available\n");
if (ret)
swap_interval = interval;
else
SetLastError(ERROR_DC_NOT_FOUND);
}
else WARN("(): GLX_SGI_swap_control extension seems not supported\n");
return ret;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment