src/video/x11/SDL_x11opengl.c
changeset 9412 8b1436ce1028
parent 9355 0d1e81f10b7e
child 9458 543298b36b28
     1.1 --- a/src/video/x11/SDL_x11opengl.c	Fri Mar 20 11:51:03 2015 -0400
     1.2 +++ b/src/video/x11/SDL_x11opengl.c	Fri Mar 06 16:03:40 2015 +0000
     1.3 @@ -122,6 +122,13 @@
     1.4  #define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
     1.5  #endif
     1.6  
     1.7 +#ifndef GLX_ARB_context_flush_control
     1.8 +#define GLX_ARB_context_flush_control
     1.9 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB   0x2097
    1.10 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB           0x0000
    1.11 +#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB          0x2098
    1.12 +#endif
    1.13 +
    1.14  #define OPENGL_REQUIRES_DLOPEN
    1.15  #if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
    1.16  #include <dlfcn.h>
    1.17 @@ -375,6 +382,11 @@
    1.18      if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) {
    1.19          _this->gl_data->HAS_GLX_EXT_create_context_es2_profile = SDL_TRUE;
    1.20      }
    1.21 +
    1.22 +    /* Check for GLX_ARB_context_flush_control */
    1.23 +    if (HasExtension("GLX_ARB_context_flush_control", extensions)) {
    1.24 +        _this->gl_data->HAS_GLX_ARB_context_flush_control = SDL_TRUE;
    1.25 +    }
    1.26  }
    1.27  
    1.28  /* glXChooseVisual and glXChooseFBConfig have some small differences in
    1.29 @@ -581,8 +593,8 @@
    1.30              context =
    1.31                  _this->gl_data->glXCreateContext(display, vinfo, share_context, True);
    1.32          } else {
    1.33 -            /* max 8 attributes plus terminator */
    1.34 -            int attribs[9] = {
    1.35 +            /* max 10 attributes plus terminator */
    1.36 +            int attribs[11] = {
    1.37                  GLX_CONTEXT_MAJOR_VERSION_ARB,
    1.38                  _this->gl_config.major_version,
    1.39                  GLX_CONTEXT_MINOR_VERSION_ARB,
    1.40 @@ -603,6 +615,15 @@
    1.41                  attribs[iattr++] = _this->gl_config.flags;
    1.42              }
    1.43  
    1.44 +            /* only set if glx extension is available */
    1.45 +            if( _this->gl_data->HAS_GLX_ARB_context_flush_control ) {
    1.46 +                attribs[iattr++] = GLX_CONTEXT_RELEASE_BEHAVIOR_ARB;
    1.47 +                attribs[iattr++] = 
    1.48 +                    _this->gl_config.release_behavior ? 
    1.49 +                    GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : 
    1.50 +                    GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;
    1.51 +            }
    1.52 +
    1.53              attribs[iattr++] = 0;
    1.54  
    1.55              /* Get a pointer to the context creation function for GL 3.0 */