summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/common.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-04-07 14:30:51 +0200
committerwm4 <wm4@nowhere>2017-04-07 15:09:27 +0200
commiteb83ee4a4a03269ac6de296c9a1c01f68bb2e835 (patch)
tree65507b0aa83e705c8d6a6e661a1f4a843596466d /video/out/opengl/common.h
parentb7b12c36af96af14b8371d16c5a7f98a7a17915f (diff)
downloadmpv-eb83ee4a4a03269ac6de296c9a1c01f68bb2e835.tar.bz2
mpv-eb83ee4a4a03269ac6de296c9a1c01f68bb2e835.tar.xz
vo_opengl: add our own copy of OpenGL headers
gl_headers.h is basically header_fixes.h done consequently. It contains all OpenGL defines (and some typedefs) we need. We don't include GL headers provided by the system anymore. Some care has to be taken by certain windowing APIs including all of gl.h anyway. Then the definitions could clash. Fortunately, redefining preprocessor symbols to the same content is allowed and ignored. Also, redefining typedefs to the same thing is allowed in C11. Apparently the latter is not allowed in C99, so there is an imperfect attempt to avoid the typedefs if required API symbols are apparently present already. The nost risky part about this are the standard typedefs and GLAPIENTRY. The latter is different only on win32 (and at least consistently so). The typedefs are mostly based on stdint.h typedefs, which khrplatform.h clumsily emulates on platforms which don't have it. The biggest difference is that we define GLsizeiptr directly to ptrdiff_t, instead of checking for the _WIN64 symbol and defining it to long or long long. This also typedefs GLsync to __GLsync, just like the khronos headers. Although symbols prefixed with __ are implementation reserved, khronos also violates this rule, and having the same definition as khronos will avoid problems on duplicate definitions. We can simplify the build scripts too. The ios-gl check seems a bit wrong now (what we really want to test for is EAGLContext), but I can't test and thus can't improve it. cuda_dynamic.h redefined two GL symbols; just include the new headers directly instead.
Diffstat (limited to 'video/out/opengl/common.h')
-rw-r--r--video/out/opengl/common.h18
1 files changed, 1 insertions, 17 deletions
diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h
index 258e6b30c0..11cc37ba8a 100644
--- a/video/out/opengl/common.h
+++ b/video/out/opengl/common.h
@@ -31,28 +31,12 @@
#include "video/mp_image.h"
-#if HAVE_GL_COCOA
-#define GL_DO_NOT_WARN_IF_MULTI_GL_VERSION_HEADERS_INCLUDED 1
-#include <OpenGL/gl.h>
-#include <OpenGL/gl3.h>
-#include <OpenGL/glext.h>
-#elif HAVE_IOS_GL
-#include <OpenGLES/ES2/glext.h>
-#include <OpenGLES/ES3/glext.h>
-#elif HAVE_STANDARD_GLES3
-#include <GLES3/gl3.h>
-#else
-#include <GL/gl.h>
-#include <GL/glext.h>
-#endif
+#include "gl_headers.h"
#if HAVE_GL_WIN32
#include <windows.h>
#endif
-#define MP_GET_GL_WORKAROUNDS
-#include "header_fixes.h"
-
struct GL;
typedef struct GL GL;