[vlc-commits] [Git][videolan/vlc][master] 2 commits: opengl: link the GL/GLES2 library only in providers
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Jun 24 02:36:25 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
4b37ee52 by Alexandre Janniaux at 2026-06-24T02:19:47+00:00
opengl: link the GL/GLES2 library only in providers
The GL modules using OpenGL as a render API run inside an
already-current context and call GL through the provider's function
table. None of them reference GL symbols at link time, so none need to
link the GL/GLES2 library.
This is different for the modules that create and drive the context
themselves since they should actually provide those functions and thus
must link the GL/GLES2 library.
libvlc_opengles embedded $(GLES2_LIBS), which both leaked the library
into the filters and let the GLES2 providers rely on it implicitly.
Make the convenience library carry only the cflags, drop
$(GL_LIBS)/$(GLES2_LIBS) from the GL filters, and link $(GLES2_LIBS)
explicitly in the GLES2 providers.
- - - - -
54017b75 by Alexandre Janniaux at 2026-06-24T02:19:47+00:00
opengl: simplify GL/GLES2 build conditions
We always needed to have conditionals in automake for the special cases
with android, iOS, tvOS and macos, and between OpenGL and GLESv2 but now
that we're starting to have a lot of OpenGL-based modules, this produces
a lot of complexity in Makefile.am.
Instead, define the detection in configure.ac so that the configuration
is done by the platform/feature detection mechanism, and add common
variables that can factor the conditionals for LIBADD/CFLAGS.
Incidently, it also fix the deprecation warnings for apple platforms and
we don't need to remove every new apple platform (that doesn't support
opengl) from the list.
But a new conditional is added to build glspectrum since it's not (yet)
provided an OpenGL module on macosx and would start to be built with
this way.
- - - - -
5 changed files:
- configure.ac
- modules/video_filter/Makefile.am
- modules/video_output/Makefile.am
- modules/video_output/opengl/Makefile.am
- modules/visualization/Makefile.am
Changes:
=====================================
configure.ac
=====================================
@@ -3521,10 +3521,31 @@ PKG_CHECK_MODULES([GL], [gl], [
AC_MSG_CHECKING([for OpenGL])
AC_MSG_RESULT([${have_gl}])
])
-AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
dnl OpenGL ES 2: depends on EGL 1.1
-PKG_HAVE_WITH_MODULES([GLES2], [glesv2], [enable GLES2 support (default auto)])
+have_gles2="no"
+PKG_WITH_MODULES([GLES2], [glesv2],
+ [have_gles2="yes"], [have_gles2="no"],
+ [enable GLES2 support (default auto)])
+
+dnl On Apple platforms OpenGL/OpenGL ES are provided as system frameworks
+dnl without pkg-config files, so the choice between desktop GL and GLES2 is
+dnl fully determined by the platform.
+AS_IF([test "${HAVE_OSX}" = "1"], [
+ have_gl="yes"
+ GL_LIBS="-Wl,-framework,OpenGL"
+ GL_CFLAGS="-DGL_SILENCE_DEPRECATION"
+])
+AS_IF([test "${HAVE_IOS_OR_TVOS}" = "1"], [
+ have_gles2="yes"
+ GLES2_LIBS="-Wl,-framework,OpenGLES"
+ GLES2_CFLAGS="-DGL_SILENCE_DEPRECATION"
+])
+
+AM_CONDITIONAL([HAVE_GL], [test "${have_gl}" = "yes"])
+AM_CONDITIONAL([HAVE_GLES2], [test "${have_gles2}" = "yes"])
+AM_CONDITIONAL([HAVE_GL_OR_GLES2],
+ [test "${have_gl}" = "yes" -o "${have_gles2}" = "yes"])
dnl
dnl Vulkan
=====================================
modules/video_filter/Makefile.am
=====================================
@@ -150,35 +150,9 @@ video_filter_PLUGINS += libci_filters_plugin.la
endif
libopengl_filter_plugin_la_SOURCES = video_filter/opengl.c
-
-if HAVE_WIN32
-libopengl_filter_plugin_la_LIBADD = libvlc_opengl.la
-if HAVE_GL
-video_filter_PLUGINS += libopengl_filter_plugin.la
-endif
-endif
-
-if HAVE_LINUX
-if HAVE_ANDROID
-libopengl_filter_plugin_la_LIBADD = libvlc_opengles.la
-libopengl_filter_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
-video_filter_PLUGINS += libopengl_filter_plugin.la
-else
-libopengl_filter_plugin_la_LIBADD = libvlc_opengl.la
-if HAVE_GL
-video_filter_PLUGINS += libopengl_filter_plugin.la
-endif
-endif
-endif
-
-if HAVE_IOS_OR_TVOS
-libopengl_filter_plugin_la_LIBADD = libvlc_opengles.la
-libopengl_filter_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
-video_filter_PLUGINS += libopengl_filter_plugin.la
-endif
-
-if HAVE_OSX
-libopengl_filter_plugin_la_LIBADD = libvlc_opengl.la
+libopengl_filter_plugin_la_LIBADD = $(GL_PLUGIN_LIBADD)
+libopengl_filter_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_PLUGIN_CFLAGS)
+if HAVE_GL_OR_GLES2
video_filter_PLUGINS += libopengl_filter_plugin.la
endif
@@ -208,28 +182,10 @@ libdeinterlace_plugin_la_LIBADD = libdeinterlace_common.la
video_filter_PLUGINS += libdeinterlace_plugin.la
libglblend_plugin_la_SOURCES = video_filter/deinterlace/glblend.c
-libglblend_plugin_la_CFLAGS = $(AM_CFLAGS)
-if HAVE_GL
-libglblend_plugin_la_LIBADD = libvlc_opengl.la
-video_filter_PLUGINS += libglblend_plugin.la
-endif
-
-if HAVE_OSX
-video_filter_PLUGINS += libglblend_plugin.la
-libglblend_plugin_la_LIBADD = libvlc_opengl.la
-endif
-if HAVE_IOS_OR_TVOS
+libglblend_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_PLUGIN_CFLAGS)
+libglblend_plugin_la_LIBADD = $(GL_PLUGIN_LIBADD)
+if HAVE_GL_OR_GLES2
video_filter_PLUGINS += libglblend_plugin.la
-libglblend_plugin_la_LIBADD = libvlc_opengles.la
-libglblend_plugin_la_CFLAGS += -DUSE_OPENGL_ES2=1
-endif
-
-if !HAVE_GL
-if HAVE_GLES2
-libglblend_plugin_la_LIBADD = libvlc_opengles.la
-libglblend_plugin_la_CFLAGS += -DUSE_OPENGL_ES2=1
-video_filter_PLUGINS += libglblend_plugin.la
-endif
endif
libopencv_wrapper_plugin_la_SOURCES = video_filter/opencv_wrapper.cpp
@@ -276,26 +232,8 @@ video_filter_PLUGINS += $(LTLIBopencv_example)
EXTRA_LTLIBRARIES += libopencv_example_plugin.la
libgladjust_plugin_la_SOURCES = video_filter/gladjust.c
-libgladjust_plugin_la_CFLAGS = $(AM_CFLAGS)
-if HAVE_GL
-libgladjust_plugin_la_LIBADD = libvlc_opengl.la
-video_filter_LTLIBRARIES += libgladjust_plugin.la
-endif
-if HAVE_DARWIN
-if !HAVE_WATCHOS
-if !HAVE_XROS
-if HAVE_OSX
-libgladjust_plugin_la_LIBADD = libvlc_opengl.la
-else
-libgladjust_plugin_la_LIBADD = libvlc_opengles.la
-libgladjust_plugin_la_CFLAGS += -DUSE_OPENGL_ES2=1
-endif
-video_filter_LTLIBRARIES += libgladjust_plugin.la
-endif
-endif
-endif
-if HAVE_ANDROID
-libgladjust_plugin_la_LIBADD = libvlc_opengles.la
-libgladjust_plugin_la_CFLAGS += -DUSE_OPENGL_ES2=1
+libgladjust_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_PLUGIN_CFLAGS)
+libgladjust_plugin_la_LIBADD = $(GL_PLUGIN_LIBADD)
+if HAVE_GL_OR_GLES2
video_filter_LTLIBRARIES += libgladjust_plugin.la
endif
=====================================
modules/video_output/Makefile.am
=====================================
@@ -113,7 +113,7 @@ endif
libvout_ios_plugin_la_SOURCES = video_output/opengl/display.c $(OPENGL_VOUT_COMMONSOURCES)
libvout_ios_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCFLAGS) -DUSE_OPENGL_ES2
-libvout_ios_plugin_la_LIBADD = libvlc_opengles.la
+libvout_ios_plugin_la_LIBADD = libvlc_opengles.la $(GLES2_LIBS)
libuiview_window_plugin_la_SOURCES = video_output/apple/VLCVideoUIView.m
libuiview_window_plugin_la_LDFLAGS = $(AM_LDFLAGS) \
=====================================
modules/video_output/opengl/Makefile.am
=====================================
@@ -36,7 +36,7 @@ OPENGL_VOUT_COMMONSOURCES = \
# Convenience library for OpenGL components -- OpenGL only
libvlc_opengl_la_SOURCES = $(OPENGL_COMMONSOURCES)
-libvlc_opengl_la_CFLAGS = $(OPENGL_COMMONCFLAGS)
+libvlc_opengl_la_CFLAGS = $(OPENGL_COMMONCFLAGS) $(GL_CFLAGS)
libvlc_opengl_la_CPPFLAGS =
libvlc_opengl_la_LIBADD = $(OPENGL_COMMONLIBS) $(LIBM)
libvlc_opengl_la_LDFLAGS = -static -no-undefined
@@ -52,43 +52,38 @@ libvlc_opengles_la_LIBADD = $(OPENGL_COMMONLIBS) $(LIBM)
libvlc_opengles_la_LDFLAGS = -static -no-undefined
libvlc_opengles_la_CFLAGS += $(GLES2_CFLAGS)
-libvlc_opengles_la_LIBADD += $(GLES2_LIBS)
if HAVE_GLES2
noinst_LTLIBRARIES += libvlc_opengles.la
endif
-libglinterop_sw_plugin_la_SOURCES = video_output/opengl/interop_sw.c
-libglinterop_sw_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
+# Plugins that adapt to either backend link against $(GL_PLUGIN_LIBADD)
+# and build with $(GL_PLUGIN_CFLAGS), and are registered under
+# HAVE_GL_OR_GLES2. These are GL filters/interops that run inside the
+# current context and call GL through the provider's function table, so
+# they need only the common convenience library, not the GL/GLES2 link
+# libraries.
if HAVE_GL
-vout_PLUGINS += libglinterop_sw_plugin.la
+GL_PLUGIN_LIBADD = libvlc_opengl.la
+GL_PLUGIN_CFLAGS = $(GL_CFLAGS)
else
if HAVE_GLES2
-vout_PLUGINS += libglinterop_sw_plugin.la
-libglinterop_sw_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2
+GL_PLUGIN_LIBADD = libvlc_opengles.la
+GL_PLUGIN_CFLAGS = $(GLES2_CFLAGS) -DUSE_OPENGL_ES2=1
endif
endif
-
-if HAVE_OSX
-vout_PLUGINS += libglinterop_sw_plugin.la
-libglinterop_sw_plugin_la_LIBADD = libvlc_opengl.la
-endif
-if HAVE_IOS_OR_TVOS
+libglinterop_sw_plugin_la_SOURCES = video_output/opengl/interop_sw.c
+libglinterop_sw_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(GL_PLUGIN_CFLAGS)
+libglinterop_sw_plugin_la_LIBADD = $(GL_PLUGIN_LIBADD)
+if HAVE_GL_OR_GLES2
vout_PLUGINS += libglinterop_sw_plugin.la
-libglinterop_sw_plugin_la_LIBADD = libvlc_opengles.la
-libglinterop_sw_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2
-endif
-
-if HAVE_ANDROID
-libglinterop_sw_plugin_la_LIBADD = libvlc_opengles.la
-libglinterop_sw_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2
endif
### OpenGL ###
libgles2_plugin_la_SOURCES = video_output/opengl/display.c \
$(OPENGL_VOUT_COMMONSOURCES)
libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES2
-libgles2_plugin_la_LIBADD = libvlc_opengles.la
+libgles2_plugin_la_LIBADD = libvlc_opengles.la $(GLES2_LIBS)
libgles2_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(vout_RPATH)
if HAVE_GLES2
vout_PLUGINS += libgles2_plugin.la
@@ -103,93 +98,32 @@ if HAVE_GL
vout_PLUGINS += libgl_plugin.la
endif # HAVE_GL
-if HAVE_OSX
-vout_PLUGINS += libgl_plugin.la
-libvlc_opengl_la_CPPFLAGS += -DGL_SILENCE_DEPRECATION
-libgl_plugin_la_CPPFLAGS += -DGL_SILENCE_DEPRECATION
-endif
-
libglfilter_draw_plugin_la_SOURCES = video_output/opengl/filter_draw.c
libglfilter_draw_plugin_la_LDFLAGS = $(AM_LDFLAGS)
-if HAVE_GL
-libglfilter_draw_plugin_la_LIBADD = libvlc_opengl.la $(GL_LIBS)
+libglfilter_draw_plugin_la_LIBADD = $(GL_PLUGIN_LIBADD)
+libglfilter_draw_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_PLUGIN_CFLAGS)
+if HAVE_GL_OR_GLES2
vout_PLUGINS += libglfilter_draw_plugin.la
endif
-if HAVE_OSX
-vout_PLUGINS += libglfilter_draw_plugin.la
-libglfilter_draw_plugin_la_LIBADD = libvlc_opengl.la
-endif
-if HAVE_IOS_OR_TVOS
-vout_PLUGINS += libglfilter_draw_plugin.la
-libglfilter_draw_plugin_la_LIBADD = libvlc_opengles.la $(GLES2_LIBS)
-libglfilter_draw_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
-endif
-
-if !HAVE_GL
-if HAVE_GLES2
-libglfilter_draw_plugin_la_LIBADD = libvlc_opengles.la $(GLES2_LIBS)
-libglfilter_draw_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
-vout_PLUGINS += libglfilter_draw_plugin.la
-endif
-endif
-
libglfilter_mock_plugin_la_SOURCES = video_output/opengl/filter_mock.c
-libglfilter_mock_plugin_la_LIBADD = $(LIBM)
+libglfilter_mock_plugin_la_LIBADD = $(LIBM) $(GL_PLUGIN_LIBADD)
+libglfilter_mock_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_PLUGIN_CFLAGS)
# NOTE: we need $(vout_RPATH) here to properly generate a shared object
# when building dynamic plugins.
libglfilter_mock_plugin_la_LDFLAGS = $(AM_LDFLAGS) $(vout_RPATH)
-if HAVE_GL
-libglfilter_mock_plugin_la_LIBADD += libvlc_opengl.la $(GL_LIBS)
-noinst_PLUGINS += libglfilter_mock_plugin.la
-endif
-
-if HAVE_IOS_OR_TVOS
-libglfilter_mock_plugin_la_LIBADD += libvlc_opengles.la $(GLES2_LIBS)
-libglfilter_mock_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
+if HAVE_GL_OR_GLES2
noinst_PLUGINS += libglfilter_mock_plugin.la
endif
-if HAVE_OSX
-libglfilter_mock_plugin_la_LIBADD += libvlc_opengl.la
-noinst_PLUGINS += libglfilter_mock_plugin.la
-endif
-
-if !HAVE_GL
-if HAVE_GLES2
-libglfilter_mock_plugin_la_LIBADD += libvlc_opengles.la $(GLES2_LIBS)
-libglfilter_mock_plugin_la_CFLAGS = -DUSE_OPENGL_ES2=1
-noinst_PLUGINS += libglfilter_mock_plugin.la
-endif
-endif
-
if HAVE_LIBPLACEBO
if HAVE_LIBPLACEBO_GL
libpl_scale_plugin_la_SOURCES = video_output/opengl/pl_scale.c
-libpl_scale_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBPLACEBO_CFLAGS)
-libpl_scale_plugin_la_LIBADD = $(LIBPLACEBO_LIBS)
-if HAVE_GL
-libpl_scale_plugin_la_LIBADD += libvlc_opengl.la
-video_filter_PLUGINS += libpl_scale_plugin.la
-endif
-
-if HAVE_OSX
-video_filter_PLUGINS += libpl_scale_plugin.la
-libpl_scale_plugin_la_LIBADD += libvlc_opengl.la
-endif
-if HAVE_IOS_OR_TVOS
+libpl_scale_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBPLACEBO_CFLAGS) $(GL_PLUGIN_CFLAGS)
+libpl_scale_plugin_la_LIBADD = $(LIBPLACEBO_LIBS) $(GL_PLUGIN_LIBADD)
+if HAVE_GL_OR_GLES2
video_filter_PLUGINS += libpl_scale_plugin.la
-libpl_scale_plugin_la_LIBADD += libvlc_opengles.la
-libpl_scale_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2=1
-endif
-
-if !HAVE_GL
-if HAVE_GLES2
-libpl_scale_plugin_la_LIBADD += libvlc_opengles.la
-libpl_scale_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2=1
-video_filter_PLUGINS += libpl_scale_plugin.la
-endif
endif
endif
@@ -222,23 +156,18 @@ libegl_pbuffer_filter_plugin_la_LIBADD = $(EGL_LIBS)
if !HAVE_EMSCRIPTEN
if HAVE_EGL
-if HAVE_GL
-libegl_pbuffer_filter_plugin_la_LIBADD += libvlc_opengl.la $(GL_LIBS)
-vout_PLUGINS += libegl_pbuffer_filter_plugin.la
-else
-if HAVE_GLES2
-libegl_pbuffer_filter_plugin_la_LIBADD += libvlc_opengles.la $(GLES2_LIBS)
-libegl_pbuffer_filter_plugin_la_CPPFLAGS += -DUSE_OPENGL_ES2=1
+if HAVE_GL_OR_GLES2
+libegl_pbuffer_filter_plugin_la_LIBADD += $(GL_PLUGIN_LIBADD)
+libegl_pbuffer_filter_plugin_la_CPPFLAGS += $(GL_PLUGIN_CFLAGS)
vout_PLUGINS += libegl_pbuffer_filter_plugin.la
endif
endif
endif
-endif
libegl_surfacetexture_plugin_la_SOURCES = video_filter/egl_surfacetexture.c
libegl_surfacetexture_plugin_la_CFLAGS = $(AM_CFLAGS) $(EGL_CFLAGS) -DUSE_OPENGL_ES2
-libegl_surfacetexture_plugin_la_LIBADD = $(EGL_LIBS) \
- libandroid_utils.la libvlc_opengles.la
+libegl_surfacetexture_plugin_la_LIBADD = $(EGL_LIBS) $(GLES2_LIBS) \
+ libandroid_utils.la
if HAVE_ANDROID
if HAVE_EGL
=====================================
modules/visualization/Makefile.am
=====================================
@@ -21,8 +21,10 @@ if HAVE_OSX
libglspectrum_plugin_la_CPPFLAGS += -DGL_SILENCE_DEPRECATION
endif
if HAVE_GL
+if !HAVE_OSX
visu_PLUGINS += libglspectrum_plugin.la
endif
+endif
libgoom_plugin_la_SOURCES = visualization/goom.c
libgoom_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) $(GOOM_CFLAGS)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f1c72b79f2e89b58e4a8ba70ed8915340cf67596...54017b7563ebc625f390ba7282f846a79680e397
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f1c72b79f2e89b58e4a8ba70ed8915340cf67596...54017b7563ebc625f390ba7282f846a79680e397
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list