Search
lxdream.org :: lxdream :: r656:031d23fa6d0b
lxdream 0.9.1
released Jun 29
Download Now
changeset656:031d23fa6d0b
parent655:31a4b664d489
child657:c4143facbfcb
authornkeynes
dateWed Apr 02 01:46:58 2008 +0000 (16 years ago)
Add configure-time checks for fbo and shader functions in libGL (so linking
doesn't fail on really old libGL implementations)
config.h.in
configure
configure.in
src/drivers/gl_fbo.c
src/pvr2/gl_sl.c
1.1 --- a/config.h.in Tue Apr 01 08:03:56 2008 +0000
1.2 +++ b/config.h.in Wed Apr 02 01:46:58 2008 +0000
1.3 @@ -67,6 +67,15 @@
1.4 /* Define to 1 if you have the <memory.h> header file. */
1.5 #undef HAVE_MEMORY_H
1.6
1.7 +/* Have EXT_framebuffer_object support */
1.8 +#undef HAVE_OPENGL_FBO
1.9 +
1.10 +/* Have 2.0 shader support */
1.11 +#undef HAVE_OPENGL_SHADER
1.12 +
1.13 +/* Have ARB shader support */
1.14 +#undef HAVE_OPENGL_SHADER_ARB
1.15 +
1.16 /* Define to 1 if you have the <stdint.h> header file. */
1.17 #undef HAVE_STDINT_H
1.18
2.1 --- a/configure Tue Apr 01 08:03:56 2008 +0000
2.2 +++ b/configure Wed Apr 02 01:46:58 2008 +0000
2.3 @@ -5973,6 +5973,274 @@
2.4 fi
2.5 fi
2.6
2.7 +{ echo "$as_me:$LINENO: checking for glGenFramebuffersEXT" >&5
2.8 +echo $ECHO_N "checking for glGenFramebuffersEXT... $ECHO_C" >&6; }
2.9 +if test "${ac_cv_func_glGenFramebuffersEXT+set}" = set; then
2.10 + echo $ECHO_N "(cached) $ECHO_C" >&6
2.11 +else
2.12 + cat >conftest.$ac_ext <<_ACEOF
2.13 +/* confdefs.h. */
2.14 +_ACEOF
2.15 +cat confdefs.h >>conftest.$ac_ext
2.16 +cat >>conftest.$ac_ext <<_ACEOF
2.17 +/* end confdefs.h. */
2.18 +/* Define glGenFramebuffersEXT to an innocuous variant, in case <limits.h> declares glGenFramebuffersEXT.
2.19 + For example, HP-UX 11i <limits.h> declares gettimeofday. */
2.20 +#define glGenFramebuffersEXT innocuous_glGenFramebuffersEXT
2.21 +
2.22 +/* System header to define __stub macros and hopefully few prototypes,
2.23 + which can conflict with char glGenFramebuffersEXT (); below.
2.24 + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
2.25 + <limits.h> exists even on freestanding compilers. */
2.26 +
2.27 +#ifdef __STDC__
2.28 +# include <limits.h>
2.29 +#else
2.30 +# include <assert.h>
2.31 +#endif
2.32 +
2.33 +#undef glGenFramebuffersEXT
2.34 +
2.35 +/* Override any GCC internal prototype to avoid an error.
2.36 + Use char because int might match the return type of a GCC
2.37 + builtin and then its argument prototype would still apply. */
2.38 +#ifdef __cplusplus
2.39 +extern "C"
2.40 +#endif
2.41 +char glGenFramebuffersEXT ();
2.42 +/* The GNU C library defines this for functions which it implements
2.43 + to always fail with ENOSYS. Some functions are actually named
2.44 + something starting with __ and the normal name is an alias. */
2.45 +#if defined __stub_glGenFramebuffersEXT || defined __stub___glGenFramebuffersEXT
2.46 +choke me
2.47 +#endif
2.48 +
2.49 +int
2.50 +main ()
2.51 +{
2.52 +return glGenFramebuffersEXT ();
2.53 + ;
2.54 + return 0;
2.55 +}
2.56 +_ACEOF
2.57 +rm -f conftest.$ac_objext conftest$ac_exeext
2.58 +if { (ac_try="$ac_link"
2.59 +case "(($ac_try" in
2.60 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2.61 + *) ac_try_echo=$ac_try;;
2.62 +esac
2.63 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2.64 + (eval "$ac_link") 2>conftest.er1
2.65 + ac_status=$?
2.66 + grep -v '^ *+' conftest.er1 >conftest.err
2.67 + rm -f conftest.er1
2.68 + cat conftest.err >&5
2.69 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
2.70 + (exit $ac_status); } && {
2.71 + test -z "$ac_c_werror_flag" ||
2.72 + test ! -s conftest.err
2.73 + } && test -s conftest$ac_exeext &&
2.74 + $as_test_x conftest$ac_exeext; then
2.75 + ac_cv_func_glGenFramebuffersEXT=yes
2.76 +else
2.77 + echo "$as_me: failed program was:" >&5
2.78 +sed 's/^/| /' conftest.$ac_ext >&5
2.79 +
2.80 + ac_cv_func_glGenFramebuffersEXT=no
2.81 +fi
2.82 +
2.83 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2.84 + conftest$ac_exeext conftest.$ac_ext
2.85 +fi
2.86 +{ echo "$as_me:$LINENO: result: $ac_cv_func_glGenFramebuffersEXT" >&5
2.87 +echo "${ECHO_T}$ac_cv_func_glGenFramebuffersEXT" >&6; }
2.88 +if test $ac_cv_func_glGenFramebuffersEXT = yes; then
2.89 +
2.90 +cat >>confdefs.h <<\_ACEOF
2.91 +#define HAVE_OPENGL_FBO 1
2.92 +_ACEOF
2.93 +
2.94 +fi
2.95 +
2.96 +{ echo "$as_me:$LINENO: checking for glCreateShader" >&5
2.97 +echo $ECHO_N "checking for glCreateShader... $ECHO_C" >&6; }
2.98 +if test "${ac_cv_func_glCreateShader+set}" = set; then
2.99 + echo $ECHO_N "(cached) $ECHO_C" >&6
2.100 +else
2.101 + cat >conftest.$ac_ext <<_ACEOF
2.102 +/* confdefs.h. */
2.103 +_ACEOF
2.104 +cat confdefs.h >>conftest.$ac_ext
2.105 +cat >>conftest.$ac_ext <<_ACEOF
2.106 +/* end confdefs.h. */
2.107 +/* Define glCreateShader to an innocuous variant, in case <limits.h> declares glCreateShader.
2.108 + For example, HP-UX 11i <limits.h> declares gettimeofday. */
2.109 +#define glCreateShader innocuous_glCreateShader
2.110 +
2.111 +/* System header to define __stub macros and hopefully few prototypes,
2.112 + which can conflict with char glCreateShader (); below.
2.113 + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
2.114 + <limits.h> exists even on freestanding compilers. */
2.115 +
2.116 +#ifdef __STDC__
2.117 +# include <limits.h>
2.118 +#else
2.119 +# include <assert.h>
2.120 +#endif
2.121 +
2.122 +#undef glCreateShader
2.123 +
2.124 +/* Override any GCC internal prototype to avoid an error.
2.125 + Use char because int might match the return type of a GCC
2.126 + builtin and then its argument prototype would still apply. */
2.127 +#ifdef __cplusplus
2.128 +extern "C"
2.129 +#endif
2.130 +char glCreateShader ();
2.131 +/* The GNU C library defines this for functions which it implements
2.132 + to always fail with ENOSYS. Some functions are actually named
2.133 + something starting with __ and the normal name is an alias. */
2.134 +#if defined __stub_glCreateShader || defined __stub___glCreateShader
2.135 +choke me
2.136 +#endif
2.137 +
2.138 +int
2.139 +main ()
2.140 +{
2.141 +return glCreateShader ();
2.142 + ;
2.143 + return 0;
2.144 +}
2.145 +_ACEOF
2.146 +rm -f conftest.$ac_objext conftest$ac_exeext
2.147 +if { (ac_try="$ac_link"
2.148 +case "(($ac_try" in
2.149 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2.150 + *) ac_try_echo=$ac_try;;
2.151 +esac
2.152 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2.153 + (eval "$ac_link") 2>conftest.er1
2.154 + ac_status=$?
2.155 + grep -v '^ *+' conftest.er1 >conftest.err
2.156 + rm -f conftest.er1
2.157 + cat conftest.err >&5
2.158 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
2.159 + (exit $ac_status); } && {
2.160 + test -z "$ac_c_werror_flag" ||
2.161 + test ! -s conftest.err
2.162 + } && test -s conftest$ac_exeext &&
2.163 + $as_test_x conftest$ac_exeext; then
2.164 + ac_cv_func_glCreateShader=yes
2.165 +else
2.166 + echo "$as_me: failed program was:" >&5
2.167 +sed 's/^/| /' conftest.$ac_ext >&5
2.168 +
2.169 + ac_cv_func_glCreateShader=no
2.170 +fi
2.171 +
2.172 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2.173 + conftest$ac_exeext conftest.$ac_ext
2.174 +fi
2.175 +{ echo "$as_me:$LINENO: result: $ac_cv_func_glCreateShader" >&5
2.176 +echo "${ECHO_T}$ac_cv_func_glCreateShader" >&6; }
2.177 +if test $ac_cv_func_glCreateShader = yes; then
2.178 +
2.179 +cat >>confdefs.h <<\_ACEOF
2.180 +#define HAVE_OPENGL_SHADER 1
2.181 +_ACEOF
2.182 +
2.183 +fi
2.184 +
2.185 +{ echo "$as_me:$LINENO: checking for glCreateShaderObjectARB" >&5
2.186 +echo $ECHO_N "checking for glCreateShaderObjectARB... $ECHO_C" >&6; }
2.187 +if test "${ac_cv_func_glCreateShaderObjectARB+set}" = set; then
2.188 + echo $ECHO_N "(cached) $ECHO_C" >&6
2.189 +else
2.190 + cat >conftest.$ac_ext <<_ACEOF
2.191 +/* confdefs.h. */
2.192 +_ACEOF
2.193 +cat confdefs.h >>conftest.$ac_ext
2.194 +cat >>conftest.$ac_ext <<_ACEOF
2.195 +/* end confdefs.h. */
2.196 +/* Define glCreateShaderObjectARB to an innocuous variant, in case <limits.h> declares glCreateShaderObjectARB.
2.197 + For example, HP-UX 11i <limits.h> declares gettimeofday. */
2.198 +#define glCreateShaderObjectARB innocuous_glCreateShaderObjectARB
2.199 +
2.200 +/* System header to define __stub macros and hopefully few prototypes,
2.201 + which can conflict with char glCreateShaderObjectARB (); below.
2.202 + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
2.203 + <limits.h> exists even on freestanding compilers. */
2.204 +
2.205 +#ifdef __STDC__
2.206 +# include <limits.h>
2.207 +#else
2.208 +# include <assert.h>
2.209 +#endif
2.210 +
2.211 +#undef glCreateShaderObjectARB
2.212 +
2.213 +/* Override any GCC internal prototype to avoid an error.
2.214 + Use char because int might match the return type of a GCC
2.215 + builtin and then its argument prototype would still apply. */
2.216 +#ifdef __cplusplus
2.217 +extern "C"
2.218 +#endif
2.219 +char glCreateShaderObjectARB ();
2.220 +/* The GNU C library defines this for functions which it implements
2.221 + to always fail with ENOSYS. Some functions are actually named
2.222 + something starting with __ and the normal name is an alias. */
2.223 +#if defined __stub_glCreateShaderObjectARB || defined __stub___glCreateShaderObjectARB
2.224 +choke me
2.225 +#endif
2.226 +
2.227 +int
2.228 +main ()
2.229 +{
2.230 +return glCreateShaderObjectARB ();
2.231 + ;
2.232 + return 0;
2.233 +}
2.234 +_ACEOF
2.235 +rm -f conftest.$ac_objext conftest$ac_exeext
2.236 +if { (ac_try="$ac_link"
2.237 +case "(($ac_try" in
2.238 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
2.239 + *) ac_try_echo=$ac_try;;
2.240 +esac
2.241 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
2.242 + (eval "$ac_link") 2>conftest.er1
2.243 + ac_status=$?
2.244 + grep -v '^ *+' conftest.er1 >conftest.err
2.245 + rm -f conftest.er1
2.246 + cat conftest.err >&5
2.247 + echo "$as_me:$LINENO: \$? = $ac_status" >&5
2.248 + (exit $ac_status); } && {
2.249 + test -z "$ac_c_werror_flag" ||
2.250 + test ! -s conftest.err
2.251 + } && test -s conftest$ac_exeext &&
2.252 + $as_test_x conftest$ac_exeext; then
2.253 + ac_cv_func_glCreateShaderObjectARB=yes
2.254 +else
2.255 + echo "$as_me: failed program was:" >&5
2.256 +sed 's/^/| /' conftest.$ac_ext >&5
2.257 +
2.258 + ac_cv_func_glCreateShaderObjectARB=no
2.259 +fi
2.260 +
2.261 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
2.262 + conftest$ac_exeext conftest.$ac_ext
2.263 +fi
2.264 +{ echo "$as_me:$LINENO: result: $ac_cv_func_glCreateShaderObjectARB" >&5
2.265 +echo "${ECHO_T}$ac_cv_func_glCreateShaderObjectARB" >&6; }
2.266 +if test $ac_cv_func_glCreateShaderObjectARB = yes; then
2.267 +
2.268 +cat >>confdefs.h <<\_ACEOF
2.269 +#define HAVE_OPENGL_SHADER_ARB 1
2.270 +_ACEOF
2.271 +
2.272 +fi
2.273 +
2.274 +
2.275
2.276 pkg_failed=no
2.277 { echo "$as_me:$LINENO: checking for GTK" >&5
3.1 --- a/configure.in Tue Apr 01 08:03:56 2008 +0000
3.2 +++ b/configure.in Wed Apr 02 01:46:58 2008 +0000
3.3 @@ -63,6 +63,10 @@
3.4 fi
3.5 fi
3.6
3.7 +AC_CHECK_FUNC(glGenFramebuffersEXT, [ AC_DEFINE([HAVE_OPENGL_FBO],1,[Have EXT_framebuffer_object support]) ], [])
3.8 +AC_CHECK_FUNC(glCreateShader, [ AC_DEFINE([HAVE_OPENGL_SHADER],1,[Have 2.0 shader support]) ], [])
3.9 +AC_CHECK_FUNC(glCreateShaderObjectARB, [ AC_DEFINE([HAVE_OPENGL_SHADER_ARB],1,[Have ARB shader support]) ], [])
3.10 +
3.11 dnl Check for GTK (required for unix systems)
3.12 PKG_CHECK_MODULES(GTK, gtk+-2.0, [
3.13 HAVE_GTK='yes'
4.1 --- a/src/drivers/gl_fbo.c Tue Apr 01 08:03:56 2008 +0000
4.2 +++ b/src/drivers/gl_fbo.c Wed Apr 02 01:46:58 2008 +0000
4.3 @@ -30,6 +30,8 @@
4.4 #include "drivers/video_gl.h"
4.5 #include "pvr2/glutil.h"
4.6
4.7 +#ifdef HAVE_OPENGL_FBO
4.8 +
4.9 #define MAX_FRAMEBUFFERS 2
4.10 #define MAX_TEXTURES_PER_FB 4
4.11
4.12 @@ -288,3 +290,14 @@
4.13 return gl_read_render_buffer( target, buffer, rowstride, format );
4.14 }
4.15
4.16 +#else
4.17 +gboolean gl_fbo_is_supported()
4.18 +{
4.19 + return FALSE;
4.20 +}
4.21 +
4.22 +void gl_fbo_init( display_driver_t driver )
4.23 +{
4.24 +}
4.25 +
4.26 +#endif
5.1 --- a/src/pvr2/gl_sl.c Tue Apr 01 08:03:56 2008 +0000
5.2 +++ b/src/pvr2/gl_sl.c Wed Apr 02 01:46:58 2008 +0000
5.3 @@ -128,7 +128,7 @@
5.4 glDeleteObjectARB(glsl_frag_shader);
5.5 }
5.6
5.7 -#else
5.8 +#elif HAVE_OPENGL_SHADER
5.9 static GLuint glsl_program = 0, glsl_vert_shader = 0, glsl_frag_shader = 0;
5.10
5.11 gboolean glsl_check_shader_error( char *msg, GLuint shader )
5.12 @@ -220,4 +220,15 @@
5.13 glDeleteShader(glsl_vert_shader);
5.14 glDeleteShader(glsl_frag_shader);
5.15 }
5.16 +
5.17 +#else
5.18 +gboolean glsl_load_shaders( const char *vertex_src, const char *fragment_src )
5.19 +{
5.20 + return FALSE;
5.21 +}
5.22 +
5.23 +void glsl_unload_shaders()
5.24 +{
5.25 +}
5.26 +
5.27 #endif
.