[vlc-devel] [PATCH 7/8] opengl: add vlc_gl_GetCoreProcAddress
Thomas Guillem
thomas at gllm.fr
Wed May 23 09:19:27 CEST 2018
- Same implementation than vlc_gl_GetProcAddress for GLX, ios, macos.
- NULL for WGL
- Depending on EGL_KHR_get_all_proc_addresses for egl
---
include/vlc_opengl.h | 6 ++++++
modules/video_output/caopengllayer.m | 2 +-
modules/video_output/glx.c | 2 +-
modules/video_output/ios.m | 2 +-
modules/video_output/macosx.m | 2 +-
modules/video_output/opengl/egl.c | 4 ++++
6 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
index 178d1587da..83324e25aa 100644
--- a/include/vlc_opengl.h
+++ b/include/vlc_opengl.h
@@ -50,6 +50,7 @@ struct vlc_gl_t
void (*resize)(vlc_gl_t *, unsigned, unsigned);
void (*swap)(vlc_gl_t *);
void*(*getProcAddress)(vlc_gl_t *, const char *);
+ void*(*getCoreProcAddress)(vlc_gl_t *, const char *);
enum {
VLC_GL_EXT_DEFAULT,
@@ -112,6 +113,11 @@ static inline void *vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)
return gl->getProcAddress(gl, name);
}
+static inline void *vlc_gl_GetCoreProcAddress(vlc_gl_t *gl, const char *name)
+{
+ return gl->getCoreProcAddress ? gl->getCoreProcAddress(gl, name) : NULL;
+}
+
VLC_API vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *,
const struct vout_window_cfg_t *,
struct vout_window_t **) VLC_USED;
diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
index b690ce0f21..57a89ae4f1 100644
--- a/modules/video_output/caopengllayer.m
+++ b/modules/video_output/caopengllayer.m
@@ -173,7 +173,7 @@ static int Open (vlc_object_t *p_this)
sys->gl->makeCurrent = OpenglLock;
sys->gl->releaseCurrent = OpenglUnlock;
sys->gl->swap = OpenglSwap;
- sys->gl->getProcAddress = OurGetProcAddress;
+ sys->gl->getProcAddress = sys->gl->getCoreProcAddress = OurGetProcAddress;
struct gl_sys *glsys = sys->gl->sys = malloc(sizeof(*glsys));
if (!sys->gl->sys)
diff --git a/modules/video_output/glx.c b/modules/video_output/glx.c
index 17188f24b2..38b97db096 100644
--- a/modules/video_output/glx.c
+++ b/modules/video_output/glx.c
@@ -207,7 +207,7 @@ static int Open (vlc_object_t *obj)
gl->releaseCurrent = ReleaseCurrent;
gl->resize = NULL;
gl->swap = SwapBuffers;
- gl->getProcAddress = GetSymbol;
+ gl->getProcAddress = gl->getCoreProcAddress = GetSymbol;
bool is_swap_interval_set = false;
diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 36075488b7..7daa0b2aa5 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -192,7 +192,7 @@ static int Open(vlc_object_t *this)
sys->gl->makeCurrent = GLESMakeCurrent;
sys->gl->releaseCurrent = GLESReleaseCurrent;
sys->gl->swap = GLESSwap;
- sys->gl->getProcAddress = OurGetProcAddress;
+ sys->gl->getProcAddress = sys->gl->getCoreProcAddress = OurGetProcAddress;
if (vlc_gl_MakeCurrent(sys->gl) != VLC_SUCCESS)
goto bailout;
diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index 406281db0d..967e8648ae 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -214,7 +214,7 @@ static int Open (vlc_object_t *this)
sys->gl->makeCurrent = OpenglLock;
sys->gl->releaseCurrent = OpenglUnlock;
sys->gl->swap = OpenglSwap;
- sys->gl->getProcAddress = OurGetProcAddress;
+ sys->gl->getProcAddress = sys->gl->getCoreProcAddress = OurGetProcAddress;
var_SetAddress(vd->obj.parent, "macosx-glcontext",
[[sys->glView openGLContext] CGLContextObj]);
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index 4543f2d66a..a300d37408 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -394,6 +394,10 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)
gl->resize = Resize;
gl->swap = SwapBuffers;
gl->getProcAddress = GetSymbol;
+ if (ext && vlc_gl_HasExtension(ext, "EGL_KHR_get_all_proc_addresses"))
+ gl->getCoreProcAddress = GetSymbol;
+ else
+ gl->getCoreProcAddress = NULL;
gl->egl.queryString = QueryString;
sys->eglCreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");
--
2.17.0
More information about the vlc-devel
mailing list