Commit 8c8764bf authored by Ryan C. Gordon's avatar Ryan C. Gordon

Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_control.

  Fixes Bugzilla #697.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%403947
parent 6e3f41a1
...@@ -289,7 +289,9 @@ int X11_GL_CreateContext(_THIS) ...@@ -289,7 +289,9 @@ int X11_GL_CreateContext(_THIS)
if ( this->gl_data->glXSwapIntervalMESA ) { if ( this->gl_data->glXSwapIntervalMESA ) {
this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control); this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control);
} else if ( this->gl_data->glXSwapIntervalSGI ) { } else if ( this->gl_data->glXSwapIntervalSGI ) {
this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control); if (this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control) != 0) {
this->gl_data->sgi_swap_interval = this->gl_config.swap_control;
}
} }
} }
#else #else
...@@ -412,7 +414,10 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) ...@@ -412,7 +414,10 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
case SDL_GL_SWAP_CONTROL: case SDL_GL_SWAP_CONTROL:
if ( this->gl_data->glXGetSwapIntervalMESA ) { if ( this->gl_data->glXGetSwapIntervalMESA ) {
*value = this->gl_data->glXGetSwapIntervalMESA(); *value = this->gl_data->glXGetSwapIntervalMESA();
return(0); return 0;
} else if ( this->gl_data->glXSwapIntervalSGI ) {
*value = this->gl_data->sgi_swap_interval;
return 0;
} else { } else {
unsupported = 1; unsupported = 1;
} }
......
...@@ -75,6 +75,7 @@ struct SDL_PrivateGLData { ...@@ -75,6 +75,7 @@ struct SDL_PrivateGLData {
GLint (*glXSwapIntervalMESA) ( unsigned interval ); GLint (*glXSwapIntervalMESA) ( unsigned interval );
GLint (*glXGetSwapIntervalMESA) ( void ); GLint (*glXGetSwapIntervalMESA) ( void );
int sgi_swap_interval;
#endif /* SDL_VIDEO_OPENGL_GLX */ #endif /* SDL_VIDEO_OPENGL_GLX */
}; };
......
...@@ -121,6 +121,8 @@ static SDL_VideoDevice *X11_CreateDevice(int devindex) ...@@ -121,6 +121,8 @@ static SDL_VideoDevice *X11_CreateDevice(int devindex)
SDL_memset(device->hidden, 0, (sizeof *device->hidden)); SDL_memset(device->hidden, 0, (sizeof *device->hidden));
SDL_memset(device->gl_data, 0, (sizeof *device->gl_data)); SDL_memset(device->gl_data, 0, (sizeof *device->gl_data));
device->gl_data->sgi_swap_interval = 1;
/* Set the driver flags */ /* Set the driver flags */
device->handles_any_size = 1; device->handles_any_size = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment