src/video/windows/SDL_windowsopengl.c
changeset 9413 eb50f63a5777
parent 8735 2134fc16252b
child 9619 b94b6d0bff0f
equal deleted inserted replaced
9412:8b1436ce1028 9413:eb50f63a5777
    70 #endif
    70 #endif
    71 
    71 
    72 #ifndef WGL_ARB_framebuffer_sRGB
    72 #ifndef WGL_ARB_framebuffer_sRGB
    73 #define WGL_ARB_framebuffer_sRGB
    73 #define WGL_ARB_framebuffer_sRGB
    74 #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB                0x20A9
    74 #define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB                0x20A9
       
    75 #endif
       
    76 
       
    77 #ifndef WGL_ARB_context_flush_control
       
    78 #define WGL_ARB_context_flush_control
       
    79 #define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB   0x2097
       
    80 #define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB           0x0000
       
    81 #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB          0x2098
    75 #endif
    82 #endif
    76 
    83 
    77 typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC,
    84 typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC,
    78                                                             HGLRC
    85                                                             HGLRC
    79                                                             hShareContext,
    86                                                             hShareContext,
   401 
   408 
   402     /* Check for WGL_EXT_create_context_es2_profile */
   409     /* Check for WGL_EXT_create_context_es2_profile */
   403     _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_FALSE;
   410     _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_FALSE;
   404     if (HasExtension("WGL_EXT_create_context_es2_profile", extensions)) {
   411     if (HasExtension("WGL_EXT_create_context_es2_profile", extensions)) {
   405         _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE;
   412         _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE;
       
   413     }
       
   414 
       
   415     /* Check for GLX_ARB_context_flush_control */
       
   416     if (HasExtension("WGL_ARB_context_flush_control", extensions)) {
       
   417         _this->gl_data->HAS_WGL_ARB_context_flush_control = SDL_TRUE;
   406     }
   418     }
   407 
   419 
   408     _this->gl_data->wglMakeCurrent(hdc, NULL);
   420     _this->gl_data->wglMakeCurrent(hdc, NULL);
   409     _this->gl_data->wglDeleteContext(hglrc);
   421     _this->gl_data->wglDeleteContext(hglrc);
   410     ReleaseDC(hwnd, hdc);
   422     ReleaseDC(hwnd, hdc);
   646             wglGetProcAddress("wglCreateContextAttribsARB");
   658             wglGetProcAddress("wglCreateContextAttribsARB");
   647         if (!wglCreateContextAttribsARB) {
   659         if (!wglCreateContextAttribsARB) {
   648             SDL_SetError("GL 3.x is not supported");
   660             SDL_SetError("GL 3.x is not supported");
   649             context = temp_context;
   661             context = temp_context;
   650         } else {
   662         } else {
   651         /* max 8 attributes plus terminator */
   663         /* max 10 attributes plus terminator */
   652             int attribs[9] = {
   664             int attribs[11] = {
   653                 WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version,
   665                 WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version,
   654                 WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version,
   666                 WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version,
   655                 0
   667                 0
   656             };
   668             };
   657         int iattr = 4;
   669         int iattr = 4;
   664 
   676 
   665         /* SDL flags match WGL flags */
   677         /* SDL flags match WGL flags */
   666         if( _this->gl_config.flags != 0 ) {
   678         if( _this->gl_config.flags != 0 ) {
   667             attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB;
   679             attribs[iattr++] = WGL_CONTEXT_FLAGS_ARB;
   668         attribs[iattr++] = _this->gl_config.flags;
   680         attribs[iattr++] = _this->gl_config.flags;
       
   681         }
       
   682 
       
   683         /* only set if wgl extension is available */
       
   684         if( _this->gl_data->HAS_WGL_ARB_context_flush_control ) {
       
   685             attribs[iattr++] = WGL_CONTEXT_RELEASE_BEHAVIOR_ARB;
       
   686             attribs[iattr++] = _this->gl_config.release_behavior ?
       
   687                                     WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB :
       
   688                                     WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;
   669         }
   689         }
   670 
   690 
   671         attribs[iattr++] = 0;
   691         attribs[iattr++] = 0;
   672 
   692 
   673             /* Create the GL 3.x context */
   693             /* Create the GL 3.x context */