mirror of
https://github.com/mpv-player/mpv
synced 2025-01-10 08:59:45 +00:00
d47dff3faa
These extensions use a bunch of EGL types, so we need to include the EGL headers in common.h to use our GL function loader with this. In the future, we should probably require presence of the EGL headers to reduce the hacks. This might be not so simple at least with OSX, so for now this has to do.
117 lines
3.5 KiB
C
117 lines
3.5 KiB
C
/*
|
|
* This file is part of mpv.
|
|
*
|
|
* mpv is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* You can alternatively redistribute this file 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.
|
|
*/
|
|
|
|
#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
|
|
#endif
|
|
|
|
typedef void *MP_voidptr;
|
|
|
|
#ifndef GL_OES_EGL_image
|
|
#define GLeglImageOES MP_voidptr
|
|
#endif
|
|
#ifndef EGL_KHR_image
|
|
#define EGLImageKHR MP_voidptr
|
|
#endif
|
|
|
|
#if !HAVE_EGL
|
|
#define EGLBoolean unsigned int
|
|
#define EGLenum unsigned int
|
|
#define EGLint int
|
|
#define EGLContext MP_voidptr
|
|
#define EGLDisplay MP_voidptr
|
|
#define EGLClientBuffer MP_voidptr
|
|
#define EGLAPIENTRY GLAPIENTRY
|
|
#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
|
|
|
|
#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
|