Use swap_control from MESA and EXT before SGI

SGI does not support disabling vsync (interval == 0)
This commit is contained in:
x2048 2022-12-29 22:44:03 +01:00
parent a549d0bfed
commit 61af99adfa

@ -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
} }