Search
lxdream.org :: lxdream :: r1228:8168aa94e6d7
lxdream 0.9.1
released Jun 29
Download Now
changeset1228:8168aa94e6d7
parent1227:cf6126df0398
child1229:dc935eee9767
authornkeynes
dateThu Feb 23 15:24:47 2012 +1000 (12 years ago)
Check for existence of glDrawBuffer (assuming that glReadBuffer will
follow). Note only need to guard the common code in gl_fbo.c
config.h.in
configure
configure.in
src/drivers/gl_fbo.c
1.1 --- a/config.h.in Thu Feb 23 14:59:58 2012 +1000
1.2 +++ b/config.h.in Thu Feb 23 15:24:47 2012 +1000
1.3 @@ -109,6 +109,9 @@
1.4 /* Have glClearDepthf function */
1.5 #undef HAVE_OPENGL_CLEAR_DEPTHF
1.6
1.7 +/* Have glDrawBuffer function */
1.8 +#undef HAVE_OPENGL_DRAW_BUFFER
1.9 +
1.10 /* Have 2.0 framebuffer_object support */
1.11 #undef HAVE_OPENGL_FBO
1.12
1.13 @@ -124,7 +127,7 @@
1.14 /* Have ARB shader support */
1.15 #undef HAVE_OPENGL_SHADER_ARB
1.16
1.17 -/* Have glAreTexturesResident */
1.18 +/* Have glAreTexturesResident function */
1.19 #undef HAVE_OPENGL_TEX_RESIDENT
1.20
1.21 /* Building with the OSMesa video driver */
2.1 --- a/configure Thu Feb 23 14:59:58 2012 +1000
2.2 +++ b/configure Thu Feb 23 15:24:47 2012 +1000
2.3 @@ -12372,6 +12372,95 @@
2.4
2.5 fi
2.6
2.7 +{ echo "$as_me:$LINENO: checking for glDrawBuffer" >&5
2.8 +echo $ECHO_N "checking for glDrawBuffer... $ECHO_C" >&6; }
2.9 +if test "${ac_cv_func_glDrawBuffer+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 glDrawBuffer to an innocuous variant, in case <limits.h> declares glDrawBuffer.
2.19 + For example, HP-UX 11i <limits.h> declares gettimeofday. */
2.20 +#define glDrawBuffer innocuous_glDrawBuffer
2.21 +
2.22 +/* System header to define __stub macros and hopefully few prototypes,
2.23 + which can conflict with char glDrawBuffer (); 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 glDrawBuffer
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 glDrawBuffer ();
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_glDrawBuffer || defined __stub___glDrawBuffer
2.46 +choke me
2.47 +#endif
2.48 +
2.49 +int
2.50 +main ()
2.51 +{
2.52 +return glDrawBuffer ();
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_glDrawBuffer=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_glDrawBuffer=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_glDrawBuffer" >&5
2.87 +echo "${ECHO_T}$ac_cv_func_glDrawBuffer" >&6; }
2.88 +if test $ac_cv_func_glDrawBuffer = yes; then
2.89 +
2.90 +cat >>confdefs.h <<\_ACEOF
2.91 +#define HAVE_OPENGL_DRAW_BUFFER 1
2.92 +_ACEOF
2.93 +
2.94 +fi
2.95 +
2.96 { echo "$as_me:$LINENO: checking for glTexEnvi" >&5
2.97 echo $ECHO_N "checking for glTexEnvi... $ECHO_C" >&6; }
2.98 if test "${ac_cv_func_glTexEnvi+set}" = set; then
2.99 @@ -12464,7 +12553,6 @@
2.100
2.101
2.102
2.103 -
2.104 if test "x$enable_translator" != "xno"; then
2.105 case $host_cpu in
2.106 i386|i486|i586|i686|x86_64)
3.1 --- a/configure.in Thu Feb 23 14:59:58 2012 +1000
3.2 +++ b/configure.in Thu Feb 23 15:24:47 2012 +1000
3.3 @@ -303,9 +303,9 @@
3.4 AC_CHECK_FUNC(glCreateShaderObjectARB, [ AC_DEFINE([HAVE_OPENGL_SHADER_ARB],1,[Have ARB shader support]) ], [])
3.5 AC_CHECK_FUNC(glClampColorARB, [ AC_DEFINE([HAVE_OPENGL_CLAMP_COLOR],1,[Have Color Clamp]) ], [])
3.6 AC_CHECK_FUNC(glClearDepthf, [ AC_DEFINE([HAVE_OPENGL_CLEAR_DEPTHF],1,[Have glClearDepthf function]) ], [])
3.7 -AC_CHECK_FUNC(glAreTexturesResident, [ AC_DEFINE([HAVE_OPENGL_TEX_RESIDENT],1,[Have glAreTexturesResident]) ], [])
3.8 +AC_CHECK_FUNC(glAreTexturesResident, [ AC_DEFINE([HAVE_OPENGL_TEX_RESIDENT],1,[Have glAreTexturesResident function]) ], [])
3.9 +AC_CHECK_FUNC(glDrawBuffer, [ AC_DEFINE([HAVE_OPENGL_DRAW_BUFFER],1,[Have glDrawBuffer function])], [])
3.10 AC_CHECK_FUNC(glTexEnvi, [ AC_DEFINE([HAVE_OPENGL_FIXEDFUNC],1,[Have OpenGL fixed-functionality]) ], [])dnl glTexEnvi is a pretty fair proxy for this.
3.11 -
3.12
3.13
3.14
4.1 --- a/src/drivers/gl_fbo.c Thu Feb 23 14:59:58 2012 +1000
4.2 +++ b/src/drivers/gl_fbo.c Thu Feb 23 15:24:47 2012 +1000
4.3 @@ -198,8 +198,10 @@
4.4 int attach = -1, i;
4.5 for( i=0; i<gl_fbo_max_attachments; i++ ) {
4.6 if( fbo[fbo_no].tex_ids[i] == tex_id ) {
4.7 +#ifdef HAVE_OPENGL_DRAW_BUFFER
4.8 glDrawBuffer(ATTACHMENT_POINT(i));
4.9 glReadBuffer(ATTACHMENT_POINT(i));
4.10 +#endif
4.11 return ATTACHMENT_POINT(i); // already attached
4.12 } else if( fbo[fbo_no].tex_ids[i] == -1 && attach == -1 ) {
4.13 attach = i;
4.14 @@ -213,8 +215,10 @@
4.15 glFramebufferTexture2D(GL_FRAMEBUFFER, ATTACHMENT_POINT(attach),
4.16 GL_TEXTURE_2D, tex_id, 0 );
4.17 /* Set draw/read buffers by default */
4.18 +#ifdef HAVE_OPENGL_DRAW_BUFFER
4.19 glDrawBuffer(ATTACHMENT_POINT(attach));
4.20 glReadBuffer(ATTACHMENT_POINT(attach));
4.21 +#endif
4.22
4.23 return ATTACHMENT_POINT(attach);
4.24 }
4.25 @@ -345,8 +349,10 @@
4.26 {
4.27 glBindFramebuffer( GL_FRAMEBUFFER, 0 );
4.28 /* Make sure texture attachment is not a current draw/read buffer */
4.29 +#ifdef HAVE_OPENGL_DRAW_BUFFER
4.30 glDrawBuffer( GL_FRONT );
4.31 glReadBuffer( GL_FRONT );
4.32 +#endif
4.33 display_driver->swap_buffers();
4.34 }
4.35
.