# HG changeset patch # User Ryan C. Gordon # Date 1255156682 0 # Node ID 485868a1c28305c0dcbb672a110f5e7e72b22d71 # Parent 91c4580138504daf89a8d145577dcf56b6b67556 Cache the swap control setting, even on Mesa. diff -r 91c458013850 -r 485868a1c283 src/video/x11/SDL_x11gl.c --- a/src/video/x11/SDL_x11gl.c Sat Oct 10 05:21:31 2009 +0000 +++ b/src/video/x11/SDL_x11gl.c Sat Oct 10 06:38:02 2009 +0000 @@ -283,15 +283,16 @@ } if ( !glXExtensionSupported(this, "GLX_MESA_swap_control") ) { this->gl_data->glXSwapIntervalMESA = NULL; - this->gl_data->glXGetSwapIntervalMESA = NULL; } if ( this->gl_config.swap_control >= 0 ) { + int rc = -1; if ( this->gl_data->glXSwapIntervalMESA ) { - this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control); + rc = this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control); } else if ( this->gl_data->glXSwapIntervalSGI ) { - if (this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control) == 0) { - this->gl_data->sgi_swap_interval = this->gl_config.swap_control; - } + rc = this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control); + } + if (rc == 0) { + this->gl_data->swap_interval = this->gl_config.swap_control; } } #else @@ -412,11 +413,9 @@ } break; case SDL_GL_SWAP_CONTROL: - if ( this->gl_data->glXGetSwapIntervalMESA ) { - *value = this->gl_data->glXGetSwapIntervalMESA(); - return 0; - } else if ( this->gl_data->glXSwapIntervalSGI ) { - *value = this->gl_data->sgi_swap_interval; + if ( ( this->gl_data->glXSwapIntervalMESA ) || + ( this->gl_data->glXSwapIntervalSGI ) ) { + *value = this->gl_data->swap_interval; return 0; } else { unsupported = 1; @@ -469,7 +468,6 @@ this->gl_data->glXSwapBuffers = NULL; this->gl_data->glXSwapIntervalSGI = NULL; this->gl_data->glXSwapIntervalMESA = NULL; - this->gl_data->glXGetSwapIntervalMESA = NULL; this->gl_config.dll_handle = NULL; this->gl_config.driver_loaded = 0; @@ -530,8 +528,6 @@ (int (*)(int)) GL_LoadFunction(handle, "glXSwapIntervalSGI"); this->gl_data->glXSwapIntervalMESA = (GLint (*)(unsigned)) GL_LoadFunction(handle, "glXSwapIntervalMESA"); - this->gl_data->glXGetSwapIntervalMESA = - (GLint (*)(void)) GL_LoadFunction(handle, "glXGetSwapIntervalMESA"); if ( (this->gl_data->glXChooseVisual == NULL) || (this->gl_data->glXCreateContext == NULL) || diff -r 91c458013850 -r 485868a1c283 src/video/x11/SDL_x11gl_c.h --- a/src/video/x11/SDL_x11gl_c.h Sat Oct 10 05:21:31 2009 +0000 +++ b/src/video/x11/SDL_x11gl_c.h Sat Oct 10 06:38:02 2009 +0000 @@ -73,9 +73,7 @@ int (*glXSwapIntervalSGI) ( int interval ); GLint (*glXSwapIntervalMESA) ( unsigned interval ); - GLint (*glXGetSwapIntervalMESA) ( void ); - - int sgi_swap_interval; + int swap_interval; #endif /* SDL_VIDEO_OPENGL_GLX */ }; diff -r 91c458013850 -r 485868a1c283 src/video/x11/SDL_x11video.c --- a/src/video/x11/SDL_x11video.c Sat Oct 10 05:21:31 2009 +0000 +++ b/src/video/x11/SDL_x11video.c Sat Oct 10 06:38:02 2009 +0000 @@ -122,7 +122,7 @@ SDL_memset(device->gl_data, 0, (sizeof *device->gl_data)); #if SDL_VIDEO_OPENGL_GLX - device->gl_data->sgi_swap_interval = -1; + device->gl_data->swap_interval = -1; #endif /* Set the driver flags */