src/video/x11/SDL_x11opengl.c
changeset 9412 8b1436ce1028
parent 9355 0d1e81f10b7e
child 9458 543298b36b28
equal deleted inserted replaced
9411:6810478a60e9 9412:8b1436ce1028
   118 #define GLX_MAX_SWAP_INTERVAL_EXT          0x20F2
   118 #define GLX_MAX_SWAP_INTERVAL_EXT          0x20F2
   119 #endif
   119 #endif
   120 
   120 
   121 #ifndef GLX_EXT_swap_control_tear
   121 #ifndef GLX_EXT_swap_control_tear
   122 #define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
   122 #define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
       
   123 #endif
       
   124 
       
   125 #ifndef GLX_ARB_context_flush_control
       
   126 #define GLX_ARB_context_flush_control
       
   127 #define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB   0x2097
       
   128 #define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB           0x0000
       
   129 #define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB          0x2098
   123 #endif
   130 #endif
   124 
   131 
   125 #define OPENGL_REQUIRES_DLOPEN
   132 #define OPENGL_REQUIRES_DLOPEN
   126 #if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
   133 #if defined(OPENGL_REQUIRES_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
   127 #include <dlfcn.h>
   134 #include <dlfcn.h>
   373     
   380     
   374     /* Check for GLX_EXT_create_context_es2_profile */
   381     /* Check for GLX_EXT_create_context_es2_profile */
   375     if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) {
   382     if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) {
   376         _this->gl_data->HAS_GLX_EXT_create_context_es2_profile = SDL_TRUE;
   383         _this->gl_data->HAS_GLX_EXT_create_context_es2_profile = SDL_TRUE;
   377     }
   384     }
       
   385 
       
   386     /* Check for GLX_ARB_context_flush_control */
       
   387     if (HasExtension("GLX_ARB_context_flush_control", extensions)) {
       
   388         _this->gl_data->HAS_GLX_ARB_context_flush_control = SDL_TRUE;
       
   389     }
   378 }
   390 }
   379 
   391 
   380 /* glXChooseVisual and glXChooseFBConfig have some small differences in
   392 /* glXChooseVisual and glXChooseFBConfig have some small differences in
   381  * the attribute encoding, it can be chosen with the for_FBConfig parameter.
   393  * the attribute encoding, it can be chosen with the for_FBConfig parameter.
   382  */
   394  */
   579             _this->gl_config.flags == 0) {
   591             _this->gl_config.flags == 0) {
   580             /* Create legacy context */
   592             /* Create legacy context */
   581             context =
   593             context =
   582                 _this->gl_data->glXCreateContext(display, vinfo, share_context, True);
   594                 _this->gl_data->glXCreateContext(display, vinfo, share_context, True);
   583         } else {
   595         } else {
   584             /* max 8 attributes plus terminator */
   596             /* max 10 attributes plus terminator */
   585             int attribs[9] = {
   597             int attribs[11] = {
   586                 GLX_CONTEXT_MAJOR_VERSION_ARB,
   598                 GLX_CONTEXT_MAJOR_VERSION_ARB,
   587                 _this->gl_config.major_version,
   599                 _this->gl_config.major_version,
   588                 GLX_CONTEXT_MINOR_VERSION_ARB,
   600                 GLX_CONTEXT_MINOR_VERSION_ARB,
   589                 _this->gl_config.minor_version,
   601                 _this->gl_config.minor_version,
   590                 0
   602                 0
   599 
   611 
   600             /* SDL flags match GLX flags */
   612             /* SDL flags match GLX flags */
   601             if( _this->gl_config.flags != 0 ) {
   613             if( _this->gl_config.flags != 0 ) {
   602                 attribs[iattr++] = GLX_CONTEXT_FLAGS_ARB;
   614                 attribs[iattr++] = GLX_CONTEXT_FLAGS_ARB;
   603                 attribs[iattr++] = _this->gl_config.flags;
   615                 attribs[iattr++] = _this->gl_config.flags;
       
   616             }
       
   617 
       
   618             /* only set if glx extension is available */
       
   619             if( _this->gl_data->HAS_GLX_ARB_context_flush_control ) {
       
   620                 attribs[iattr++] = GLX_CONTEXT_RELEASE_BEHAVIOR_ARB;
       
   621                 attribs[iattr++] = 
       
   622                     _this->gl_config.release_behavior ? 
       
   623                     GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : 
       
   624                     GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;
   604             }
   625             }
   605 
   626 
   606             attribs[iattr++] = 0;
   627             attribs[iattr++] = 0;
   607 
   628 
   608             /* Get a pointer to the context creation function for GL 3.0 */
   629             /* Get a pointer to the context creation function for GL 3.0 */