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);
|
glXMakeCurrent (display, xwindow, glx_context);
|
||||||
|
|
||||||
|
swap_control (config->sync_to_vblank);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,30 +868,49 @@ S9xOpenGLDisplayDriver::init (void)
|
||||||
void
|
void
|
||||||
S9xOpenGLDisplayDriver::swap_control (int enable)
|
S9xOpenGLDisplayDriver::swap_control (int enable)
|
||||||
{
|
{
|
||||||
glSwapIntervalProc glSwapInterval = NULL;
|
static glSwapIntervalProc glSwapInterval = NULL;
|
||||||
const char *ext_str;
|
static glXSwapIntervalEXTProc glXSwapIntervalEXT = NULL;
|
||||||
|
static int queried = FALSE;
|
||||||
|
const char *ext_str;
|
||||||
|
|
||||||
ext_str = glXQueryExtensionsString (display, DefaultScreen (display));
|
enable = enable ? 1 : 0;
|
||||||
|
|
||||||
/* We try to set this with both extensions since some cards pretend
|
if (!queried)
|
||||||
* to support both, but ignore one. */
|
|
||||||
|
|
||||||
if (strstr (ext_str, "GLX_MESA_swap_control"))
|
|
||||||
{
|
{
|
||||||
glSwapInterval = (glSwapIntervalProc)
|
ext_str = glXQueryExtensionsString (display, DefaultScreen (display));
|
||||||
glGetProcAddress ((GLubyte *) "glXSwapIntervalMESA");
|
|
||||||
if (glSwapInterval)
|
/* We try to set this with both extensions since some cards pretend
|
||||||
glSwapInterval (enable ? 1 : 0);
|
* to support both, but ignore one. */
|
||||||
|
|
||||||
|
if (strstr (ext_str, "GLX_MESA_swap_control"))
|
||||||
|
{
|
||||||
|
glSwapInterval = (glSwapIntervalProc)
|
||||||
|
glGetProcAddress ((GLubyte *) "glXSwapIntervalMESA");
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (strstr (ext_str, "GLX_SGI_swap_control"))
|
if (glSwapInterval)
|
||||||
{
|
{
|
||||||
glSwapInterval = (glSwapIntervalProc)
|
glSwapInterval (enable);
|
||||||
glGetProcAddress ((GLubyte *) "glXSwapIntervalSGI");
|
}
|
||||||
if (glSwapInterval)
|
|
||||||
{
|
if (glXSwapIntervalEXT)
|
||||||
glSwapInterval (enable ? 1 : 0);
|
{
|
||||||
}
|
glXSwapIntervalEXT (display, xwindow, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -35,6 +35,9 @@ typedef void (*gl_proc) (void);
|
||||||
typedef gl_proc (*getProcAddressProc) (const GLubyte *name);
|
typedef gl_proc (*getProcAddressProc) (const GLubyte *name);
|
||||||
|
|
||||||
typedef GLint (*glSwapIntervalProc) (GLint interval);
|
typedef GLint (*glSwapIntervalProc) (GLint interval);
|
||||||
|
typedef void (*glXSwapIntervalEXTProc) (Display *dpy,
|
||||||
|
GLXDrawable drawable,
|
||||||
|
int interval);
|
||||||
/* Procedures for pixel buffer objects */
|
/* Procedures for pixel buffer objects */
|
||||||
typedef void (*glGenBuffersProc) (GLsizei n, GLuint *buffers);
|
typedef void (*glGenBuffersProc) (GLsizei n, GLuint *buffers);
|
||||||
typedef void (*glDeleteBuffersProc) (GLsizei n, const GLuint *buffers);
|
typedef void (*glDeleteBuffersProc) (GLsizei n, const GLuint *buffers);
|
||||||
|
|
Loading…
Reference in New Issue