video: Only specify some GL context attributes if not the explicit default.

Just in case it upsets some OpenGL drivers unnecessarily.

Fixes #7730.

(cherry picked from commit d4bc393efebdd45a95430397df106b69b1c26df3)
This commit is contained in:
Ryan C. Gordon 2023-05-25 10:04:44 -04:00
parent 63b8af3558
commit a535cc62a0
No known key found for this signature in database
GPG key ID: FA148B892AB48044
2 changed files with 12 additions and 12 deletions

View file

@ -780,20 +780,20 @@ SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window *window)
attribs[iattr++] = _this->gl_config.flags; attribs[iattr++] = _this->gl_config.flags;
} }
/* only set if wgl extension is available */ /* only set if wgl extension is available and not the default setting */
if (_this->gl_data->HAS_WGL_ARB_context_flush_control) { if ((_this->gl_data->HAS_WGL_ARB_context_flush_control) && (_this->gl_config.release_behavior == 0)) {
attribs[iattr++] = WGL_CONTEXT_RELEASE_BEHAVIOR_ARB; attribs[iattr++] = WGL_CONTEXT_RELEASE_BEHAVIOR_ARB;
attribs[iattr++] = _this->gl_config.release_behavior ? WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; attribs[iattr++] = _this->gl_config.release_behavior ? WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;
} }
/* only set if wgl extension is available */ /* only set if wgl extension is available and not the default setting */
if (_this->gl_data->HAS_WGL_ARB_create_context_robustness) { if ((_this->gl_data->HAS_WGL_ARB_create_context_robustness) && (_this->gl_config.reset_notification != 0)) {
attribs[iattr++] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; attribs[iattr++] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB;
attribs[iattr++] = _this->gl_config.reset_notification ? WGL_LOSE_CONTEXT_ON_RESET_ARB : WGL_NO_RESET_NOTIFICATION_ARB; attribs[iattr++] = _this->gl_config.reset_notification ? WGL_LOSE_CONTEXT_ON_RESET_ARB : WGL_NO_RESET_NOTIFICATION_ARB;
} }
/* only set if wgl extension is available */ /* only set if wgl extension is available and not the default setting */
if (_this->gl_data->HAS_WGL_ARB_create_context_no_error) { if ((_this->gl_data->HAS_WGL_ARB_create_context_no_error) && (_this->gl_config.no_error != 0)) {
attribs[iattr++] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB; attribs[iattr++] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB;
attribs[iattr++] = _this->gl_config.no_error; attribs[iattr++] = _this->gl_config.no_error;
} }

View file

@ -749,22 +749,22 @@ SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window *window)
attribs[iattr++] = _this->gl_config.flags; attribs[iattr++] = _this->gl_config.flags;
} }
/* only set if glx extension is available */ /* only set if glx extension is available and not the default setting */
if (_this->gl_data->HAS_GLX_ARB_context_flush_control) { if ((_this->gl_data->HAS_GLX_ARB_context_flush_control) && (_this->gl_config.release_behavior == 0)) {
attribs[iattr++] = GLX_CONTEXT_RELEASE_BEHAVIOR_ARB; attribs[iattr++] = GLX_CONTEXT_RELEASE_BEHAVIOR_ARB;
attribs[iattr++] = attribs[iattr++] =
_this->gl_config.release_behavior ? GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; _this->gl_config.release_behavior ? GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB : GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB;
} }
/* only set if glx extension is available */ /* only set if glx extension is available and not the default setting */
if (_this->gl_data->HAS_GLX_ARB_create_context_robustness) { if ((_this->gl_data->HAS_GLX_ARB_create_context_robustness) && (_this->gl_config.reset_notification != 0)) {
attribs[iattr++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; attribs[iattr++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB;
attribs[iattr++] = attribs[iattr++] =
_this->gl_config.reset_notification ? GLX_LOSE_CONTEXT_ON_RESET_ARB : GLX_NO_RESET_NOTIFICATION_ARB; _this->gl_config.reset_notification ? GLX_LOSE_CONTEXT_ON_RESET_ARB : GLX_NO_RESET_NOTIFICATION_ARB;
} }
/* only set if glx extension is available */ /* only set if glx extension is available and not the default setting */
if (_this->gl_data->HAS_GLX_ARB_create_context_no_error) { if ((_this->gl_data->HAS_GLX_ARB_create_context_no_error) && (_this->gl_config.no_error != 0)) {
attribs[iattr++] = GLX_CONTEXT_OPENGL_NO_ERROR_ARB; attribs[iattr++] = GLX_CONTEXT_OPENGL_NO_ERROR_ARB;
attribs[iattr++] = _this->gl_config.no_error; attribs[iattr++] = _this->gl_config.no_error;
} }