src/video/windows/SDL_windowsopengl.c
changeset 7401 698995795574
parent 7191 75360622e65f
child 7412 50211a1fd557
     1.1 --- a/src/video/windows/SDL_windowsopengl.c	Thu Jul 11 01:09:45 2013 -0400
     1.2 +++ b/src/video/windows/SDL_windowsopengl.c	Thu Jul 11 12:17:13 2013 -0400
     1.3 @@ -425,6 +425,7 @@
     1.4      int pixel_format = 0;
     1.5      int iAttribs[64];
     1.6      int *iAttr;
     1.7 +    int *iAccelAttr;
     1.8      float fAttribs[1] = { 0 };
     1.9  
    1.10      WIN_GL_SetupPixelFormat(_this, &pfd);
    1.11 @@ -492,18 +493,28 @@
    1.12          *iAttr++ = _this->gl_config.multisamplesamples;
    1.13      }
    1.14  
    1.15 +    /* We always choose either FULL or NO accel on Windows, because of flaky
    1.16 +       drivers. If the app didn't specify, we use FULL, because that's
    1.17 +       probably what they wanted (and if you didn't care and got FULL, that's
    1.18 +       a perfectly valid result in any case). */
    1.19      *iAttr++ = WGL_ACCELERATION_ARB;
    1.20 -    *iAttr++ = WGL_FULL_ACCELERATION_ARB;
    1.21 +    iAccelAttr = iAttr;
    1.22 +    if (_this->gl_config.accelerated) {
    1.23 +        *iAttr++ = WGL_FULL_ACCELERATION_ARB;
    1.24 +    } else {
    1.25 +        *iAttr++ = WGL_NO_ACCELERATION_ARB;
    1.26 +    }
    1.27  
    1.28      *iAttr = 0;
    1.29  
    1.30      /* Choose and set the closest available pixel format */
    1.31 -    if (_this->gl_config.accelerated != 0) {
    1.32 +    pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs);
    1.33 +
    1.34 +    /* App said "don't care about accel" and FULL accel failed. Try NO. */
    1.35 +    if ( ( !pixel_format ) && ( _this->gl_config.accelerated < 0 ) ) {
    1.36 +        *iAccelAttr = WGL_NO_ACCELERATION_ARB;
    1.37          pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs);
    1.38 -    }
    1.39 -    if (!pixel_format && _this->gl_config.accelerated != 1) {
    1.40 -        iAttr[-1] = WGL_NO_ACCELERATION_ARB;
    1.41 -    pixel_format = WIN_GL_ChoosePixelFormatARB(_this, iAttribs, fAttribs);
    1.42 +        *iAccelAttr = WGL_FULL_ACCELERATION_ARB;  /* if we try again. */
    1.43      }
    1.44      if (!pixel_format) {
    1.45          pixel_format = WIN_GL_ChoosePixelFormat(hdc, &pfd);