Use swap_control from MESA and EXT before SGI (#151)

SGI extension does not support interval == 0 (disabling VSync)
This commit is contained in:
x2048 2022-12-29 23:42:52 +01:00 committed by GitHub
commit 2ae816b5a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3401,8 +3401,23 @@ inline void COpenGLExtensionHandler::extGlSwapInterval(int interval)
#endif #endif
#endif #endif
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_ #ifdef _IRR_COMPILE_WITH_X11_DEVICE_
//TODO: Check GLX_EXT_swap_control and GLX_MESA_swap_control #if defined(GLX_MESA_swap_control)
#ifdef GLX_SGI_swap_control #ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlxSwapIntervalMESA)
pGlxSwapIntervalMESA(interval);
#else
pGlXSwapIntervalMESA(interval);
#endif
#elif defined(GLX_EXT_swap_control)
Display *dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable();
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlxSwapIntervalEXT)
pGlxSwapIntervalEXT(dpy, drawable, interval);
#else
pGlXSwapIntervalEXT(dpy, drawable, interval);
#endif
#elif defined(GLX_SGI_swap_control)
// does not work with interval==0 // does not work with interval==0
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (interval && pGlxSwapIntervalSGI) if (interval && pGlxSwapIntervalSGI)
@ -3411,23 +3426,7 @@ inline void COpenGLExtensionHandler::extGlSwapInterval(int interval)
if (interval) if (interval)
glXSwapIntervalSGI(interval); glXSwapIntervalSGI(interval);
#endif #endif
#elif defined(GLX_EXT_swap_control) }
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
Display *dpy = glXGetCurrentDisplay();
GLXDrawable drawable = glXGetCurrentDrawable();
if (pGlxSwapIntervalEXT)
pGlxSwapIntervalEXT(dpy, drawable, interval);
#else
pGlXSwapIntervalEXT(dpy, drawable, interval);
#endif
#elif defined(GLX_MESA_swap_control)
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlxSwapIntervalMESA)
pGlxSwapIntervalMESA(interval);
#else
pGlXSwapIntervalMESA(interval);
#endif
#endif #endif
#endif #endif
} }