summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context_w32.c
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/context_w32.c
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/context_w32.c')
-rw-r--r--video/out/opengl/context_w32.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/video/out/opengl/context_w32.c b/video/out/opengl/context_w32.c
index 4c477642db..eb6123967b 100644
--- a/video/out/opengl/context_w32.c
+++ b/video/out/opengl/context_w32.c
@@ -24,6 +24,19 @@
#include "video/out/win32/exclusive_hack.h"
#include "context.h"
+#if !defined(WGL_CONTEXT_MAJOR_VERSION_ARB)
+/* these are supposed to be defined in wingdi.h but mingw's is too old */
+/* only the bits actually used by mplayer are defined */
+/* reference: http://www.opengl.org/registry/specs/ARB/wgl_create_context.txt */
+
+#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define WGL_CONTEXT_FLAGS_ARB 0x2094
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#endif
+
struct w32_context {
int opt_swapinterval;
int current_swapinterval;