Added GLX_EXT_swap_control support for 1.2 x11 video target. SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Mon, 22 Aug 2011 02:11:56 -0400
branchSDL-1.2
changeset 5629 e594196ba99f
parent 5628 f78f29271dfd
child 5637 d39fe8e7d26a
Added GLX_EXT_swap_control support for 1.2 x11 video target.
src/video/x11/SDL_x11gl.c
src/video/x11/SDL_x11gl_c.h
--- a/src/video/x11/SDL_x11gl.c	Sun Aug 21 23:38:35 2011 -0400
+++ b/src/video/x11/SDL_x11gl.c	Mon Aug 22 02:11:56 2011 -0400
@@ -289,9 +289,16 @@
 	if ( !glXExtensionSupported(this, "GLX_MESA_swap_control") ) {
 		this->gl_data->glXSwapIntervalMESA = NULL;
 	}
+	if ( !glXExtensionSupported(this, "GLX_EXT_swap_control") ) {
+		this->gl_data->glXSwapIntervalEXT = NULL;
+	}
+
 	if ( this->gl_config.swap_control >= 0 ) {
-        int rc = -1;
-		if ( this->gl_data->glXSwapIntervalMESA ) {
+		int rc = -1;
+		if ( this->gl_data->glXSwapIntervalEXT ) {
+			rc = this->gl_data->glXSwapIntervalEXT(GFX_Display, SDL_Window,
+					this->gl_config.swap_control);
+		} else if ( this->gl_data->glXSwapIntervalMESA ) {
 			rc = this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control);
 		} else if ( this->gl_data->glXSwapIntervalSGI ) {
 			rc = this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control);
@@ -418,7 +425,8 @@
 		}
 		break;
 	    case SDL_GL_SWAP_CONTROL:
-		if ( ( this->gl_data->glXSwapIntervalMESA ) ||
+		if ( ( this->gl_data->glXSwapIntervalEXT ) ||
+		     ( this->gl_data->glXSwapIntervalMESA ) ||
 		     ( this->gl_data->glXSwapIntervalSGI ) ) {
 			*value = this->gl_data->swap_interval;
 			return 0;
@@ -473,6 +481,7 @@
 		this->gl_data->glXSwapBuffers = NULL;
 		this->gl_data->glXSwapIntervalSGI = NULL;
 		this->gl_data->glXSwapIntervalMESA = NULL;
+		this->gl_data->glXSwapIntervalEXT = NULL;
 
 		this->gl_config.dll_handle = NULL;
 		this->gl_config.driver_loaded = 0;
@@ -536,6 +545,8 @@
 		(int (*)(int)) X11_GL_GetProcAddress(this, "glXSwapIntervalSGI");
 	this->gl_data->glXSwapIntervalMESA =
 		(GLint (*)(unsigned)) X11_GL_GetProcAddress(this, "glXSwapIntervalMESA");
+	this->gl_data->glXSwapIntervalEXT =
+		(int (*)(Display*,GLXDrawable,int)) X11_GL_GetProcAddress(this, "glXSwapIntervalEXT");
 
 	if ( (this->gl_data->glXChooseVisual == NULL) || 
 	     (this->gl_data->glXCreateContext == NULL) ||
--- a/src/video/x11/SDL_x11gl_c.h	Sun Aug 21 23:38:35 2011 -0400
+++ b/src/video/x11/SDL_x11gl_c.h	Mon Aug 22 02:11:56 2011 -0400
@@ -73,6 +73,7 @@
 
     int (*glXSwapIntervalSGI) ( int interval );
     GLint (*glXSwapIntervalMESA) ( unsigned interval );
+    int (*glXSwapIntervalEXT)( Display *dpy, GLXDrawable drw, int interval);
     int swap_interval;
 #endif /* SDL_VIDEO_OPENGL_GLX */
 };