[vlc-devel] [PATCH 1/3] vout: drop OpenGL ES 1 support

Thomas Guillem thomas at gllm.fr
Thu Dec 8 13:15:03 CET 2016


Replace USE_OPENGL_ES=2 define with USE_OPENGL_ES2
---
 extras/package/snap/snapcraft.yaml |  2 --
 modules/MODULES_LIST               |  1 -
 modules/video_output/Makefile.am   | 13 +++----------
 modules/video_output/gl.c          | 14 ++------------
 modules/video_output/opengl.c      | 34 ++++++++++++++++------------------
 modules/video_output/opengl.h      | 15 +++++----------
 6 files changed, 26 insertions(+), 53 deletions(-)

diff --git a/extras/package/snap/snapcraft.yaml b/extras/package/snap/snapcraft.yaml
index 7b9c063..ed94c1f 100644
--- a/extras/package/snap/snapcraft.yaml
+++ b/extras/package/snap/snapcraft.yaml
@@ -66,8 +66,6 @@ parts:
       - libfreerdp-dev
       - libfreetype6-dev
       - libfribidi-dev
-      - libgl1-mesa-dev
-      - libgles1-mesa-dev
       - libgles2-mesa-dev
       - libgnutls28-dev
       - libgtk2.0-dev
diff --git a/modules/MODULES_LIST b/modules/MODULES_LIST
index d207339..2743013 100644
--- a/modules/MODULES_LIST
+++ b/modules/MODULES_LIST
@@ -160,7 +160,6 @@ $Id$
  * gaussianblur: gaussian blur video filter
  * gestures: mouse gestures control plugin
  * gl: OpenGL video output using the generic OpenGL provider
- * gles1: OpenGL ES video output using the generic OpenGL provider
  * gles2: OpenGL ES2 video output using the generic OpenGL provider
  * glspectrum: 3D OpenGL spectrum visualization
  * glwin32: a opengl provider using DirectX OpenGL
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 786f8c7..b92b0c5 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -32,21 +32,14 @@ vout_LTLIBRARIES += libvout_ios2_plugin.la
 endif
 
 ### OpenGL ###
-# TODO: merge all three source files (?)
 libgles2_plugin_la_SOURCES = video_output/opengl.c video_output/opengl.h \
 	video_output/gl.c
-libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES=2
+libgles2_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES2_CFLAGS) -DUSE_OPENGL_ES2
 libgles2_plugin_la_LIBADD = $(GLES2_LIBS) $(LIBM)
 libgles2_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
 
-libgles1_plugin_la_SOURCES = video_output/opengl.c video_output/opengl.h \
-	video_output/gl.c
-libgles1_plugin_la_CFLAGS = $(AM_CFLAGS) $(GLES1_CFLAGS) -DUSE_OPENGL_ES=1
-libgles1_plugin_la_LIBADD = $(GLES1_LIBS) $(LIBM)
-libgles1_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
-
-EXTRA_LTLIBRARIES += libgles2_plugin.la libgles1_plugin.la
-vout_LTLIBRARIES += $(LTLIBgles2) $(LTLIBgles1)
+EXTRA_LTLIBRARIES += libgles2_plugin.la
+vout_LTLIBRARIES += $(LTLIBgles2)
 
 libgl_plugin_la_SOURCES = video_output/opengl.c video_output/opengl.h \
 	video_output/gl.c
diff --git a/modules/video_output/gl.c b/modules/video_output/gl.c
index 6d1fce6..0441326 100644
--- a/modules/video_output/gl.c
+++ b/modules/video_output/gl.c
@@ -39,12 +39,11 @@ static void Close (vlc_object_t *);
 
 #define GL_TEXT N_("OpenGL extension")
 #define GLES2_TEXT N_("OpenGL ES 2 extension")
-#define GLES_TEXT N_("OpenGL ES extension")
 #define PROVIDER_LONGTEXT N_( \
     "Extension through which to use the Open Graphics Library (OpenGL).")
 
 vlc_module_begin ()
-#if USE_OPENGL_ES == 2
+#if defined (USE_OPENGL_ES2)
 # define API VLC_OPENGL_ES2
 # define MODULE_VARNAME "gles2"
     set_shortname (N_("OpenGL ES2"))
@@ -55,17 +54,8 @@ vlc_module_begin ()
     add_module ("gles2", "opengl es2", NULL,
                 GLES2_TEXT, PROVIDER_LONGTEXT, true)
 
-#elif USE_OPENGL_ES == 1
-# define API VLC_OPENGL_ES
-# define MODULE_VARNAME "gles"
-    set_shortname (N_("OpenGL ES"))
-    set_description (N_("OpenGL for Embedded Systems video output"))
-    set_capability ("vout display", /*260*/0)
-    set_callbacks (Open, Close)
-    add_shortcut ("opengles", "gles")
-    add_module ("gles", "opengl es", NULL,
-                GLES_TEXT, PROVIDER_LONGTEXT, true)
 #else
+
 # define API VLC_OPENGL
 # define MODULE_VARNAME "gl"
     set_shortname (N_("OpenGL"))
diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index bad83c2..c96df1d 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -45,7 +45,7 @@
 # define GL_CLAMP_TO_EDGE 0x812F
 #endif
 
-#if USE_OPENGL_ES == 2 || defined(__APPLE__)
+#if defined(USE_OPENGL_ES2) || defined(__APPLE__)
 #   define PFNGLGETPROGRAMIVPROC             typeof(glGetProgramiv)*
 #   define PFNGLGETPROGRAMINFOLOGPROC        typeof(glGetProgramInfoLog)*
 #   define PFNGLGETSHADERIVPROC              typeof(glGetShaderiv)*
@@ -71,25 +71,19 @@
 #   define PFNGLBINDBUFFERPROC               typeof(glBindBuffer)*
 #   define PFNGLBUFFERDATAPROC               typeof(glBufferData)*
 #   define PFNGLDELETEBUFFERSPROC            typeof(glDeleteBuffers)*
-#if defined(__APPLE__) && USE_OPENGL_ES
+#if defined(__APPLE__)
 #   import <CoreFoundation/CoreFoundation.h>
 #endif
 #endif
 
-#if USE_OPENGL_ES
+#if defined(USE_OPENGL_ES2)
 #   define GLSL_VERSION "100"
 #   define VLCGL_TEXTURE_COUNT 1
 #   define PRECISION "precision highp float;"
-#if USE_OPENGL_ES == 2
 #   define VLCGL_PICTURE_MAX 128
 #   define SUPPORTS_SHADERS
 #   define glClientActiveTexture(x)
 #else
-#   define VLCGL_PICTURE_MAX 1
-#   define SUPPORTS_FIXED_PIPELINE
-#   define GL_MAX_TEXTURE_IMAGE_UNITS GL_MAX_TEXTURE_UNITS
-#endif
-#else
 #   define GLSL_VERSION "120"
 #   define VLCGL_TEXTURE_COUNT 1
 #   define VLCGL_PICTURE_MAX 128
@@ -231,7 +225,7 @@ static inline int GetAlignedSize(unsigned size)
     return ((align >> 1) == size) ? size : align;
 }
 
-#if !USE_OPENGL_ES
+#ifndef USE_OPENGL_ES2
 static int GetTexFormatSize(int target, int tex_format, int tex_internal,
                             int tex_type)
 {
@@ -479,7 +473,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     }
 
     const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
-#if !USE_OPENGL_ES
+#ifndef USE_OPENGL_ES2
     const unsigned char *ogl_version = glGetString(GL_VERSION);
     bool supports_shaders = strverscmp((const char *)ogl_version, "2.0") >= 0;
     const bool oglv3 = strverscmp((const char *)ogl_version, "3.0") >= 0;
@@ -490,7 +484,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     const int yuv_plane_texformat = GL_LUMINANCE;
 #endif
 
-#if USE_OPENGL_ES == 2
+#ifdef USE_OPENGL_ES2
     vgl->CreateShader  = glCreateShader;
     vgl->ShaderSource  = glShaderSource;
     vgl->CompileShader = glCompileShader;
@@ -569,7 +563,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     vgl->supports_npot = HasExtension(extensions, "GL_ARB_texture_non_power_of_two") ||
                          HasExtension(extensions, "GL_APPLE_texture_2D_limited_npot");
 
-#if USE_OPENGL_ES == 2
+#ifdef USE_OPENGL_ES2
     /* OpenGL ES 2 includes support for non-power of 2 textures by specification
      * so checks for extensions are bound to fail. Check for OpenGL ES version instead. */
     vgl->supports_npot = true;
@@ -579,7 +573,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_units);
 
 #ifdef __APPLE__
-#if USE_OPENGL_ES
+#ifdef USE_OPENGL_ES2
     supports_shaders = true;
 #endif
 #endif
@@ -603,7 +597,11 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     /* Use YUV if possible and needed */
     bool need_fs_yuv = false;
     bool need_fs_xyz = false;
-    bool need_fs_rgba = USE_OPENGL_ES == 2;
+#   if defined (USE_OPENGL_ES2)
+    bool need_fs_rgba = true;
+#   else
+    bool need_fs_rgba = false;
+#   endif
     bool need_vs = fmt->projection_mode != PROJECTION_MODE_RECTANGULAR;
     float yuv_range_correction = 1.0;
 
@@ -620,7 +618,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
                 vgl->tex_type     = GL_UNSIGNED_BYTE;
                 yuv_range_correction = 1.0;
                 break;
-#if !USE_OPENGL_ES
+#ifndef USE_OPENGL_ES2
             } else if (dsc && dsc->plane_count == 3 && dsc->pixel_size == 2 &&
                        GetTexFormatSize(vgl->tex_target,
                                         yuv_plane_texformat,
@@ -925,7 +923,7 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
             }
             glBindTexture(vgl->tex_target, vgl->texture[i][j]);
 
-#if !USE_OPENGL_ES
+#ifndef USE_OPENGL_ES2
             /* Set the texture parameters */
             glTexParameterf(vgl->tex_target, GL_TEXTURE_PRIORITY, 1.0);
             glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
@@ -1107,7 +1105,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
                 /* Could not recycle a previous texture, generate a new one. */
                 glGenTextures(1, &glr->texture);
                 glBindTexture(GL_TEXTURE_2D, glr->texture);
-#if !USE_OPENGL_ES
+#ifndef USE_OPENGL_ES2
                 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 1.0);
                 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
 #endif
diff --git a/modules/video_output/opengl.h b/modules/video_output/opengl.h
index 7d6f55c..e7de09b 100644
--- a/modules/video_output/opengl.h
+++ b/modules/video_output/opengl.h
@@ -33,28 +33,23 @@
 #include <vlc_picture_pool.h>
 #include <vlc_opengl.h>
 
-/* Change USE_OPENGL_ES value to set the OpenGL ES version (1, 2) you want to use
- * A value of 0 will activate normal OpenGL */
+/* if USE_OPENGL_ES2 is defined, OpenGL ES version 2 will be used, otherwise
+ * normal OpenGL will be used */
 #ifdef __APPLE__
 # include <TargetConditionals.h>
 # if !TARGET_OS_IPHONE
-#  define USE_OPENGL_ES 0
+#  undef USE_OPENGL_ES2
 #  define MACOS_OPENGL
 #  include <OpenGL/gl.h>
 # else /* Force ESv2 on iOS */
-#  define USE_OPENGL_ES 2
+#  define USE_OPENGL_ES2
 #  include <OpenGLES/ES1/gl.h>
 #  include <OpenGLES/ES2/gl.h>
 #  include <OpenGLES/ES2/glext.h>
 # endif
 #else /* !defined (__APPLE__) */
-# ifndef USE_OPENGL_ES
-#  define USE_OPENGL_ES 0
-# endif
-# if USE_OPENGL_ES == 2
+# if defined (USE_OPENGL_ES2)
 #  include <GLES2/gl2.h>
-# elif USE_OPENGL_ES == 1
-#  include <GLES/gl.h>
 # else
 #  ifdef _WIN32
 #   include <GL/glew.h>
-- 
2.10.2



More information about the vlc-devel mailing list