revision 635:76c63aac3590
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 635:76c63aac3590 |
parent | 625:5b44eca14f00 |
child | 636:2ccf94f966fc |
author | nkeynes |
date | Thu Feb 14 13:54:11 2008 +0000 (16 years ago) |
branch | lxdream-render |
Commit render work in progress. Main changes:
* Preliminary OSMesa support
* Move the generic gl code out to pvr2/
* Implement scene data structure + reader
* Remove the 1/z adjustments
* Preliminary OSMesa support
* Move the generic gl code out to pvr2/
* Implement scene data structure + reader
* Remove the 1/z adjustments
1.1 --- a/Makefile.in Thu Feb 07 02:04:40 2008 +00001.2 +++ b/Makefile.in Thu Feb 14 13:54:11 2008 +00001.3 @@ -111,6 +111,8 @@1.4 MSGFMT = @MSGFMT@1.5 MSGFMT_OPTS = @MSGFMT_OPTS@1.6 OBJEXT = @OBJEXT@1.7 +OSMESA_DRIVER_FALSE = @OSMESA_DRIVER_FALSE@1.8 +OSMESA_DRIVER_TRUE = @OSMESA_DRIVER_TRUE@1.9 PACKAGE = @PACKAGE@1.10 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@1.11 PACKAGE_NAME = @PACKAGE_NAME@1.12 @@ -190,7 +192,7 @@1.13 installdirs-recursive install-recursive uninstall-recursive \1.14 check-recursive installcheck-recursive1.15 DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \1.16 - COPYING ChangeLog INSTALL Makefile.am NEWS acconfig.h \1.17 + COPYING ChangeLog INSTALL Makefile.am NEWS TODO acconfig.h \1.18 aclocal.m4 config.guess config.h.in config.sub configure \1.19 configure.in depcomp install-sh missing mkinstalldirs1.20 DIST_SUBDIRS = src po test
2.1 --- a/config.h.in Thu Feb 07 02:04:40 2008 +00002.2 +++ b/config.h.in Thu Feb 14 13:54:11 2008 +00002.3 @@ -49,6 +49,9 @@2.4 /* Define to 1 if you have the `GL' library (-lGL). */2.5 #undef HAVE_LIBGL2.7 +/* Define to 1 if you have the `OSMesa' library (-lOSMesa). */2.8 +#undef HAVE_LIBOSMESA2.9 +2.10 /* Define to 1 if you have the `z' library (-lz). */2.11 #undef HAVE_LIBZ
3.1 --- a/configure Thu Feb 07 02:04:40 2008 +00003.2 +++ b/configure Thu Feb 14 13:54:11 2008 +00003.3 @@ -700,6 +700,8 @@3.4 host_cpu3.5 host_vendor3.6 host_os3.7 +OSMESA_DRIVER_TRUE3.8 +OSMESA_DRIVER_FALSE3.9 PKG_CONFIG3.10 LIBPNG_CFLAGS3.11 LIBPNG_LIBS3.12 @@ -1353,6 +1355,12 @@3.13 --enable-watch Enable watchpoints in the debugger (warning: hurts3.14 performance)3.16 +Optional Packages:3.17 + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]3.18 + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)3.19 + --with-osmesa Build with the osmesa GL library (software3.20 + rendering)3.21 +3.22 Some influential environment variables:3.23 CC C compiler command3.24 CFLAGS C compiler flags3.25 @@ -4983,6 +4991,15 @@3.26 fi3.27 fi3.29 +3.30 +# Check whether --with-osmesa was given.3.31 +if test "${with_osmesa+set}" = set; then3.32 + withval=$with_osmesa;3.33 +else3.34 + with_osmesa=no3.35 +fi3.36 +3.37 +3.38 # On IRIX 5.3, sys/types and inttypes.h are conflicting.3.41 @@ -5052,6 +5069,235 @@3.42 done3.45 +if test "x$with_osmesa" != xno; then3.46 +3.47 +3.48 +{ echo "$as_me:$LINENO: checking for OSMesaCreateContext in -lOSMesa" >&53.49 +echo $ECHO_N "checking for OSMesaCreateContext in -lOSMesa... $ECHO_C" >&6; }3.50 +if test "${ac_cv_lib_OSMesa_OSMesaCreateContext+set}" = set; then3.51 + echo $ECHO_N "(cached) $ECHO_C" >&63.52 +else3.53 + ac_check_lib_save_LIBS=$LIBS3.54 +LIBS="-lOSMesa $LIBS"3.55 +cat >conftest.$ac_ext <<_ACEOF3.56 +/* confdefs.h. */3.57 +_ACEOF3.58 +cat confdefs.h >>conftest.$ac_ext3.59 +cat >>conftest.$ac_ext <<_ACEOF3.60 +/* end confdefs.h. */3.61 +3.62 +/* Override any GCC internal prototype to avoid an error.3.63 + Use char because int might match the return type of a GCC3.64 + builtin and then its argument prototype would still apply. */3.65 +#ifdef __cplusplus3.66 +extern "C"3.67 +#endif3.68 +char OSMesaCreateContext ();3.69 +int3.70 +main ()3.71 +{3.72 +return OSMesaCreateContext ();3.73 + ;3.74 + return 0;3.75 +}3.76 +_ACEOF3.77 +rm -f conftest.$ac_objext conftest$ac_exeext3.78 +if { (ac_try="$ac_link"3.79 +case "(($ac_try" in3.80 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.81 + *) ac_try_echo=$ac_try;;3.82 +esac3.83 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&53.84 + (eval "$ac_link") 2>conftest.er13.85 + ac_status=$?3.86 + grep -v '^ *+' conftest.er1 >conftest.err3.87 + rm -f conftest.er13.88 + cat conftest.err >&53.89 + echo "$as_me:$LINENO: \$? = $ac_status" >&53.90 + (exit $ac_status); } && {3.91 + test -z "$ac_c_werror_flag" ||3.92 + test ! -s conftest.err3.93 + } && test -s conftest$ac_exeext &&3.94 + $as_test_x conftest$ac_exeext; then3.95 + ac_cv_lib_OSMesa_OSMesaCreateContext=yes3.96 +else3.97 + echo "$as_me: failed program was:" >&53.98 +sed 's/^/| /' conftest.$ac_ext >&53.99 +3.100 + ac_cv_lib_OSMesa_OSMesaCreateContext=no3.101 +fi3.102 +3.103 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \3.104 + conftest$ac_exeext conftest.$ac_ext3.105 +LIBS=$ac_check_lib_save_LIBS3.106 +fi3.107 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_OSMesa_OSMesaCreateContext" >&53.108 +echo "${ECHO_T}$ac_cv_lib_OSMesa_OSMesaCreateContext" >&6; }3.109 +if test $ac_cv_lib_OSMesa_OSMesaCreateContext = yes; then3.110 + cat >>confdefs.h <<_ACEOF3.111 +#define HAVE_LIBOSMESA 13.112 +_ACEOF3.113 +3.114 + LIBS="-lOSMesa $LIBS"3.115 +3.116 +else3.117 + { { echo "$as_me:$LINENO: error: --with-osmesa was given, but OSMesa library could not be found3.118 +See \`config.log' for more details." >&53.119 +echo "$as_me: error: --with-osmesa was given, but OSMesa library could not be found3.120 +See \`config.log' for more details." >&2;}3.121 + { (exit 1); exit 1; }; }3.122 +fi3.123 +3.124 + if test "${ac_cv_header_GL_osmesa_h+set}" = set; then3.125 + { echo "$as_me:$LINENO: checking for GL/osmesa.h" >&53.126 +echo $ECHO_N "checking for GL/osmesa.h... $ECHO_C" >&6; }3.127 +if test "${ac_cv_header_GL_osmesa_h+set}" = set; then3.128 + echo $ECHO_N "(cached) $ECHO_C" >&63.129 +fi3.130 +{ echo "$as_me:$LINENO: result: $ac_cv_header_GL_osmesa_h" >&53.131 +echo "${ECHO_T}$ac_cv_header_GL_osmesa_h" >&6; }3.132 +else3.133 + # Is the header compilable?3.134 +{ echo "$as_me:$LINENO: checking GL/osmesa.h usability" >&53.135 +echo $ECHO_N "checking GL/osmesa.h usability... $ECHO_C" >&6; }3.136 +cat >conftest.$ac_ext <<_ACEOF3.137 +/* confdefs.h. */3.138 +_ACEOF3.139 +cat confdefs.h >>conftest.$ac_ext3.140 +cat >>conftest.$ac_ext <<_ACEOF3.141 +/* end confdefs.h. */3.142 +$ac_includes_default3.143 +#include <GL/osmesa.h>3.144 +_ACEOF3.145 +rm -f conftest.$ac_objext3.146 +if { (ac_try="$ac_compile"3.147 +case "(($ac_try" in3.148 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.149 + *) ac_try_echo=$ac_try;;3.150 +esac3.151 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&53.152 + (eval "$ac_compile") 2>conftest.er13.153 + ac_status=$?3.154 + grep -v '^ *+' conftest.er1 >conftest.err3.155 + rm -f conftest.er13.156 + cat conftest.err >&53.157 + echo "$as_me:$LINENO: \$? = $ac_status" >&53.158 + (exit $ac_status); } && {3.159 + test -z "$ac_c_werror_flag" ||3.160 + test ! -s conftest.err3.161 + } && test -s conftest.$ac_objext; then3.162 + ac_header_compiler=yes3.163 +else3.164 + echo "$as_me: failed program was:" >&53.165 +sed 's/^/| /' conftest.$ac_ext >&53.166 +3.167 + ac_header_compiler=no3.168 +fi3.169 +3.170 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext3.171 +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&53.172 +echo "${ECHO_T}$ac_header_compiler" >&6; }3.173 +3.174 +# Is the header present?3.175 +{ echo "$as_me:$LINENO: checking GL/osmesa.h presence" >&53.176 +echo $ECHO_N "checking GL/osmesa.h presence... $ECHO_C" >&6; }3.177 +cat >conftest.$ac_ext <<_ACEOF3.178 +/* confdefs.h. */3.179 +_ACEOF3.180 +cat confdefs.h >>conftest.$ac_ext3.181 +cat >>conftest.$ac_ext <<_ACEOF3.182 +/* end confdefs.h. */3.183 +#include <GL/osmesa.h>3.184 +_ACEOF3.185 +if { (ac_try="$ac_cpp conftest.$ac_ext"3.186 +case "(($ac_try" in3.187 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.188 + *) ac_try_echo=$ac_try;;3.189 +esac3.190 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&53.191 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er13.192 + ac_status=$?3.193 + grep -v '^ *+' conftest.er1 >conftest.err3.194 + rm -f conftest.er13.195 + cat conftest.err >&53.196 + echo "$as_me:$LINENO: \$? = $ac_status" >&53.197 + (exit $ac_status); } >/dev/null && {3.198 + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||3.199 + test ! -s conftest.err3.200 + }; then3.201 + ac_header_preproc=yes3.202 +else3.203 + echo "$as_me: failed program was:" >&53.204 +sed 's/^/| /' conftest.$ac_ext >&53.205 +3.206 + ac_header_preproc=no3.207 +fi3.208 +3.209 +rm -f conftest.err conftest.$ac_ext3.210 +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&53.211 +echo "${ECHO_T}$ac_header_preproc" >&6; }3.212 +3.213 +# So? What about this header?3.214 +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in3.215 + yes:no: )3.216 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: accepted by the compiler, rejected by the preprocessor!" >&53.217 +echo "$as_me: WARNING: GL/osmesa.h: accepted by the compiler, rejected by the preprocessor!" >&2;}3.218 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: proceeding with the compiler's result" >&53.219 +echo "$as_me: WARNING: GL/osmesa.h: proceeding with the compiler's result" >&2;}3.220 + ac_header_preproc=yes3.221 + ;;3.222 + no:yes:* )3.223 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: present but cannot be compiled" >&53.224 +echo "$as_me: WARNING: GL/osmesa.h: present but cannot be compiled" >&2;}3.225 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: check for missing prerequisite headers?" >&53.226 +echo "$as_me: WARNING: GL/osmesa.h: check for missing prerequisite headers?" >&2;}3.227 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: see the Autoconf documentation" >&53.228 +echo "$as_me: WARNING: GL/osmesa.h: see the Autoconf documentation" >&2;}3.229 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: section \"Present But Cannot Be Compiled\"" >&53.230 +echo "$as_me: WARNING: GL/osmesa.h: section \"Present But Cannot Be Compiled\"" >&2;}3.231 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: proceeding with the preprocessor's result" >&53.232 +echo "$as_me: WARNING: GL/osmesa.h: proceeding with the preprocessor's result" >&2;}3.233 + { echo "$as_me:$LINENO: WARNING: GL/osmesa.h: in the future, the compiler will take precedence" >&53.234 +echo "$as_me: WARNING: GL/osmesa.h: in the future, the compiler will take precedence" >&2;}3.235 +3.236 + ;;3.237 +esac3.238 +{ echo "$as_me:$LINENO: checking for GL/osmesa.h" >&53.239 +echo $ECHO_N "checking for GL/osmesa.h... $ECHO_C" >&6; }3.240 +if test "${ac_cv_header_GL_osmesa_h+set}" = set; then3.241 + echo $ECHO_N "(cached) $ECHO_C" >&63.242 +else3.243 + ac_cv_header_GL_osmesa_h=$ac_header_preproc3.244 +fi3.245 +{ echo "$as_me:$LINENO: result: $ac_cv_header_GL_osmesa_h" >&53.246 +echo "${ECHO_T}$ac_cv_header_GL_osmesa_h" >&6; }3.247 +3.248 +fi3.249 +if test $ac_cv_header_GL_osmesa_h = yes; then3.250 + :3.251 +else3.252 + { { echo "$as_me:$LINENO: error: --with-osmesa was given, but osmesa.h could not be found3.253 +See \`config.log' for more details." >&53.254 +echo "$as_me: error: --with-osmesa was given, but osmesa.h could not be found3.255 +See \`config.log' for more details." >&2;}3.256 + { (exit 1); exit 1; }; }3.257 +fi3.258 +3.259 +3.260 +3.261 +fi3.262 +3.263 +3.264 +3.265 +if test "x$with_osmesa" != xno; then3.266 + OSMESA_DRIVER_TRUE=3.267 + OSMESA_DRIVER_FALSE='#'3.268 +else3.269 + OSMESA_DRIVER_TRUE='#'3.270 + OSMESA_DRIVER_FALSE=3.271 +fi3.272 +3.273 +3.274 if test "${ac_cv_header_Carbon_Carbon_h+set}" = set; then3.275 { echo "$as_me:$LINENO: checking for Carbon/Carbon.h" >&53.276 echo $ECHO_N "checking for Carbon/Carbon.h... $ECHO_C" >&6; }3.277 @@ -5506,6 +5752,7 @@3.280 if test "$APPLE_BUILD" != 'yes'; then3.281 +if test "x$with_osmesa" == "xno"; then3.283 { echo "$as_me:$LINENO: checking for glXQueryVersion in -lGL" >&53.284 echo $ECHO_N "checking for glXQueryVersion in -lGL... $ECHO_C" >&6; }3.285 @@ -5716,6 +5963,7 @@3.288 fi3.289 +fi3.292 pkg_failed=no3.293 @@ -8204,6 +8452,13 @@3.294 Usually this means the macro was only invoked conditionally." >&2;}3.295 { (exit 1); exit 1; }; }3.296 fi3.297 +if test -z "${OSMESA_DRIVER_TRUE}" && test -z "${OSMESA_DRIVER_FALSE}"; then3.298 + { { echo "$as_me:$LINENO: error: conditional \"OSMESA_DRIVER\" was never defined.3.299 +Usually this means the macro was only invoked conditionally." >&53.300 +echo "$as_me: error: conditional \"OSMESA_DRIVER\" was never defined.3.301 +Usually this means the macro was only invoked conditionally." >&2;}3.302 + { (exit 1); exit 1; }; }3.303 +fi3.304 if test -z "${GUI_CARBON_TRUE}" && test -z "${GUI_CARBON_FALSE}"; then3.305 { { echo "$as_me:$LINENO: error: conditional \"GUI_CARBON\" was never defined.3.306 Usually this means the macro was only invoked conditionally." >&53.307 @@ -8890,6 +9145,8 @@3.308 host_cpu!$host_cpu$ac_delim3.309 host_vendor!$host_vendor$ac_delim3.310 host_os!$host_os$ac_delim3.311 +OSMESA_DRIVER_TRUE!$OSMESA_DRIVER_TRUE$ac_delim3.312 +OSMESA_DRIVER_FALSE!$OSMESA_DRIVER_FALSE$ac_delim3.313 PKG_CONFIG!$PKG_CONFIG$ac_delim3.314 LIBPNG_CFLAGS!$LIBPNG_CFLAGS$ac_delim3.315 LIBPNG_LIBS!$LIBPNG_LIBS$ac_delim3.316 @@ -8898,8 +9155,6 @@3.317 GUI_CARBON_TRUE!$GUI_CARBON_TRUE$ac_delim3.318 GUI_CARBON_FALSE!$GUI_CARBON_FALSE$ac_delim3.319 GUI_GTK_TRUE!$GUI_GTK_TRUE$ac_delim3.320 -GUI_GTK_FALSE!$GUI_GTK_FALSE$ac_delim3.321 -BUILD_SH4X86_TRUE!$BUILD_SH4X86_TRUE$ac_delim3.322 _ACEOF3.324 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then3.325 @@ -8941,6 +9196,8 @@3.326 ac_delim='%!_!# '3.327 for ac_last_try in false false false false false :; do3.328 cat >conf$$subs.sed <<_ACEOF3.329 +GUI_GTK_FALSE!$GUI_GTK_FALSE$ac_delim3.330 +BUILD_SH4X86_TRUE!$BUILD_SH4X86_TRUE$ac_delim3.331 BUILD_SH4X86_FALSE!$BUILD_SH4X86_FALSE$ac_delim3.332 BUILD_X86_64_TRUE!$BUILD_X86_64_TRUE$ac_delim3.333 BUILD_X86_64_FALSE!$BUILD_X86_64_FALSE$ac_delim3.334 @@ -8983,7 +9240,7 @@3.335 LTLIBOBJS!$LTLIBOBJS$ac_delim3.336 _ACEOF3.338 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 40; then3.339 + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 42; then3.340 break3.341 elif $ac_last_try; then3.342 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
4.1 --- a/configure.in Thu Feb 07 02:04:40 2008 +00004.2 +++ b/configure.in Thu Feb 14 13:54:11 2008 +00004.3 @@ -22,6 +22,18 @@4.4 [if test "$enableval" == "yes"; then4.5 AC_DEFINE(ENABLE_WATCH, 1, [Enable watchpoints])4.6 fi] )4.7 +AC_ARG_WITH( osmesa,4.8 + AS_HELP_STRING( [--with-osmesa], [Build with the osmesa GL library (software rendering)]),4.9 + [], [with_osmesa=no])4.10 +4.11 +AS_IF([test "x$with_osmesa" != xno], [4.12 + AC_CHECK_LIB([OSMesa], [OSMesaCreateContext], [],4.13 + [AC_MSG_FAILURE( [--with-osmesa was given, but OSMesa library could not be found])])4.14 + AC_CHECK_HEADER([GL/osmesa.h], [],4.15 + [AC_MSG_FAILURE( [--with-osmesa was given, but osmesa.h could not be found])])4.16 + ])4.17 +AM_CONDITIONAL(OSMESA_DRIVER, [test "x$with_osmesa" != xno])4.18 +4.19 dnl ----------- Check for mandatory dependencies --------------4.20 dnl Building on MAC?4.21 AC_CHECK_HEADER([Carbon/Carbon.h], [4.22 @@ -41,6 +53,7 @@4.23 exit 1])4.25 if test "$APPLE_BUILD" != 'yes'; then4.26 +if test "x$with_osmesa" == "xno"; then4.27 AC_CHECK_LIB(GL, glXQueryVersion, [], [4.28 echo "The OpenGL library (libGL.so) could not be found, but is required."4.29 exit 1])4.30 @@ -48,6 +61,7 @@4.31 echo "The OpenGL header files (eg GL/gl.h) could not be found, but are required."4.32 exit 1])4.33 fi4.34 +fi4.36 dnl Check for GTK (required for unix systems)4.37 PKG_CHECK_MODULES(GTK, gtk+-2.0, [
5.1 --- a/src/Makefile.am Thu Feb 07 02:04:40 2008 +00005.2 +++ b/src/Makefile.am Thu Feb 14 13:54:11 2008 +00005.3 @@ -13,7 +13,7 @@5.5 AM_CFLAGS = -D_ISOC99_SOURCE -D_BSD_SOURCE5.6 TESTS = test/testxlt5.7 -BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c drivers/gl_slsrc.c5.8 +BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c pvr2/gl_slsrc.c5.10 gendec_SOURCES = tools/gendec.c tools/gendec.h tools/insparse.c tools/actparse.c5.11 genglsl_SOURCES = tools/genglsl.c5.12 @@ -34,14 +34,14 @@5.13 aica/aica.c aica/aica.h aica/audio.c aica/audio.h \5.14 pvr2/pvr2.c pvr2/pvr2.h pvr2/pvr2mem.c \5.15 pvr2/tacore.c pvr2/render.c pvr2/rendcore.c pvr2/rendbkg.c pvr2/rendsort.c \5.16 - pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c \5.17 + pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c pvr2/scene.h \5.18 + pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c pvr2/glutil.h \5.19 maple/maple.c maple/maple.h \5.20 maple/controller.c maple/controller.h maple/kbd.c maple/mouse.c \5.21 loader.c bootstrap.c util.c \5.22 display.c display.h dckeysyms.h \5.23 drivers/audio_null.c drivers/video_null.c \5.24 - drivers/gl_common.c drivers/gl_common.h drivers/gl_fbo.c \5.25 - drivers/gl_sl.c drivers/gl_slsrc.c5.26 + drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c5.28 if BUILD_SH4X865.29 lxdream_SOURCES += sh4/sh4x86.c sh4/x86op.h \5.30 @@ -61,12 +61,21 @@5.31 endif5.33 if GUI_GTK5.34 +if OSMESA_DRIVER5.35 lxdream_SOURCES += gtkui/gtkui.c gtkui/gtkui.h \5.36 gtkui/main_win.c gtkui/gtkcb.c \5.37 gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \5.38 gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \5.39 drivers/video_gtk.c drivers/video_gtk.h \5.40 - drivers/video_glx.c drivers/video_glx.h5.41 + drivers/video_gdk.c drivers/video_gdk.h5.42 +else5.43 +lxdream_SOURCES += gtkui/gtkui.c gtkui/gtkui.h \5.44 + gtkui/main_win.c gtkui/gtkcb.c \5.45 + gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \5.46 + gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \5.47 + drivers/video_gtk.c drivers/video_gtk.h \5.48 + drivers/video_glx.c drivers/video_glx.h5.49 +endif5.50 endif5.52 if CDROM_LINUX5.53 @@ -99,5 +108,5 @@5.54 ./gendec sh4/sh4.def sh4/sh4x86.in -o sh4/sh4x86.c5.55 sh4/sh4stat.c: gendec sh4/sh4.def sh4/sh4stat.in5.56 ./gendec sh4/sh4.def sh4/sh4stat.in -o sh4/sh4stat.c5.57 -drivers/gl_slsrc.c: genglsl drivers/vertex.glsl drivers/fragment.glsl5.58 - ./genglsl drivers/vertex.glsl drivers/fragment.glsl drivers/gl_slsrc.c5.59 +pvr2/gl_slsrc.c: genglsl pvr2/vertex.glsl pvr2/fragment.glsl5.60 + ./genglsl pvr2/vertex.glsl pvr2/fragment.glsl pvr2/gl_slsrc.c
6.1 --- a/src/Makefile.in Thu Feb 07 02:04:40 2008 +00006.2 +++ b/src/Makefile.in Thu Feb 14 13:54:11 2008 +00006.3 @@ -43,17 +43,24 @@6.4 @BUILD_SH4X86_TRUE@ x86dasm/i386-dis.c x86dasm/dis-init.c x86dasm/dis-buf.c6.6 @BUILD_SH4X86_TRUE@am__append_2 = test/testsh4x866.7 -@GUI_GTK_TRUE@am__append_3 = gtkui/gtkui.c gtkui/gtkui.h \6.8 -@GUI_GTK_TRUE@ gtkui/main_win.c gtkui/gtkcb.c \6.9 -@GUI_GTK_TRUE@ gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \6.10 -@GUI_GTK_TRUE@ gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \6.11 -@GUI_GTK_TRUE@ drivers/video_gtk.c drivers/video_gtk.h \6.12 -@GUI_GTK_TRUE@ drivers/video_glx.c drivers/video_glx.h6.13 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@am__append_3 = gtkui/gtkui.c gtkui/gtkui.h \6.14 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ gtkui/main_win.c gtkui/gtkcb.c \6.15 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \6.16 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \6.17 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ drivers/video_gtk.c drivers/video_gtk.h \6.18 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ drivers/video_gdk.c drivers/video_gdk.h6.20 -@CDROM_LINUX_TRUE@am__append_4 = drivers/cd_linux.c6.21 -@CDROM_LINUX_FALSE@am__append_5 = drivers/cd_none.c6.22 -@JOY_LINUX_TRUE@am__append_6 = drivers/joy_linux.c6.23 -@AUDIO_ESOUND_TRUE@am__append_7 = drivers/audio_esd.c6.24 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@am__append_4 = gtkui/gtkui.c gtkui/gtkui.h \6.25 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ gtkui/main_win.c gtkui/gtkcb.c \6.26 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \6.27 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \6.28 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ drivers/video_gtk.c drivers/video_gtk.h \6.29 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ drivers/video_glx.c drivers/video_glx.h6.30 +6.31 +@CDROM_LINUX_TRUE@am__append_5 = drivers/cd_linux.c6.32 +@CDROM_LINUX_FALSE@am__append_6 = drivers/cd_none.c6.33 +@JOY_LINUX_TRUE@am__append_7 = drivers/joy_linux.c6.34 +@AUDIO_ESOUND_TRUE@am__append_8 = drivers/audio_esd.c6.35 ACLOCAL = @ACLOCAL@6.36 AMDEP_FALSE = @AMDEP_FALSE@6.37 AMDEP_TRUE = @AMDEP_TRUE@6.38 @@ -129,6 +136,8 @@6.39 MSGFMT = @MSGFMT@6.40 MSGFMT_OPTS = @MSGFMT_OPTS@6.41 OBJEXT = @OBJEXT@6.42 +OSMESA_DRIVER_FALSE = @OSMESA_DRIVER_FALSE@6.43 +OSMESA_DRIVER_TRUE = @OSMESA_DRIVER_TRUE@6.44 PACKAGE = @PACKAGE@6.45 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@6.46 PACKAGE_NAME = @PACKAGE_NAME@6.47 @@ -205,7 +214,7 @@6.49 AM_CFLAGS = -D_ISOC99_SOURCE -D_BSD_SOURCE6.50 TESTS = test/testxlt6.51 -BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c drivers/gl_slsrc.c6.52 +BUILT_SOURCES = sh4/sh4core.c sh4/sh4dasm.c sh4/sh4x86.c pvr2/gl_slsrc.c6.54 gendec_SOURCES = tools/gendec.c tools/gendec.h tools/insparse.c tools/actparse.c6.55 genglsl_SOURCES = tools/genglsl.c6.56 @@ -226,15 +235,15 @@6.57 aica/aica.c aica/aica.h aica/audio.c aica/audio.h \6.58 pvr2/pvr2.c pvr2/pvr2.h pvr2/pvr2mem.c \6.59 pvr2/tacore.c pvr2/render.c pvr2/rendcore.c pvr2/rendbkg.c pvr2/rendsort.c \6.60 - pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c \6.61 + pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c pvr2/scene.h \6.62 + pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c pvr2/glutil.h \6.63 maple/maple.c maple/maple.h \6.64 maple/controller.c maple/controller.h maple/kbd.c maple/mouse.c \6.65 loader.c bootstrap.c util.c \6.66 display.c display.h dckeysyms.h \6.67 drivers/audio_null.c drivers/video_null.c \6.68 - drivers/gl_common.c drivers/gl_common.h drivers/gl_fbo.c \6.69 - drivers/gl_sl.c drivers/gl_slsrc.c\6.70 -$(am__append_1) $(am__append_3) $(am__append_4) $(am__append_5) $(am__append_6) $(am__append_7)6.71 + drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c\6.72 +$(am__append_1) $(am__append_3) $(am__append_4) $(am__append_5) $(am__append_6) $(am__append_7) $(am__append_8)6.74 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @GTK_LIBS@6.75 @BUILD_SH4X86_TRUE@test_testsh4x86_SOURCES = test/testsh4x86.c x86dasm/x86dasm.c \6.76 @@ -284,34 +293,52 @@6.77 aica/aica.c aica/aica.h aica/audio.c aica/audio.h pvr2/pvr2.c \6.78 pvr2/pvr2.h pvr2/pvr2mem.c pvr2/tacore.c pvr2/render.c \6.79 pvr2/rendcore.c pvr2/rendbkg.c pvr2/rendsort.c pvr2/texcache.c \6.80 - pvr2/yuv.c pvr2/rendsave.c maple/maple.c maple/maple.h \6.81 - maple/controller.c maple/controller.h maple/kbd.c maple/mouse.c \6.82 - loader.c bootstrap.c util.c display.c display.h dckeysyms.h \6.83 - drivers/audio_null.c drivers/video_null.c drivers/gl_common.c \6.84 - drivers/gl_common.h drivers/gl_fbo.c drivers/gl_sl.c \6.85 - drivers/gl_slsrc.c sh4/sh4x86.c sh4/x86op.h sh4/ia32abi.h \6.86 - sh4/ia32mac.h sh4/ia64abi.h sh4/sh4trans.c sh4/sh4trans.h \6.87 - x86dasm/x86dasm.c x86dasm/x86dasm.h x86dasm/i386-dis.c \6.88 - x86dasm/dis-init.c x86dasm/dis-buf.c gtkui/gtkui.c \6.89 - gtkui/gtkui.h gtkui/main_win.c gtkui/gtkcb.c gtkui/mmio_win.c \6.90 - gtkui/debug_win.c gtkui/dump_win.c gtkui/ctrl_dlg.c \6.91 - gtkui/path_dlg.c gtkui/gdrom_menu.c drivers/video_gtk.c \6.92 - drivers/video_gtk.h drivers/video_glx.c drivers/video_glx.h \6.93 + pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c pvr2/scene.h \6.94 + pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c pvr2/glutil.h \6.95 + maple/maple.c maple/maple.h maple/controller.c \6.96 + maple/controller.h maple/kbd.c maple/mouse.c loader.c \6.97 + bootstrap.c util.c display.c display.h dckeysyms.h \6.98 + drivers/audio_null.c drivers/video_null.c drivers/video_gl.c \6.99 + drivers/video_gl.h drivers/gl_fbo.c sh4/sh4x86.c sh4/x86op.h \6.100 + sh4/ia32abi.h sh4/ia32mac.h sh4/ia64abi.h sh4/sh4trans.c \6.101 + sh4/sh4trans.h x86dasm/x86dasm.c x86dasm/x86dasm.h \6.102 + x86dasm/i386-dis.c x86dasm/dis-init.c x86dasm/dis-buf.c \6.103 + gtkui/gtkui.c gtkui/gtkui.h gtkui/main_win.c gtkui/gtkcb.c \6.104 + gtkui/mmio_win.c gtkui/debug_win.c gtkui/dump_win.c \6.105 + gtkui/ctrl_dlg.c gtkui/path_dlg.c gtkui/gdrom_menu.c \6.106 + drivers/video_gtk.c drivers/video_gtk.h drivers/video_gdk.c \6.107 + drivers/video_gdk.h drivers/video_glx.c drivers/video_glx.h \6.108 drivers/cd_linux.c drivers/cd_none.c drivers/joy_linux.c \6.109 drivers/audio_esd.c6.110 @BUILD_SH4X86_TRUE@am__objects_1 = sh4x86.$(OBJEXT) sh4trans.$(OBJEXT) \6.111 @BUILD_SH4X86_TRUE@ x86dasm.$(OBJEXT) i386-dis.$(OBJEXT) \6.112 @BUILD_SH4X86_TRUE@ dis-init.$(OBJEXT) dis-buf.$(OBJEXT)6.113 -@GUI_GTK_TRUE@am__objects_2 = gtkui.$(OBJEXT) main_win.$(OBJEXT) \6.114 -@GUI_GTK_TRUE@ gtkcb.$(OBJEXT) mmio_win.$(OBJEXT) \6.115 -@GUI_GTK_TRUE@ debug_win.$(OBJEXT) dump_win.$(OBJEXT) \6.116 -@GUI_GTK_TRUE@ ctrl_dlg.$(OBJEXT) path_dlg.$(OBJEXT) \6.117 -@GUI_GTK_TRUE@ gdrom_menu.$(OBJEXT) video_gtk.$(OBJEXT) \6.118 -@GUI_GTK_TRUE@ video_glx.$(OBJEXT)6.119 -@CDROM_LINUX_TRUE@am__objects_3 = cd_linux.$(OBJEXT)6.120 -@CDROM_LINUX_FALSE@am__objects_4 = cd_none.$(OBJEXT)6.121 -@JOY_LINUX_TRUE@am__objects_5 = joy_linux.$(OBJEXT)6.122 -@AUDIO_ESOUND_TRUE@am__objects_6 = audio_esd.$(OBJEXT)6.123 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@am__objects_2 = gtkui.$(OBJEXT) \6.124 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ main_win.$(OBJEXT) \6.125 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ gtkcb.$(OBJEXT) \6.126 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ mmio_win.$(OBJEXT) \6.127 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ debug_win.$(OBJEXT) \6.128 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ dump_win.$(OBJEXT) \6.129 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ ctrl_dlg.$(OBJEXT) \6.130 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ path_dlg.$(OBJEXT) \6.131 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ gdrom_menu.$(OBJEXT) \6.132 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ video_gtk.$(OBJEXT) \6.133 +@GUI_GTK_TRUE@@OSMESA_DRIVER_TRUE@ video_gdk.$(OBJEXT)6.134 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@am__objects_3 = gtkui.$(OBJEXT) \6.135 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ main_win.$(OBJEXT) \6.136 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ gtkcb.$(OBJEXT) \6.137 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ mmio_win.$(OBJEXT) \6.138 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ debug_win.$(OBJEXT) \6.139 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ dump_win.$(OBJEXT) \6.140 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ ctrl_dlg.$(OBJEXT) \6.141 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ path_dlg.$(OBJEXT) \6.142 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ gdrom_menu.$(OBJEXT) \6.143 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ video_gtk.$(OBJEXT) \6.144 +@GUI_GTK_TRUE@@OSMESA_DRIVER_FALSE@ video_glx.$(OBJEXT)6.145 +@CDROM_LINUX_TRUE@am__objects_4 = cd_linux.$(OBJEXT)6.146 +@CDROM_LINUX_FALSE@am__objects_5 = cd_none.$(OBJEXT)6.147 +@JOY_LINUX_TRUE@am__objects_6 = joy_linux.$(OBJEXT)6.148 +@AUDIO_ESOUND_TRUE@am__objects_7 = audio_esd.$(OBJEXT)6.149 am_lxdream_OBJECTS = main.$(OBJEXT) config.$(OBJEXT) mem.$(OBJEXT) \6.150 watch.$(OBJEXT) asic.$(OBJEXT) syscall.$(OBJEXT) bios.$(OBJEXT) \6.151 dcload.$(OBJEXT) ide.$(OBJEXT) gdimage.$(OBJEXT) \6.152 @@ -325,13 +352,14 @@6.153 pvr2mem.$(OBJEXT) tacore.$(OBJEXT) render.$(OBJEXT) \6.154 rendcore.$(OBJEXT) rendbkg.$(OBJEXT) rendsort.$(OBJEXT) \6.155 texcache.$(OBJEXT) yuv.$(OBJEXT) rendsave.$(OBJEXT) \6.156 - maple.$(OBJEXT) controller.$(OBJEXT) kbd.$(OBJEXT) \6.157 - mouse.$(OBJEXT) loader.$(OBJEXT) bootstrap.$(OBJEXT) \6.158 - util.$(OBJEXT) display.$(OBJEXT) audio_null.$(OBJEXT) \6.159 - video_null.$(OBJEXT) gl_common.$(OBJEXT) gl_fbo.$(OBJEXT) \6.160 - gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT) $(am__objects_1) \6.161 - $(am__objects_2) $(am__objects_3) $(am__objects_4) \6.162 - $(am__objects_5) $(am__objects_6)6.163 + scene.$(OBJEXT) gl_sl.$(OBJEXT) gl_slsrc.$(OBJEXT) \6.164 + glutil.$(OBJEXT) maple.$(OBJEXT) controller.$(OBJEXT) \6.165 + kbd.$(OBJEXT) mouse.$(OBJEXT) loader.$(OBJEXT) \6.166 + bootstrap.$(OBJEXT) util.$(OBJEXT) display.$(OBJEXT) \6.167 + audio_null.$(OBJEXT) video_null.$(OBJEXT) video_gl.$(OBJEXT) \6.168 + gl_fbo.$(OBJEXT) $(am__objects_1) $(am__objects_2) \6.169 + $(am__objects_3) $(am__objects_4) $(am__objects_5) \6.170 + $(am__objects_6) $(am__objects_7)6.171 lxdream_OBJECTS = $(am_lxdream_OBJECTS)6.172 lxdream_DEPENDENCIES =6.173 lxdream_LDFLAGS =6.174 @@ -375,8 +403,8 @@6.175 @AMDEP_TRUE@ ./$(DEPDIR)/gdi.Po ./$(DEPDIR)/gdimage.Po \6.176 @AMDEP_TRUE@ ./$(DEPDIR)/gdrom.Po ./$(DEPDIR)/gdrom_menu.Po \6.177 @AMDEP_TRUE@ ./$(DEPDIR)/gendec.Po ./$(DEPDIR)/genglsl.Po \6.178 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_common.Po ./$(DEPDIR)/gl_fbo.Po \6.179 -@AMDEP_TRUE@ ./$(DEPDIR)/gl_sl.Po ./$(DEPDIR)/gl_slsrc.Po \6.180 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_fbo.Po ./$(DEPDIR)/gl_sl.Po \6.181 +@AMDEP_TRUE@ ./$(DEPDIR)/gl_slsrc.Po ./$(DEPDIR)/glutil.Po \6.182 @AMDEP_TRUE@ ./$(DEPDIR)/gtkcb.Po ./$(DEPDIR)/gtkui.Po \6.183 @AMDEP_TRUE@ ./$(DEPDIR)/i386-dis.Po ./$(DEPDIR)/ide.Po \6.184 @AMDEP_TRUE@ ./$(DEPDIR)/insparse.Po ./$(DEPDIR)/intc.Po \6.185 @@ -389,18 +417,20 @@6.186 @AMDEP_TRUE@ ./$(DEPDIR)/pvr2.Po ./$(DEPDIR)/pvr2mem.Po \6.187 @AMDEP_TRUE@ ./$(DEPDIR)/rendbkg.Po ./$(DEPDIR)/rendcore.Po \6.188 @AMDEP_TRUE@ ./$(DEPDIR)/render.Po ./$(DEPDIR)/rendsave.Po \6.189 -@AMDEP_TRUE@ ./$(DEPDIR)/rendsort.Po ./$(DEPDIR)/scif.Po \6.190 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4.Po ./$(DEPDIR)/sh4core.Po \6.191 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4dasm.Po ./$(DEPDIR)/sh4mem.Po \6.192 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4mmio.Po ./$(DEPDIR)/sh4stat.Po \6.193 -@AMDEP_TRUE@ ./$(DEPDIR)/sh4trans.Po ./$(DEPDIR)/sh4x86.Po \6.194 -@AMDEP_TRUE@ ./$(DEPDIR)/syscall.Po ./$(DEPDIR)/tacore.Po \6.195 -@AMDEP_TRUE@ ./$(DEPDIR)/testsh4x86.Po ./$(DEPDIR)/testxlt.Po \6.196 -@AMDEP_TRUE@ ./$(DEPDIR)/texcache.Po ./$(DEPDIR)/timer.Po \6.197 -@AMDEP_TRUE@ ./$(DEPDIR)/util.Po ./$(DEPDIR)/video_glx.Po \6.198 -@AMDEP_TRUE@ ./$(DEPDIR)/video_gtk.Po ./$(DEPDIR)/video_null.Po \6.199 -@AMDEP_TRUE@ ./$(DEPDIR)/watch.Po ./$(DEPDIR)/x86dasm.Po \6.200 -@AMDEP_TRUE@ ./$(DEPDIR)/xltcache.Po ./$(DEPDIR)/yuv.Po6.201 +@AMDEP_TRUE@ ./$(DEPDIR)/rendsort.Po ./$(DEPDIR)/scene.Po \6.202 +@AMDEP_TRUE@ ./$(DEPDIR)/scif.Po ./$(DEPDIR)/sh4.Po \6.203 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4core.Po ./$(DEPDIR)/sh4dasm.Po \6.204 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4mem.Po ./$(DEPDIR)/sh4mmio.Po \6.205 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4stat.Po ./$(DEPDIR)/sh4trans.Po \6.206 +@AMDEP_TRUE@ ./$(DEPDIR)/sh4x86.Po ./$(DEPDIR)/syscall.Po \6.207 +@AMDEP_TRUE@ ./$(DEPDIR)/tacore.Po ./$(DEPDIR)/testsh4x86.Po \6.208 +@AMDEP_TRUE@ ./$(DEPDIR)/testxlt.Po ./$(DEPDIR)/texcache.Po \6.209 +@AMDEP_TRUE@ ./$(DEPDIR)/timer.Po ./$(DEPDIR)/util.Po \6.210 +@AMDEP_TRUE@ ./$(DEPDIR)/video_gdk.Po ./$(DEPDIR)/video_gl.Po \6.211 +@AMDEP_TRUE@ ./$(DEPDIR)/video_glx.Po ./$(DEPDIR)/video_gtk.Po \6.212 +@AMDEP_TRUE@ ./$(DEPDIR)/video_null.Po ./$(DEPDIR)/watch.Po \6.213 +@AMDEP_TRUE@ ./$(DEPDIR)/x86dasm.Po ./$(DEPDIR)/xltcache.Po \6.214 +@AMDEP_TRUE@ ./$(DEPDIR)/yuv.Po6.215 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \6.216 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)6.217 CCLD = $(CC)6.218 @@ -508,10 +538,10 @@6.219 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gdrom_menu.Po@am__quote@6.220 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gendec.Po@am__quote@6.221 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genglsl.Po@am__quote@6.222 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_common.Po@am__quote@6.223 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_fbo.Po@am__quote@6.224 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_sl.Po@am__quote@6.225 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_slsrc.Po@am__quote@6.226 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/glutil.Po@am__quote@6.227 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtkcb.Po@am__quote@6.228 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtkui.Po@am__quote@6.229 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-dis.Po@am__quote@6.230 @@ -537,6 +567,7 @@6.231 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/render.Po@am__quote@6.232 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rendsave.Po@am__quote@6.233 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rendsort.Po@am__quote@6.234 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scene.Po@am__quote@6.235 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scif.Po@am__quote@6.236 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4.Po@am__quote@6.237 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh4core.Po@am__quote@6.238 @@ -553,6 +584,8 @@6.239 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texcache.Po@am__quote@6.240 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timer.Po@am__quote@6.241 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@6.242 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_gdk.Po@am__quote@6.243 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_gl.Po@am__quote@6.244 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_glx.Po@am__quote@6.245 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_gtk.Po@am__quote@6.246 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/video_null.Po@am__quote@6.247 @@ -1397,6 +1430,94 @@6.248 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.249 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rendsave.obj `if test -f 'pvr2/rendsave.c'; then $(CYGPATH_W) 'pvr2/rendsave.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/rendsave.c'; fi`6.251 +scene.o: pvr2/scene.c6.252 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT scene.o -MD -MP -MF "$(DEPDIR)/scene.Tpo" \6.253 +@am__fastdepCC_TRUE@ -c -o scene.o `test -f 'pvr2/scene.c' || echo '$(srcdir)/'`pvr2/scene.c; \6.254 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/scene.Tpo" "$(DEPDIR)/scene.Po"; \6.255 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/scene.Tpo"; exit 1; \6.256 +@am__fastdepCC_TRUE@ fi6.257 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/scene.c' object='scene.o' libtool=no @AMDEPBACKSLASH@6.258 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/scene.Po' tmpdepfile='$(DEPDIR)/scene.TPo' @AMDEPBACKSLASH@6.259 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.260 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o scene.o `test -f 'pvr2/scene.c' || echo '$(srcdir)/'`pvr2/scene.c6.261 +6.262 +scene.obj: pvr2/scene.c6.263 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT scene.obj -MD -MP -MF "$(DEPDIR)/scene.Tpo" \6.264 +@am__fastdepCC_TRUE@ -c -o scene.obj `if test -f 'pvr2/scene.c'; then $(CYGPATH_W) 'pvr2/scene.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/scene.c'; fi`; \6.265 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/scene.Tpo" "$(DEPDIR)/scene.Po"; \6.266 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/scene.Tpo"; exit 1; \6.267 +@am__fastdepCC_TRUE@ fi6.268 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/scene.c' object='scene.obj' libtool=no @AMDEPBACKSLASH@6.269 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/scene.Po' tmpdepfile='$(DEPDIR)/scene.TPo' @AMDEPBACKSLASH@6.270 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.271 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o scene.obj `if test -f 'pvr2/scene.c'; then $(CYGPATH_W) 'pvr2/scene.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/scene.c'; fi`6.272 +6.273 +gl_sl.o: pvr2/gl_sl.c6.274 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_sl.o -MD -MP -MF "$(DEPDIR)/gl_sl.Tpo" \6.275 +@am__fastdepCC_TRUE@ -c -o gl_sl.o `test -f 'pvr2/gl_sl.c' || echo '$(srcdir)/'`pvr2/gl_sl.c; \6.276 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_sl.Tpo" "$(DEPDIR)/gl_sl.Po"; \6.277 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_sl.Tpo"; exit 1; \6.278 +@am__fastdepCC_TRUE@ fi6.279 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/gl_sl.c' object='gl_sl.o' libtool=no @AMDEPBACKSLASH@6.280 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_sl.Po' tmpdepfile='$(DEPDIR)/gl_sl.TPo' @AMDEPBACKSLASH@6.281 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.282 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_sl.o `test -f 'pvr2/gl_sl.c' || echo '$(srcdir)/'`pvr2/gl_sl.c6.283 +6.284 +gl_sl.obj: pvr2/gl_sl.c6.285 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_sl.obj -MD -MP -MF "$(DEPDIR)/gl_sl.Tpo" \6.286 +@am__fastdepCC_TRUE@ -c -o gl_sl.obj `if test -f 'pvr2/gl_sl.c'; then $(CYGPATH_W) 'pvr2/gl_sl.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/gl_sl.c'; fi`; \6.287 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_sl.Tpo" "$(DEPDIR)/gl_sl.Po"; \6.288 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_sl.Tpo"; exit 1; \6.289 +@am__fastdepCC_TRUE@ fi6.290 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/gl_sl.c' object='gl_sl.obj' libtool=no @AMDEPBACKSLASH@6.291 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_sl.Po' tmpdepfile='$(DEPDIR)/gl_sl.TPo' @AMDEPBACKSLASH@6.292 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.293 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_sl.obj `if test -f 'pvr2/gl_sl.c'; then $(CYGPATH_W) 'pvr2/gl_sl.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/gl_sl.c'; fi`6.294 +6.295 +gl_slsrc.o: pvr2/gl_slsrc.c6.296 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_slsrc.o -MD -MP -MF "$(DEPDIR)/gl_slsrc.Tpo" \6.297 +@am__fastdepCC_TRUE@ -c -o gl_slsrc.o `test -f 'pvr2/gl_slsrc.c' || echo '$(srcdir)/'`pvr2/gl_slsrc.c; \6.298 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_slsrc.Tpo" "$(DEPDIR)/gl_slsrc.Po"; \6.299 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_slsrc.Tpo"; exit 1; \6.300 +@am__fastdepCC_TRUE@ fi6.301 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/gl_slsrc.c' object='gl_slsrc.o' libtool=no @AMDEPBACKSLASH@6.302 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_slsrc.Po' tmpdepfile='$(DEPDIR)/gl_slsrc.TPo' @AMDEPBACKSLASH@6.303 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.304 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_slsrc.o `test -f 'pvr2/gl_slsrc.c' || echo '$(srcdir)/'`pvr2/gl_slsrc.c6.305 +6.306 +gl_slsrc.obj: pvr2/gl_slsrc.c6.307 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_slsrc.obj -MD -MP -MF "$(DEPDIR)/gl_slsrc.Tpo" \6.308 +@am__fastdepCC_TRUE@ -c -o gl_slsrc.obj `if test -f 'pvr2/gl_slsrc.c'; then $(CYGPATH_W) 'pvr2/gl_slsrc.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/gl_slsrc.c'; fi`; \6.309 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_slsrc.Tpo" "$(DEPDIR)/gl_slsrc.Po"; \6.310 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_slsrc.Tpo"; exit 1; \6.311 +@am__fastdepCC_TRUE@ fi6.312 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/gl_slsrc.c' object='gl_slsrc.obj' libtool=no @AMDEPBACKSLASH@6.313 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_slsrc.Po' tmpdepfile='$(DEPDIR)/gl_slsrc.TPo' @AMDEPBACKSLASH@6.314 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.315 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_slsrc.obj `if test -f 'pvr2/gl_slsrc.c'; then $(CYGPATH_W) 'pvr2/gl_slsrc.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/gl_slsrc.c'; fi`6.316 +6.317 +glutil.o: pvr2/glutil.c6.318 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glutil.o -MD -MP -MF "$(DEPDIR)/glutil.Tpo" \6.319 +@am__fastdepCC_TRUE@ -c -o glutil.o `test -f 'pvr2/glutil.c' || echo '$(srcdir)/'`pvr2/glutil.c; \6.320 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/glutil.Tpo" "$(DEPDIR)/glutil.Po"; \6.321 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/glutil.Tpo"; exit 1; \6.322 +@am__fastdepCC_TRUE@ fi6.323 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/glutil.c' object='glutil.o' libtool=no @AMDEPBACKSLASH@6.324 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/glutil.Po' tmpdepfile='$(DEPDIR)/glutil.TPo' @AMDEPBACKSLASH@6.325 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.326 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glutil.o `test -f 'pvr2/glutil.c' || echo '$(srcdir)/'`pvr2/glutil.c6.327 +6.328 +glutil.obj: pvr2/glutil.c6.329 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT glutil.obj -MD -MP -MF "$(DEPDIR)/glutil.Tpo" \6.330 +@am__fastdepCC_TRUE@ -c -o glutil.obj `if test -f 'pvr2/glutil.c'; then $(CYGPATH_W) 'pvr2/glutil.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/glutil.c'; fi`; \6.331 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/glutil.Tpo" "$(DEPDIR)/glutil.Po"; \6.332 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/glutil.Tpo"; exit 1; \6.333 +@am__fastdepCC_TRUE@ fi6.334 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/glutil.c' object='glutil.obj' libtool=no @AMDEPBACKSLASH@6.335 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/glutil.Po' tmpdepfile='$(DEPDIR)/glutil.TPo' @AMDEPBACKSLASH@6.336 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.337 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o glutil.obj `if test -f 'pvr2/glutil.c'; then $(CYGPATH_W) 'pvr2/glutil.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/glutil.c'; fi`6.338 +6.339 maple.o: maple/maple.c6.340 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT maple.o -MD -MP -MF "$(DEPDIR)/maple.Tpo" \6.341 @am__fastdepCC_TRUE@ -c -o maple.o `test -f 'maple/maple.c' || echo '$(srcdir)/'`maple/maple.c; \6.342 @@ -1529,27 +1650,27 @@6.343 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.344 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_null.obj `if test -f 'drivers/video_null.c'; then $(CYGPATH_W) 'drivers/video_null.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_null.c'; fi`6.346 -gl_common.o: drivers/gl_common.c6.347 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_common.o -MD -MP -MF "$(DEPDIR)/gl_common.Tpo" \6.348 -@am__fastdepCC_TRUE@ -c -o gl_common.o `test -f 'drivers/gl_common.c' || echo '$(srcdir)/'`drivers/gl_common.c; \6.349 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_common.Tpo" "$(DEPDIR)/gl_common.Po"; \6.350 -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_common.Tpo"; exit 1; \6.351 +video_gl.o: drivers/video_gl.c6.352 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_gl.o -MD -MP -MF "$(DEPDIR)/video_gl.Tpo" \6.353 +@am__fastdepCC_TRUE@ -c -o video_gl.o `test -f 'drivers/video_gl.c' || echo '$(srcdir)/'`drivers/video_gl.c; \6.354 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_gl.Tpo" "$(DEPDIR)/video_gl.Po"; \6.355 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/video_gl.Tpo"; exit 1; \6.356 @am__fastdepCC_TRUE@ fi6.357 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_common.c' object='gl_common.o' libtool=no @AMDEPBACKSLASH@6.358 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_common.Po' tmpdepfile='$(DEPDIR)/gl_common.TPo' @AMDEPBACKSLASH@6.359 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_gl.c' object='video_gl.o' libtool=no @AMDEPBACKSLASH@6.360 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/video_gl.Po' tmpdepfile='$(DEPDIR)/video_gl.TPo' @AMDEPBACKSLASH@6.361 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.362 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_common.o `test -f 'drivers/gl_common.c' || echo '$(srcdir)/'`drivers/gl_common.c6.363 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_gl.o `test -f 'drivers/video_gl.c' || echo '$(srcdir)/'`drivers/video_gl.c6.365 -gl_common.obj: drivers/gl_common.c6.366 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_common.obj -MD -MP -MF "$(DEPDIR)/gl_common.Tpo" \6.367 -@am__fastdepCC_TRUE@ -c -o gl_common.obj `if test -f 'drivers/gl_common.c'; then $(CYGPATH_W) 'drivers/gl_common.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_common.c'; fi`; \6.368 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_common.Tpo" "$(DEPDIR)/gl_common.Po"; \6.369 -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_common.Tpo"; exit 1; \6.370 +video_gl.obj: drivers/video_gl.c6.371 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_gl.obj -MD -MP -MF "$(DEPDIR)/video_gl.Tpo" \6.372 +@am__fastdepCC_TRUE@ -c -o video_gl.obj `if test -f 'drivers/video_gl.c'; then $(CYGPATH_W) 'drivers/video_gl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_gl.c'; fi`; \6.373 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_gl.Tpo" "$(DEPDIR)/video_gl.Po"; \6.374 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/video_gl.Tpo"; exit 1; \6.375 @am__fastdepCC_TRUE@ fi6.376 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_common.c' object='gl_common.obj' libtool=no @AMDEPBACKSLASH@6.377 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_common.Po' tmpdepfile='$(DEPDIR)/gl_common.TPo' @AMDEPBACKSLASH@6.378 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_gl.c' object='video_gl.obj' libtool=no @AMDEPBACKSLASH@6.379 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/video_gl.Po' tmpdepfile='$(DEPDIR)/video_gl.TPo' @AMDEPBACKSLASH@6.380 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.381 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_common.obj `if test -f 'drivers/gl_common.c'; then $(CYGPATH_W) 'drivers/gl_common.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_common.c'; fi`6.382 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_gl.obj `if test -f 'drivers/video_gl.c'; then $(CYGPATH_W) 'drivers/video_gl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_gl.c'; fi`6.384 gl_fbo.o: drivers/gl_fbo.c6.385 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_fbo.o -MD -MP -MF "$(DEPDIR)/gl_fbo.Tpo" \6.386 @@ -1573,50 +1694,6 @@6.387 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.388 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_fbo.obj `if test -f 'drivers/gl_fbo.c'; then $(CYGPATH_W) 'drivers/gl_fbo.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_fbo.c'; fi`6.390 -gl_sl.o: drivers/gl_sl.c6.391 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_sl.o -MD -MP -MF "$(DEPDIR)/gl_sl.Tpo" \6.392 -@am__fastdepCC_TRUE@ -c -o gl_sl.o `test -f 'drivers/gl_sl.c' || echo '$(srcdir)/'`drivers/gl_sl.c; \6.393 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_sl.Tpo" "$(DEPDIR)/gl_sl.Po"; \6.394 -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_sl.Tpo"; exit 1; \6.395 -@am__fastdepCC_TRUE@ fi6.396 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_sl.c' object='gl_sl.o' libtool=no @AMDEPBACKSLASH@6.397 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_sl.Po' tmpdepfile='$(DEPDIR)/gl_sl.TPo' @AMDEPBACKSLASH@6.398 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.399 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_sl.o `test -f 'drivers/gl_sl.c' || echo '$(srcdir)/'`drivers/gl_sl.c6.400 -6.401 -gl_sl.obj: drivers/gl_sl.c6.402 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_sl.obj -MD -MP -MF "$(DEPDIR)/gl_sl.Tpo" \6.403 -@am__fastdepCC_TRUE@ -c -o gl_sl.obj `if test -f 'drivers/gl_sl.c'; then $(CYGPATH_W) 'drivers/gl_sl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_sl.c'; fi`; \6.404 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_sl.Tpo" "$(DEPDIR)/gl_sl.Po"; \6.405 -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_sl.Tpo"; exit 1; \6.406 -@am__fastdepCC_TRUE@ fi6.407 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_sl.c' object='gl_sl.obj' libtool=no @AMDEPBACKSLASH@6.408 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_sl.Po' tmpdepfile='$(DEPDIR)/gl_sl.TPo' @AMDEPBACKSLASH@6.409 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.410 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_sl.obj `if test -f 'drivers/gl_sl.c'; then $(CYGPATH_W) 'drivers/gl_sl.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_sl.c'; fi`6.411 -6.412 -gl_slsrc.o: drivers/gl_slsrc.c6.413 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_slsrc.o -MD -MP -MF "$(DEPDIR)/gl_slsrc.Tpo" \6.414 -@am__fastdepCC_TRUE@ -c -o gl_slsrc.o `test -f 'drivers/gl_slsrc.c' || echo '$(srcdir)/'`drivers/gl_slsrc.c; \6.415 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_slsrc.Tpo" "$(DEPDIR)/gl_slsrc.Po"; \6.416 -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_slsrc.Tpo"; exit 1; \6.417 -@am__fastdepCC_TRUE@ fi6.418 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_slsrc.c' object='gl_slsrc.o' libtool=no @AMDEPBACKSLASH@6.419 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_slsrc.Po' tmpdepfile='$(DEPDIR)/gl_slsrc.TPo' @AMDEPBACKSLASH@6.420 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.421 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_slsrc.o `test -f 'drivers/gl_slsrc.c' || echo '$(srcdir)/'`drivers/gl_slsrc.c6.422 -6.423 -gl_slsrc.obj: drivers/gl_slsrc.c6.424 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT gl_slsrc.obj -MD -MP -MF "$(DEPDIR)/gl_slsrc.Tpo" \6.425 -@am__fastdepCC_TRUE@ -c -o gl_slsrc.obj `if test -f 'drivers/gl_slsrc.c'; then $(CYGPATH_W) 'drivers/gl_slsrc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_slsrc.c'; fi`; \6.426 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gl_slsrc.Tpo" "$(DEPDIR)/gl_slsrc.Po"; \6.427 -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/gl_slsrc.Tpo"; exit 1; \6.428 -@am__fastdepCC_TRUE@ fi6.429 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/gl_slsrc.c' object='gl_slsrc.obj' libtool=no @AMDEPBACKSLASH@6.430 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/gl_slsrc.Po' tmpdepfile='$(DEPDIR)/gl_slsrc.TPo' @AMDEPBACKSLASH@6.431 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.432 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gl_slsrc.obj `if test -f 'drivers/gl_slsrc.c'; then $(CYGPATH_W) 'drivers/gl_slsrc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/gl_slsrc.c'; fi`6.433 -6.434 sh4x86.o: sh4/sh4x86.c6.435 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sh4x86.o -MD -MP -MF "$(DEPDIR)/sh4x86.Tpo" \6.436 @am__fastdepCC_TRUE@ -c -o sh4x86.o `test -f 'sh4/sh4x86.c' || echo '$(srcdir)/'`sh4/sh4x86.c; \6.437 @@ -1969,6 +2046,28 @@6.438 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.439 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_gtk.obj `if test -f 'drivers/video_gtk.c'; then $(CYGPATH_W) 'drivers/video_gtk.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_gtk.c'; fi`6.441 +video_gdk.o: drivers/video_gdk.c6.442 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_gdk.o -MD -MP -MF "$(DEPDIR)/video_gdk.Tpo" \6.443 +@am__fastdepCC_TRUE@ -c -o video_gdk.o `test -f 'drivers/video_gdk.c' || echo '$(srcdir)/'`drivers/video_gdk.c; \6.444 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_gdk.Tpo" "$(DEPDIR)/video_gdk.Po"; \6.445 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/video_gdk.Tpo"; exit 1; \6.446 +@am__fastdepCC_TRUE@ fi6.447 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_gdk.c' object='video_gdk.o' libtool=no @AMDEPBACKSLASH@6.448 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/video_gdk.Po' tmpdepfile='$(DEPDIR)/video_gdk.TPo' @AMDEPBACKSLASH@6.449 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.450 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_gdk.o `test -f 'drivers/video_gdk.c' || echo '$(srcdir)/'`drivers/video_gdk.c6.451 +6.452 +video_gdk.obj: drivers/video_gdk.c6.453 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_gdk.obj -MD -MP -MF "$(DEPDIR)/video_gdk.Tpo" \6.454 +@am__fastdepCC_TRUE@ -c -o video_gdk.obj `if test -f 'drivers/video_gdk.c'; then $(CYGPATH_W) 'drivers/video_gdk.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_gdk.c'; fi`; \6.455 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/video_gdk.Tpo" "$(DEPDIR)/video_gdk.Po"; \6.456 +@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/video_gdk.Tpo"; exit 1; \6.457 +@am__fastdepCC_TRUE@ fi6.458 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/video_gdk.c' object='video_gdk.obj' libtool=no @AMDEPBACKSLASH@6.459 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/video_gdk.Po' tmpdepfile='$(DEPDIR)/video_gdk.TPo' @AMDEPBACKSLASH@6.460 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@6.461 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o video_gdk.obj `if test -f 'drivers/video_gdk.c'; then $(CYGPATH_W) 'drivers/video_gdk.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_gdk.c'; fi`6.462 +6.463 video_glx.o: drivers/video_glx.c6.464 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT video_glx.o -MD -MP -MF "$(DEPDIR)/video_glx.Tpo" \6.465 @am__fastdepCC_TRUE@ -c -o video_glx.o `test -f 'drivers/video_glx.c' || echo '$(srcdir)/'`drivers/video_glx.c; \6.466 @@ -2387,8 +2486,8 @@6.467 ./gendec sh4/sh4.def sh4/sh4x86.in -o sh4/sh4x86.c6.468 sh4/sh4stat.c: gendec sh4/sh4.def sh4/sh4stat.in6.469 ./gendec sh4/sh4.def sh4/sh4stat.in -o sh4/sh4stat.c6.470 -drivers/gl_slsrc.c: genglsl drivers/vertex.glsl drivers/fragment.glsl6.471 - ./genglsl drivers/vertex.glsl drivers/fragment.glsl drivers/gl_slsrc.c6.472 +pvr2/gl_slsrc.c: genglsl pvr2/vertex.glsl pvr2/fragment.glsl6.473 + ./genglsl pvr2/vertex.glsl pvr2/fragment.glsl pvr2/gl_slsrc.c6.474 # Tell versions [3.59,3.63) of GNU make to not export all variables.6.475 # Otherwise a system limit (for SysV at least) may be exceeded.6.476 .NOEXPORT:
7.1 --- a/src/drivers/fragment.glsl Thu Feb 07 02:04:40 2008 +00007.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00007.3 @@ -1,6 +0,0 @@7.4 -// Standard PVR2 fragment shader7.5 -7.6 -void main()7.7 -{7.8 - gl_FragColor = gl_Color;7.9 -}7.10 \ No newline at end of file
8.1 --- a/src/drivers/gl_common.c Thu Feb 07 02:04:40 2008 +00008.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00008.3 @@ -1,213 +0,0 @@8.4 -/**8.5 - * $Id$8.6 - *8.7 - * Common GL code that doesn't depend on a specific implementation8.8 - *8.9 - * Copyright (c) 2005 Nathan Keynes.8.10 - *8.11 - * This program is free software; you can redistribute it and/or modify8.12 - * it under the terms of the GNU General Public License as published by8.13 - * the Free Software Foundation; either version 2 of the License, or8.14 - * (at your option) any later version.8.15 - *8.16 - * This program is distributed in the hope that it will be useful,8.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of8.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8.19 - * GNU General Public License for more details.8.20 - */8.21 -8.22 -#include <sys/time.h>8.23 -8.24 -#include "display.h"8.25 -#include "pvr2/pvr2.h"8.26 -#include "drivers/gl_common.h"8.27 -8.28 -extern uint32_t video_width, video_height;8.29 -8.30 -char *required_extensions[] = { "GL_EXT_framebuffer_object", NULL };8.31 -8.32 -/**8.33 - * Test if a specific extension is supported. From opengl.org8.34 - * @param extension extension name to check for8.35 - * @return TRUE if supported, otherwise FALSE.8.36 - */8.37 -gboolean isGLExtensionSupported( const char *extension )8.38 -{8.39 - const GLubyte *extensions = NULL;8.40 - const GLubyte *start;8.41 - GLubyte *where, *terminator;8.42 -8.43 - /* Extension names should not have spaces. */8.44 - where = (GLubyte *) strchr(extension, ' ');8.45 - if (where || *extension == '\0')8.46 - return 0;8.47 - extensions = glGetString(GL_EXTENSIONS);8.48 - /* It takes a bit of care to be fool-proof about parsing the8.49 - OpenGL extensions string. Don't be fooled by sub-strings,8.50 - etc. */8.51 - start = extensions;8.52 - for (;;) {8.53 - where = (GLubyte *) strstr((const char *) start, extension);8.54 - if (!where)8.55 - break;8.56 - terminator = where + strlen(extension);8.57 - if (where == start || *(where - 1) == ' ')8.58 - if (*terminator == ' ' || *terminator == '\0')8.59 - return TRUE;8.60 - start = terminator;8.61 - }8.62 - return FALSE;8.63 -}8.64 -8.65 -gboolean hasRequiredGLExtensions( )8.66 -{8.67 - int i;8.68 - gboolean isOK = TRUE;8.69 -8.70 - for( i=0; required_extensions[i] != NULL; i++ ) {8.71 - if( !isGLExtensionSupported(required_extensions[i]) ) {8.72 - ERROR( "Required OpenGL extension not supported: %s", required_extensions[i] );8.73 - isOK = FALSE;8.74 - }8.75 - }8.76 - return isOK;8.77 -}8.78 -8.79 -/**8.80 - * Reset the gl state to simple orthographic projection with8.81 - * texturing, alpha/depth/scissor/cull tests disabled.8.82 - */8.83 -void gl_reset_state()8.84 -{8.85 - glViewport( 0, 0, video_width, video_height );8.86 - glMatrixMode(GL_PROJECTION);8.87 - glLoadIdentity();8.88 - glOrtho( 0, video_width, video_height, 0, 0, -65535 );8.89 - glMatrixMode(GL_MODELVIEW);8.90 - glLoadIdentity();8.91 - glDisable( GL_TEXTURE_2D );8.92 - glDisable( GL_ALPHA_TEST );8.93 - glDisable( GL_DEPTH_TEST );8.94 - glDisable( GL_SCISSOR_TEST );8.95 - glDisable( GL_CULL_FACE );8.96 - glDrawBuffer( GL_FRONT );8.97 -}8.98 -8.99 -void gl_display_render_buffer( render_buffer_t buffer )8.100 -{8.101 - gl_texture_window( buffer->width, buffer->height, buffer->buf_id, buffer->inverted );8.102 -}8.103 -8.104 -void gl_texture_window( int width, int height, int tex_id, gboolean inverted )8.105 -{8.106 - float top, bottom;8.107 - if( inverted ) {8.108 - top = ((float)height);8.109 - bottom = 0;8.110 - } else {8.111 - top = 0;8.112 - bottom = ((float)height);8.113 - }8.114 -8.115 - /* Reset display parameters */8.116 - gl_reset_state();8.117 - glColor3f( 0,0,0 );8.118 -8.119 - int x1=0,y1=0,x2=video_width,y2=video_height;8.120 -8.121 - int ah = video_width * 0.75;8.122 -8.123 - if( ah > video_height ) {8.124 - int w = (video_height/0.75);8.125 - x1 = (video_width - w)/2;8.126 - x2 -= x1;8.127 -8.128 - glBegin( GL_QUADS );8.129 - glVertex2f( 0, 0 );8.130 - glVertex2f( x1, 0 );8.131 - glVertex2f( x1, video_height );8.132 - glVertex2f( 0, video_height);8.133 - glVertex2f( x2, 0 );8.134 - glVertex2f( video_width, 0 );8.135 - glVertex2f( video_width, video_height );8.136 - glVertex2f( x2, video_height);8.137 - glEnd();8.138 - } else if( ah < video_height ) {8.139 - y1 = (video_height - ah)/2;8.140 - y2 -= y1;8.141 - glBegin( GL_QUADS );8.142 - glVertex2f( 0, 0 );8.143 - glVertex2f( video_width, 0 );8.144 - glVertex2f( video_width, y1 );8.145 - glVertex2f( 0, y1 );8.146 - glVertex2f( 0, y2 );8.147 - glVertex2f( video_width, y2 );8.148 - glVertex2f( video_width, video_height );8.149 - glVertex2f( 0, video_height );8.150 - glEnd();8.151 - }8.152 -8.153 - /* Render the textured rectangle */8.154 - glEnable( GL_TEXTURE_RECTANGLE_ARB );8.155 - glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex_id );8.156 - glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );8.157 - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);8.158 - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);8.159 - glEnable( GL_BLEND );8.160 - glBlendFunc( GL_ONE, GL_ZERO );8.161 - glBegin( GL_QUADS );8.162 - glTexCoord2f( 0, top );8.163 - glVertex2f( x1, y1 );8.164 - glTexCoord2f( ((float)width), top );8.165 - glVertex2f( x2, y1 );8.166 - glTexCoord2f( ((float)width), bottom );8.167 - glVertex2f( x2, y2 );8.168 - glTexCoord2f( 0, bottom );8.169 - glVertex2f( x1, y2 );8.170 - glEnd();8.171 - glDisable( GL_TEXTURE_RECTANGLE_ARB );8.172 - glFlush();8.173 -}8.174 -8.175 -gboolean gl_load_frame_buffer( frame_buffer_t frame, int tex_id )8.176 -{8.177 - GLenum type = colour_formats[frame->colour_format].type;8.178 - GLenum format = colour_formats[frame->colour_format].format;8.179 - int bpp = colour_formats[frame->colour_format].bpp;8.180 - int rowstride = (frame->rowstride / bpp) - frame->width;8.181 -8.182 - glPixelStorei( GL_UNPACK_ROW_LENGTH, rowstride );8.183 - glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex_id );8.184 - glTexSubImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, 0,0,8.185 - frame->width, frame->height, format, type, frame->data );8.186 - return TRUE;8.187 -}8.188 -8.189 -gboolean gl_display_blank( uint32_t colour )8.190 -{8.191 - gl_reset_state();8.192 - glColor3ub( (colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF );8.193 - glRecti(0,0, video_width, video_height );8.194 - glFlush();8.195 - return TRUE;8.196 -}8.197 -8.198 -/**8.199 - * Generic GL read_render_buffer. This function assumes that the caller8.200 - * has already set the appropriate glReadBuffer(); in other words, unless8.201 - * there's only one buffer this needs to be wrapped.8.202 - */8.203 -gboolean gl_read_render_buffer( unsigned char *target, render_buffer_t buffer,8.204 - int rowstride, int colour_format )8.205 -{8.206 - glFinish();8.207 - GLenum type = colour_formats[colour_format].type;8.208 - GLenum format = colour_formats[colour_format].format;8.209 - // int line_size = buffer->width * colour_formats[colour_format].bpp;8.210 - // int size = line_size * buffer->height;8.211 - int glrowstride = (rowstride / colour_formats[colour_format].bpp) - buffer->width;8.212 - glPixelStorei( GL_PACK_ROW_LENGTH, glrowstride );8.213 -8.214 - glReadPixels( 0, 0, buffer->width, buffer->height, format, type, target );8.215 - return TRUE;8.216 -}
9.1 --- a/src/drivers/gl_common.h Thu Feb 07 02:04:40 2008 +00009.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00009.3 @@ -1,81 +0,0 @@9.4 -/**9.5 - * $Id$9.6 - *9.7 - * Parent for all X11 display drivers.9.8 - *9.9 - * Copyright (c) 2005 Nathan Keynes.9.10 - *9.11 - * This program is free software; you can redistribute it and/or modify9.12 - * it under the terms of the GNU General Public License as published by9.13 - * the Free Software Foundation; either version 2 of the License, or9.14 - * (at your option) any later version.9.15 - *9.16 - * This program is distributed in the hope that it will be useful,9.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of9.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9.19 - * GNU General Public License for more details.9.20 - */9.21 -9.22 -#ifndef video_gl_common_H9.23 -#define video_gl_common_H9.24 -9.25 -#include "display.h"9.26 -9.27 -/**9.28 - * Test if a specific extension is supported. From opengl.org9.29 - * @param extension extension name to check for9.30 - * @return TRUE if supported, otherwise FALSE.9.31 - */9.32 -gboolean isGLExtensionSupported( const char *extension );9.33 -9.34 -gboolean hasRequiredGLExtensions();9.35 -9.36 -/**9.37 - * Generic GL routine to draw the given frame buffer into a texture9.38 - */9.39 -gboolean gl_load_frame_buffer( frame_buffer_t frame, int tex_id );9.40 -9.41 -/**9.42 - * Generic GL routine to blank the display view with the specified colour.9.43 - */9.44 -gboolean gl_display_blank( uint32_t colour );9.45 -9.46 -/**9.47 - * Write a rectangular texture (GL_TEXTURE_RECTANGLE_ARB) to the display frame9.48 - */9.49 -void gl_display_render_buffer( render_buffer_t buffer );9.50 -9.51 -/**9.52 - * Write a rectangular texture (GL_TEXTURE_RECTANGLE_ARB) to the display frame9.53 - */9.54 -void gl_texture_window( int width, int height, int tex_id, gboolean inverted );9.55 -9.56 -/**9.57 - * Redisplay the last frame.9.58 - */9.59 -void gl_redisplay_last();9.60 -9.61 -/**9.62 - * Generic GL read_render_buffer. This function assumes that the caller9.63 - * has already set the appropriate glReadBuffer(); in other words, unless9.64 - * there's only one buffer this needs to be wrapped.9.65 - */9.66 -gboolean gl_read_render_buffer( unsigned char *target, render_buffer_t buffer,9.67 - int rowstride, int colour_format );9.68 -9.69 -9.70 -/****** FBO handling (gl_fbo.c) ******/9.71 -gboolean gl_fbo_is_supported();9.72 -void gl_fbo_shutdown();9.73 -void gl_fbo_init( display_driver_t driver );9.74 -void gl_fbo_detach();9.75 -9.76 -/****** Shader handling (gl_sl.c) *****/9.77 -gboolean glsl_is_supported(void);9.78 -gboolean glsl_load_shaders( const char *vert_shader, const char *frag_shader );9.79 -void glsl_unload_shaders(void);9.80 -9.81 -extern const char *glsl_vertex_shader_src;9.82 -extern const char *glsl_fragment_shader_src;9.83 -9.84 -#endif /* !video_gl_common_H */
10.1 --- a/src/drivers/gl_fbo.c Thu Feb 07 02:04:40 2008 +000010.2 +++ b/src/drivers/gl_fbo.c Thu Feb 14 13:54:11 2008 +000010.3 @@ -27,7 +27,8 @@10.4 #include <stdlib.h>10.5 #include "lxdream.h"10.6 #include "display.h"10.7 -#include "drivers/gl_common.h"10.8 +#include "drivers/video_gl.h"10.9 +#include "pvr2/glutil.h"10.11 #define MAX_FRAMEBUFFERS 210.12 #define MAX_TEXTURES_PER_FB 410.13 @@ -238,6 +239,7 @@10.14 gl_fbo_attach_texture( fb, buffer->buf_id );10.15 /* setup the gl context */10.16 glViewport( 0, 0, buffer->width, buffer->height );10.17 + glsl_enable_shader(TRUE);10.19 return TRUE;10.20 }10.21 @@ -250,6 +252,7 @@10.22 {10.23 glFinish();10.24 gl_fbo_detach();10.25 + glsl_enable_shader(FALSE);10.26 gl_display_render_buffer( buffer );10.27 return TRUE;10.28 }10.29 @@ -258,6 +261,7 @@10.30 {10.31 glFinish();10.32 gl_fbo_detach();10.33 + glsl_enable_shader(FALSE);10.34 gl_load_frame_buffer( frame, buffer->buf_id );10.35 }10.37 @@ -265,6 +269,7 @@10.38 {10.39 glFinish();10.40 gl_fbo_detach();10.41 + glsl_enable_shader(FALSE);10.42 return gl_display_blank( colour );10.43 }
11.1 --- a/src/drivers/gl_sl.c Thu Feb 07 02:04:40 2008 +000011.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000011.3 @@ -1,173 +0,0 @@11.4 -/**11.5 - * $Id$11.6 - *11.7 - * GLSL shader loader/unloader. Current version assumes there's exactly11.8 - * 1 shader program that's used globally. This may turn out not to be the11.9 - * most efficient approach.11.10 - *11.11 - * Copyright (c) 2007 Nathan Keynes.11.12 - *11.13 - * This program is free software; you can redistribute it and/or modify11.14 - * it under the terms of the GNU General Public License as published by11.15 - * the Free Software Foundation; either version 2 of the License, or11.16 - * (at your option) any later version.11.17 - *11.18 - * This program is distributed in the hope that it will be useful,11.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of11.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11.21 - * GNU General Public License for more details.11.22 - */11.23 -11.24 -#define GL_GLEXT_PROTOTYPES 111.25 -11.26 -#include "lxdream.h"11.27 -#include "display.h"11.28 -#include "drivers/gl_common.h"11.29 -11.30 -#define MAX_ERROR_BUF 409611.31 -11.32 -gboolean glsl_is_supported()11.33 -{11.34 - return isGLExtensionSupported("GL_ARB_fragment_shader") &&11.35 - isGLExtensionSupported("GL_ARB_vertex_shader") &&11.36 - isGLExtensionSupported("GL_ARB_shading_language_100");11.37 -}11.38 -11.39 -#ifdef GL_ARB_shader_objects11.40 -static GLhandleARB glsl_program, glsl_vert_shader, glsl_frag_shader;11.41 -11.42 -void glsl_print_error( char *msg, GLhandleARB obj )11.43 -{11.44 - char buf[MAX_ERROR_BUF];11.45 - GLsizei length;11.46 - glGetInfoLogARB( obj, sizeof(buf), &length, buf );11.47 - ERROR( "%s: %s", msg, buf );11.48 -}11.49 -11.50 -gboolean glsl_check_shader_error( char *msg, GLhandleARB obj )11.51 -{11.52 - GLint value;11.53 -11.54 - glGetObjectParameterivARB(obj, GL_OBJECT_COMPILE_STATUS_ARB, &value);11.55 - if( value == 0 ) {11.56 - glsl_print_error(msg, obj);11.57 - return FALSE;11.58 - }11.59 - return TRUE;11.60 -}11.61 -11.62 -gboolean glsl_check_program_error( char *msg, GLhandleARB obj )11.63 -{11.64 - if( glGetError() != GL_NO_ERROR ) {11.65 - glsl_print_error(msg, obj);11.66 - }11.67 - return TRUE;11.68 -}11.69 -11.70 -11.71 -gboolean glsl_load_shaders( const char *vertex_src, const char *fragment_src )11.72 -{11.73 - gboolean vsok, fsok, pok = FALSE;11.74 - glsl_program = glCreateProgramObjectARB();11.75 -11.76 - glsl_vert_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);11.77 - glsl_frag_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);11.78 - glShaderSourceARB( glsl_vert_shader, 1, &vertex_src, NULL );11.79 - glCompileShaderARB(glsl_vert_shader);11.80 - vsok = glsl_check_shader_error("Failed to compile vertex shader", glsl_vert_shader);11.81 - glShaderSourceARB( glsl_frag_shader, 1, &fragment_src, NULL );11.82 - glCompileShaderARB(glsl_frag_shader);11.83 - fsok = glsl_check_shader_error("Failed to compile fragment shader", glsl_frag_shader);11.84 -11.85 - if( vsok && fsok ) {11.86 - glAttachObjectARB(glsl_program, glsl_vert_shader);11.87 - glAttachObjectARB(glsl_program, glsl_frag_shader);11.88 - glLinkProgramARB(glsl_program);11.89 - pok = glsl_check_program_error( "Failed to link shader program", glsl_program );11.90 - }11.91 - if( pok ) {11.92 - glUseProgramObjectARB(glsl_program);11.93 - pok = glsl_check_program_error( "Failed to apply shader program", glsl_program );11.94 - } else {11.95 - glsl_unload_shaders();11.96 - }11.97 - return pok;11.98 -}11.99 -11.100 -void glsl_unload_shaders(void)11.101 -{11.102 - glUseProgramObjectARB(0);11.103 - glDetachObjectARB(glsl_program, glsl_vert_shader);11.104 - glDetachObjectARB(glsl_program, glsl_frag_shader);11.105 - glDeleteObjectARB(glsl_program);11.106 - glDeleteObjectARB(glsl_vert_shader);11.107 - glDeleteObjectARB(glsl_frag_shader);11.108 -}11.109 -11.110 -#else11.111 -static GLuint glsl_program, glsl_vert_shader, glsl_frag_shader;11.112 -11.113 -gboolean glsl_check_shader_error( char *msg, GLuint shader )11.114 -{11.115 - GLint value;11.116 -11.117 - glGetShaderiv( shader, GL_COMPILE_STATUS, &value );11.118 - if( value == 0 ) {11.119 - char buf[MAX_ERROR_BUF];11.120 - GLsizei length;11.121 - glGetShaderInfoLog( shader, sizeof(buf), &length, buf );11.122 - ERROR( "%s: %s", msg, buf );11.123 - return FALSE;11.124 - }11.125 - return TRUE;11.126 -}11.127 -gboolean glsl_check_program_error( char *msg, GLuint program )11.128 -{11.129 - if( glGetError() != GL_NO_ERROR ) {11.130 - char buf[MAX_ERROR_BUF];11.131 - GLsizei length;11.132 - glGetProgramInfoLog( program, sizeof(buf), &length, buf );11.133 - ERROR( "%s: %s", msg, buf );11.134 - return FALSE;11.135 - }11.136 - return TRUE;11.137 -}11.138 -11.139 -gboolean glsl_load_shaders( const char *vertex_src, const char *fragment_src )11.140 -{11.141 - gboolean vsok, fsok, pok = FALSE;11.142 - glsl_program = glCreateProgram();11.143 - glsl_vert_shader = glCreateShader(GL_VERTEX_SHADER);11.144 - glsl_frag_shader = glCreateShader(GL_FRAGMENT_SHADER);11.145 - glShaderSource( glsl_vert_shader, 1, &vertex_src, NULL );11.146 - glCompileShader(glsl_vert_shader);11.147 - vsok = glsl_check_shader_error( "Failed to compile vertex shader", glsl_vert_shader );11.148 - glShaderSource( glsl_frag_shader, 1, &fragment_src, NULL );11.149 - glCompileShader(glsl_frag_shader);11.150 - fsok = glsl_check_shader_error( "Failed to compile fragment shader", glsl_frag_shader );11.151 -11.152 - if( vsok && fsok ) {11.153 - glAttachShader(glsl_program, glsl_vert_shader);11.154 - glAttachShader(glsl_program, glsl_frag_shader);11.155 - glLinkProgram(glsl_program);11.156 - pok = glsl_check_program_error( "Failed to link shader program", glsl_program );11.157 - }11.158 -11.159 - if( pok ) {11.160 - glUseProgram(glsl_program);11.161 - } else {11.162 - glsl_unload_shaders();11.163 - }11.164 - return pok;11.165 -}11.166 -11.167 -void glsl_unload_shaders(void)11.168 -{11.169 - glUseProgram(0);11.170 - glDetachShader(glsl_program, glsl_vert_shader);11.171 - glDetachShader(glsl_program, glsl_frag_shader);11.172 - glDeleteProgram(glsl_program);11.173 - glDeleteShader(glsl_vert_shader);11.174 - glDeleteShader(glsl_frag_shader);11.175 -}11.176 -#endif
12.1 --- a/src/drivers/gl_slsrc.c Thu Feb 07 02:04:40 2008 +000012.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000012.3 @@ -1,19 +0,0 @@12.4 -/**12.5 - * This file is automatically generated - do not edit12.6 - */12.7 -12.8 -const char *glsl_vertex_shader_src = "// Standard PVR2 vertex shader\n\12.9 -\n\12.10 -void main()\n\12.11 -{\n\12.12 - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n\12.13 -}\n\12.14 -";12.15 -12.16 -const char *glsl_fragment_shader_src = "// Standard PVR2 fragment shader\n\12.17 -\n\12.18 -void main()\n\12.19 -{\n\12.20 - gl_FragColor = gl_Color;\n\12.21 -}";12.22 -
13.1 --- a/src/drivers/vertex.glsl Thu Feb 07 02:04:40 2008 +000013.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000013.3 @@ -1,6 +0,0 @@13.4 -// Standard PVR2 vertex shader13.5 -13.6 -void main()13.7 -{13.8 - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;13.9 -}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000014.2 +++ b/src/drivers/video_gdk.c Thu Feb 14 13:54:11 2008 +000014.3 @@ -0,0 +1,203 @@14.4 +/**14.5 + * $Id: video_gtk.c 636 2008-01-30 11:31:21Z nkeynes $14.6 + *14.7 + * The PC side of the video support (responsible for actually displaying /14.8 + * rendering frames)14.9 + *14.10 + * Copyright (c) 2005 Nathan Keynes.14.11 + *14.12 + * This program is free software; you can redistribute it and/or modify14.13 + * it under the terms of the GNU General Public License as published by14.14 + * the Free Software Foundation; either version 2 of the License, or14.15 + * (at your option) any later version.14.16 + *14.17 + * This program is distributed in the hope that it will be useful,14.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of14.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14.20 + * GNU General Public License for more details.14.21 + */14.22 +#include <assert.h>14.23 +#include <stdlib.h>14.24 +#include <gdk/gdk.h>14.25 +#include <gdk-pixbuf/gdk-pixbuf.h>14.26 +#include <gtk/gtkwidget.h>14.27 +#include <GL/osmesa.h>14.28 +#include "lxdream.h"14.29 +#include "display.h"14.30 +14.31 +#define MAX_PIXBUF 1614.32 +14.33 +extern GtkWidget *gtk_video_win;14.34 +extern int video_width, video_height;14.35 +14.36 +static render_buffer_t gdk_pixbuf_create_render_buffer( uint32_t width, uint32_t height );14.37 +static void gdk_pixbuf_destroy_render_buffer( render_buffer_t buffer );14.38 +static gboolean gdk_pixbuf_set_render_target( render_buffer_t buffer );14.39 +static gboolean gdk_pixbuf_display_render_buffer( render_buffer_t buffer );14.40 +static void gdk_pixbuf_load_frame_buffer( frame_buffer_t frame, render_buffer_t buffer );14.41 +static gboolean gdk_pixbuf_display_blank( uint32_t colour );14.42 +static gboolean gdk_pixbuf_read_render_buffer( unsigned char *target, render_buffer_t buffer, int rowstride, int format );14.43 +14.44 +static void *pixbuf_array[MAX_PIXBUF];14.45 +unsigned int pixbuf_max = 0;14.46 +OSMesaContext osmesa_context = NULL;14.47 +14.48 +void video_gdk_init_driver( display_driver_t driver )14.49 +{14.50 + pixbuf_max = 0;14.51 + driver->create_render_buffer = gdk_pixbuf_create_render_buffer;14.52 + driver->destroy_render_buffer = gdk_pixbuf_destroy_render_buffer;14.53 + driver->set_render_target = gdk_pixbuf_set_render_target;14.54 + driver->display_render_buffer = gdk_pixbuf_display_render_buffer;14.55 + driver->load_frame_buffer = gdk_pixbuf_load_frame_buffer;14.56 + driver->display_blank = gdk_pixbuf_display_blank;14.57 + driver->read_render_buffer = gdk_pixbuf_read_render_buffer;14.58 +14.59 + osmesa_context = OSMesaCreateContextExt( OSMESA_RGBA, 32, 0, 0, 0 );14.60 + OSMesaMakeCurrent( osmesa_context, NULL, GL_UNSIGNED_BYTE, 640, 480 );14.61 + texcache_gl_init();14.62 +}14.63 +14.64 +int video_gdk_find_free()14.65 +{14.66 + unsigned int i;14.67 + for( i=0; i<pixbuf_max; i++ ) {14.68 + if( pixbuf_array[i] == NULL ) {14.69 + return i;14.70 + }14.71 + }14.72 + if( i < MAX_PIXBUF ) {14.73 + return pixbuf_max++;14.74 + }14.75 + return -1;14.76 +}14.77 +14.78 +void video_gdk_shutdown()14.79 +{14.80 + unsigned int i;14.81 + for( i=0; i<pixbuf_max; i++ ) {14.82 + if( pixbuf_array[i] != NULL ) {14.83 + g_free(pixbuf_array[i]);14.84 + pixbuf_array[i] = NULL;14.85 + }14.86 + }14.87 + pixbuf_max = 0;14.88 + OSMesaDestroyContext( osmesa_context );14.89 +}14.90 +14.91 +14.92 +static render_buffer_t gdk_pixbuf_create_render_buffer( uint32_t width, uint32_t height )14.93 +{14.94 + render_buffer_t buf = g_malloc0(sizeof(struct render_buffer));14.95 + gboolean alpha = FALSE;14.96 + buf->width = width;14.97 + buf->height = height;14.98 + buf->buf_id = video_gdk_find_free();14.99 + pixbuf_array[buf->buf_id] = g_malloc0( width * height * 4 );14.100 + return buf;14.101 +}14.102 +14.103 +static void gdk_pixbuf_destroy_render_buffer( render_buffer_t buffer )14.104 +{14.105 + g_free(pixbuf_array[buffer->buf_id] );14.106 + pixbuf_array[buffer->buf_id] = NULL;14.107 + if( buffer->buf_id == (pixbuf_max-1) ) {14.108 + pixbuf_max--;14.109 + }14.110 +}14.111 +14.112 +static gboolean gdk_pixbuf_display_render_buffer( render_buffer_t buffer )14.113 +{14.114 + glFinish();14.115 +14.116 + void *pb = pixbuf_array[buffer->buf_id];14.117 + GdkGC *gc = gtk_video_win->style->fg_gc[GTK_STATE_NORMAL];14.118 + GdkColor black = {0,0,0,0};14.119 +14.120 + assert(gc);14.121 +14.122 + int x1=0,y1=0,x2=video_width,y2=video_height;14.123 +14.124 + int ah = video_width * 0.75;14.125 +14.126 +14.127 + if( ah > video_height ) {14.128 + int w = (video_height/0.75);14.129 + x1 = (video_width - w)/2;14.130 + x2 -= x1;14.131 + gdk_gc_set_foreground( gc, &black );14.132 + gdk_gc_set_background( gc, &black );14.133 + gdk_draw_rectangle( gtk_video_win->window, gc, TRUE, 0, 0, x1, video_height );14.134 + gdk_draw_rectangle( gtk_video_win->window, gc, TRUE, x2, 0, video_width, video_height );14.135 + } else if( ah < video_height ) {14.136 + y1 = (video_height - ah)/2;14.137 + y2 -= y1;14.138 + gdk_gc_set_foreground( gc, &black );14.139 + gdk_gc_set_background( gc, &black );14.140 + gdk_draw_rectangle( gtk_video_win->window, gc, TRUE, 0, 0, video_width, y1 );14.141 + gdk_draw_rectangle( gtk_video_win->window, gc, TRUE, 0, y2, video_width, video_height );14.142 + }14.143 + int w = x2-x1;14.144 + int h = y2-y1;14.145 +14.146 + if( w != buffer->width || h != buffer->height ) {14.147 + gdk_draw_rgb_32_image( gtk_video_win->window, gc, x1, y1, buffer->width, buffer->height, GDK_RGB_DITHER_NONE,14.148 + pb, buffer->width*4 );14.149 + } else {14.150 + gdk_draw_rgb_32_image( gtk_video_win->window, gc, x1, y1, buffer->width, buffer->height, GDK_RGB_DITHER_NONE,14.151 + pb, buffer->width*4 );14.152 + }14.153 +}14.154 +14.155 +static gboolean gdk_pixbuf_display_blank( uint32_t colour )14.156 +{14.157 + GdkGC *gc = gtk_video_win->style->fg_gc[GTK_STATE_NORMAL];14.158 + GdkColor col = { };14.159 +14.160 + gdk_gc_set_foreground( gc, &col );14.161 + gdk_gc_set_background( gc, &col );14.162 + gdk_draw_rectangle( gtk_video_win->window, gc, TRUE, 0, 0, video_width, video_height );14.163 + return TRUE;14.164 +}14.165 +14.166 +static gboolean gdk_pixbuf_set_render_target( render_buffer_t buffer )14.167 +{14.168 + glFinish();14.169 + void *pb = pixbuf_array[buffer->buf_id];14.170 + OSMesaMakeCurrent( osmesa_context, pb, GL_UNSIGNED_BYTE,14.171 + buffer->width, buffer->height );14.172 + //OSMesaPixelStore( OSMESA_Y_UP, 0 );14.173 + glViewport( 0, 0, buffer->width, buffer->height );14.174 + glDrawBuffer(GL_FRONT);14.175 + return TRUE;14.176 +}14.177 +14.178 +static void gdk_pixbuf_load_frame_buffer( frame_buffer_t frame, render_buffer_t buffer )14.179 +{14.180 + glFinish();14.181 + void *pb = pixbuf_array[buffer->buf_id];14.182 + OSMesaMakeCurrent( osmesa_context, pb, GL_UNSIGNED_BYTE,14.183 + buffer->width, buffer->height );14.184 + GLenum type = colour_formats[frame->colour_format].type;14.185 + GLenum format = colour_formats[frame->colour_format].format;14.186 + int bpp = colour_formats[frame->colour_format].bpp;14.187 + int rowstride = (frame->rowstride / bpp) - frame->width;14.188 +14.189 + gl_reset_state();14.190 + glPixelStorei( GL_UNPACK_ROW_LENGTH, rowstride );14.191 + glRasterPos2f(0.375, frame->height-0.375);14.192 + glPixelZoom( 1.0, 1.0 );14.193 + glDrawPixels( frame->width, frame->height, format, type, frame->data );14.194 + glFlush();14.195 +}14.196 +14.197 +static gboolean gdk_pixbuf_read_render_buffer( unsigned char *target, render_buffer_t buffer, int rowstride, int format )14.198 +{14.199 + glFinish();14.200 + void *pb = pixbuf_array[buffer->buf_id];14.201 + OSMesaMakeCurrent( osmesa_context, pb, GL_UNSIGNED_BYTE,14.202 + buffer->width, buffer->height );14.203 + glReadBuffer( GL_FRONT );14.204 + return gl_read_render_buffer( target, buffer, rowstride, format );14.205 +14.206 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000015.2 +++ b/src/drivers/video_gl.c Thu Feb 14 13:54:11 2008 +000015.3 @@ -0,0 +1,164 @@15.4 +/**15.5 + * $Id$15.6 + *15.7 + * Common GL code that doesn't depend on a specific implementation15.8 + *15.9 + * Copyright (c) 2005 Nathan Keynes.15.10 + *15.11 + * This program is free software; you can redistribute it and/or modify15.12 + * it under the terms of the GNU General Public License as published by15.13 + * the Free Software Foundation; either version 2 of the License, or15.14 + * (at your option) any later version.15.15 + *15.16 + * This program is distributed in the hope that it will be useful,15.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of15.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15.19 + * GNU General Public License for more details.15.20 + */15.21 +15.22 +#include <sys/time.h>15.23 +15.24 +#include "display.h"15.25 +#include "pvr2/pvr2.h"15.26 +#include "drivers/video_gl.h"15.27 +15.28 +extern uint32_t video_width, video_height;15.29 +15.30 +/**15.31 + * Reset the gl state to simple orthographic projection with15.32 + * texturing, alpha/depth/scissor/cull tests disabled.15.33 + */15.34 +void gl_reset_state()15.35 +{15.36 + glViewport( 0, 0, video_width, video_height );15.37 + glMatrixMode(GL_PROJECTION);15.38 + glLoadIdentity();15.39 + glOrtho( 0, video_width, video_height, 0, 0, 65535 );15.40 + glMatrixMode(GL_MODELVIEW);15.41 + glLoadIdentity();15.42 + glDisable( GL_TEXTURE_2D );15.43 + glDisable( GL_ALPHA_TEST );15.44 + glDisable( GL_DEPTH_TEST );15.45 + glDisable( GL_SCISSOR_TEST );15.46 + glDisable( GL_CULL_FACE );15.47 + glDrawBuffer( GL_FRONT );15.48 +}15.49 +15.50 +void gl_display_render_buffer( render_buffer_t buffer )15.51 +{15.52 + gl_texture_window( buffer->width, buffer->height, buffer->buf_id, buffer->inverted );15.53 +}15.54 +15.55 +void gl_texture_window( int width, int height, int tex_id, gboolean inverted )15.56 +{15.57 + float top, bottom;15.58 + if( inverted ) {15.59 + top = ((float)height);15.60 + bottom = 0;15.61 + } else {15.62 + top = 0;15.63 + bottom = ((float)height);15.64 + }15.65 +15.66 + /* Reset display parameters */15.67 + gl_reset_state();15.68 + glColor3f( 0,0,0 );15.69 +15.70 + int x1=0,y1=0,x2=video_width,y2=video_height;15.71 +15.72 + int ah = video_width * 0.75;15.73 +15.74 + if( ah > video_height ) {15.75 + int w = (video_height/0.75);15.76 + x1 = (video_width - w)/2;15.77 + x2 -= x1;15.78 +15.79 + glBegin( GL_QUADS );15.80 + glVertex2f( 0, 0 );15.81 + glVertex2f( x1, 0 );15.82 + glVertex2f( x1, video_height );15.83 + glVertex2f( 0, video_height);15.84 + glVertex2f( x2, 0 );15.85 + glVertex2f( video_width, 0 );15.86 + glVertex2f( video_width, video_height );15.87 + glVertex2f( x2, video_height);15.88 + glEnd();15.89 + } else if( ah < video_height ) {15.90 + y1 = (video_height - ah)/2;15.91 + y2 -= y1;15.92 + glBegin( GL_QUADS );15.93 + glVertex2f( 0, 0 );15.94 + glVertex2f( video_width, 0 );15.95 + glVertex2f( video_width, y1 );15.96 + glVertex2f( 0, y1 );15.97 + glVertex2f( 0, y2 );15.98 + glVertex2f( video_width, y2 );15.99 + glVertex2f( video_width, video_height );15.100 + glVertex2f( 0, video_height );15.101 + glEnd();15.102 + }15.103 +15.104 + /* Render the textured rectangle */15.105 + glEnable( GL_TEXTURE_RECTANGLE_ARB );15.106 + glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex_id );15.107 + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );15.108 + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);15.109 + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);15.110 + glEnable( GL_BLEND );15.111 + glBlendFunc( GL_ONE, GL_ZERO );15.112 + glBegin( GL_QUADS );15.113 + glTexCoord2f( 0, top );15.114 + glVertex2f( x1, y1 );15.115 + glTexCoord2f( ((float)width), top );15.116 + glVertex2f( x2, y1 );15.117 + glTexCoord2f( ((float)width), bottom );15.118 + glVertex2f( x2, y2 );15.119 + glTexCoord2f( 0, bottom );15.120 + glVertex2f( x1, y2 );15.121 + glEnd();15.122 + glDisable( GL_TEXTURE_RECTANGLE_ARB );15.123 + glFlush();15.124 +}15.125 +15.126 +gboolean gl_load_frame_buffer( frame_buffer_t frame, int tex_id )15.127 +{15.128 + GLenum type = colour_formats[frame->colour_format].type;15.129 + GLenum format = colour_formats[frame->colour_format].format;15.130 + int bpp = colour_formats[frame->colour_format].bpp;15.131 + int rowstride = (frame->rowstride / bpp) - frame->width;15.132 +15.133 + glPixelStorei( GL_UNPACK_ROW_LENGTH, rowstride );15.134 + glBindTexture( GL_TEXTURE_RECTANGLE_ARB, tex_id );15.135 + glTexSubImage2D( GL_TEXTURE_RECTANGLE_ARB, 0, 0,0,15.136 + frame->width, frame->height, format, type, frame->data );15.137 + return TRUE;15.138 +}15.139 +15.140 +gboolean gl_display_blank( uint32_t colour )15.141 +{15.142 + gl_reset_state();15.143 + glColor3ub( (colour >> 16) & 0xFF, (colour >> 8) & 0xFF, colour & 0xFF );15.144 + glRecti(0,0, video_width, video_height );15.145 + glFlush();15.146 + return TRUE;15.147 +}15.148 +15.149 +/**15.150 + * Generic GL read_render_buffer. This function assumes that the caller15.151 + * has already set the appropriate glReadBuffer(); in other words, unless15.152 + * there's only one buffer this needs to be wrapped.15.153 + */15.154 +gboolean gl_read_render_buffer( unsigned char *target, render_buffer_t buffer,15.155 + int rowstride, int colour_format )15.156 +{15.157 + glFinish();15.158 + GLenum type = colour_formats[colour_format].type;15.159 + GLenum format = colour_formats[colour_format].format;15.160 + // int line_size = buffer->width * colour_formats[colour_format].bpp;15.161 + // int size = line_size * buffer->height;15.162 + int glrowstride = (rowstride / colour_formats[colour_format].bpp) - buffer->width;15.163 + glPixelStorei( GL_PACK_ROW_LENGTH, glrowstride );15.164 +15.165 + glReadPixels( 0, 0, buffer->width, buffer->height, format, type, target );15.166 + return TRUE;15.167 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000016.2 +++ b/src/drivers/video_gl.h Thu Feb 14 13:54:11 2008 +000016.3 @@ -0,0 +1,57 @@16.4 +/**16.5 + * $Id$16.6 + *16.7 + * Parent for all X11 display drivers.16.8 + *16.9 + * Copyright (c) 2005 Nathan Keynes.16.10 + *16.11 + * This program is free software; you can redistribute it and/or modify16.12 + * it under the terms of the GNU General Public License as published by16.13 + * the Free Software Foundation; either version 2 of the License, or16.14 + * (at your option) any later version.16.15 + *16.16 + * This program is distributed in the hope that it will be useful,16.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of16.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16.19 + * GNU General Public License for more details.16.20 + */16.21 +16.22 +#ifndef video_gl_common_H16.23 +#define video_gl_common_H16.24 +16.25 +/**16.26 + * Generic GL routine to draw the given frame buffer into a texture16.27 + */16.28 +gboolean gl_load_frame_buffer( frame_buffer_t frame, int tex_id );16.29 +16.30 +/**16.31 + * Generic GL routine to blank the display view with the specified colour.16.32 + */16.33 +gboolean gl_display_blank( uint32_t colour );16.34 +16.35 +/**16.36 + * Write a rectangular texture (GL_TEXTURE_RECTANGLE_ARB) to the display frame16.37 + */16.38 +void gl_display_render_buffer( render_buffer_t buffer );16.39 +16.40 +/**16.41 + * Write a rectangular texture (GL_TEXTURE_RECTANGLE_ARB) to the display frame16.42 + */16.43 +void gl_texture_window( int width, int height, int tex_id, gboolean inverted );16.44 +16.45 +/**16.46 + * Generic GL read_render_buffer. This function assumes that the caller16.47 + * has already set the appropriate glReadBuffer(); in other words, unless16.48 + * there's only one buffer this needs to be wrapped.16.49 + */16.50 +gboolean gl_read_render_buffer( unsigned char *target, render_buffer_t buffer,16.51 + int rowstride, int colour_format );16.52 +16.53 +16.54 +/****** FBO handling (gl_fbo.c) ******/16.55 +gboolean gl_fbo_is_supported();16.56 +void gl_fbo_shutdown();16.57 +void gl_fbo_init( display_driver_t driver );16.58 +void gl_fbo_detach();16.59 +16.60 +#endif /* !video_gl_common_H */
17.1 --- a/src/drivers/video_glx.c Thu Feb 07 02:04:40 2008 +000017.2 +++ b/src/drivers/video_glx.c Thu Feb 14 13:54:11 2008 +000017.3 @@ -16,12 +16,14 @@17.4 * GNU General Public License for more details.17.5 */17.7 +#include <string.h>17.8 #include "display.h"17.9 -#include "pvr2/pvr2.h"17.10 -#include "drivers/gl_common.h"17.11 #include <X11/Xlib.h>17.12 #include <GL/glx.h>17.13 +#include "pvr2/pvr2.h"17.14 +#include "pvr2/glutil.h"17.15 #include "drivers/video_glx.h"17.16 +#include "drivers/video_gl.h"17.18 /**17.19 * General X11 parameters. The front-end driver is expected to set this up17.20 @@ -168,6 +170,13 @@17.21 WARN( "Not using direct rendering - this is likely to be slow" );17.22 }17.24 + if( glsl_is_supported() ) {17.25 + //if( !glsl_load_shaders( glsl_vertex_shader_src, glsl_fragment_shader_src ) ) {17.26 + if( !glsl_load_shaders( glsl_vertex_shader_src, NULL ) ) {17.27 + WARN( "Unable to load GL shaders" );17.28 + }17.29 + }17.30 +17.31 texcache_gl_init();17.32 video_x11_display = display;17.33 video_x11_window = window;
18.1 --- a/src/drivers/video_gtk.c Thu Feb 07 02:04:40 2008 +000018.2 +++ b/src/drivers/video_gtk.c Thu Feb 14 13:54:11 2008 +000018.3 @@ -24,11 +24,11 @@18.4 #include "display.h"18.5 #include "dckeysyms.h"18.6 #include "drivers/video_glx.h"18.7 -#include "drivers/gl_common.h"18.8 +#include "drivers/video_gl.h"18.9 #include "pvr2/pvr2.h"18.10 #include "gtkui/gtkui.h"18.12 -static GtkWidget *video_win = NULL;18.13 +GtkWidget *gtk_video_win = NULL;18.14 int video_width = 640;18.15 int video_height = 480;18.17 @@ -154,23 +154,28 @@18.18 gboolean video_gtk_init()18.19 {18.21 - video_win = gtk_gui_get_renderarea();18.22 - if( video_win == NULL ) {18.23 + gtk_video_win = gtk_gui_get_renderarea();18.24 + if( gtk_video_win == NULL ) {18.25 return FALSE;18.26 }18.28 - g_signal_connect( video_win, "expose_event",18.29 + g_signal_connect( gtk_video_win, "expose_event",18.30 G_CALLBACK(video_gtk_expose_callback), NULL );18.31 - g_signal_connect( video_win, "configure_event",18.32 + g_signal_connect( gtk_video_win, "configure_event",18.33 G_CALLBACK(video_gtk_resize_callback), NULL );18.34 - video_width = video_win->allocation.width;18.35 - video_height = video_win->allocation.height;18.36 - Display *display = gdk_x11_display_get_xdisplay( gtk_widget_get_display(GTK_WIDGET(video_win)));18.37 - Window window = GDK_WINDOW_XWINDOW( GTK_WIDGET(video_win)->window );18.38 + video_width = gtk_video_win->allocation.width;18.39 + video_height = gtk_video_win->allocation.height;18.40 + Display *display = gdk_x11_display_get_xdisplay( gtk_widget_get_display(GTK_WIDGET(gtk_video_win)));18.41 + Window window = GDK_WINDOW_XWINDOW( GTK_WIDGET(gtk_video_win)->window );18.42 +#ifdef HAVE_LIBOSMESA18.43 + video_gdk_init_driver( &display_gtk_driver );18.44 +#else18.45 if( ! video_glx_init_context( display, window ) ||18.46 ! video_glx_init_driver( &display_gtk_driver ) ) {18.47 return FALSE;18.48 }18.49 +#endif18.50 +18.51 #ifdef HAVE_LINUX_JOYSTICK18.52 linux_joystick_init();18.53 #endif18.54 @@ -179,21 +184,34 @@18.56 gboolean video_gtk_display_blank( uint32_t colour )18.57 {18.58 - GdkGC *gc = gdk_gc_new(video_win->window);18.59 + GdkGC *gc = gdk_gc_new(gtk_video_win->window);18.60 GdkColor color = {0, ((colour>>16)&0xFF)*257, ((colour>>8)&0xFF)*257, ((colour)&0xFF)*257 };18.61 GdkColormap *cmap = gdk_colormap_get_system();18.62 gdk_colormap_alloc_color( cmap, &color, TRUE, TRUE );18.63 gdk_gc_set_foreground( gc, &color );18.64 gdk_gc_set_background( gc, &color );18.65 - gdk_draw_rectangle( video_win->window, gc, TRUE, 0, 0, video_width, video_height );18.66 + gdk_draw_rectangle( gtk_video_win->window, gc, TRUE, 0, 0, video_width, video_height );18.67 gdk_gc_destroy(gc);18.68 gdk_colormap_free_colors( cmap, &color, 1 );18.69 }18.71 +XVisualInfo *video_gtk_get_visual()18.72 +{18.73 +#ifdef HAVE_LIBOSMESA18.74 + return NULL;18.75 +#else18.76 + return video_glx_get_visual();18.77 +#endif18.78 +}18.79 +18.80 void video_gtk_shutdown()18.81 {18.82 - if( video_win != NULL ) {18.83 + if( gtk_video_win != NULL ) {18.84 +#ifdef HAVE_LIBOSMESA18.85 + video_gdk_shutdown();18.86 +#else18.87 video_glx_shutdown();18.88 +#endif18.89 }18.90 #ifdef HAVE_LINUX_JOYSTICK18.91 linux_joystick_shutdown();
19.1 --- a/src/gtkui/main_win.c Thu Feb 07 02:04:40 2008 +000019.2 +++ b/src/gtkui/main_win.c Thu Feb 14 13:54:11 2008 +000019.3 @@ -250,16 +250,21 @@19.4 Display *display = gdk_x11_display_get_xdisplay( gtk_widget_get_display(win->window));19.5 Screen *screen = gdk_x11_screen_get_xscreen( gtk_widget_get_screen(win->window));19.6 int screen_no = XScreenNumberOfScreen(screen);19.7 +#ifndef HAVE_LIBOSMESA19.8 if( !video_glx_init(display, screen_no) ) {19.9 ERROR( "Unable to initialize GLX, aborting" );19.10 exit(3);19.11 }19.12 +#endif19.14 - XVisualInfo *visual = video_glx_get_visual();19.15 - GdkVisual *gdkvis = gdk_x11_screen_lookup_visual( gtk_widget_get_screen(win->window), visual->visualid );19.16 - GdkColormap *colormap = gdk_colormap_new( gdkvis, FALSE );19.17 win->video = gtk_drawing_area_new();19.18 - gtk_widget_set_colormap( win->video, colormap );19.19 +19.20 + XVisualInfo *visual = video_gtk_get_visual();19.21 + if( visual != NULL ) {19.22 + GdkVisual *gdkvis = gdk_x11_screen_lookup_visual( gtk_widget_get_screen(win->window), visual->visualid );19.23 + GdkColormap *colormap = gdk_colormap_new( gdkvis, FALSE );19.24 + gtk_widget_set_colormap( win->video, colormap );19.25 + }19.26 GTK_WIDGET_SET_FLAGS(win->video, GTK_CAN_FOCUS|GTK_CAN_DEFAULT);19.27 gtk_widget_set_size_request( win->video, 640, 480 );19.28 gtk_widget_set_double_buffered( win->video, FALSE );
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000020.2 +++ b/src/pvr2/fragment.glsl Thu Feb 14 13:54:11 2008 +000020.3 @@ -0,0 +1,7 @@20.4 +// Standard PVR2 fragment shader20.5 +20.6 +void main()20.7 +{20.8 + gl_FragColor = gl_Color;20.9 + gl_FragDepth = gl_FragCoord.z;20.10 +}20.11 \ No newline at end of file
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000021.2 +++ b/src/pvr2/gl_sl.c Thu Feb 14 13:54:11 2008 +000021.3 @@ -0,0 +1,223 @@21.4 +/**21.5 + * $Id$21.6 + *21.7 + * GLSL shader loader/unloader. Current version assumes there's exactly21.8 + * 1 shader program that's used globally. This may turn out not to be the21.9 + * most efficient approach.21.10 + *21.11 + * Copyright (c) 2007 Nathan Keynes.21.12 + *21.13 + * This program is free software; you can redistribute it and/or modify21.14 + * it under the terms of the GNU General Public License as published by21.15 + * the Free Software Foundation; either version 2 of the License, or21.16 + * (at your option) any later version.21.17 + *21.18 + * This program is distributed in the hope that it will be useful,21.19 + * but WITHOUT ANY WARRANTY; without even the implied warranty of21.20 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21.21 + * GNU General Public License for more details.21.22 + */21.23 +21.24 +#define GL_GLEXT_PROTOTYPES 121.25 +21.26 +#include "lxdream.h"21.27 +#include "display.h"21.28 +#include "pvr2/glutil.h"21.29 +21.30 +#define MAX_ERROR_BUF 409621.31 +21.32 +gboolean glsl_is_supported()21.33 +{21.34 + return isGLExtensionSupported("GL_ARB_fragment_shader") &&21.35 + isGLExtensionSupported("GL_ARB_vertex_shader") &&21.36 + isGLExtensionSupported("GL_ARB_shading_language_100");21.37 +}21.38 +21.39 +#ifdef GL_ARB_shader_objects21.40 +static GLhandleARB glsl_program = 0, glsl_vert_shader = 0, glsl_frag_shader = 0;21.41 +21.42 +void glsl_print_error( char *msg, GLhandleARB obj )21.43 +{21.44 + char buf[MAX_ERROR_BUF];21.45 + GLsizei length;21.46 + glGetInfoLogARB( obj, sizeof(buf), &length, buf );21.47 + ERROR( "%s: %s", msg, buf );21.48 +}21.49 +21.50 +gboolean glsl_check_shader_error( char *msg, GLhandleARB obj )21.51 +{21.52 + GLint value;21.53 +21.54 + glGetObjectParameterivARB(obj, GL_OBJECT_COMPILE_STATUS_ARB, &value);21.55 + if( value == 0 ) {21.56 + glsl_print_error(msg, obj);21.57 + return FALSE;21.58 + }21.59 + return TRUE;21.60 +}21.61 +21.62 +gboolean glsl_check_program_error( char *msg, GLhandleARB obj )21.63 +{21.64 + if( glGetError() != GL_NO_ERROR ) {21.65 + glsl_print_error(msg, obj);21.66 + }21.67 + return TRUE;21.68 +}21.69 +21.70 +21.71 +gboolean glsl_load_shaders( const char *vertex_src, const char *fragment_src )21.72 +{21.73 + gboolean vsok = TRUE, fsok = TRUE, pok = FALSE;21.74 +21.75 + if( vertex_src == NULL && fragment_src == NULL ) {21.76 + return TRUE; // nothing to do21.77 + }21.78 +21.79 + glsl_program = glCreateProgramObjectARB();21.80 +21.81 + if( vertex_src != NULL ) {21.82 + glsl_vert_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB);21.83 + glShaderSourceARB( glsl_vert_shader, 1, &vertex_src, NULL );21.84 + glCompileShaderARB(glsl_vert_shader);21.85 + vsok = glsl_check_shader_error("Failed to compile vertex shader", glsl_vert_shader);21.86 + }21.87 + if( fragment_src != NULL ) {21.88 + glsl_frag_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);21.89 + glShaderSourceARB( glsl_frag_shader, 1, &fragment_src, NULL );21.90 + glCompileShaderARB(glsl_frag_shader);21.91 + fsok = glsl_check_shader_error("Failed to compile fragment shader", glsl_frag_shader);21.92 + }21.93 +21.94 + if( vsok && fsok ) {21.95 + if( vertex_src != NULL ) {21.96 + glAttachObjectARB(glsl_program, glsl_vert_shader);21.97 + }21.98 + if( fragment_src != NULL ) {21.99 + glAttachObjectARB(glsl_program, glsl_frag_shader);21.100 + }21.101 + glLinkProgramARB(glsl_program);21.102 + pok = glsl_check_program_error( "Failed to link shader program", glsl_program );21.103 + }21.104 + if( pok ) {21.105 + glUseProgramObjectARB(glsl_program);21.106 + pok = glsl_check_program_error( "Failed to apply shader program", glsl_program );21.107 + } else {21.108 + glsl_unload_shaders();21.109 + }21.110 + return pok;21.111 +}21.112 +21.113 +void glsl_enable_shader(gboolean en)21.114 +{21.115 + if( glsl_program != 0 ) {21.116 + if( en ) {21.117 + glUseProgramObjectARB(glsl_program);21.118 + } else {21.119 + glUseProgramObjectARB(0);21.120 + }21.121 + }21.122 +}21.123 +21.124 +void glsl_unload_shaders(void)21.125 +{21.126 + glUseProgramObjectARB(0);21.127 + glDetachObjectARB(glsl_program, glsl_vert_shader);21.128 + glDetachObjectARB(glsl_program, glsl_frag_shader);21.129 + glDeleteObjectARB(glsl_program);21.130 + glDeleteObjectARB(glsl_vert_shader);21.131 + glDeleteObjectARB(glsl_frag_shader);21.132 +}21.133 +21.134 +#else21.135 +static GLuint glsl_program = 0, glsl_vert_shader = 0, glsl_frag_shader = 0;21.136 +21.137 +gboolean glsl_check_shader_error( char *msg, GLuint shader )21.138 +{21.139 + GLint value;21.140 +21.141 + glGetShaderiv( shader, GL_COMPILE_STATUS, &value );21.142 + if( value == 0 ) {21.143 + char buf[MAX_ERROR_BUF];21.144 + GLsizei length;21.145 + glGetShaderInfoLog( shader, sizeof(buf), &length, buf );21.146 + ERROR( "%s: %s", msg, buf );21.147 + return FALSE;21.148 + }21.149 + return TRUE;21.150 +}21.151 +gboolean glsl_check_program_error( char *msg, GLuint program )21.152 +{21.153 + if( glGetError() != GL_NO_ERROR ) {21.154 + char buf[MAX_ERROR_BUF];21.155 + GLsizei length;21.156 + glGetProgramInfoLog( program, sizeof(buf), &length, buf );21.157 + ERROR( "%s: %s", msg, buf );21.158 + return FALSE;21.159 + }21.160 + return TRUE;21.161 +}21.162 +21.163 +gboolean glsl_load_shaders( const char *vertex_src, const char *fragment_src )21.164 +{21.165 + gboolean vsok = TRUE, fsok = TRUE, pok = FALSE;21.166 +21.167 + if( vertex_src == NULL && fragment_src == NULL ) {21.168 + return TRUE;21.169 + }21.170 +21.171 + glsl_program = glCreateProgram();21.172 +21.173 + if( vertex_src != NULL ) {21.174 + glsl_vert_shader = glCreateShader(GL_VERTEX_SHADER);21.175 + glShaderSource( glsl_vert_shader, 1, &vertex_src, NULL );21.176 + glCompileShader(glsl_vert_shader);21.177 + vsok = glsl_check_shader_error( "Failed to compile vertex shader", glsl_vert_shader );21.178 + }21.179 + if( fragment_src != NULL ) {21.180 + glsl_frag_shader = glCreateShader(GL_FRAGMENT_SHADER);21.181 + glShaderSource( glsl_frag_shader, 1, &fragment_src, NULL );21.182 + glCompileShader(glsl_frag_shader);21.183 + fsok = glsl_check_shader_error( "Failed to compile fragment shader", glsl_frag_shader );21.184 + }21.185 +21.186 + if( vsok && fsok ) {21.187 + if( vertex_src != NULL ) {21.188 + glAttachShader(glsl_program, glsl_vert_shader);21.189 + }21.190 + if( fragment_src != NULL ) {21.191 + glAttachShader(glsl_program, glsl_frag_shader);21.192 + }21.193 + glLinkProgram(glsl_program);21.194 + pok = glsl_check_program_error( "Failed to link shader program", glsl_program );21.195 + }21.196 +21.197 + if( pok ) {21.198 + glUseProgram(glsl_program);21.199 + } else {21.200 + glsl_unload_shaders();21.201 + }21.202 + return pok;21.203 +}21.204 +21.205 +21.206 +void glsl_enable_shader(gboolean en)21.207 +{21.208 + if( glsl_program != 0 ) {21.209 + if( en ) {21.210 + glUseProgram(glsl_program);21.211 + } else {21.212 + glUseProgram(0);21.213 + }21.214 + }21.215 +}21.216 +21.217 +void glsl_unload_shaders(void)21.218 +{21.219 + glUseProgram(0);21.220 + glDetachShader(glsl_program, glsl_vert_shader);21.221 + glDetachShader(glsl_program, glsl_frag_shader);21.222 + glDeleteProgram(glsl_program);21.223 + glDeleteShader(glsl_vert_shader);21.224 + glDeleteShader(glsl_frag_shader);21.225 +}21.226 +#endif
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000022.2 +++ b/src/pvr2/gl_slsrc.c Thu Feb 14 13:54:11 2008 +000022.3 @@ -0,0 +1,25 @@22.4 +/**22.5 + * This file is automatically generated - do not edit22.6 + */22.7 +22.8 +const char *glsl_vertex_shader_src = "// Standard PVR2 vertex shader\n\22.9 +\n\22.10 +void main()\n\22.11 +{\n\22.12 + gl_Position.xy = ftransform().xy;\n\22.13 + gl_Position.z = gl_Vertex.z;\n\22.14 + gl_Position.w = 1;\n\22.15 + gl_FrontColor = gl_Color;\n\22.16 + gl_FrontSecondaryColor = gl_SecondaryColor;\n\22.17 + gl_TexCoord[0] = gl_MultiTexCoord0;\n\22.18 +}\n\22.19 +";22.20 +22.21 +const char *glsl_fragment_shader_src = "// Standard PVR2 fragment shader\n\22.22 +\n\22.23 +void main()\n\22.24 +{\n\22.25 + gl_FragColor = gl_Color;\n\22.26 + gl_FragDepth = gl_FragCoord.z;\n\22.27 +}";22.28 +
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000023.2 +++ b/src/pvr2/glutil.c Thu Feb 14 13:54:11 2008 +000023.3 @@ -0,0 +1,52 @@23.4 +/**23.5 + * $Id: glutil.c 602 2008-01-15 20:50:23Z nkeynes $23.6 + *23.7 + * GL-based support functions23.8 + *23.9 + * Copyright (c) 2005 Nathan Keynes.23.10 + *23.11 + * This program is free software; you can redistribute it and/or modify23.12 + * it under the terms of the GNU General Public License as published by23.13 + * the Free Software Foundation; either version 2 of the License, or23.14 + * (at your option) any later version.23.15 + *23.16 + * This program is distributed in the hope that it will be useful,23.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of23.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the23.19 + * GNU General Public License for more details.23.20 + */23.21 +23.22 +#include "pvr2/glutil.h"23.23 +23.24 +/**23.25 + * Test if a specific extension is supported. From opengl.org23.26 + * @param extension extension name to check for23.27 + * @return TRUE if supported, otherwise FALSE.23.28 + */23.29 +gboolean isGLExtensionSupported( const char *extension )23.30 +{23.31 + const GLubyte *extensions = NULL;23.32 + const GLubyte *start;23.33 + GLubyte *where, *terminator;23.34 +23.35 + /* Extension names should not have spaces. */23.36 + where = (GLubyte *) strchr(extension, ' ');23.37 + if (where || *extension == '\0')23.38 + return 0;23.39 + extensions = glGetString(GL_EXTENSIONS);23.40 + /* It takes a bit of care to be fool-proof about parsing the23.41 + OpenGL extensions string. Don't be fooled by sub-strings,23.42 + etc. */23.43 + start = extensions;23.44 + for (;;) {23.45 + where = (GLubyte *) strstr((const char *) start, extension);23.46 + if (!where)23.47 + break;23.48 + terminator = where + strlen(extension);23.49 + if (where == start || *(where - 1) == ' ')23.50 + if (*terminator == ' ' || *terminator == '\0')23.51 + return TRUE;23.52 + start = terminator;23.53 + }23.54 + return FALSE;23.55 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000024.2 +++ b/src/pvr2/glutil.h Thu Feb 14 13:54:11 2008 +000024.3 @@ -0,0 +1,40 @@24.4 +/**24.5 + * $Id: glutil.h 602 2008-01-15 20:50:23Z nkeynes $24.6 + *24.7 + * GL-based support functions24.8 + *24.9 + * Copyright (c) 2005 Nathan Keynes.24.10 + *24.11 + * This program is free software; you can redistribute it and/or modify24.12 + * it under the terms of the GNU General Public License as published by24.13 + * the Free Software Foundation; either version 2 of the License, or24.14 + * (at your option) any later version.24.15 + *24.16 + * This program is distributed in the hope that it will be useful,24.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of24.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the24.19 + * GNU General Public License for more details.24.20 + */24.21 +24.22 +#ifndef lxdream_glutil_H24.23 +#define lxdream_glutil_H24.24 +24.25 +#include "display.h"24.26 +24.27 +/**24.28 + * Test if a specific extension is supported. From opengl.org24.29 + * @param extension extension name to check for24.30 + * @return TRUE if supported, otherwise FALSE.24.31 + */24.32 +gboolean isGLExtensionSupported( const char *extension );24.33 +24.34 +24.35 +/****** Shader handling (gl_sl.c) *****/24.36 +gboolean glsl_is_supported(void);24.37 +gboolean glsl_load_shaders( const char *vert_shader, const char *frag_shader );24.38 +void glsl_unload_shaders(void);24.39 +24.40 +extern const char *glsl_vertex_shader_src;24.41 +extern const char *glsl_fragment_shader_src;24.42 +24.43 +#endif /* !lxdream_glutil_H */
25.1 --- a/src/pvr2/pvr2.h Thu Feb 07 02:04:40 2008 +000025.2 +++ b/src/pvr2/pvr2.h Thu Feb 14 13:54:11 2008 +000025.3 @@ -16,7 +16,11 @@25.4 * GNU General Public License for more details.25.5 */25.7 -#include "dream.h"25.8 +#ifndef lxdream_pvr2_H25.9 +#define lxdream_pvr2_H 125.10 +25.11 +#include <stdio.h>25.12 +#include "lxdream.h"25.13 #include "mem.h"25.14 #include "display.h"25.15 #include "pvr2/pvr2mmio.h"25.16 @@ -240,6 +244,8 @@25.18 /********************************* Renderer ******************************/25.20 +void pvr2_read_scene( void );25.21 +25.22 /**25.23 * Render the current scene stored in PVR ram to the GL back buffer.25.24 */25.25 @@ -260,7 +266,7 @@25.26 void pvr2_render_tilebuffer( int width, int height, int clipx1, int clipy1,25.27 int clipx2, int clipy2 );25.29 -float pvr2_render_find_maximum_z();25.30 +void pvr2_render_find_z_range( float *min, float *max );25.32 void pvr2_render_getsize( int *x, int *y );25.34 @@ -293,7 +299,6 @@25.36 void render_autosort_tile( pvraddr_t tile_entry, int render_mode, gboolean cheap_modifier_mode );25.38 -25.39 /****************************** Texture Cache ****************************/25.41 /**25.42 @@ -377,3 +382,29 @@25.43 extern int pvr2_render_colour_format[8];25.45 float halftofloat(uint16_t half);25.46 +25.47 +#define CULL_NONE 025.48 +#define CULL_SMALL 125.49 +#define CULL_CCW 225.50 +#define CULL_CW 325.51 +25.52 +#define SEGMENT_END 0x8000000025.53 +#define SEGMENT_ZCLEAR 0x4000000025.54 +#define SEGMENT_SORT_TRANS 0x2000000025.55 +#define SEGMENT_START 0x1000000025.56 +#define SEGMENT_X(c) (((c) >> 2) & 0x3F)25.57 +#define SEGMENT_Y(c) (((c) >> 8) & 0x3F)25.58 +#define NO_POINTER 0x8000000025.59 +#define IS_TILE_PTR(p) ( ((p)&NO_POINTER) == 0 )25.60 +#define IS_LAST_SEGMENT(s) (((s)->control) & SEGMENT_END)25.61 +25.62 +struct tile_segment {25.63 + uint32_t control;25.64 + pvraddr_t opaque_ptr;25.65 + pvraddr_t opaquemod_ptr;25.66 + pvraddr_t trans_ptr;25.67 + pvraddr_t transmod_ptr;25.68 + pvraddr_t punchout_ptr;25.69 +};25.70 +25.71 +#endif /* !lxdream_pvr2_H */
26.1 --- a/src/pvr2/rendbkg.c Thu Feb 07 02:04:40 2008 +000026.2 +++ b/src/pvr2/rendbkg.c Thu Feb 14 13:54:11 2008 +000026.3 @@ -426,15 +426,15 @@26.5 center.x = base[1].x;26.6 center.y = base[1].y;26.7 - center.z = (1/base[1].z);26.8 + center.z = base[1].z;26.9 center.u = base[1].u;26.10 center.v = base[1].v;26.11 diff0.x = base[0].x - center.x;26.12 diff0.y = base[0].y - center.y;26.13 - diff0.z = (1/base[0].z) - center.z;26.14 + diff0.z = base[0].z - center.z;26.15 diff1.x = base[2].x - center.x;26.16 diff1.y = base[2].y - center.y;26.17 - diff1.z = (1/base[2].z) - center.z;26.18 + diff1.z = base[2].z - center.z;26.20 float detxy = ((diff1.y) * (diff0.x)) - ((diff0.y) * (diff1.x));26.22 @@ -461,7 +461,7 @@26.23 scene->vertexes[i].rgba[1] = base[2].rgba[1];26.24 scene->vertexes[i].rgba[2] = base[2].rgba[2];26.25 scene->vertexes[i].rgba[3] = base[2].rgba[3];26.26 - scene->vertexes[i].z = 1/base[2].z;26.27 + scene->vertexes[i].z = base[2].z;26.28 scene->vertexes[i].u = base[2].u;26.29 scene->vertexes[i].v = base[2].v;26.30 }
27.1 --- a/src/pvr2/rendcore.c Thu Feb 07 02:04:40 2008 +000027.2 +++ b/src/pvr2/rendcore.c Thu Feb 14 13:54:11 2008 +000027.3 @@ -16,6 +16,8 @@27.4 * GNU General Public License for more details.27.5 */27.6 #include <sys/time.h>27.7 +#include <assert.h>27.8 +#include <string.h>27.9 #include "pvr2/pvr2.h"27.10 #include "asic.h"27.11 #include "display.h"27.12 @@ -41,33 +43,11 @@27.13 COLFMT_BGRA1555, COLFMT_RGB565, COLFMT_BGRA4444, COLFMT_BGRA1555,27.14 COLFMT_BGR888, COLFMT_BGRA8888, COLFMT_BGRA8888, COLFMT_BGRA4444 };27.16 -27.17 -#define CULL_NONE 027.18 -#define CULL_SMALL 127.19 -#define CULL_CCW 227.20 -#define CULL_CW 327.21 -27.22 -#define SEGMENT_END 0x8000000027.23 -#define SEGMENT_ZCLEAR 0x4000000027.24 -#define SEGMENT_SORT_TRANS 0x2000000027.25 -#define SEGMENT_START 0x1000000027.26 -#define SEGMENT_X(c) (((c) >> 2) & 0x3F)27.27 -#define SEGMENT_Y(c) (((c) >> 8) & 0x3F)27.28 -#define NO_POINTER 0x8000000027.29 -27.30 extern char *video_base;27.32 gboolean pvr2_force_fragment_alpha = FALSE;27.33 gboolean pvr2_debug_render = FALSE;27.35 -struct tile_segment {27.36 - uint32_t control;27.37 - pvraddr_t opaque_ptr;27.38 - pvraddr_t opaquemod_ptr;27.39 - pvraddr_t trans_ptr;27.40 - pvraddr_t transmod_ptr;27.41 - pvraddr_t punchout_ptr;27.42 -};27.44 void render_print_tilelist( FILE *f, uint32_t tile_entry );27.46 @@ -272,9 +252,9 @@27.47 (unpacked[3].y - unpacked[1].y) * diff1.x) / detxy;27.48 float s = ((unpacked[3].y - unpacked[1].y) * diff0.x -27.49 (unpacked[3].x - unpacked[1].x) * diff0.y) / detxy;27.50 - diff0.z = (1/unpacked[0].z) - (1/unpacked[1].z);27.51 - diff1.z = (1/unpacked[2].z) - (1/unpacked[1].z);27.52 - unpacked[3].z = 1/((1/unpacked[1].z) + (t*diff0.z) + (s*diff1.z));27.53 + diff0.z = unpacked[0].z - unpacked[1].z;27.54 + diff1.z = unpacked[2].z - unpacked[1].z;27.55 + unpacked[3].z = unpacked[1].z + (t*diff0.z) + (s*diff1.z);27.57 diff0.u = unpacked[0].u - unpacked[1].u;27.58 diff0.v = unpacked[0].v - unpacked[1].v;27.59 @@ -320,7 +300,8 @@27.60 vertexes[i]->offset_rgba[1],27.61 vertexes[i]->offset_rgba[2] );27.62 }27.63 - glVertex3f( vertexes[i]->x, vertexes[i]->y, 1/vertexes[i]->z );27.64 + assert( vertexes[i]->z > 0 && !isinf(vertexes[i]->z) );27.65 + glVertex3f( vertexes[i]->x, vertexes[i]->y, vertexes[i]->z );27.66 }27.68 glEnd();27.69 @@ -375,7 +356,8 @@27.70 glSecondaryColor3ubEXT( (GLubyte)(spec >> 16), (GLubyte)(spec >> 8),27.71 (GLubyte)spec );27.72 }27.73 - glVertex3f( vertexf[0], vertexf[1], 1/vertexf[2] );27.74 + // assert( vertexf[2] > 0 && !isinf(vertexf[2]) );27.75 + glVertex3f( vertexf[0], vertexf[1], vertexf[2] );27.76 vertexes += vertex_size;27.77 }27.79 @@ -545,13 +527,12 @@27.80 glDisable( GL_SCISSOR_TEST );27.81 }27.83 -static float render_find_maximum_tile_z( pvraddr_t tile_entry, float inputz )27.84 +static void render_find_maximum_tile_z( pvraddr_t tile_entry, float *minimumz, float *maximumz )27.85 {27.86 uint32_t poly_bank = MMIO_READ(PVR2,RENDER_POLYBASE);27.87 uint32_t *tile_list = (uint32_t *)(video_base+tile_entry);27.88 int shadow_cfg = MMIO_READ( PVR2, RENDER_SHADOW ) & 0x100;27.89 int i, j;27.90 - float z = inputz;27.91 do {27.92 uint32_t entry = *tile_list++;27.93 if( entry >> 28 == 0x0F ) {27.94 @@ -573,8 +554,10 @@27.95 float *vertexz = (float *)(polygon+context_length+2);27.96 for( i=0; i<strip_count; i++ ) {27.97 for( j=0; j<3; j++ ) {27.98 - if( *vertexz > z ) {27.99 - z = *vertexz;27.100 + if( *vertexz > *maximumz ) {27.101 + *maximumz = *vertexz;27.102 + } else if( *vertexz < *minimumz ) {27.103 + *minimumz = *vertexz;27.104 }27.105 vertexz += vertex_length;27.106 }27.107 @@ -587,8 +570,10 @@27.108 float *vertexz = (float *)(polygon+context_length+2);27.109 for( i=0; i<strip_count; i++ ) {27.110 for( j=0; j<4; j++ ) {27.111 - if( *vertexz > z ) {27.112 - z = *vertexz;27.113 + if( *vertexz > *maximumz ) {27.114 + *maximumz = *vertexz;27.115 + } else if( *vertexz < *minimumz ) {27.116 + *minimumz = *vertexz;27.117 }27.118 vertexz += vertex_length;27.119 }27.120 @@ -599,48 +584,50 @@27.121 int i;27.122 float *vertexz = (float *)polygon+context_length+2;27.123 for( i=0; i<6; i++ ) {27.124 - if( (entry & (0x40000000>>i)) && *vertexz > z ) {27.125 - z = *vertexz;27.126 + if( (entry & (0x40000000>>i)) ) {27.127 + if( *vertexz > *maximumz ) {27.128 + *maximumz = *vertexz;27.129 + } else if( *vertexz < *minimumz ) {27.130 + *minimumz = *vertexz;27.131 + }27.132 }27.133 vertexz += vertex_length;27.134 }27.135 }27.136 }27.137 } while(1);27.138 - return z;27.139 }27.141 /**27.142 * Scan through the scene to determine the largest z value (in order to set up27.143 * an appropriate near clip plane).27.144 */27.145 -float pvr2_render_find_maximum_z( )27.146 +void pvr2_render_find_z_range( float *minimumz, float *maximumz )27.147 {27.148 pvraddr_t segmentbase = MMIO_READ( PVR2, RENDER_TILEBASE );27.149 - float maximumz = MMIO_READF( PVR2, RENDER_FARCLIP ); /* Initialize to the far clip plane */27.150 + *minimumz = MMIO_READF( PVR2, RENDER_FARCLIP ); /* Initialize to the far clip plane */27.151 + *maximumz = *minimumz;27.153 struct tile_segment *segment = (struct tile_segment *)(video_base + segmentbase);27.154 do {27.156 if( (segment->opaque_ptr & NO_POINTER) == 0 ) {27.157 - maximumz = render_find_maximum_tile_z(segment->opaque_ptr, maximumz);27.158 + render_find_maximum_tile_z(segment->opaque_ptr, minimumz, maximumz);27.159 }27.160 if( (segment->opaquemod_ptr & NO_POINTER) == 0 ) {27.161 - maximumz = render_find_maximum_tile_z(segment->opaquemod_ptr, maximumz);27.162 + render_find_maximum_tile_z(segment->opaquemod_ptr, minimumz, maximumz);27.163 }27.164 if( (segment->trans_ptr & NO_POINTER) == 0 ) {27.165 - maximumz = render_find_maximum_tile_z(segment->trans_ptr, maximumz);27.166 + render_find_maximum_tile_z(segment->trans_ptr, minimumz, maximumz);27.167 }27.168 if( (segment->transmod_ptr & NO_POINTER) == 0 ) {27.169 - maximumz = render_find_maximum_tile_z(segment->transmod_ptr, maximumz);27.170 + render_find_maximum_tile_z(segment->transmod_ptr, minimumz, maximumz);27.171 }27.172 if( (segment->punchout_ptr & NO_POINTER) == 0 ) {27.173 - maximumz = render_find_maximum_tile_z(segment->punchout_ptr, maximumz);27.174 + render_find_maximum_tile_z(segment->punchout_ptr, minimumz, maximumz);27.175 }27.177 } while( ((segment++)->control & SEGMENT_END) == 0 );27.178 -27.179 - return 1/maximumz;27.180 }27.182 /**
28.1 --- a/src/pvr2/render.c Thu Feb 07 02:04:40 2008 +000028.2 +++ b/src/pvr2/render.c Thu Feb 14 13:54:11 2008 +000028.3 @@ -18,6 +18,7 @@28.5 #include <sys/time.h>28.6 #include <time.h>28.7 +#include <math.h>28.8 #include "pvr2/pvr2.h"28.9 #include "asic.h"28.11 @@ -79,7 +80,7 @@28.12 * Prepare the OpenGL context to receive instructions for a new frame.28.13 */28.14 static void pvr2_render_prepare_context( render_buffer_t buffer,28.15 - float bgplanez, float nearz )28.16 + float nearz, float farz )28.17 {28.18 /* Select and initialize the render context */28.19 display_driver->set_render_target(buffer);28.20 @@ -95,7 +96,7 @@28.21 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);28.22 glMatrixMode(GL_PROJECTION);28.23 glLoadIdentity();28.24 - glOrtho( 0, buffer->width, buffer->height, 0, -bgplanez, -nearz );28.25 + glOrtho( 0, buffer->width, buffer->height, 0, -nearz, -farz );28.26 glMatrixMode(GL_MODELVIEW);28.27 glLoadIdentity();28.28 glCullFace( GL_BACK );28.29 @@ -121,8 +122,10 @@28.31 gettimeofday(&tva, NULL);28.33 - float bgplanez = 1/MMIO_READF( PVR2, RENDER_FARCLIP );28.34 - pvr2_render_prepare_context( buffer, bgplanez, 0 );28.35 + float farz, nearz;28.36 + pvr2_render_find_z_range( &nearz, &farz );28.37 + float bgplanez = MMIO_READF( PVR2, RENDER_FARCLIP );28.38 + pvr2_render_prepare_context( buffer, nearz, farz );28.40 int clip_x = MMIO_READ( PVR2, RENDER_HCLIP ) & 0x03FF;28.41 int clip_y = MMIO_READ( PVR2, RENDER_VCLIP ) & 0x03FF;
29.1 --- a/src/pvr2/rendsort.c Thu Feb 07 02:04:40 2008 +000029.2 +++ b/src/pvr2/rendsort.c Thu Feb 14 13:54:11 2008 +000029.3 @@ -72,9 +72,9 @@29.4 triangle[i].maxx = MAX3(triangle[i].vertexes[0][0],triangle[i].vertexes[1][0],triangle[i].vertexes[2][0]);29.5 triangle[i].miny = MIN3(triangle[i].vertexes[0][1],triangle[i].vertexes[1][1],triangle[i].vertexes[2][1]);29.6 triangle[i].maxy = MAX3(triangle[i].vertexes[0][1],triangle[i].vertexes[1][1],triangle[i].vertexes[2][1]);29.7 - float az = 1/triangle[i].vertexes[0][2];29.8 - float bz = 1/triangle[i].vertexes[1][2];29.9 - float cz = 1/triangle[i].vertexes[2][2];29.10 + float az = triangle[i].vertexes[0][2];29.11 + float bz = triangle[i].vertexes[1][2];29.12 + float cz = triangle[i].vertexes[2][2];29.13 triangle[i].minz = MIN3(az,bz,cz);29.14 triangle[i].maxz = MAX3(az,bz,cz);29.15 }29.16 @@ -198,9 +198,9 @@29.17 {29.18 const struct render_triangle *tri1 = a;29.19 const struct render_triangle *tri2 = b;29.20 - if( tri1->minz < tri2->minz ) {29.21 - return 1; // No these _aren't_ back to front...29.22 - } else if( tri1->minz > tri2->minz ) {29.23 + if( tri1->minz > tri2->minz ) {29.24 + return 1;29.25 + } else if( tri1->minz < tri2->minz ) {29.26 return -1;29.27 } else {29.28 return 0;
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000030.2 +++ b/src/pvr2/scene.c Thu Feb 14 13:54:11 2008 +000030.3 @@ -0,0 +1,532 @@30.4 +/**30.5 + * $Id: gl_common.c 602 2008-01-15 20:50:23Z nkeynes $30.6 + *30.7 + * Manage the internal vertex/polygon buffers and scene data structure.30.8 + * Where possible this uses VBOs for the vertex + index data.30.9 + *30.10 + * Copyright (c) 2005 Nathan Keynes.30.11 + *30.12 + * This program is free software; you can redistribute it and/or modify30.13 + * it under the terms of the GNU General Public License as published by30.14 + * the Free Software Foundation; either version 2 of the License, or30.15 + * (at your option) any later version.30.16 + *30.17 + * This program is distributed in the hope that it will be useful,30.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of30.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the30.20 + * GNU General Public License for more details.30.21 + */30.22 +30.23 +#include <assert.h>30.24 +#include <string.h>30.25 +#include "lxdream.h"30.26 +#include "display.h"30.27 +#include "pvr2/pvr2.h"30.28 +#include "pvr2/glutil.h"30.29 +#include "pvr2/scene.h"30.30 +30.31 +#define VBO_EXT_STRING "GL_ARB_vertex_buffer_object"30.32 +#define PBO_EXT_STRING "GL_ARB_pixel_buffer_object"30.33 +30.34 +struct pvr2_scene_struct pvr2_scene;30.35 +30.36 +static gboolean vbo_init = FALSE;30.37 +static gboolean vbo_supported = FALSE;30.38 +30.39 +/**30.40 + * Test for VBO support, and allocate all the system memory needed for the30.41 + * temporary structures. GL context must have been initialized before this30.42 + * point.30.43 + */30.44 +void pvr2_scene_init()30.45 +{30.46 + if( !vbo_init ) {30.47 + if( isGLExtensionSupported(VBO_EXT_STRING) ) {30.48 + vbo_supported = TRUE;30.49 + pvr2_scene.vbo_id = 1;30.50 + }30.51 + pvr2_scene.vertex_array = NULL;30.52 + pvr2_scene.vertex_array_size = 0;30.53 + pvr2_scene.poly_array = g_malloc( MAX_POLY_BUFFER_SIZE );30.54 + pvr2_scene.buf_to_poly_map = g_malloc0( BUF_POLY_MAP_SIZE );30.55 + vbo_init = TRUE;30.56 + }30.57 +}30.58 +30.59 +void pvr2_scene_shutdown()30.60 +{30.61 + if( vbo_supported ) {30.62 + glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );30.63 + glDeleteBuffersARB( 1, &pvr2_scene.vbo_id );30.64 + pvr2_scene.vbo_id = 0;30.65 + } else {30.66 + g_free( pvr2_scene.vertex_array );30.67 + pvr2_scene.vertex_array = NULL;30.68 + }30.69 + g_free( pvr2_scene.poly_array );30.70 + g_free( pvr2_scene.buf_to_poly_map );30.71 + vbo_init = FALSE;30.72 +}30.73 +30.74 +void *vertex_buffer_map()30.75 +{30.76 + uint32_t size = pvr2_scene.vertex_count * sizeof(struct vertex_struct);30.77 + if( vbo_supported ) {30.78 + glBindBufferARB( GL_ARRAY_BUFFER_ARB, pvr2_scene.vbo_id );30.79 +30.80 + if( size > pvr2_scene.vertex_array_size ) {30.81 + glBufferDataARB( GL_ARRAY_BUFFER_ARB, size, NULL, GL_DYNAMIC_DRAW_ARB );30.82 + assert( glGetError() == 0 );30.83 + }30.84 + pvr2_scene.vertex_array = glMapBufferARB( GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB );30.85 + assert(pvr2_scene.vertex_array != NULL );30.86 + } else {30.87 + if( size > pvr2_scene.vertex_array_size ) {30.88 + pvr2_scene.vertex_array = g_realloc( pvr2_scene.vertex_array, size );30.89 + }30.90 + }30.91 + return pvr2_scene.vertex_array;30.92 +}30.93 +30.94 +gboolean vertex_buffer_unmap()30.95 +{30.96 + if( vbo_supported ) {30.97 + pvr2_scene.vertex_array = NULL;30.98 + return glUnmapBufferARB( GL_ARRAY_BUFFER_ARB );30.99 + } else {30.100 + return TRUE;30.101 + }30.102 +}30.103 +30.104 +static struct polygon_struct *vertex_buffer_add_polygon( pvraddr_t poly_idx, int vertex_count,30.105 + gboolean is_modified )30.106 +{30.107 + int vert_mul = is_modified ? 2 : 1;30.108 +30.109 + if( pvr2_scene.buf_to_poly_map[poly_idx] != NULL ) {30.110 + if( vertex_count > pvr2_scene.buf_to_poly_map[poly_idx]->vertex_count ) {30.111 + pvr2_scene.vertex_count += (vertex_count - pvr2_scene.buf_to_poly_map[poly_idx]->vertex_count) * vert_mul;30.112 + pvr2_scene.buf_to_poly_map[poly_idx]->vertex_count = vertex_count;30.113 + }30.114 + return pvr2_scene.buf_to_poly_map[poly_idx];30.115 + } else {30.116 + struct polygon_struct *poly = &pvr2_scene.poly_array[pvr2_scene.poly_count++];30.117 + poly->context = (uint32_t *)(video_base + MMIO_READ(PVR2,RENDER_POLYBASE) + (poly_idx<<2));30.118 + poly->vertex_count = vertex_count;30.119 + poly->vertex_index = -1;30.120 + pvr2_scene.buf_to_poly_map[poly_idx] = poly;30.121 + pvr2_scene.vertex_count += (vertex_count * vert_mul);30.122 + return poly;30.123 + }30.124 +}30.125 +30.126 +/**30.127 + * Decode a single PVR2 renderable vertex (opaque/trans/punch-out, but not shadow30.128 + * volume)30.129 + * @param vert Pointer to output vertex structure30.130 + * @param poly1 First word of polygon context (needed to understand vertex)30.131 + * @param pvr2_data Pointer to raw pvr2 vertex data (in VRAM)30.132 + * @param modify_offset Offset in 32-bit words to the tex/color data. 0 for30.133 + * the normal vertex, half the vertex length for the modified vertex.30.134 + */30.135 +static void pvr2_decode_render_vertex( struct vertex_struct *vert, uint32_t poly1,30.136 + uint32_t *pvr2_data, int modify_offset )30.137 +{30.138 + union pvr2_data_type {30.139 + uint32_t *ival;30.140 + float *fval;30.141 + } data;30.142 +30.143 + data.ival = pvr2_data;30.144 +30.145 + vert->x = *data.fval++;30.146 + vert->y = *data.fval++;30.147 +30.148 + float z = *data.fval++;30.149 + if( z > pvr2_scene.bounds[5] ) {30.150 + pvr2_scene.bounds[5] = z;30.151 + } else if( z < pvr2_scene.bounds[4] && z != 0 ) {30.152 + pvr2_scene.bounds[4] = z;30.153 + }30.154 + vert->z = z;30.155 + data.ival += modify_offset;30.156 +30.157 +30.158 + if( POLY1_TEXTURED(poly1) ) {30.159 + if( POLY1_UV16(poly1) ) {30.160 + vert->u = halftofloat( *data.ival>>16 );30.161 + vert->v = halftofloat( *data.ival );30.162 + data.ival++;30.163 + } else {30.164 + vert->u = *data.fval++;30.165 + vert->v = *data.fval++;30.166 + }30.167 + }30.168 + vert->rgba = *data.ival++;30.169 + if( POLY1_SPECULAR(poly1) ) {30.170 + vert->offset_rgba = *data.ival++;30.171 + }30.172 +}30.173 +30.174 +/**30.175 + * Compute texture, colour, and z values for a result point by interpolating from30.176 + * a set of 3 input points. The result point must define its x,y.30.177 + */30.178 +static void vertex_buffer_compute_vertex( struct vertex_struct *result,30.179 + struct vertex_struct *input,30.180 + gboolean is_solid_shaded )30.181 +{30.182 + int i;30.183 + float sx = input[2].x - input[1].x;30.184 + float sy = input[2].y - input[1].y;30.185 + float tx = input[0].x - input[1].x;30.186 + float ty = input[0].y - input[1].y;30.187 +30.188 + float detxy = ((sy) * (tx)) - ((ty) * (sx));30.189 + if( detxy == 0 ) {30.190 + result->z = input[2].z;30.191 + result->u = input[2].u;30.192 + result->v = input[2].v;30.193 + result->rgba = input[2].rgba;30.194 + result->offset_rgba = input[2].offset_rgba;30.195 + return;30.196 + }30.197 + float t = ((result->x - input[1].x) * sy -30.198 + (result->y - input[1].y) * sx) / detxy;30.199 + float s = ((result->y - input[1].y) * tx -30.200 + (result->x - input[1].x) * ty) / detxy;30.201 +30.202 + float sz = input[2].z - input[1].z;30.203 + float tz = input[0].z - input[1].z;30.204 + float su = input[2].u - input[1].u;30.205 + float tu = input[0].u - input[1].u;30.206 + float sv = input[2].v - input[1].v;30.207 + float tv = input[0].v - input[1].v;30.208 +30.209 + float rz = input[1].z + (t*tz) + (s*sz);30.210 + if( rz > pvr2_scene.bounds[5] ) {30.211 + pvr2_scene.bounds[5] = rz;30.212 + } else if( rz < pvr2_scene.bounds[4] ) {30.213 + pvr2_scene.bounds[4] = rz;30.214 + }30.215 + result->z = rz;30.216 + result->u = input[1].u + (t*tu) + (s*su);30.217 + result->v = input[1].v + (t*tv) + (s*sv);30.218 +30.219 + if( is_solid_shaded ) {30.220 + result->rgba = input[2].rgba;30.221 + result->offset_rgba = input[2].offset_rgba;30.222 + } else {30.223 + uint8_t *rgba0 = (uint8_t *)&input[0].rgba;30.224 + uint8_t *rgba1 = (uint8_t *)&input[1].rgba;30.225 + uint8_t *rgba2 = (uint8_t *)&input[2].rgba;30.226 + uint8_t *rgba3 = (uint8_t *)&result->rgba;30.227 + for( i=0; i<8; i++ ) { // note: depends on rgba & offset_rgba being adjacent30.228 + float tc = *rgba0++ - *rgba1;30.229 + float sc = *rgba2++ - *rgba1;30.230 + float rc = *rgba1++ + (t*tc) + (s*sc);30.231 + if( rc < 0 ) {30.232 + rc = 0;30.233 + } else if( rc > 255 ) {30.234 + rc = 255;30.235 + }30.236 + *rgba3++ = rc;30.237 + }30.238 + }30.239 +30.240 +}30.241 +30.242 +static void vertex_buffer_add_vertexes( pvraddr_t poly_idx, int vertex_length,30.243 + gboolean is_modified )30.244 +{30.245 + struct polygon_struct *poly = pvr2_scene.buf_to_poly_map[poly_idx];30.246 + uint32_t *ptr = &pvr2_scene.pvr2_pbuf[poly_idx];30.247 + uint32_t *context = ptr;30.248 + unsigned int i;30.249 +30.250 + assert( poly != NULL );30.251 + if( poly->vertex_index == -1 ) {30.252 + ptr += (is_modified ? 5 : 3 );30.253 + poly->vertex_index = pvr2_scene.vertex_index;30.254 + assert( pvr2_scene.vertex_index + poly->vertex_count <= pvr2_scene.vertex_count );30.255 + for( i=0; i<poly->vertex_count; i++ ) {30.256 + pvr2_decode_render_vertex( &pvr2_scene.vertex_array[pvr2_scene.vertex_index++], context[0], ptr, 0 );30.257 + ptr += vertex_length;30.258 + }30.259 + if( is_modified ) {30.260 + int mod_offset = (vertex_length - 3)>>1;30.261 + ptr = &pvr2_scene.pvr2_pbuf[poly_idx] + 5;30.262 + poly->mod_vertex_index = pvr2_scene.vertex_index;30.263 + for( i=0; i<poly->vertex_count; i++ ) {30.264 + pvr2_decode_render_vertex( &pvr2_scene.vertex_array[pvr2_scene.vertex_index++], context[0], ptr, mod_offset );30.265 + ptr += vertex_length;30.266 + }30.267 + }30.268 + }30.269 +}30.270 +30.271 +static void vertex_buffer_add_quad_vertexes( pvraddr_t poly_idx, int vertex_length,30.272 + gboolean is_modified )30.273 +{30.274 + struct polygon_struct *poly = pvr2_scene.buf_to_poly_map[poly_idx];30.275 + uint32_t *ptr = &pvr2_scene.pvr2_pbuf[poly_idx];30.276 + uint32_t *context = ptr;30.277 + unsigned int i;30.278 +30.279 + if( poly->vertex_index == -1 ) {30.280 + // Construct it locally and copy to the vertex buffer, as the VBO is30.281 + // allowed to be horribly slow for reads (ie it could be direct-mapped30.282 + // vram).30.283 + struct vertex_struct quad[4];30.284 +30.285 + assert( poly != NULL );30.286 + ptr += (is_modified ? 5 : 3 );30.287 + poly->vertex_index = pvr2_scene.vertex_index;30.288 + for( i=0; i<4; i++ ) {30.289 + pvr2_decode_render_vertex( &quad[i], context[0], ptr, 0 );30.290 + ptr += vertex_length;30.291 + }30.292 + vertex_buffer_compute_vertex( &quad[3], &quad[0], !POLY1_GOURAUD_SHADED(context[0]) );30.293 + memcpy( &pvr2_scene.vertex_array[pvr2_scene.vertex_index], quad, sizeof(quad) );30.294 + pvr2_scene.vertex_index += 4;30.295 +30.296 + if( is_modified ) {30.297 + int mod_offset = (vertex_length - 3)>>1;30.298 + ptr = &pvr2_scene.pvr2_pbuf[poly_idx] + 5;30.299 + poly->mod_vertex_index = pvr2_scene.vertex_index;30.300 + for( i=0; i<4; i++ ) {30.301 + pvr2_decode_render_vertex( &quad[4], context[0], ptr, mod_offset );30.302 + ptr += vertex_length;30.303 + }30.304 + vertex_buffer_compute_vertex( &quad[3], &quad[0], !POLY1_GOURAUD_SHADED(context[0]) );30.305 + memcpy( &pvr2_scene.vertex_array[pvr2_scene.vertex_index], quad, sizeof(quad) );30.306 + pvr2_scene.vertex_index += 4;30.307 + }30.308 + }30.309 +}30.310 +30.311 +static void vertex_buffer_extract_polygons( pvraddr_t tile_entry )30.312 +{30.313 + uint32_t *tile_list = (uint32_t *)(video_base+tile_entry);30.314 + do {30.315 + uint32_t entry = *tile_list++;30.316 + if( entry >> 28 == 0x0F ) {30.317 + break;30.318 + } else if( entry >> 28 == 0x0E ) {30.319 + tile_list = (uint32_t *)(video_base + (entry&0x007FFFFF));30.320 + } else {30.321 + pvraddr_t polyaddr = entry&0x000FFFFF;30.322 + int is_modified = (entry & 0x01000000) && pvr2_scene.full_shadow;30.323 + int vertex_length = (entry >> 21) & 0x07;30.324 + int context_length = 3;30.325 + if( is_modified ) {30.326 + context_length = 5;30.327 + vertex_length <<= 1 ;30.328 + }30.329 + vertex_length += 3;30.330 +30.331 + if( (entry & 0xE0000000) == 0x80000000 ) {30.332 + /* Triangle(s) */30.333 + int strip_count = ((entry >> 25) & 0x0F)+1;30.334 + int polygon_length = 3 * vertex_length + context_length;30.335 + int i;30.336 + struct polygon_struct *last_poly = NULL;30.337 + for( i=0; i<strip_count; i++ ) {30.338 + struct polygon_struct *poly = vertex_buffer_add_polygon( polyaddr, 3, is_modified );30.339 + polyaddr += polygon_length;30.340 + if( last_poly != NULL && last_poly->next == NULL ) {30.341 + last_poly->next = poly;30.342 + }30.343 + last_poly = poly;30.344 + }30.345 + } else if( (entry & 0xE0000000) == 0xA0000000 ) {30.346 + /* Sprite(s) */30.347 + int strip_count = ((entry >> 25) & 0x0F)+1;30.348 + int polygon_length = 4 * vertex_length + context_length;30.349 + int i;30.350 + struct polygon_struct *last_poly = NULL;30.351 + for( i=0; i<strip_count; i++ ) {30.352 + struct polygon_struct *poly = vertex_buffer_add_polygon( polyaddr, 4, is_modified );30.353 + polyaddr += polygon_length;30.354 + if( last_poly != NULL && last_poly->next == NULL ) {30.355 + last_poly->next = poly;30.356 + }30.357 + last_poly = poly;30.358 + }30.359 + } else {30.360 + /* Polygon */30.361 + int i, last = -1;30.362 + for( i=5; i>=0; i-- ) {30.363 + if( entry & (0x40000000>>i) ) {30.364 + last = i;30.365 + break;30.366 + }30.367 + }30.368 + if( last != -1 ) {30.369 + vertex_buffer_add_polygon( polyaddr, last+3, is_modified );30.370 + }30.371 + }30.372 + }30.373 + } while( 1 );30.374 +}30.375 +30.376 +static void vertex_buffer_extract_vertexes( pvraddr_t tile_entry )30.377 +{30.378 + uint32_t *tile_list = (uint32_t *)(video_base+tile_entry);30.379 + do {30.380 + uint32_t entry = *tile_list++;30.381 + if( entry >> 28 == 0x0F ) {30.382 + break;30.383 + } else if( entry >> 28 == 0x0E ) {30.384 + tile_list = (uint32_t *)(video_base + (entry&0x007FFFFF));30.385 + } else {30.386 + pvraddr_t polyaddr = entry&0x000FFFFF;30.387 + int is_modified = (entry & 0x01000000) && pvr2_scene.full_shadow;30.388 + int vertex_length = (entry >> 21) & 0x07;30.389 + int context_length = 3;30.390 + if( is_modified ) {30.391 + context_length = 5;30.392 + vertex_length <<=1 ;30.393 + }30.394 + vertex_length += 3;30.395 +30.396 + if( (entry & 0xE0000000) == 0x80000000 ) {30.397 + /* Triangle(s) */30.398 + int strip_count = ((entry >> 25) & 0x0F)+1;30.399 + int polygon_length = 3 * vertex_length + context_length;30.400 + int i;30.401 + for( i=0; i<strip_count; i++ ) {30.402 + vertex_buffer_add_vertexes( polyaddr, vertex_length, is_modified );30.403 + polyaddr += polygon_length;30.404 + }30.405 + } else if( (entry & 0xE0000000) == 0xA0000000 ) {30.406 + /* Sprite(s) */30.407 + int strip_count = ((entry >> 25) & 0x0F)+1;30.408 + int polygon_length = 4 * vertex_length + context_length;30.409 + int i;30.410 + for( i=0; i<strip_count; i++ ) {30.411 + vertex_buffer_add_quad_vertexes( polyaddr, vertex_length, is_modified );30.412 + polyaddr += polygon_length;30.413 + }30.414 + } else {30.415 + /* Polygon */30.416 + int i, last = -1;30.417 + for( i=5; i>=0; i-- ) {30.418 + if( entry & (0x40000000>>i) ) {30.419 + last = i;30.420 + break;30.421 + }30.422 + }30.423 + if( last != -1 ) {30.424 + vertex_buffer_add_vertexes( polyaddr, vertex_length, is_modified );30.425 + }30.426 + }30.427 + }30.428 + } while( 1 );30.429 +}30.430 +30.431 +/**30.432 + * Extract the current scene into the rendering structures. We run two passes30.433 + * - first pass extracts the polygons into pvr2_scene.poly_array (finding vertex counts),30.434 + * second pass extracts the vertex data into the VBO/vertex array.30.435 + *30.436 + * Difficult to do in single pass as we don't generally know the size of a30.437 + * polygon for certain until we've seen all tiles containing it. It also means we30.438 + * can count the vertexes and allocate the appropriate size VBO.30.439 + *30.440 + * FIXME: accesses into VRAM need to be bounds-checked properly30.441 + */30.442 +void pvr2_scene_read( void )30.443 +{30.444 + pvr2_scene_init();30.445 +30.446 + pvr2_scene.poly_count = 0;30.447 + pvr2_scene.vertex_count = 0;30.448 + pvr2_scene.bounds[0] = MMIO_READ( PVR2, RENDER_HCLIP ) & 0x03FF;30.449 + pvr2_scene.bounds[1] = ((MMIO_READ( PVR2, RENDER_HCLIP ) >> 16) & 0x03FF) + 1;30.450 + pvr2_scene.bounds[2] = MMIO_READ( PVR2, RENDER_VCLIP ) & 0x03FF;30.451 + pvr2_scene.bounds[3] = ((MMIO_READ( PVR2, RENDER_VCLIP ) >> 16) & 0x03FF) + 1;30.452 + pvr2_scene.bounds[4] = pvr2_scene.bounds[5] = MMIO_READF( PVR2, RENDER_FARCLIP );30.453 +30.454 + uint32_t *tilebuffer = (uint32_t *)(video_base + MMIO_READ( PVR2, RENDER_TILEBASE ));30.455 + uint32_t *segment = tilebuffer;30.456 + pvr2_scene.segment_list = (struct tile_segment *)tilebuffer;30.457 + pvr2_scene.pvr2_pbuf = (uint32_t *)(video_base + MMIO_READ(PVR2,RENDER_POLYBASE));30.458 + pvr2_scene.full_shadow = MMIO_READ( PVR2, RENDER_SHADOW ) & 0x100 ? FALSE : TRUE;30.459 +30.460 + int max_tile_x = 0;30.461 + int max_tile_y = 0;30.462 + int obj_config = MMIO_READ( PVR2, RENDER_OBJCFG );30.463 + int isp_config = MMIO_READ( PVR2, RENDER_ISPCFG );30.464 +30.465 + if( (obj_config & 0x00200000) == 0 ) {30.466 + if( isp_config & 1 ) {30.467 + pvr2_scene.sort_mode = SORT_NEVER;30.468 + } else {30.469 + pvr2_scene.sort_mode = SORT_ALWAYS;30.470 + }30.471 + } else {30.472 + pvr2_scene.sort_mode = SORT_BYFLAG;30.473 + }30.474 +30.475 + // Pass 1: Extract polygon list30.476 + uint32_t control;30.477 + int i;30.478 + do {30.479 + control = *segment++;30.480 + int tile_x = SEGMENT_X(control);30.481 + int tile_y = SEGMENT_Y(control);30.482 + if( tile_x > max_tile_x ) {30.483 + max_tile_x = tile_x;30.484 + }30.485 + if( tile_y > max_tile_y ) {30.486 + max_tile_y = tile_y;30.487 + }30.488 + for( i=0; i<5; i++ ) {30.489 + if( (*segment & NO_POINTER) == 0 ) {30.490 + vertex_buffer_extract_polygons( *segment );30.491 + }30.492 + segment++;30.493 + }30.494 + } while( (control & SEGMENT_END) == 0 );30.495 +30.496 + pvr2_scene.buffer_width = (max_tile_x+1)<<5;30.497 + pvr2_scene.buffer_height = (max_tile_y+1)<<5;30.498 +30.499 + if( pvr2_scene.vertex_count > 0 ) {30.500 + // Pass 2: Extract vertex data30.501 + vertex_buffer_map();30.502 + pvr2_scene.vertex_index = 0;30.503 + segment = tilebuffer;30.504 + do {30.505 + control = *segment++;30.506 + for( i=0; i<5; i++ ) {30.507 + if( (*segment & NO_POINTER) == 0 ) {30.508 + vertex_buffer_extract_vertexes( *segment );30.509 + }30.510 + segment++;30.511 + }30.512 + } while( (control & SEGMENT_END) == 0 );30.513 +30.514 + vertex_buffer_unmap();30.515 + }30.516 +}30.517 +30.518 +/**30.519 + * Render the data in the scene structure. The GL target should already be setup.30.520 + * Note: thar be GL code here.30.521 + */30.522 +void vertex_buffer_render()30.523 +{30.524 + /* Scene setup */30.525 +30.526 + glEnable( GL_SCISSOR_TEST );30.527 +30.528 + /* Scene render */30.529 + struct tile_segment *segment = pvr2_scene.segment_list;30.530 + do {30.531 +30.532 +30.533 + } while( !IS_LAST_SEGMENT(segment) );30.534 + glDisable( GL_SCISSOR_TEST );30.535 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000031.2 +++ b/src/pvr2/scene.h Thu Feb 14 13:54:11 2008 +000031.3 @@ -0,0 +1,137 @@31.4 +/**31.5 + * $Id: pvr2.h 602 2008-01-15 20:50:23Z nkeynes $31.6 + *31.7 + * PVR2 rendering functions (private)31.8 + *31.9 + * Copyright (c) 2005 Nathan Keynes.31.10 + *31.11 + * This program is free software; you can redistribute it and/or modify31.12 + * it under the terms of the GNU General Public License as published by31.13 + * the Free Software Foundation; either version 2 of the License, or31.14 + * (at your option) any later version.31.15 + *31.16 + * This program is distributed in the hope that it will be useful,31.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of31.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the31.19 + * GNU General Public License for more details.31.20 + */31.21 +31.22 +#ifndef lxdream_render_H31.23 +#define lxdream_render_H 131.24 +31.25 +/************************* Intermediate vertex buffer ************************/31.26 +31.27 +typedef enum {31.28 + SORT_NEVER = 0,31.29 + SORT_BYFLAG = 1, /* In this mode, sorting is controlled by the per-segment flag */31.30 + SORT_ALWAYS = 231.31 +} tile_sort_mode_t;31.32 +31.33 +struct vertex_struct {31.34 + float x,y,z;31.35 + float u,v;31.36 + uint32_t rgba;31.37 + uint32_t offset_rgba;31.38 +};31.39 +31.40 +struct polygon_struct {31.41 + uint32_t *context;31.42 + int cull; // culling mode31.43 + uint32_t vertex_count; // number of vertexes in polygon31.44 + int32_t vertex_index; // index of first vertex in vertex buffer31.45 + int32_t mod_vertex_index; // index of first modified vertex in vertex buffer31.46 + float center_z;31.47 + struct polygon_struct *next; // chain for tri/quad arrays31.48 +};31.49 +31.50 +void pvr2_scene_init(void);31.51 +void pvr2_scene_read(void);31.52 +void pvr2_scene_shutdown();31.53 +31.54 +extern char *video_base;31.55 +31.56 +/**31.57 + * Maximum possible size of the vertex buffer. This is figured as follows:31.58 + * PVR2 polygon buffer is limited to 4MB. The tightest polygon format31.59 + * is 3 vertexes in 48 bytes = 16 bytes/vertex, (shadow triangle)31.60 + * (the next tightest is 8 vertex in 140 bytes (6-strip colour-only)).31.61 + * giving a theoretical maximum of 262144 vertexes.31.62 + * The expanded structure is 44 bytes/vertex, giving31.63 + * 11534336 bytes...31.64 + */31.65 +#define MAX_VERTEXES 26214431.66 +#define MAX_VERTEX_BUFFER_SIZE (MAX_VERTEXES*sizeof(struct vertex_struct))31.67 +31.68 +/**31.69 + * Maximum polygons - smallest is 1 polygon in 48 bytes, giving31.70 + * 8738131.71 + *31.72 + */31.73 +#define MAX_POLYGONS 8738231.74 +#define MAX_POLY_BUFFER_SIZE (MAX_POLYGONS*sizeof(struct polygon_struct))31.75 +#define BUF_POLY_MAP_SIZE (4 MB)31.76 +31.77 +/*************************************************************************/31.78 +31.79 +/* Scene data - this structure holds all the intermediate data used during31.80 + * the rendering process.31.81 + *31.82 + * Special note: if vbo_supported == FALSE, then vertex_array points to a31.83 + * malloced chunk of system RAM. Otherwise, vertex_array will be either NULL31.84 + * (if the VBO is unmapped), or a pointer into a chunk of GL managed RAM31.85 + * (possibly direct-mapped VRAM).31.86 + */31.87 +struct pvr2_scene_struct {31.88 + /** GL ID of the VBO used by the scene (or 0 if VBOs are not in use). */31.89 + GLuint vbo_id;31.90 + /** Pointer to the vertex array data, or NULL for unmapped VBOs */31.91 + struct vertex_struct *vertex_array;31.92 + /** Current allocated size (in bytes) of the vertex array */31.93 + uint32_t vertex_array_size;31.94 + /** Total number of vertexes in the scene (note modified vertexes31.95 + * count for 2 vertexes */31.96 + uint32_t vertex_count;31.97 +31.98 + /** Pointer to the polygon data for the scene (main ram).31.99 + * This will always have room for at least MAX_POLYGONS */31.100 + struct polygon_struct *poly_array;31.101 + /** Total number of polygons in the scene */31.102 + uint32_t poly_count;31.103 +31.104 + /** Image bounds in 3D - x1,x2,y1,y2,z1,z231.105 + * x and y values are determined by the clip planes, while z values are31.106 + * determined from the vertex data itself.31.107 + */31.108 + float bounds[6];31.109 +31.110 + /* Total size of the image buffer, determined by the tile map used to31.111 + * render the scene */31.112 + uint32_t buffer_width, buffer_height;31.113 +31.114 + /** True if modifier volumes use the two-parameter form, False if they31.115 + * use the cheap-shadow option.31.116 + */31.117 + gboolean full_shadow;31.118 + /** Specifies the translucency auto-sort mode for the scene */31.119 + tile_sort_mode_t sort_mode;31.120 +31.121 + /** Pointer to the start of the tile segment list in PVR2 VRAM (32-bit) */31.122 + struct tile_segment *segment_list;31.123 + /** Map from PVR2 polygon address to an element of poly_array. Temporary,31.124 + * used only during poly buffer parsing */31.125 + struct polygon_struct **buf_to_poly_map;31.126 + /** Pointer to the start of the raw polygon buffer in PVR2 VRAM (32-bit).31.127 + * Also only used during parsing */31.128 + uint32_t *pvr2_pbuf;31.129 + /** Current vertex index during parsing */31.130 + uint32_t vertex_index;31.131 +};31.132 +31.133 +/**31.134 + * Current scene structure. Note this should only be written to by vertex bufer31.135 + * functions31.136 + */31.137 +extern struct pvr2_scene_struct pvr2_scene;31.138 +31.139 +31.140 +#endif /* !lxdream_render_H */
32.1 --- a/src/pvr2/texcache.c Thu Feb 07 02:04:40 2008 +000032.2 +++ b/src/pvr2/texcache.c Thu Feb 14 13:54:11 2008 +000032.3 @@ -67,6 +67,7 @@32.4 for( i=0; i<MAX_TEXTURES; i++ ) {32.5 texcache_free_list[i] = i;32.6 texcache_active_list[i].texture_addr = -1;32.7 + texcache_active_list[i].next = EMPTY_ENTRY;32.8 }32.9 texcache_free_ptr = 0;32.10 texcache_ref_counter = 0;32.11 @@ -99,6 +100,7 @@32.12 }32.13 for( i=0; i<MAX_TEXTURES; i++ ) {32.14 texcache_free_list[i] = i;32.15 + texcache_active_list[i].next = EMPTY_ENTRY;32.16 }32.17 texcache_free_ptr = 0;32.18 texcache_ref_counter = 0;32.19 @@ -526,6 +528,7 @@32.20 idx = entry->next;32.21 }32.23 +32.24 /* Not found - check the free list */32.25 texcache_entry_index slot = 0;32.27 @@ -561,6 +564,45 @@32.28 /* Construct the GL texture */32.29 glBindTexture( GL_TEXTURE_2D, texcache_active_list[slot].texture_id );32.30 texcache_load_texture( texture_addr, width, height, mode );32.31 -32.32 +32.33 + texcache_integrity_check();32.34 return texcache_active_list[slot].texture_id;32.35 }32.36 +32.37 +/**32.38 + * Check the integrity of the texcache. Verifies that every cache slot32.39 + * appears exactly once on either the free list or one page list. For32.40 + * active slots, the texture address must also match the page it appears on.32.41 + *32.42 + */32.43 +void texcache_integrity_check()32.44 +{32.45 + int i;32.46 + int slot_found[MAX_TEXTURES];32.47 +32.48 + memset( slot_found, 0, sizeof(slot_found) );32.49 +32.50 + /* Check entries on the free list */32.51 + for( i= texcache_free_ptr; i< MAX_TEXTURES; i++ ) {32.52 + int slot = texcache_free_list[i];32.53 + assert( slot_found[slot] == 0 );32.54 + assert( texcache_active_list[slot].next == EMPTY_ENTRY );32.55 + slot_found[slot] = 1;32.56 + }32.57 +32.58 + /* Check entries on the active lists */32.59 + for( i=0; i< PVR2_RAM_PAGES; i++ ) {32.60 + int slot = texcache_page_lookup[i];32.61 + while( slot != EMPTY_ENTRY ) {32.62 + assert( slot_found[slot] == 0 );32.63 + assert( (texcache_active_list[slot].texture_addr >> 12) == i );32.64 + slot_found[slot] = 2;32.65 + slot = texcache_active_list[slot].next;32.66 + }32.67 + }32.68 +32.69 + /* Make sure we didn't miss any entries */32.70 + for( i=0; i<MAX_TEXTURES; i++ ) {32.71 + assert( slot_found[i] != 0 );32.72 + }32.73 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000033.2 +++ b/src/pvr2/vertex.glsl Thu Feb 14 13:54:11 2008 +000033.3 @@ -0,0 +1,11 @@33.4 +// Standard PVR2 vertex shader33.5 +33.6 +void main()33.7 +{33.8 + gl_Position.xy = ftransform().xy;33.9 + gl_Position.z = gl_Vertex.z;33.10 + gl_Position.w = 1;33.11 + gl_FrontColor = gl_Color;33.12 + gl_FrontSecondaryColor = gl_SecondaryColor;33.13 + gl_TexCoord[0] = gl_MultiTexCoord0;33.14 +}
.