[vlc-devel] [PATCH] video_output: refactor vlc_gl_api into opengl providers

Romain Vimont rom1v at videolabs.io
Mon Sep 21 13:09:06 CEST 2020


Hi,

LGTM (except one missing release call, see comment inline)

Regards

On Mon, Sep 21, 2020 at 12:58:55PM +0200, Alexandre Janniaux wrote:
> This is part 4/ of the RFC OpenGL filter refactor implementation aiming
> at reworking the OpenGL providers to be the sole linker to OpenGL
> libraries.
> 
> Currently, OpenGL providers are linking the provider libraries like EGL,
> GLX, or CoreVideo but OpenGL is already sometimes needed to those kind
> of modules. But in the general case, OpenGL / OpenGL ES must be linked
> to the clinets modules, using the VLC OpenGL vtable because they need to
> load it themselves and it's not always done in a dynamic way through
> GetProcAddress mechanisms.
> 
> Instead, link OpenGL / OpenGL ES to the provider modules bringing the
> OpenGL features themselves. In particular, on Apple systems, it avoid
> the need to link OpenGL framework to every OpenGL users, thus needing
> special handling in buildsystem, and on other systems exposing both
> OpenGL and OpenGL ES, it prepares to have different targets for both
> variants in the future too.
> 
> It also prepares defining tools for automatically testing shaders even
> though they would be generated dynamically during runtime, and defining
> layers for debugging purpose.
> 
> This is also fixing the current issues on Windows where the functions
> are dynamically loaded through WGL, but not found instead of being
> dynamically linked like the Windows environment expects.
> 
> The last pain point for independence stem from the OpenGL headers
> themselves which are different between OpenGL and OpenGL ES. Note that
> this patchset doesn't do the necessary refactor to avoid using `gl`
> pointer in OpenGL code that would only use the `api` field, so there are
> multiple places in which some modules actually have access to different
> api pointer, though it's the same. Given the complexity for testing this
> code, and the fact it fixes the Windows GL provider too, I evaluated
> that merging it first was an acceptable tradeoff and it is left for a
> future refactor.
> 
> Tested on iOS, MacOSX (macosx.m), Windows and Linux.
> ---
>  include/vlc_opengl.h                      |  2 ++
>  modules/video_output/Makefile.am          | 26 ++++++++++++++++-------
>  modules/video_output/caopengllayer.m      | 25 ++++++++++++++++------
>  modules/video_output/ios.m                |  6 ++++++
>  modules/video_output/macosx.m             | 11 ++++++++++
>  modules/video_output/opengl/Makefile.am   | 16 ++++++--------
>  modules/video_output/opengl/egl.c         | 19 +++++++++++++++++
>  modules/video_output/opengl/vout_helper.c | 18 ++++++----------
>  modules/video_output/wayland/Makefile.am  |  3 ++-
>  modules/video_output/win32/wgl.c          | 11 ++++++++--
>  modules/video_output/xcb/Makefile.am      |  3 ++-
>  11 files changed, 102 insertions(+), 38 deletions(-)
> 
> diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h
> index 79e165e72b..05b5c5b242 100644
> --- a/include/vlc_opengl.h
> +++ b/include/vlc_opengl.h
> @@ -53,6 +53,8 @@ struct vlc_gl_t
>      void*(*get_proc_address)(vlc_gl_t *, const char *);
>      void (*destroy)(vlc_gl_t *);
>  
> +    const struct vlc_gl_api *api;
> +
>      enum {
>          VLC_GL_EXT_DEFAULT,
>          VLC_GL_EXT_EGL,
> diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
> index c42fdc474a..4ebbcd8d87 100644
> --- a/modules/video_output/Makefile.am
> +++ b/modules/video_output/Makefile.am
> @@ -27,13 +27,17 @@ libglinterop_cvpx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
>  	-Wl,-framework,Foundation,-framework,CoreVideo
>  
>  if HAVE_OSX
> -libvout_macosx_plugin_la_SOURCES = video_output/macosx.m
> +libvout_macosx_plugin_la_SOURCES = video_output/macosx.m \
> +	video_output/opengl/gl_api.c \
> +	video_output/opengl/gl_api.h
>  libvout_macosx_plugin_la_CFLAGS = $(AM_CFLAGS) -DHAVE_GL_CORE_SYMBOLS
>  libvout_macosx_plugin_la_LIBADD = libvlc_opengl.la
>  libvout_macosx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
>  	-Wl,-framework,OpenGL,-framework,Cocoa
>  
> -libcaopengllayer_plugin_la_SOURCES = video_output/caopengllayer.m
> +libcaopengllayer_plugin_la_SOURCES = video_output/caopengllayer.m \
> +	video_output/opengl/gl_api.c \
> +	video_output/opengl/gl_api.h
>  libcaopengllayer_plugin_la_CFLAGS = $(AM_CFLAGS)  -DHAVE_GL_CORE_SYMBOLS
>  libcaopengllayer_plugin_la_LIBADD = libvlc_opengl.la
>  libcaopengllayer_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
> @@ -47,7 +51,9 @@ if HAVE_IOS
>  libglinterop_cvpx_plugin_la_CFLAGS = $(AM_CFLAGS) -DUSE_OPENGL_ES2
>  endif
>  
> -libvout_ios_plugin_la_SOURCES = video_output/ios.m
> +libvout_ios_plugin_la_SOURCES = video_output/ios.m \
> +	video_output/opengl/gl_api.c \
> +	video_output/opengl/gl_api.h
>  libvout_ios_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DUSE_OPENGL_ES2
>  libvout_ios_plugin_la_LIBADD = libvlc_opengles.la
>  libvout_ios_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
> @@ -143,13 +149,15 @@ libglwin32_plugin_la_SOURCES = \
>  	video_output/win32/events.c video_output/win32/events.h \
>  	video_output/win32/sensors.cpp \
>  	video_output/win32/win32touch.c video_output/win32/win32touch.h
> -libwgl_plugin_la_SOURCES = video_output/win32/wgl.c
> +libwgl_plugin_la_SOURCES = video_output/win32/wgl.c \
> +	video_output/opengl/gl_api.c \
> +	video_output/opengl/gl_api.h
>  
>  libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid libvlc_opengl.la
>  libwgl_plugin_la_LIBADD = -lopengl32 -lgdi32 libvlc_opengl.la
>  
> -libglwin32_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DHAVE_GL_CORE_SYMBOLS
> -libwgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS)
> +libglwin32_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS)
> +libwgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DHAVE_GL_CORE_SYMBOLS
>  
>  libglwin32_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
>  libwgl_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
> @@ -173,7 +181,8 @@ if HAVE_WIN32_DESKTOP
>  vout_LTLIBRARIES += libwinhibit_plugin.la
>  endif
>  
> -libegl_win32_plugin_la_SOURCES = video_output/opengl/egl.c
> +libegl_win32_plugin_la_SOURCES = video_output/opengl/egl.c \
> +	video_output/opengl/gl_api.h video_output/opengl/gl_api.c
>  libegl_win32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_WIN32=1
>  libegl_win32_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS)
>  libegl_win32_plugin_la_LIBADD = $(EGL_LIBS)
> @@ -208,7 +217,8 @@ endif
>  
>  ### Android ###
>  
> -libegl_android_plugin_la_SOURCES = video_output/opengl/egl.c
> +libegl_android_plugin_la_SOURCES = video_output/opengl/egl.c \
> +	video_output/opengl/gl_api.h video_output/opengl/gl_api.c
>  libegl_android_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) -DUSE_PLATFORM_ANDROID=1
>  libegl_android_plugin_la_LIBADD = $(EGL_LIBS)
>  
> diff --git a/modules/video_output/caopengllayer.m b/modules/video_output/caopengllayer.m
> index 587817d153..5b17ae9e5e 100644
> --- a/modules/video_output/caopengllayer.m
> +++ b/modules/video_output/caopengllayer.m
> @@ -43,6 +43,7 @@
>  #include "opengl/filter_draw.h"
>  #include "opengl/renderer.h"
>  #include "opengl/vout_helper.h"
> +#include "opengl/gl_api.h"
>  
>  #define OSX_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1485)
>  
> @@ -94,6 +95,7 @@ struct vout_display_sys_t {
>      VLCCAOpenGLLayer *cgLayer;
>  
>      vlc_gl_t *gl;
> +    struct vlc_gl_api api;
>      vout_display_opengl_t *vgl;
>  
>      vout_display_place_t place;
> @@ -199,12 +201,23 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
>          glsys->cgLayer = sys->cgLayer;
>  
>          const vlc_fourcc_t *subpicture_chromas;
> -        if (!OpenglLock(sys->gl)) {
> -            sys->vgl = vout_display_opengl_New(fmt, &subpicture_chromas,
> -                                               sys->gl, &cfg->viewpoint, context);
> -            OpenglUnlock(sys->gl);
> -        } else
> -            sys->vgl = NULL;
> +        sys->vgl = NULL;
> +
> +        if (OpenglLock(sys->gl) != VLC_SUCCESS)
> +            goto bailout;
> +
> +        if (vlc_gl_api_Init(&sys->api, sys->gl) != VLC_SUCCESS)
> +        {
> +            msg_Err(vd, "Error while initializing opengl api.");
> +            goto bailout;
> +        }
> +        sys->gl->api = &sys->api;
> +
> +        sys->vgl = vout_display_opengl_New(fmt, &subpicture_chromas,
> +                                           sys->gl, &cfg->viewpoint,
> +                                           context);
> +        OpenglUnlock(sys->gl);
> +
>          if (!sys->vgl) {
>              msg_Err(vd, "Error while initializing opengl display.");
>              goto bailout;
> diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
> index 07c8355d45..fd6be2face 100644
> --- a/modules/video_output/ios.m
> +++ b/modules/video_output/ios.m
> @@ -48,6 +48,7 @@
>  #import "opengl/filter_draw.h"
>  #import "opengl/renderer.h"
>  #import "opengl/vout_helper.h"
> +#import "opengl/gl_api.h"
>  
>  /**
>   * Forward declarations
> @@ -124,6 +125,7 @@ struct vout_display_sys_t
>      VLCOpenGLES2VideoView *glESView;
>  
>      vlc_gl_t *gl;
> +    struct vlc_gl_api api;
>  
>      vout_window_t *embed;
>  };
> @@ -209,6 +211,10 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
>          if (vlc_gl_MakeCurrent(sys->gl) != VLC_SUCCESS)
>              goto bailout;
>  
> +        if (vlc_gl_api_Init(&sys->api, sys->gl) != VLC_SUCCESS)

vlc_gl_ReleaseCurrent()?

> +            goto bailout;
> +        sys->gl->api = &sys->api;
> +
>          vout_display_opengl_t *vgl = vout_display_opengl_New(fmt, &subpicture_chromas,
>                                                               sys->gl, &cfg->viewpoint,
>                                                               context);
> diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
> index 9ce48deaaf..26ccbf3995 100644
> --- a/modules/video_output/macosx.m
> +++ b/modules/video_output/macosx.m
> @@ -49,6 +49,7 @@
>  #include "opengl/filter_draw.h"
>  #include "opengl/renderer.h"
>  #include "opengl/vout_helper.h"
> +#include "opengl/gl_api.h"
>  
>  /**
>   * Forward declarations
> @@ -110,6 +111,7 @@ struct vout_display_sys_t
>  
>      vout_window_t *embed;
>      vlc_gl_t *gl;
> +    struct vlc_gl_api api;
>      vout_display_opengl_t *vgl;
>  
>      picture_t *current;
> @@ -240,6 +242,15 @@ static int Open (vout_display_t *vd, const vout_display_cfg_t *cfg,
>              msg_Err(vd, "Can't attach gl context");
>              goto error;
>          }
> +
> +        if (vlc_gl_api_Init(&sys->api, sys->gl) != VLC_SUCCESS)
> +        {
> +            msg_Err(vd, "Can't init OpenGL API");
> +            vlc_gl_ReleaseCurrent(sys->gl);
> +            goto error;
> +        }
> +        sys->gl->api = &sys->api;
> +
>          sys->vgl = vout_display_opengl_New (fmt, &subpicture_chromas, sys->gl,
>                                              &cfg->viewpoint, context);
>          vlc_gl_ReleaseCurrent(sys->gl);
> diff --git a/modules/video_output/opengl/Makefile.am b/modules/video_output/opengl/Makefile.am
> index 9e08ec09fc..5eef38951e 100644
> --- a/modules/video_output/opengl/Makefile.am
> +++ b/modules/video_output/opengl/Makefile.am
> @@ -7,8 +7,6 @@ OPENGL_COMMONSOURCES = video_output/opengl/vout_helper.c \
>         video_output/opengl/filter_priv.h \
>         video_output/opengl/filters.c \
>         video_output/opengl/filters.h \
> -       video_output/opengl/gl_api.c \
> -       video_output/opengl/gl_api.h \
>         video_output/opengl/gl_common.h \
>         video_output/opengl/gl_util.c \
>         video_output/opengl/gl_util.h \
> @@ -54,20 +52,20 @@ endif
>  
>  ### OpenGL ###
>  libgles2_plugin_la_SOURCES = video_output/opengl/display.c
> -libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES2
> -libgles2_plugin_la_LIBADD = $(GLES2_LIBS) libvlc_opengles.la
> +libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) -DUSE_OPENGL_ES2
> +libgles2_plugin_la_LIBADD = libvlc_opengles.la
>  libgles2_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
>  if HAVE_GLES2
>  vout_LTLIBRARIES += libgles2_plugin.la
>  endif
>  
>  libgl_plugin_la_SOURCES = video_output/opengl/display.c
> -libgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS) $(OPENGL_COMMONCFLAGS)
> +libgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS)
>  libgl_plugin_la_LIBADD = libvlc_opengl.la
> -if HAVE_WIN32
> -libgl_plugin_la_CFLAGS += -DHAVE_GL_CORE_SYMBOLS
> -libgl_plugin_la_LIBADD += $(GL_LIBS)
> -endif
> +#if HAVE_WIN32
> +#libgl_plugin_la_CFLAGS += -DHAVE_GL_CORE_SYMBOLS
> +#libgl_plugin_la_LIBADD += $(GL_LIBS)
> +#endif
>  
>  if HAVE_GL
>  vout_LTLIBRARIES += libgl_plugin.la
> diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
> index ba589cbae7..920aca55bc 100644
> --- a/modules/video_output/opengl/egl.c
> +++ b/modules/video_output/opengl/egl.c
> @@ -43,6 +43,8 @@
>  # include "../android/utils.h"
>  #endif
>  
> +#include "gl_api.h"
> +
>  typedef struct vlc_gl_sys_t
>  {
>      EGLDisplay display;
> @@ -56,6 +58,10 @@ typedef struct vlc_gl_sys_t
>  #endif
>      PFNEGLCREATEIMAGEKHRPROC    eglCreateImageKHR;
>      PFNEGLDESTROYIMAGEKHRPROC   eglDestroyImageKHR;
> +
> +    /* OpenGL API for clients */
> +    struct vlc_gl_api api;
> +
>  } vlc_gl_sys_t;
>  
>  static int MakeCurrent (vlc_gl_t *gl)
> @@ -375,6 +381,11 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api,
>      }
>      sys->context = ctx;
>  
> +    EGLDisplay prev_display = eglGetCurrentDisplay();
> +    EGLSurface prev_dsurface = eglGetCurrentSurface(EGL_DRAW);
> +    EGLSurface prev_rsurface = eglGetCurrentSurface(EGL_READ);
> +    EGLSurface prev_context = eglGetCurrentContext();
> +
>      /* Initialize OpenGL callbacks */
>      gl->ext = VLC_GL_EXT_EGL;
>      gl->make_current = MakeCurrent;
> @@ -382,6 +393,7 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api,
>      gl->resize = Resize;
>      gl->swap = SwapBuffers;
>      gl->get_proc_address = GetSymbol;
> +    gl->api = &sys->api;
>      gl->destroy = Close;
>      gl->egl.queryString = QueryString;
>  
> @@ -392,6 +404,13 @@ static int Open(vlc_gl_t *gl, const struct gl_api *api,
>          gl->egl.createImageKHR = CreateImageKHR;
>          gl->egl.destroyImageKHR = DestroyImageKHR;
>      }
> +    eglMakeCurrent(sys->display, sys->surface, sys->surface, sys->context);
> +    int ret = vlc_gl_api_Init(&sys->api, gl);
> +    eglMakeCurrent(prev_display, prev_rsurface, prev_dsurface, prev_context);
> +
> +    if (ret != VLC_SUCCESS)
> +        goto error;
> +
>  
>      return VLC_SUCCESS;
>  
> diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
> index ad3eba280b..7e82d91f7f 100644
> --- a/modules/video_output/opengl/vout_helper.c
> +++ b/modules/video_output/opengl/vout_helper.c
> @@ -110,11 +110,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
>  
>      vgl->gl = gl;
>  
> -    int ret = vlc_gl_api_Init(&vgl->api, gl);
> -    if (ret != VLC_SUCCESS)
> -        goto free_vgl;
> -
> -    const struct vlc_gl_api *api = &vgl->api;
> +    const struct vlc_gl_api *api = gl->api;
>      const opengl_vtable_t *vt = &api->vt;
>  
>  #if !defined(USE_OPENGL_ES2)
> @@ -164,7 +160,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
>       * forward SetViewpoint() */
>      vgl->renderer = renderer_filter->sys;
>  
> -    ret = vlc_gl_filters_InitFramebuffers(vgl->filters);
> +    int ret = vlc_gl_filters_InitFramebuffers(vgl->filters);
>      if (ret != VLC_SUCCESS)
>      {
>          msg_Err(gl, "Could not init filters framebuffers");
> @@ -219,7 +215,7 @@ free_vgl:
>  
>  void vout_display_opengl_Delete(vout_display_opengl_t *vgl)
>  {
> -    const opengl_vtable_t *vt = &vgl->api.vt;
> +    const opengl_vtable_t *vt = &vgl->gl->api->vt;
>  
>      GL_ASSERT_NOERROR(vt);
>  
> @@ -259,19 +255,19 @@ void vout_display_opengl_Viewport(vout_display_opengl_t *vgl, int x, int y,
>  int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
>                                  picture_t *picture, subpicture_t *subpicture)
>  {
> -    GL_ASSERT_NOERROR(&vgl->api.vt);
> +    GL_ASSERT_NOERROR(&vgl->gl->api->vt);
>  
>      int ret = vlc_gl_filters_UpdatePicture(vgl->filters, picture);
>      if (ret != VLC_SUCCESS)
>          return ret;
>  
>      ret = vlc_gl_sub_renderer_Prepare(vgl->sub_renderer, subpicture);
> -    GL_ASSERT_NOERROR(&vgl->api.vt);
> +    GL_ASSERT_NOERROR(&vgl->gl->api->vt);
>      return ret;
>  }
>  int vout_display_opengl_Display(vout_display_opengl_t *vgl)
>  {
> -    GL_ASSERT_NOERROR(&vgl->api.vt);
> +    GL_ASSERT_NOERROR(&vgl->gl->api->vt);
>  
>      /* Why drawing here and not in Render()? Because this way, the
>         OpenGL providers can call vout_display_opengl_Display to force redraw.
> @@ -288,7 +284,7 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl)
>      /* Display */
>      vlc_gl_Swap(vgl->gl);
>  
> -    GL_ASSERT_NOERROR(&vgl->api.vt);
> +    GL_ASSERT_NOERROR(&vgl->gl->api->vt);
>  
>      return VLC_SUCCESS;
>  }
> diff --git a/modules/video_output/wayland/Makefile.am b/modules/video_output/wayland/Makefile.am
> index 65dc2ad299..60d5f9bdc9 100644
> --- a/modules/video_output/wayland/Makefile.am
> +++ b/modules/video_output/wayland/Makefile.am
> @@ -68,7 +68,8 @@ video_output/wayland/xdg-decoration-protocol.c: \
>  		video_output/Makefile.am
>  	$(AM_V_GEN)$(WAYLAND_SCANNER) private-code $< $@
>  
> -libegl_wl_plugin_la_SOURCES = video_output/opengl/egl.c
> +libegl_wl_plugin_la_SOURCES = video_output/opengl/egl.c \
> +	video_output/opengl/gl_api.h video_output/opengl/gl_api.c
>  libegl_wl_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_WAYLAND=1
>  libegl_wl_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) $(WAYLAND_EGL_CFLAGS)
>  libegl_wl_plugin_la_LIBADD = $(EGL_LIBS) $(WAYLAND_EGL_LIBS)
> diff --git a/modules/video_output/win32/wgl.c b/modules/video_output/win32/wgl.c
> index ec02c2dc6e..56c70883e9 100644
> --- a/modules/video_output/win32/wgl.c
> +++ b/modules/video_output/win32/wgl.c
> @@ -29,6 +29,7 @@
>  #include <vlc_opengl.h>
>  
>  #include "../opengl/vout_helper.h"
> +#include "../opengl/gl_api.h"
>  #include <GL/glew.h>
>  #include <GL/wglew.h>
>  
> @@ -70,6 +71,8 @@ struct vout_display_sys_t
>          PFNWGLGETEXTENSIONSSTRINGEXTPROC GetExtensionsStringEXT;
>          PFNWGLGETEXTENSIONSSTRINGARBPROC GetExtensionsStringARB;
>      } exts;
> +
> +    struct vlc_gl_api api;
>  };
>  
>  static void          Swap(vlc_gl_t *);
> @@ -227,8 +230,6 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
>      if (!sys->exts.GetExtensionsStringEXT)
>          LOAD_EXT(GetExtensionsStringARB, PFNWGLGETEXTENSIONSSTRINGARBPROC);
>  
> -    wglMakeCurrent(sys->hGLDC, NULL);
> -
>      gl->ext = VLC_GL_EXT_WGL;
>      gl->make_current = MakeCurrent;
>      gl->release_current = ReleaseCurrent;
> @@ -236,6 +237,12 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
>      gl->swap = Swap;
>      gl->get_proc_address = OurGetProcAddress;
>      gl->destroy = Close;
> +    gl->api = &sys->api;
> +
> +    if (vlc_gl_api_Init(&sys->api, gl) != VLC_SUCCESS)
> +        goto error;
> +
> +    wglMakeCurrent(sys->hGLDC, NULL);
>  
>      if (sys->exts.GetExtensionsStringEXT || sys->exts.GetExtensionsStringARB)
>          gl->wgl.getExtensionsString = GetExtensionsString;
> diff --git a/modules/video_output/xcb/Makefile.am b/modules/video_output/xcb/Makefile.am
> index f946e07ce7..beb7d0684c 100644
> --- a/modules/video_output/xcb/Makefile.am
> +++ b/modules/video_output/xcb/Makefile.am
> @@ -40,7 +40,8 @@ libvk_x11_plugin_la_CFLAGS = $(AM_CFLAGS) \
>  	-DVK_USE_PLATFORM_XCB_KHR -DPLATFORM_NAME=X11
>  libvk_x11_plugin_la_LIBADD = $(VULKAN_COMMONLIBS) $(XCB_LIBS)
>  
> -libegl_x11_plugin_la_SOURCES = video_output/opengl/egl.c
> +libegl_x11_plugin_la_SOURCES = video_output/opengl/egl.c \
> +	video_output/opengl/gl_api.h video_output/opengl/gl_api.c
>  libegl_x11_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -DUSE_PLATFORM_X11=1
>  libegl_x11_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS)
>  libegl_x11_plugin_la_LIBADD = $(EGL_LIBS) $(X_LIBS) $(X_PRE_LIBS) -lX11
> -- 
> 2.28.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list