summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/header_fixes.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/header_fixes.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/header_fixes.h')
-rw-r--r--video/out/opengl/header_fixes.h145
1 files changed, 0 insertions, 145 deletions
diff --git a/video/out/opengl/header_fixes.h b/video/out/opengl/header_fixes.h
deleted file mode 100644
index 5e7d30366c..0000000000
--- a/video/out/opengl/header_fixes.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * This file is part of mpv.
- *
- * mpv is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * mpv is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with mpv. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef MP_GET_GL_WORKAROUNDS
-
-// workaround for some gl.h headers
-#ifndef GLAPIENTRY
-#ifdef APIENTRY
-#define GLAPIENTRY APIENTRY
-#elif HAVE_GL_WIN32
-#define GLAPIENTRY __stdcall
-#else
-#define GLAPIENTRY
-#endif
-#endif
-
-#ifndef GL_TEXTURE_RECTANGLE
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#endif
-#ifndef GL_UNSIGNED_SHORT_8_8
-#define GL_UNSIGNED_SHORT_8_8 0x85BA
-#endif
-#ifndef GL_UNSIGNED_SHORT_8_8_REV
-#define GL_UNSIGNED_SHORT_8_8_REV 0x85BB
-#endif
-
-#if HAVE_GL_WIN32 && !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
-
-#ifndef GL_NV_vdpau_interop
-#define GLvdpauSurfaceNV GLintptr
-#define GL_WRITE_DISCARD_NV 0x88BE
-#endif
-
-#ifndef GL_DEBUG_SEVERITY_HIGH
-#define GL_DEBUG_SEVERITY_HIGH 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
-#define GL_DEBUG_SEVERITY_LOW 0x9148
-#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
-#endif
-
-#ifndef GL_BACK_LEFT
-#define GL_BACK_LEFT 0x0402
-#endif
-
-// Desktop symbols we need in addition to standard GLES 3.0 symbols.
-// Might also include GLES 3.1, 3.2, etc. symbols.
-#if HAVE_STANDARD_GLES3 || HAVE_IOS_GL
-#define GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_BGR 0x80E0
-#define GL_BGRA 0x80E1
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_WRITE_ONLY 0x88B9
-#define GL_RGB16 0x8054
-#define GL_RGB10 0x8052
-#define GL_RGBA12 0x805A
-#define GL_RGBA16 0x805B
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_LUMINANCE_SIZE 0x8060
-#define GL_R16 0x822A
-#define GL_RG16 0x822C
-#define GL_LUMINANCE8 0x8040
-#define GL_LUMINANCE8_ALPHA8 0x8045
-#define GL_LUMINANCE16 0x8042
-#define GL_LUMINANCE16_ALPHA16 0x8048
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#endif
-
-// GL_ARB_timer_query and EXT_disjoint_timer_query
-#ifndef GL_TIME_ELAPSED
-// Same as GL_TIME_ELAPSED_EXT
-#define GL_TIME_ELAPSED 0x88BF
-#endif
-
-// GL_OES_EGL_image_external, GL_NV_EGL_stream_consumer_external
-#ifndef GL_TEXTURE_EXTERNAL_OES
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#endif
-
-// GL_ANGLE_translated_shader_source
-#ifndef GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE
-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
-#endif
-
-#ifndef GL_RGB_RAW_422_APPLE
-#define GL_RGB_RAW_422_APPLE 0x8A51
-#endif
-
-#undef MP_GET_GL_WORKAROUNDS
-
-#endif // MP_GET_GL_WORKAROUNDS
-
-#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
-#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define GLX_CONTEXT_FLAGS_ARB 0x2094
-#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
-#ifndef __APPLE__
-// These are respectively 0x00000001 and 0x00000002 on OSX
-#define GLX_CONTEXT_DEBUG_BIT_ARB 0x0001
-#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
-#endif
-#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#endif
-// GLX_EXT_create_context_es2_profile
-#ifndef GLX_CONTEXT_ES2_PROFILE_BIT_EXT
-#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
-#endif
-
-#undef MP_GET_GLX_WORKAROUNDS
-
-#endif