0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

gl_common: get rid of symbol redefinition warnings with recent Mesa

Apparently newer Mesa versions changed their <GL/glx.h> header, and
unconditionally define GLX_CONTEXT_MAJOR_VERSION_ARB and others. This
clashed with gl_header_fixes.h, a header which quarantines bad hacks
to make compilation possible on systems with outdated GL headers.
Specifically, our header was included before glx.h, so the hacks were
always active, and somehow Mesa's glx.h used to deal with this by not
redefining existing identifiers.

Fix the gl_header_fixes.h logic so the hacks are checked after including
glx.h.
This commit is contained in:
wm4 2013-03-03 13:02:10 +01:00
parent ca893689fe
commit 979ce46c64
3 changed files with 17 additions and 0 deletions

View File

@ -1060,8 +1060,12 @@ static void swapGlBuffers_w32(MPGLContext *ctx)
#ifdef CONFIG_GL_X11
#include <X11/Xlib.h>
#include <GL/glx.h>
#include "x11_common.h"
#define MP_GET_GLX_WORKAROUNDS
#include "gl_header_fixes.h"
struct glx_context {
XVisualInfo *vinfo;
GLXContext context;

View File

@ -47,6 +47,7 @@
#include <GL/glext.h>
#endif
#define MP_GET_GL_WORKAROUNDS
#include "video/out/gl_header_fixes.h"
struct GL;

View File

@ -21,6 +21,8 @@
* version 2.1 of the License, or (at your option) any later version.
*/
#ifdef MP_GET_GL_WORKAROUNDS
// workaround for some gl.h headers
#ifndef GLAPIENTRY
#ifdef APIENTRY
@ -244,6 +246,12 @@
#endif
#endif
#undef MP_GET_GL_WORKAROUNDS
#endif
#ifdef MP_GET_GLX_WORKAROUNDS
// FreeBSD 10.0-CURRENT lacks the GLX_ARB_create_context extension completely
#ifndef GLX_CONTEXT_MAJOR_VERSION_ARB
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
@ -258,3 +266,7 @@
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#endif
#undef MP_GET_GLX_WORKAROUNDS
#endif