mirror of https://github.com/snes9xgit/snes9x.git
Add support for glXSwapIntervalEXT.
This commit is contained in:
parent
f362195fb4
commit
583f2a7ef8
|
@ -736,6 +736,8 @@ S9xOpenGLDisplayDriver::resize_window (int width, int height)
|
|||
|
||||
glXMakeCurrent (display, xwindow, glx_context);
|
||||
|
||||
swap_control (config->sync_to_vblank);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -866,9 +868,15 @@ S9xOpenGLDisplayDriver::init (void)
|
|||
void
|
||||
S9xOpenGLDisplayDriver::swap_control (int enable)
|
||||
{
|
||||
glSwapIntervalProc glSwapInterval = NULL;
|
||||
static glSwapIntervalProc glSwapInterval = NULL;
|
||||
static glXSwapIntervalEXTProc glXSwapIntervalEXT = NULL;
|
||||
static int queried = FALSE;
|
||||
const char *ext_str;
|
||||
|
||||
enable = enable ? 1 : 0;
|
||||
|
||||
if (!queried)
|
||||
{
|
||||
ext_str = glXQueryExtensionsString (display, DefaultScreen (display));
|
||||
|
||||
/* We try to set this with both extensions since some cards pretend
|
||||
|
@ -878,18 +886,31 @@ S9xOpenGLDisplayDriver::swap_control (int enable)
|
|||
{
|
||||
glSwapInterval = (glSwapIntervalProc)
|
||||
glGetProcAddress ((GLubyte *) "glXSwapIntervalMESA");
|
||||
if (glSwapInterval)
|
||||
glSwapInterval (enable ? 1 : 0);
|
||||
}
|
||||
|
||||
else if (strstr (ext_str, "GLX_SGI_swap_control"))
|
||||
if (strstr (ext_str, "GLX_SGI_swap_control"))
|
||||
{
|
||||
glSwapInterval = (glSwapIntervalProc)
|
||||
glGetProcAddress ((GLubyte *) "glXSwapIntervalSGI");
|
||||
}
|
||||
|
||||
if (strstr (ext_str, "GLX_EXT_swap_control"))
|
||||
{
|
||||
glXSwapIntervalEXT = (glXSwapIntervalEXTProc)
|
||||
glGetProcAddress ((GLubyte *) "glXSwapIntervalEXT");
|
||||
}
|
||||
|
||||
queried = TRUE;
|
||||
}
|
||||
|
||||
if (glSwapInterval)
|
||||
{
|
||||
glSwapInterval (enable ? 1 : 0);
|
||||
glSwapInterval (enable);
|
||||
}
|
||||
|
||||
if (glXSwapIntervalEXT)
|
||||
{
|
||||
glXSwapIntervalEXT (display, xwindow, enable);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -35,6 +35,9 @@ typedef void (*gl_proc) (void);
|
|||
typedef gl_proc (*getProcAddressProc) (const GLubyte *name);
|
||||
|
||||
typedef GLint (*glSwapIntervalProc) (GLint interval);
|
||||
typedef void (*glXSwapIntervalEXTProc) (Display *dpy,
|
||||
GLXDrawable drawable,
|
||||
int interval);
|
||||
/* Procedures for pixel buffer objects */
|
||||
typedef void (*glGenBuffersProc) (GLsizei n, GLuint *buffers);
|
||||
typedef void (*glDeleteBuffersProc) (GLsizei n, const GLuint *buffers);
|
||||
|
|
Loading…
Reference in New Issue