src/video/x11/SDL_x11opengl.c
changeset 2327 7b53a8401195
parent 2324 3202e4826c57
child 2698 e1da92da346c
child 2723 911db724ea24
equal deleted inserted replaced
2326:133562468ff2 2327:7b53a8401195
   470     XSync(display, False);
   470     XSync(display, False);
   471 
   471 
   472     return (status);
   472     return (status);
   473 }
   473 }
   474 
   474 
       
   475 /* 
       
   476    0 is a valid argument to glxSwapIntervalMESA and setting it to 0
       
   477    with the MESA version of the extension will undo the effect of a
       
   478    previous call with a value that is greater than zero (or at least
       
   479    that is what the FM says. OTOH, 0 is an invalid argument to
       
   480    glxSwapIntervalSGI and it returns an error if you call it with 0 as
       
   481    an argument.
       
   482 */
       
   483 
       
   484 static int swapinterval = -1;
   475 int
   485 int
   476 X11_GL_SetSwapInterval(_THIS, int interval)
   486 X11_GL_SetSwapInterval(_THIS, int interval)
   477 {
   487 {
   478     int status;
   488     int status;
   479 
   489 
   480     if (_this->gl_data->glXSwapIntervalMESA) {
   490     if (_this->gl_data->glXSwapIntervalMESA) {
   481         status = _this->gl_data->glXSwapIntervalMESA(interval);
   491         status = _this->gl_data->glXSwapIntervalMESA(interval);
   482         if (status != 0) {
   492         if (status != 0) {
   483             SDL_SetError("glxSwapIntervalMESA failed");
   493             SDL_SetError("glxSwapIntervalMESA failed");
   484             status = -1;
   494             status = -1;
       
   495         } else {
       
   496             swapinterval = interval;
   485         }
   497         }
   486     } else if (_this->gl_data->glXSwapIntervalSGI) {
   498     } else if (_this->gl_data->glXSwapIntervalSGI) {
   487         status = _this->gl_data->glXSwapIntervalSGI(interval);
   499         status = _this->gl_data->glXSwapIntervalSGI(interval);
   488         if (status != 0) {
   500         if (status != 0) {
   489             SDL_SetError("glxSwapIntervalSGI failed");
   501             SDL_SetError("glxSwapIntervalSGI failed");
   490             status = -1;
   502             status = -1;
       
   503         } else {
       
   504             swapinterval = interval;
   491         }
   505         }
   492     } else {
   506     } else {
   493         SDL_Unsupported();
   507         SDL_Unsupported();
   494         status = -1;
   508         status = -1;
   495     }
   509     }
   500 X11_GL_GetSwapInterval(_THIS)
   514 X11_GL_GetSwapInterval(_THIS)
   501 {
   515 {
   502     if (_this->gl_data->glXGetSwapIntervalMESA) {
   516     if (_this->gl_data->glXGetSwapIntervalMESA) {
   503         return _this->gl_data->glXGetSwapIntervalMESA();
   517         return _this->gl_data->glXGetSwapIntervalMESA();
   504     } else {
   518     } else {
   505         SDL_Unsupported();
   519         return swapinterval;
   506         return -1;
       
   507     }
   520     }
   508 }
   521 }
   509 
   522 
   510 void
   523 void
   511 X11_GL_SwapWindow(_THIS, SDL_Window * window)
   524 X11_GL_SwapWindow(_THIS, SDL_Window * window)