mirror of https://github.com/mpv-player/mpv
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
This commit is contained in:
parent
ef75d0ff26
commit
670a4a85a9
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue