gl: add support for building against GLES3 headers
authorMatthew Waters <matthew@centricular.com>
Thu, 31 Mar 2016 08:43:04 +0000 (19:43 +1100)
committerMatthew Waters <matthew@centricular.com>
Thu, 31 Mar 2016 09:53:18 +0000 (20:53 +1100)
with a fallback to GLES2 headers if available.

configure.ac
gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h
gst-libs/gst/gl/gstglapi.h
gst-libs/gst/gl/gstglcontext.c

index 8f1992e..51aa29f 100644 (file)
@@ -682,6 +682,7 @@ save_LIBS="$LIBS"
 
 HAVE_GL=no
 HAVE_GLES2=no
+HAVE_GLES3_H=no
 HAVE_WAYLAND_EGL=no
 
 HAVE_EGL_RPI=no
@@ -708,6 +709,7 @@ case $host in
       if test "x$HAVE_GLES2" != "xyes"; then
         AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h)
       fi
+      AC_CHECK_HEADER([GLES3/gl3.h], [HAVE_GLES3_H=yes])
     fi
     if test "x$NEED_EGL" != "xno"; then
       AG_GST_PKG_CHECK_MODULES(EGL, egl)
@@ -872,6 +874,10 @@ if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then
 # else
 #  include <GLES2/gl2.h>
 #  include <GLES2/gl2ext.h>
+#  if $HAVE_GLES3_H
+#   include <GLES3/gl3.h>
+#   include <GLES3/gl3ext.h>
+#  endif
 # endif
 # ifdef __APPLE__
 #  include <OpenGL/OpenGL.h>
@@ -907,6 +913,7 @@ int main (int argc, char **argv) { return 0; }
     else
       AC_MSG_WARN([Disabling GL|ES 2.0 support])
       HAVE_GLES2=no
+      HAVE_GLES3_H=no
     fi
   ])
   CFLAGS="$save_CFLAGS"
@@ -1150,6 +1157,9 @@ fi
 if test "x$USE_GLES2" = "xyes"; then
   GL_APIS="gles2 $GL_APIS"
   GST_GL_HAVE_GLES2=1
+  if test "x$HAVE_GLES3_H" = "xyes"; then
+    GST_GL_HAVE_GLES3=1
+  fi
 fi
 
 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
@@ -1321,6 +1331,10 @@ if test "x$USE_GLES2" = "xyes"; then
 # else
 #  include <GLES2/gl2.h>
 #  include <GLES2/gl2ext.h>
+#  if GST_GL_HAVE_GLES3
+#   include <GLES3/gl3.h>
+#   include <GLES3/gl3ext.h>
+#  endif
 # endif
 "
 fi
index d282990..6dfd2c3 100644 (file)
 
 G_BEGIN_DECLS
 
-/* SUPPORTED */
-//FIXME:
+#ifndef GL_RGB16
 #define GL_RGB16 GL_RGB565
+#endif
+#ifndef GL_RGB8
 #define GL_RGB8 GL_RGB
-//END FIXME
+#endif
 
 /* UNSUPPORTED */
 
-#define GL_COLOR_ATTACHMENT1 0
-#define GL_COLOR_ATTACHMENT2 0
+#ifndef GL_COLOR_ATTACHMENT1
+#define GL_COLOR_ATTACHMENT1 0x8CE1
+#endif
+#ifndef GL_COLOR_ATTACHMENT2
+#define GL_COLOR_ATTACHMENT2 0x8CE2
+#endif
 #ifndef GL_TEXTURE_ENV
 #define GL_TEXTURE_ENV 0
 #endif
 #ifndef GL_TEXTURE_ENV_MODE
 #define GL_TEXTURE_ENV_MODE 0
 #endif
-#define GL_DEPTH24_STENCIL8 0
+#ifndef GL_DEPTH24_STENCIL8
+#define GL_DEPTH24_STENCIL8 0x88F0
+#endif
 
 G_END_DECLS
 
index be38113..8c92666 100644 (file)
 # else
 #  include <GLES2/gl2.h>
 #  include <GLES2/gl2ext.h>
+#  if GST_GL_HAVE_GLES3
+#   include <GLES3/gl3.h>
+#   include <GLES3/gl3ext.h>
+#  endif
 # endif
 # if !GST_GL_HAVE_OPENGL
 #  include <gst/gl/glprototypes/gstgl_gles2compat.h>
index 2c208ed..77dc8fc 100644 (file)
@@ -132,10 +132,6 @@ load_self_module (gpointer user_data)
   return NULL;
 }
 
-#if GST_GL_HAVE_GLES3
-#error "Add module loading support for GLES3"
-#endif
-
 /* Context sharedness is tracked by a refcounted pointer stored in each context
  * object to track complex creation/deletion scenarios.  As a result,
  * sharedness can only be successfully validated between two GstGLContext's