[vlc-devel] [PATCH 1/2] gl: add extension type in vlc_gl_t
Thomas Guillem
thomas at gllm.fr
Wed Jun 21 15:14:31 CEST 2017
Calling a EGL function while a GLX context is current or vice-versa seems to be
an undefined behaviour. See next commit.
---
include/vlc_opengl.h | 7 +++++++
modules/video_output/glx.c | 1 +
modules/video_output/opengl/egl.c | 1 +
modules/video_output/win32/wgl.c | 1 +
4 files changed, 10 insertions(+)
diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index 6642f78554..7510e3dbb8 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -45,6 +45,13 @@ struct vlc_gl_t
module_t *module;
void *sys;
+ enum {
+ VLC_GL_EXT_CUSTOM,
+ VLC_GL_EXT_EGL,
+ VLC_GL_EXT_GLX,
+ VLC_GL_EXT_WGL,
+ } ext;
+
int (*makeCurrent)(vlc_gl_t *);
void (*releaseCurrent)(vlc_gl_t *);
void (*resize)(vlc_gl_t *, unsigned, unsigned);
diff --git a/modules/video_output/glx.c b/modules/video_output/glx.c
index dc692e9a59..5aab26cfe9 100644
--- a/modules/video_output/glx.c
+++ b/modules/video_output/glx.c
@@ -202,6 +202,7 @@ static int Open (vlc_object_t *obj)
}
/* Initialize OpenGL callbacks */
+ gl->ext = VLC_GL_EXT_GLX;
gl->sys = sys;
gl->makeCurrent = MakeCurrent;
gl->releaseCurrent = ReleaseCurrent;
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index 22cf3545c9..085d513896 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -366,6 +366,7 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
sys->context = ctx;
/* Initialize OpenGL callbacks */
+ gl->ext = VLC_GL_EXT_EGL;
gl->makeCurrent = MakeCurrent;
gl->releaseCurrent = ReleaseCurrent;
gl->resize = Resize;
diff --git a/modules/video_output/win32/wgl.c b/modules/video_output/win32/wgl.c
index 3baee6e350..665df7436f 100644
--- a/modules/video_output/win32/wgl.c
+++ b/modules/video_output/win32/wgl.c
@@ -214,6 +214,7 @@ static int Open(vlc_object_t *object)
wglMakeCurrent(sys->hGLDC, NULL);
#endif
+ gl->ext = VLC_GL_EXT_WGL;
gl->makeCurrent = MakeCurrent;
gl->releaseCurrent = ReleaseCurrent;
gl->resize = NULL;
--
2.11.0
More information about the vlc-devel
mailing list