From 670a4a85a9bb305f6757cafcfe0f88c89c1f5bc2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 20 Nov 2012 17:52:32 +0100 Subject: [PATCH] gl_common: improve Mesa compatibility for GL3 context creation Don't request CONTEXT_FORWARD_COMPATIBLE when creating a GL3 context on X11. This improves compatibility with some Mesa drivers. Setting this bit was originally intended to make the code compatible to newer (future, possibly not yet existing) OpenGL implementations. These implementations wouldn't have to support deprecated legacy GL features, which we know that we don't use, and could return a context with a higher OpenGL version than requested. In practice, this didn't work out. CONTEXT_FORWARD_COMPATIBLE requires the driver to explicitly disable deprecated functionality. If it doesn't do that, it has to reject context creation with that flag set. And it turns out there are Mesa drivers which suffer from this caveat. See [1]. This probably also means that a GL application with a fixed set of required GL features (such as a subset of GL 3.2 core, like vo_opengl.c) may need to probe several GL versions if drivers really start dropping legacy GL. On Windows, CONTEXT_FORWARD_COMPATIBLE is still set. It is not known if this is ideal, but fortunately there is no Mesa on Windows. CONTEXT_CORE_PROFILE is still always set. For requested GL versions lower than 3.2, this flag is ignored. Should we requires higher versions later, we want it to be set, so don't remove it. [1] https://bugs.freedesktop.org/show_bug.cgi?id=57241 --- video/out/gl_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 8f4ef3525a..06c208f36e 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -2402,8 +2402,8 @@ static bool create_window_x11_gl3(struct MPGLContext *ctx, uint32_t d_width, GLX_CONTEXT_MAJOR_VERSION_ARB, MPGL_VER_GET_MAJOR(gl_version), GLX_CONTEXT_MINOR_VERSION_ARB, MPGL_VER_GET_MINOR(gl_version), GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, - GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB - | (flags & VOFLAG_GL_DEBUG ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), + GLX_CONTEXT_FLAGS_ARB, + flags & VOFLAG_GL_DEBUG ? GLX_CONTEXT_DEBUG_BIT_ARB : 0, None }; GLXContext context = glXCreateContextAttribsARB(vo->x11->display,