[vlc-devel] [PATCH 1/2] gl: add extension type in vlc_gl_t

Rémi Denis-Courmont remi at remlab.net
Wed Jun 21 15:32:00 CEST 2017


Le 21 juin 2017 16:14:31 GMT+03:00, Thomas Guillem <thomas at gllm.fr> a écrit :
>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
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

The whole point of separating provider and GL is that you don't call the provider-specific functions from the generic code.

This patcj is a big layering violation. No thanks.
-- 
Rémi Denis-Courmont
Typed on an inconvenient virtual keyboard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170621/640e4e3d/attachment.html>


More information about the vlc-devel mailing list