src/video/windows/SDL_windowsopengl.c
changeset 6382 64d54101773a
parent 6380 3990b7d564d7
child 6383 869effc44c41
     1.1 --- a/src/video/windows/SDL_windowsopengl.c	Tue Jul 31 16:55:09 2012 -0700
     1.2 +++ b/src/video/windows/SDL_windowsopengl.c	Wed Aug 01 20:29:36 2012 -0400
     1.3 @@ -112,10 +112,6 @@
     1.4          GetProcAddress(handle, "wglDeleteContext");
     1.5      _this->gl_data->wglMakeCurrent = (BOOL(WINAPI *) (HDC, HGLRC))
     1.6          GetProcAddress(handle, "wglMakeCurrent");
     1.7 -    _this->gl_data->wglSwapIntervalEXT = (void (WINAPI *) (int))
     1.8 -        GetProcAddress(handle, "wglSwapIntervalEXT");
     1.9 -    _this->gl_data->wglGetSwapIntervalEXT = (int (WINAPI *) (void))
    1.10 -        GetProcAddress(handle, "wglGetSwapIntervalEXT");
    1.11  
    1.12      if (!_this->gl_data->wglGetProcAddress ||
    1.13          !_this->gl_data->wglCreateContext ||
    1.14 @@ -341,7 +337,7 @@
    1.15      }
    1.16  
    1.17      /* Check for WGL_ARB_pixel_format */
    1.18 -    _this->gl_data->WGL_ARB_pixel_format = 0;
    1.19 +    _this->gl_data->HAS_WGL_ARB_pixel_format = SDL_FALSE;
    1.20      if (HasExtension("WGL_ARB_pixel_format", extensions)) {
    1.21          _this->gl_data->wglChoosePixelFormatARB = (BOOL(WINAPI *)
    1.22                                                     (HDC, const int *,
    1.23 @@ -354,16 +350,20 @@
    1.24  
    1.25          if ((_this->gl_data->wglChoosePixelFormatARB != NULL) &&
    1.26              (_this->gl_data->wglGetPixelFormatAttribivARB != NULL)) {
    1.27 -            _this->gl_data->WGL_ARB_pixel_format = 1;
    1.28 +            _this->gl_data->HAS_WGL_ARB_pixel_format = SDL_TRUE;
    1.29          }
    1.30      }
    1.31  
    1.32      /* Check for WGL_EXT_swap_control */
    1.33 +    _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_FALSE;
    1.34      if (HasExtension("WGL_EXT_swap_control", extensions)) {
    1.35          _this->gl_data->wglSwapIntervalEXT =
    1.36              WIN_GL_GetProcAddress(_this, "wglSwapIntervalEXT");
    1.37          _this->gl_data->wglGetSwapIntervalEXT =
    1.38              WIN_GL_GetProcAddress(_this, "wglGetSwapIntervalEXT");
    1.39 +        if (HasExtension("WGL_EXT_swap_control_tear", extensions)) {
    1.40 +            _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_TRUE;
    1.41 +        }
    1.42      } else {
    1.43          _this->gl_data->wglSwapIntervalEXT = NULL;
    1.44          _this->gl_data->wglGetSwapIntervalEXT = NULL;
    1.45 @@ -397,7 +397,7 @@
    1.46  
    1.47          WIN_GL_InitExtensions(_this, hdc);
    1.48  
    1.49 -        if (_this->gl_data->WGL_ARB_pixel_format) {
    1.50 +        if (_this->gl_data->HAS_WGL_ARB_pixel_format) {
    1.51              _this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs,
    1.52                                                      1, &pixel_format,
    1.53                                                      &matching);
    1.54 @@ -611,7 +611,9 @@
    1.55  int
    1.56  WIN_GL_SetSwapInterval(_THIS, int interval)
    1.57  {
    1.58 -    if (_this->gl_data->wglSwapIntervalEXT) {
    1.59 +    if ((interval < 0) && (!_this->gl_data->HAS_WGL_EXT_swap_control_tear)) {
    1.60 +        SDL_SetError("Negative swap interval unsupported in this GL");
    1.61 +    } else if (_this->gl_data->wglSwapIntervalEXT) {
    1.62          _this->gl_data->wglSwapIntervalEXT(interval);
    1.63          return 0;
    1.64      } else {
    1.65 @@ -626,8 +628,8 @@
    1.66      if (_this->gl_data->wglGetSwapIntervalEXT) {
    1.67          return _this->gl_data->wglGetSwapIntervalEXT();
    1.68      } else {
    1.69 -        SDL_Unsupported();
    1.70 -        return -1;
    1.71 +        /*SDL_Unsupported();*/
    1.72 +        return 0;  /* just say we're unsync'd. */
    1.73      }
    1.74  }
    1.75