build: Check for GLES3/gl3ext.h existence

Some OpenGL drivers do not ship this but use GLES2/gl2ext.h instead.
This is also in line with Khronos's recommendations

https://bugzilla.gnome.org/show_bug.cgi?id=781885
This commit is contained in:
Jens Georg 2017-05-11 10:29:58 +02:00 committed by Matthew Waters
parent b2663e12e4
commit 791e7522eb
2 changed files with 25 additions and 3 deletions

View file

@ -699,6 +699,10 @@ case $host in
AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h) AG_GST_CHECK_LIBHEADER(GLES2, GLESv2, glTexImage2D,, GLES2/gl2.h)
fi fi
AC_CHECK_HEADER([GLES3/gl3.h], [HAVE_GLES3_H=yes]) AC_CHECK_HEADER([GLES3/gl3.h], [HAVE_GLES3_H=yes])
AS_IF([test "x$HAVE_GLES3_H" == "xyes"],
[
AC_CHECK_HEADER([GLES3/gl3ext.h], [HAVE_GLES3EXT3_H=yes], [HAVE_GLES3EXT3_H=no], [#include <GLES3/gl3.h>])
])
fi fi
if test "x$NEED_EGL" != "xno"; then if test "x$NEED_EGL" != "xno"; then
AG_GST_PKG_CHECK_MODULES(EGL, egl) AG_GST_PKG_CHECK_MODULES(EGL, egl)
@ -874,9 +878,13 @@ fi
dnl check if we can include both GL and GLES2 at the same time dnl check if we can include both GL and GLES2 at the same time
if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then
GLES3_H_DEFINE=0 GLES3_H_DEFINE=0
GLES3EXT3_H_DEFINE=0
if test "x$HAVE_GLES3_H" == "xyes"; then if test "x$HAVE_GLES3_H" == "xyes"; then
GLES3_H_DEFINE=1 GLES3_H_DEFINE=1
fi fi
if test "x$HAVE_GLES3EXT3_H" == "xyes"; then
GLES3EXT3_H_DEFINE=1
fi
GL_INCLUDES=" GL_INCLUDES="
#ifdef __GNUC__ #ifdef __GNUC__
# pragma GCC diagnostic push # pragma GCC diagnostic push
@ -891,7 +899,10 @@ if test "x$HAVE_GL" = "xyes" -a "x$HAVE_GLES2" = "xyes"; then
# else # else
# if $GLES3_H_DEFINE # if $GLES3_H_DEFINE
# include <GLES3/gl3.h> # include <GLES3/gl3.h>
# include <GLES3/gl3ext.h> # if $GLES3EXT3_H_DEFINE
# include <GLES3/gl3ext.h>
# endif
# include <GLES2/gl2ext.h>
# else # else
# include <GLES2/gl2.h> # include <GLES2/gl2.h>
# include <GLES2/gl2ext.h> # include <GLES2/gl2ext.h>
@ -1177,6 +1188,7 @@ dnl APIs
GST_GL_HAVE_OPENGL=0 GST_GL_HAVE_OPENGL=0
GST_GL_HAVE_GLES2=0 GST_GL_HAVE_GLES2=0
GST_GL_HAVE_GLES3=0 GST_GL_HAVE_GLES3=0
GST_GL_HAVE_GLES3EXT3_H=0
if test "x$USE_OPENGL" = "xyes"; then if test "x$USE_OPENGL" = "xyes"; then
GL_APIS="gl $GL_APIS" GL_APIS="gl $GL_APIS"
@ -1187,6 +1199,9 @@ if test "x$USE_GLES2" = "xyes"; then
GST_GL_HAVE_GLES2=1 GST_GL_HAVE_GLES2=1
if test "x$HAVE_GLES3_H" = "xyes"; then if test "x$HAVE_GLES3_H" = "xyes"; then
GST_GL_HAVE_GLES3=1 GST_GL_HAVE_GLES3=1
if test "x$HAVE_GLES3EXT3_H" = "xyes"; then
GST_GL_HAVE_GLES3EXT3_H=1
fi
fi fi
fi fi
@ -1194,6 +1209,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
#define GST_GL_HAVE_OPENGL $GST_GL_HAVE_OPENGL #define GST_GL_HAVE_OPENGL $GST_GL_HAVE_OPENGL
#define GST_GL_HAVE_GLES2 $GST_GL_HAVE_GLES2 #define GST_GL_HAVE_GLES2 $GST_GL_HAVE_GLES2
#define GST_GL_HAVE_GLES3 $GST_GL_HAVE_GLES3 #define GST_GL_HAVE_GLES3 $GST_GL_HAVE_GLES3
#define GST_GL_HAVE_GLES3EXT3_H $GST_GL_HAVE_GLES3EXT3_H
" "
dnl WINDOW's dnl WINDOW's
@ -1371,7 +1387,10 @@ if test "x$USE_GLES2" = "xyes"; then
# else # else
# if $GST_GL_HAVE_GLES3 # if $GST_GL_HAVE_GLES3
# include <GLES3/gl3.h> # include <GLES3/gl3.h>
# include <GLES3/gl3ext.h> # if $GST_GL_HAVE_GLES3EXT3_H
# include <GLES3/gl3ext.h>
# endif
# include <GLES2/gl2ext.h>
# else # else
# include <GLES2/gl2.h> # include <GLES2/gl2.h>
# include <GLES2/gl2ext.h> # include <GLES2/gl2ext.h>

View file

@ -38,7 +38,10 @@
# else # else
# if GST_GL_HAVE_GLES3 # if GST_GL_HAVE_GLES3
# include <GLES3/gl3.h> # include <GLES3/gl3.h>
# include <GLES3/gl3ext.h> # if GST_GL_HAVE_GLES3EXT3_H
# include <GLES3/gl3ext.h>
# endif
# include <GLES2/gl2ext.h>
# else # else
# include <GLES2/gl2.h> # include <GLES2/gl2.h>
# include <GLES2/gl2ext.h> # include <GLES2/gl2ext.h>