src/video/x11/SDL_x11opengl.c
changeset 2327 7b53a8401195
parent 2324 3202e4826c57
child 2698 e1da92da346c
child 2723 911db724ea24
     1.1 --- a/src/video/x11/SDL_x11opengl.c	Fri Mar 07 21:01:54 2008 +0000
     1.2 +++ b/src/video/x11/SDL_x11opengl.c	Fri Mar 07 23:57:15 2008 +0000
     1.3 @@ -472,6 +472,16 @@
     1.4      return (status);
     1.5  }
     1.6  
     1.7 +/* 
     1.8 +   0 is a valid argument to glxSwapIntervalMESA and setting it to 0
     1.9 +   with the MESA version of the extension will undo the effect of a
    1.10 +   previous call with a value that is greater than zero (or at least
    1.11 +   that is what the FM says. OTOH, 0 is an invalid argument to
    1.12 +   glxSwapIntervalSGI and it returns an error if you call it with 0 as
    1.13 +   an argument.
    1.14 +*/
    1.15 +
    1.16 +static int swapinterval = -1;
    1.17  int
    1.18  X11_GL_SetSwapInterval(_THIS, int interval)
    1.19  {
    1.20 @@ -482,12 +492,16 @@
    1.21          if (status != 0) {
    1.22              SDL_SetError("glxSwapIntervalMESA failed");
    1.23              status = -1;
    1.24 +        } else {
    1.25 +            swapinterval = interval;
    1.26          }
    1.27      } else if (_this->gl_data->glXSwapIntervalSGI) {
    1.28          status = _this->gl_data->glXSwapIntervalSGI(interval);
    1.29          if (status != 0) {
    1.30              SDL_SetError("glxSwapIntervalSGI failed");
    1.31              status = -1;
    1.32 +        } else {
    1.33 +            swapinterval = interval;
    1.34          }
    1.35      } else {
    1.36          SDL_Unsupported();
    1.37 @@ -502,8 +516,7 @@
    1.38      if (_this->gl_data->glXGetSwapIntervalMESA) {
    1.39          return _this->gl_data->glXGetSwapIntervalMESA();
    1.40      } else {
    1.41 -        SDL_Unsupported();
    1.42 -        return -1;
    1.43 +        return swapinterval;
    1.44      }
    1.45  }
    1.46