Search
lxdream.org :: lxdream :: r1153:00e507e4025c
lxdream 0.9.1
released Jun 29
Download Now
changeset1153:00e507e4025c
parent1152:6464d890cc9e
child1154:5225c7c059ce
authornkeynes
dateThu Dec 23 18:14:29 2010 +1000 (8 years ago)
Revert changes from r1151 that went in by accident (not ready from
prime-time yet)
src/Makefile.am
src/Makefile.in
src/pvr2/glrender.c
src/pvr2/scene.h
src/pvr2/tileiter.h
src/pvr2/untile.c
src/tools/genglsl.c
test/pvr.c
1.1 --- a/src/Makefile.am Thu Dec 23 17:50:10 2010 +1000
1.2 +++ b/src/Makefile.am Thu Dec 23 18:14:29 2010 +1000
1.3 @@ -55,7 +55,7 @@
1.4 sh4/cache.c sh4/mmu.h sh4/shadow.c \
1.5 aica/armcore.c aica/armcore.h aica/armdasm.c aica/armdasm.h aica/armmem.c \
1.6 aica/aica.c aica/aica.h aica/audio.c aica/audio.h \
1.7 - pvr2/pvr2.c pvr2/pvr2.h pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/untile.c \
1.8 + pvr2/pvr2.c pvr2/pvr2.h pvr2/pvr2mem.c pvr2/pvr2mmio.h \
1.9 pvr2/tacore.c pvr2/rendsort.c pvr2/tileiter.h pvr2/shaders.glsl \
1.10 pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c pvr2/scene.h \
1.11 pvr2/gl_sl.c pvr2/shaders.h pvr2/shaders.def pvr2/glutil.c pvr2/glutil.h pvr2/glrender.c \
2.1 --- a/src/Makefile.in Thu Dec 23 17:50:10 2010 +1000
2.2 +++ b/src/Makefile.in Thu Dec 23 18:14:29 2010 +1000
2.3 @@ -155,18 +155,18 @@
2.4 sh4/cache.c sh4/mmu.h sh4/shadow.c aica/armcore.c \
2.5 aica/armcore.h aica/armdasm.c aica/armdasm.h aica/armmem.c \
2.6 aica/aica.c aica/aica.h aica/audio.c aica/audio.h pvr2/pvr2.c \
2.7 - pvr2/pvr2.h pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/untile.c \
2.8 - pvr2/tacore.c pvr2/rendsort.c pvr2/tileiter.h \
2.9 - pvr2/shaders.glsl pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c \
2.10 - pvr2/scene.c pvr2/scene.h pvr2/gl_sl.c pvr2/shaders.h \
2.11 - pvr2/shaders.def pvr2/glutil.c pvr2/glutil.h pvr2/glrender.c \
2.12 - maple/maple.c maple/maple.h maple/controller.c maple/kbd.c \
2.13 - maple/mouse.c maple/lightgun.c maple/vmu.c loader.c loader.h \
2.14 - elf.h bootstrap.c bootstrap.h util.c gdlist.c gdlist.h \
2.15 - vmu/vmuvol.c vmu/vmuvol.h vmu/vmulist.c vmu/vmulist.h \
2.16 - display.c display.h dckeysyms.h drivers/audio_null.c \
2.17 - drivers/video_null.c drivers/video_gl.c drivers/video_gl.h \
2.18 - drivers/gl_fbo.c drivers/serial_unix.c drivers/cdrom/cdrom.h \
2.19 + pvr2/pvr2.h pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c \
2.20 + pvr2/rendsort.c pvr2/tileiter.h pvr2/shaders.glsl \
2.21 + pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c \
2.22 + pvr2/scene.h pvr2/gl_sl.c pvr2/shaders.h pvr2/shaders.def \
2.23 + pvr2/glutil.c pvr2/glutil.h pvr2/glrender.c maple/maple.c \
2.24 + maple/maple.h maple/controller.c maple/kbd.c maple/mouse.c \
2.25 + maple/lightgun.c maple/vmu.c loader.c loader.h elf.h \
2.26 + bootstrap.c bootstrap.h util.c gdlist.c gdlist.h vmu/vmuvol.c \
2.27 + vmu/vmuvol.h vmu/vmulist.c vmu/vmulist.h display.c display.h \
2.28 + dckeysyms.h drivers/audio_null.c drivers/video_null.c \
2.29 + drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \
2.30 + drivers/serial_unix.c drivers/cdrom/cdrom.h \
2.31 drivers/cdrom/cdrom.c drivers/cdrom/drive.h \
2.32 drivers/cdrom/sector.h drivers/cdrom/sector.c \
2.33 drivers/cdrom/defs.h drivers/cdrom/cd_nrg.c \
2.34 @@ -263,32 +263,31 @@
2.35 lxdream-armdasm.$(OBJEXT) lxdream-armmem.$(OBJEXT) \
2.36 lxdream-aica.$(OBJEXT) lxdream-audio.$(OBJEXT) \
2.37 lxdream-pvr2.$(OBJEXT) lxdream-pvr2mem.$(OBJEXT) \
2.38 - lxdream-untile.$(OBJEXT) lxdream-tacore.$(OBJEXT) \
2.39 - lxdream-rendsort.$(OBJEXT) lxdream-texcache.$(OBJEXT) \
2.40 - lxdream-yuv.$(OBJEXT) lxdream-rendsave.$(OBJEXT) \
2.41 - lxdream-scene.$(OBJEXT) lxdream-gl_sl.$(OBJEXT) \
2.42 - lxdream-glutil.$(OBJEXT) lxdream-glrender.$(OBJEXT) \
2.43 - lxdream-maple.$(OBJEXT) lxdream-controller.$(OBJEXT) \
2.44 - lxdream-kbd.$(OBJEXT) lxdream-mouse.$(OBJEXT) \
2.45 - lxdream-lightgun.$(OBJEXT) lxdream-vmu.$(OBJEXT) \
2.46 - lxdream-loader.$(OBJEXT) lxdream-bootstrap.$(OBJEXT) \
2.47 - lxdream-util.$(OBJEXT) lxdream-gdlist.$(OBJEXT) \
2.48 - lxdream-vmuvol.$(OBJEXT) lxdream-vmulist.$(OBJEXT) \
2.49 - lxdream-display.$(OBJEXT) lxdream-audio_null.$(OBJEXT) \
2.50 - lxdream-video_null.$(OBJEXT) lxdream-video_gl.$(OBJEXT) \
2.51 - lxdream-gl_fbo.$(OBJEXT) lxdream-serial_unix.$(OBJEXT) \
2.52 - lxdream-cdrom.$(OBJEXT) lxdream-sector.$(OBJEXT) \
2.53 - lxdream-cd_nrg.$(OBJEXT) lxdream-cd_cdi.$(OBJEXT) \
2.54 - lxdream-cd_gdi.$(OBJEXT) lxdream-edc_ecc.$(OBJEXT) \
2.55 - lxdream-drive.$(OBJEXT) lxdream-cd_mmc.$(OBJEXT) \
2.56 - lxdream-isofs.$(OBJEXT) lxdream-isomem.$(OBJEXT) \
2.57 - lxdream-hotkeys.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
2.58 - $(am__objects_3) $(am__objects_4) $(am__objects_5) \
2.59 - $(am__objects_6) $(am__objects_7) $(am__objects_8) \
2.60 - $(am__objects_9) $(am__objects_10) $(am__objects_11) \
2.61 - $(am__objects_12) $(am__objects_13) $(am__objects_14) \
2.62 - $(am__objects_15) $(am__objects_16) $(am__objects_17) \
2.63 - $(am__objects_18)
2.64 + lxdream-tacore.$(OBJEXT) lxdream-rendsort.$(OBJEXT) \
2.65 + lxdream-texcache.$(OBJEXT) lxdream-yuv.$(OBJEXT) \
2.66 + lxdream-rendsave.$(OBJEXT) lxdream-scene.$(OBJEXT) \
2.67 + lxdream-gl_sl.$(OBJEXT) lxdream-glutil.$(OBJEXT) \
2.68 + lxdream-glrender.$(OBJEXT) lxdream-maple.$(OBJEXT) \
2.69 + lxdream-controller.$(OBJEXT) lxdream-kbd.$(OBJEXT) \
2.70 + lxdream-mouse.$(OBJEXT) lxdream-lightgun.$(OBJEXT) \
2.71 + lxdream-vmu.$(OBJEXT) lxdream-loader.$(OBJEXT) \
2.72 + lxdream-bootstrap.$(OBJEXT) lxdream-util.$(OBJEXT) \
2.73 + lxdream-gdlist.$(OBJEXT) lxdream-vmuvol.$(OBJEXT) \
2.74 + lxdream-vmulist.$(OBJEXT) lxdream-display.$(OBJEXT) \
2.75 + lxdream-audio_null.$(OBJEXT) lxdream-video_null.$(OBJEXT) \
2.76 + lxdream-video_gl.$(OBJEXT) lxdream-gl_fbo.$(OBJEXT) \
2.77 + lxdream-serial_unix.$(OBJEXT) lxdream-cdrom.$(OBJEXT) \
2.78 + lxdream-sector.$(OBJEXT) lxdream-cd_nrg.$(OBJEXT) \
2.79 + lxdream-cd_cdi.$(OBJEXT) lxdream-cd_gdi.$(OBJEXT) \
2.80 + lxdream-edc_ecc.$(OBJEXT) lxdream-drive.$(OBJEXT) \
2.81 + lxdream-cd_mmc.$(OBJEXT) lxdream-isofs.$(OBJEXT) \
2.82 + lxdream-isomem.$(OBJEXT) lxdream-hotkeys.$(OBJEXT) \
2.83 + $(am__objects_1) $(am__objects_2) $(am__objects_3) \
2.84 + $(am__objects_4) $(am__objects_5) $(am__objects_6) \
2.85 + $(am__objects_7) $(am__objects_8) $(am__objects_9) \
2.86 + $(am__objects_10) $(am__objects_11) $(am__objects_12) \
2.87 + $(am__objects_13) $(am__objects_14) $(am__objects_15) \
2.88 + $(am__objects_16) $(am__objects_17) $(am__objects_18)
2.89 lxdream_OBJECTS = $(am_lxdream_OBJECTS)
2.90 lxdream_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
2.91 $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
2.92 @@ -577,35 +576,35 @@
2.93 sh4/shadow.c aica/armcore.c aica/armcore.h aica/armdasm.c \
2.94 aica/armdasm.h aica/armmem.c aica/aica.c aica/aica.h \
2.95 aica/audio.c aica/audio.h pvr2/pvr2.c pvr2/pvr2.h \
2.96 - pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/untile.c pvr2/tacore.c \
2.97 - pvr2/rendsort.c pvr2/tileiter.h pvr2/shaders.glsl \
2.98 - pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c \
2.99 - pvr2/scene.h pvr2/gl_sl.c pvr2/shaders.h pvr2/shaders.def \
2.100 - pvr2/glutil.c pvr2/glutil.h pvr2/glrender.c maple/maple.c \
2.101 - maple/maple.h maple/controller.c maple/kbd.c maple/mouse.c \
2.102 - maple/lightgun.c maple/vmu.c loader.c loader.h elf.h \
2.103 - bootstrap.c bootstrap.h util.c gdlist.c gdlist.h vmu/vmuvol.c \
2.104 - vmu/vmuvol.h vmu/vmulist.c vmu/vmulist.h display.c display.h \
2.105 - dckeysyms.h drivers/audio_null.c drivers/video_null.c \
2.106 - drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \
2.107 - drivers/serial_unix.c drivers/cdrom/cdrom.h \
2.108 - drivers/cdrom/cdrom.c drivers/cdrom/drive.h \
2.109 - drivers/cdrom/sector.h drivers/cdrom/sector.c \
2.110 - drivers/cdrom/defs.h drivers/cdrom/cd_nrg.c \
2.111 - drivers/cdrom/cd_cdi.c drivers/cdrom/cd_gdi.c \
2.112 - drivers/cdrom/edc_ecc.c drivers/cdrom/ecc.h \
2.113 - drivers/cdrom/drive.c drivers/cdrom/edc_crctable.h \
2.114 - drivers/cdrom/edc_encoder.h drivers/cdrom/edc_l2sq.h \
2.115 - drivers/cdrom/edc_scramble.h drivers/cdrom/cd_mmc.c \
2.116 - drivers/cdrom/isofs.h drivers/cdrom/isofs.c \
2.117 - drivers/cdrom/isomem.c sh4/sh4.def sh4/sh4core.in \
2.118 - sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c \
2.119 - hotkeys.h $(am__append_1) $(am__append_2) $(am__append_4) \
2.120 - $(am__append_5) $(am__append_6) $(am__append_7) \
2.121 - $(am__append_8) $(am__append_9) $(am__append_10) \
2.122 - $(am__append_17) $(am__append_19) $(am__append_21) \
2.123 - $(am__append_23) $(am__append_25) $(am__append_27) \
2.124 - $(am__append_28) $(am__append_29) $(am__append_30)
2.125 + pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c \
2.126 + pvr2/tileiter.h pvr2/shaders.glsl pvr2/texcache.c pvr2/yuv.c \
2.127 + pvr2/rendsave.c pvr2/scene.c pvr2/scene.h pvr2/gl_sl.c \
2.128 + pvr2/shaders.h pvr2/shaders.def pvr2/glutil.c pvr2/glutil.h \
2.129 + pvr2/glrender.c maple/maple.c maple/maple.h maple/controller.c \
2.130 + maple/kbd.c maple/mouse.c maple/lightgun.c maple/vmu.c \
2.131 + loader.c loader.h elf.h bootstrap.c bootstrap.h util.c \
2.132 + gdlist.c gdlist.h vmu/vmuvol.c vmu/vmuvol.h vmu/vmulist.c \
2.133 + vmu/vmulist.h display.c display.h dckeysyms.h \
2.134 + drivers/audio_null.c drivers/video_null.c drivers/video_gl.c \
2.135 + drivers/video_gl.h drivers/gl_fbo.c drivers/serial_unix.c \
2.136 + drivers/cdrom/cdrom.h drivers/cdrom/cdrom.c \
2.137 + drivers/cdrom/drive.h drivers/cdrom/sector.h \
2.138 + drivers/cdrom/sector.c drivers/cdrom/defs.h \
2.139 + drivers/cdrom/cd_nrg.c drivers/cdrom/cd_cdi.c \
2.140 + drivers/cdrom/cd_gdi.c drivers/cdrom/edc_ecc.c \
2.141 + drivers/cdrom/ecc.h drivers/cdrom/drive.c \
2.142 + drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \
2.143 + drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h \
2.144 + drivers/cdrom/cd_mmc.c drivers/cdrom/isofs.h \
2.145 + drivers/cdrom/isofs.c drivers/cdrom/isomem.c sh4/sh4.def \
2.146 + sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in \
2.147 + hotkeys.c hotkeys.h $(am__append_1) $(am__append_2) \
2.148 + $(am__append_4) $(am__append_5) $(am__append_6) \
2.149 + $(am__append_7) $(am__append_8) $(am__append_9) \
2.150 + $(am__append_10) $(am__append_17) $(am__append_19) \
2.151 + $(am__append_21) $(am__append_23) $(am__append_25) \
2.152 + $(am__append_27) $(am__append_28) $(am__append_29) \
2.153 + $(am__append_30)
2.154 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@
2.155 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @LXDREAM_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@
2.156 @BUILD_SH4X86_TRUE@test_testsh4x86_CPPFLAGS = @LXDREAMCPPFLAGS@
2.157 @@ -879,7 +878,6 @@
2.158 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-tacore.Po@am__quote@
2.159 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-texcache.Po@am__quote@
2.160 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-timer.Po@am__quote@
2.161 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-untile.Po@am__quote@
2.162 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-util.Po@am__quote@
2.163 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-version.Po@am__quote@
2.164 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-video_gdk.Po@am__quote@
2.165 @@ -1570,20 +1568,6 @@
2.166 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.167 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-pvr2mem.obj `if test -f 'pvr2/pvr2mem.c'; then $(CYGPATH_W) 'pvr2/pvr2mem.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/pvr2mem.c'; fi`
2.168
2.169 -lxdream-untile.o: pvr2/untile.c
2.170 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-untile.o -MD -MP -MF "$(DEPDIR)/lxdream-untile.Tpo" -c -o lxdream-untile.o `test -f 'pvr2/untile.c' || echo '$(srcdir)/'`pvr2/untile.c; \
2.171 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-untile.Tpo" "$(DEPDIR)/lxdream-untile.Po"; else rm -f "$(DEPDIR)/lxdream-untile.Tpo"; exit 1; fi
2.172 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/untile.c' object='lxdream-untile.o' libtool=no @AMDEPBACKSLASH@
2.173 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.174 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-untile.o `test -f 'pvr2/untile.c' || echo '$(srcdir)/'`pvr2/untile.c
2.175 -
2.176 -lxdream-untile.obj: pvr2/untile.c
2.177 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-untile.obj -MD -MP -MF "$(DEPDIR)/lxdream-untile.Tpo" -c -o lxdream-untile.obj `if test -f 'pvr2/untile.c'; then $(CYGPATH_W) 'pvr2/untile.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/untile.c'; fi`; \
2.178 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-untile.Tpo" "$(DEPDIR)/lxdream-untile.Po"; else rm -f "$(DEPDIR)/lxdream-untile.Tpo"; exit 1; fi
2.179 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pvr2/untile.c' object='lxdream-untile.obj' libtool=no @AMDEPBACKSLASH@
2.180 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
2.181 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-untile.obj `if test -f 'pvr2/untile.c'; then $(CYGPATH_W) 'pvr2/untile.c'; else $(CYGPATH_W) '$(srcdir)/pvr2/untile.c'; fi`
2.182 -
2.183 lxdream-tacore.o: pvr2/tacore.c
2.184 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-tacore.o -MD -MP -MF "$(DEPDIR)/lxdream-tacore.Tpo" -c -o lxdream-tacore.o `test -f 'pvr2/tacore.c' || echo '$(srcdir)/'`pvr2/tacore.c; \
2.185 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-tacore.Tpo" "$(DEPDIR)/lxdream-tacore.Po"; else rm -f "$(DEPDIR)/lxdream-tacore.Tpo"; exit 1; fi
3.1 --- a/src/pvr2/glrender.c Thu Dec 23 17:50:10 2010 +1000
3.2 +++ b/src/pvr2/glrender.c Thu Dec 23 18:14:29 2010 +1000
3.3 @@ -222,7 +222,7 @@
3.4 } while( poly != NULL );
3.5 }
3.6
3.7 -void gl_render_poly( struct polygon_struct *poly, gboolean set_depth)
3.8 +static void gl_render_poly( struct polygon_struct *poly, gboolean set_depth)
3.9 {
3.10 if( poly->vertex_count == 0 )
3.11 return; /* Culled */
3.12 @@ -390,35 +390,6 @@
3.13 glDisable( GL_STENCIL_TEST );
3.14 }
3.15
3.16 -static void gl_render_stencil( )
3.17 -{
3.18 - struct tile_segment *segment = pvr2_scene.segment_list;
3.19 - if( display_driver->capabilities.stencil_bits >= 2 ) {
3.20 - glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
3.21 - do {
3.22 - int tilex = SEGMENT_X(segment->control);
3.23 - int tiley = SEGMENT_Y(segment->control);
3.24 -
3.25 - uint32_t tile_bounds[4] = { tilex << 5, (tilex+1)<<5, tiley<<5, (tiley+1)<<5 };
3.26 - if( !clip_tile_bounds(tile_bounds, pvr2_scene.bounds) ) {
3.27 - continue; // fully clipped, skip tile
3.28 - }
3.29 -
3.30 - /* Clip to the visible part of the tile */
3.31 - glScissor( tile_bounds[0], pvr2_scene.buffer_height-tile_bounds[3],
3.32 - tile_bounds[1]-tile_bounds[0], tile_bounds[3] - tile_bounds[2] );
3.33 - if( IS_TILE_PTR(segment->opaquemod_ptr) &&
3.34 - !IS_EMPTY_TILE_LIST(segment->opaquemod_ptr) ) {
3.35 - gl_render_tilelist_depthonly(segment->opaque_ptr);
3.36 - gl_render_modifier_tilelist(segment->opaquemod_ptr, tile_bounds);
3.37 - }
3.38 - } while( !IS_LAST_SEGMENT(segment++) );
3.39 - glClear( GL_DEPTH_BUFFER_BIT );
3.40 - glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
3.41 - }
3.42 -}
3.43 -
3.44 -
3.45 /**
3.46 * Render the currently defined scene in pvr2_scene
3.47 */
3.48 @@ -473,12 +444,6 @@
3.49 glEnable( GL_FOG );
3.50 glEnable( GL_TEXTURE_2D );
3.51
3.52 - gl_render_stencil();
3.53 -
3.54 - glDisable( GL_SCISSOR_TEST );
3.55 - untile_list(pvr2_scene.segment_list, 0, 0);
3.56 - glEnable( GL_SCISSOR_TEST );
3.57 -
3.58 /* Process the segment list */
3.59 struct tile_segment *segment = pvr2_scene.segment_list;
3.60 do {
3.61 @@ -493,6 +458,19 @@
3.62 /* Clip to the visible part of the tile */
3.63 glScissor( tile_bounds[0], pvr2_scene.buffer_height-tile_bounds[3],
3.64 tile_bounds[1]-tile_bounds[0], tile_bounds[3] - tile_bounds[2] );
3.65 + if( display_driver->capabilities.stencil_bits >= 2 &&
3.66 + IS_TILE_PTR(segment->opaquemod_ptr) &&
3.67 + !IS_EMPTY_TILE_LIST(segment->opaquemod_ptr) ) {
3.68 + /* Don't do this unless there's actually some shadow polygons */
3.69 +
3.70 + /* Use colormask instead of drawbuffer for simplicity */
3.71 + glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
3.72 + gl_render_tilelist_depthonly(segment->opaque_ptr);
3.73 + gl_render_modifier_tilelist(segment->opaquemod_ptr, tile_bounds);
3.74 + glClear( GL_DEPTH_BUFFER_BIT );
3.75 + glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
3.76 + }
3.77 + gl_render_tilelist(segment->opaque_ptr,TRUE);
3.78 if( IS_TILE_PTR(segment->punchout_ptr) ) {
3.79 glEnable(GL_ALPHA_TEST );
3.80 glDepthFunc(GL_GEQUAL);
4.1 --- a/src/pvr2/scene.h Thu Dec 23 17:50:10 2010 +1000
4.2 +++ b/src/pvr2/scene.h Thu Dec 23 18:14:29 2010 +1000
4.3 @@ -82,7 +82,6 @@
4.4 #define MAX_POLYGONS (87382*2)
4.5 #define MAX_POLY_BUFFER_SIZE (MAX_POLYGONS*sizeof(struct polygon_struct))
4.6 #define BUF_POLY_MAP_SIZE (4 MB)
4.7 -#define POLY_NO(poly) (poly - pvr2_scene.poly_array)
4.8
4.9 /*************************************************************************/
4.10
5.1 --- a/src/pvr2/tileiter.h Thu Dec 23 17:50:10 2010 +1000
5.2 +++ b/src/pvr2/tileiter.h Thu Dec 23 18:14:29 2010 +1000
5.3 @@ -84,36 +84,34 @@
5.4 for(;;){
5.5 uint32_t entry = *it->ptr;
5.6 uint32_t tag = entry >> 29;
5.7 - if( tag < 6 ) {
5.8 - if( tag & 0x04 ) {
5.9 - int vertex_count = tag-1; /* 4 == tri, 5 == quad */
5.10 - int vertex_length = (entry >> 21) & 0x07;
5.11 - if( (entry & 0x01000000) && (pvr2_scene.shadow_mode == SHADOW_FULL) ) {
5.12 - it->poly_size = 5 + (vertex_length<<1) * vertex_count;
5.13 - } else {
5.14 - it->poly_size = 3 + vertex_length * vertex_count;
5.15 - }
5.16 - it->strip_count = ((entry >> 25) & 0x0F);
5.17 - it->poly_addr = entry & 0x001FFFFF;
5.18 + if( tag == 0x07 ) {
5.19 + if( tag & 0x10000000 ) {
5.20 + it->ptr = NULL;
5.21 return;
5.22 } else {
5.23 - /* Other polygon */
5.24 - it->strip_count = 0;
5.25 - it->poly_addr = entry & 0x001FFFFF;
5.26 - return;
5.27 + it->ptr = (uint32_t *)(pvr2_main_ram + (entry&0x007FFFFF));
5.28 + it->poly_addr = -1;
5.29 + entry = *it->ptr;
5.30 }
5.31 + } else if( tag == 6 ) {
5.32 + /* Illegal? Skip */
5.33 + it->ptr++;
5.34 + } else if( tag & 0x04 ) {
5.35 + int vertex_count = tag-1; /* 4 == tri, 5 == quad */
5.36 + int vertex_length = (entry >> 21) & 0x07;
5.37 + if( (entry & 0x01000000) && (pvr2_scene.shadow_mode == SHADOW_FULL) ) {
5.38 + it->poly_size = 5 + (vertex_length<<1) * vertex_count;
5.39 + } else {
5.40 + it->poly_size = 3 + vertex_length * vertex_count;
5.41 + }
5.42 + it->strip_count = ((entry >> 25) & 0x0F);
5.43 + it->poly_addr = entry & 0x001FFFFF;
5.44 + return;
5.45 } else {
5.46 - if( tag == 0x07 ) {
5.47 - if( entry & 0x10000000 ) {
5.48 - it->ptr = NULL;
5.49 - return;
5.50 - } else {
5.51 - it->ptr = (uint32_t *)(pvr2_main_ram + (entry&0x007FFFFF));
5.52 - }
5.53 - } else if( tag == 6 ) {
5.54 - /* Illegal? Skip */
5.55 - it->ptr++;
5.56 - }
5.57 + /* Other polygon */
5.58 + it->strip_count = 0;
5.59 + it->poly_addr = entry & 0x001FFFFF;
5.60 + return;
5.61 }
5.62 }
5.63 }
6.1 --- a/src/pvr2/untile.c Thu Dec 23 17:50:10 2010 +1000
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,143 +0,0 @@
6.4 -/**
6.5 - * $Id$
6.6 - *
6.7 - * Process the tile + polygon data to extract a list of polygons that can
6.8 - * be rendered directly without tiling.
6.9 - *
6.10 - * Copyright (c) 2010 Nathan Keynes.
6.11 - *
6.12 - * This program is free software; you can redistribute it and/or modify
6.13 - * it under the terms of the GNU General Public License as published by
6.14 - * the Free Software Foundation; either version 2 of the License, or
6.15 - * (at your option) any later version.
6.16 - *
6.17 - * This program is distributed in the hope that it will be useful,
6.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
6.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.20 - * GNU General Public License for more details.
6.21 - */
6.22 -
6.23 -#include <stdlib.h>
6.24 -#include "pvr2/pvr2.h"
6.25 -#include "pvr2/scene.h"
6.26 -#include "pvr2/tileiter.h"
6.27 -
6.28 -static int sort_polydata( const void *a, const void *b )
6.29 -{
6.30 - uint32_t idxa = *(const uint32_t*)a;
6.31 - uint32_t idxb = *(const uint32_t*)b;
6.32 - return pvr2_scene.poly_array[idxa].context - pvr2_scene.poly_array[idxb].context;
6.33 -}
6.34 -
6.35 -gboolean untile_list( struct tile_segment *segment, int pass, int list )
6.36 -{
6.37 - int tile_width = pvr2_scene.buffer_width >> 5;
6.38 - int tile_height = pvr2_scene.buffer_height >> 5;
6.39 - tileiter tile_map[tile_width][tile_height];
6.40 -
6.41 - memset(tile_map, 0, tile_width*tile_height*sizeof(uint32_t *));
6.42 -
6.43 - /* 1. Construct the tile map for the last/pass */
6.44 - int last_x = -1, last_y = -1, tile_pass;
6.45 - do {
6.46 - int tile_x = SEGMENT_X(segment->control);
6.47 - int tile_y = SEGMENT_Y(segment->control);
6.48 - if( last_x == tile_x && last_y == tile_y ) {
6.49 - tile_pass++;
6.50 - } else {
6.51 - tile_pass = 0;
6.52 - last_x = tile_x;
6.53 - last_y = tile_y;
6.54 - }
6.55 -
6.56 - if( tile_pass == pass ) {
6.57 - uint32_t ptr = ((uint32_t *)segment)[list+1];
6.58 - if( IS_TILE_PTR(ptr) )
6.59 - TILEITER_BEGIN(tile_map[tile_x][tile_y], ptr);
6.60 - }
6.61 - } while( !IS_LAST_SEGMENT(segment++) );
6.62 -
6.63 - /* 2. Extract the polygon list, sorted by appearance. We assume the list
6.64 - * can be sorted by address, which makes this a lot simpler/faster.
6.65 - */
6.66 - uint32_t poly_present[pvr2_scene.poly_count];
6.67 - memset( poly_present, 0, sizeof(poly_present) );
6.68 - unsigned x,y, i, j, poly_count = 0;
6.69 - for( x = 0; x < tile_width; x++ ) {
6.70 - for( y = 0; y < tile_height; y++ ) {
6.71 - tileiter list = tile_map[x][y];
6.72 - while( !TILEITER_DONE(list) ) {
6.73 - struct polygon_struct *poly = pvr2_scene.buf_to_poly_map[TILEITER_POLYADDR(list)];
6.74 - if( poly ) {
6.75 - poly_present[POLY_NO(poly)] = 1;
6.76 - }
6.77 - TILEITER_NEXT(list);
6.78 - }
6.79 - }
6.80 - }
6.81 - /* Collapse array into a set of polygon indexes and then sort it */
6.82 - for( x=0; x<pvr2_scene.poly_count; x++ ) {
6.83 - if( poly_present[x] ) {
6.84 - poly_present[poly_count++] = x;
6.85 - }
6.86 - }
6.87 - qsort(poly_present, poly_count, sizeof(uint32_t), sort_polydata);
6.88 -
6.89 - /* 3. Process each polygon in the list. Extract the bounds, and check
6.90 - * each tile in which it should appear - if missing, the poly is clipped
6.91 - * (and we need to construct appropriate bounds).
6.92 - */
6.93 - for( i=0; i<poly_count; i++ ) {
6.94 - struct tile_bounds poly_bounds = {tile_width, tile_height, -1, -1};
6.95 - struct tile_bounds clip_bounds = {0, 0, tile_width, tile_height};
6.96 - struct polygon_struct *poly = &pvr2_scene.poly_array[poly_present[i]];
6.97 - uint32_t poly_addr = poly->context - ((uint32_t *)pvr2_main_ram);
6.98 - do {
6.99 - /* Extract tile bounds for the poly - we assume (since we have the
6.100 - * polygon at all) that it appears correctly in at least one tile.
6.101 - */
6.102 - struct vertex_struct *vert = &pvr2_scene.vertex_array[poly->vertex_index];
6.103 - for( j=0; j<poly->vertex_count; j++ ) {
6.104 - int tx, ty;
6.105 - if( vert[j].x < 0 ) tx = 0;
6.106 - else if( vert[j].x >= pvr2_scene.buffer_width ) tx = tile_width-1;
6.107 - else tx = ((int)vert[j].x)>>5;
6.108 - if( tx < poly_bounds.x1 ) poly_bounds.x1 = tx;
6.109 - if( tx > poly_bounds.x2 ) poly_bounds.x2 = tx;
6.110 - if( vert[j].y < 0 ) ty = 0;
6.111 - else if( vert[j].y >= pvr2_scene.buffer_height ) ty = tile_height-1;
6.112 - else ty = ((int)vert[j].y)>>5;
6.113 - if( ty < poly_bounds.y1 ) poly_bounds.y1 = ty;
6.114 - if( ty > poly_bounds.y2 ) poly_bounds.y2 = ty;
6.115 - }
6.116 - poly = poly->sub_next;
6.117 - } while( poly != NULL );
6.118 - if( poly_bounds.x1 == tile_width ) {
6.119 - continue; /* Polygon has been culled */
6.120 - }
6.121 -
6.122 - gl_render_poly(&pvr2_scene.poly_array[poly_present[i]], TRUE);
6.123 -#if 0
6.124 - /* Search the tile map for the polygon */
6.125 - for( x = poly_bounds.x1; x <= poly_bounds.x2; x++ ) {
6.126 - for( y = poly_bounds.y1; y <= poly_bounds.y2; y++ ) {
6.127 - tileiter *list = &tile_map[x][y];
6.128 -
6.129 -
6.130 - /* Skip over earlier entries in the list, if any (can happen if
6.131 - * we culled something, or had an empty polygon
6.132 - */
6.133 - while( !TILEITER_DONE(*list) && TILEITER_POLYADDR(*list) < poly_addr )
6.134 - TILEITER_NEXT(*list);
6.135 - if( TILEITER_POLYADDR(*list) == poly_addr ) {
6.136 - /* Match */
6.137 - } else {
6.138 - /* Clipped */
6.139 - }
6.140 - }
6.141 - }
6.142 -#endif
6.143 - }
6.144 -}
6.145 -
6.146 -
7.1 --- a/src/tools/genglsl.c Thu Dec 23 17:50:10 2010 +1000
7.2 +++ b/src/tools/genglsl.c Thu Dec 23 18:14:29 2010 +1000
7.3 @@ -37,16 +37,10 @@
7.4 FRAGMENT_SHADER = 1
7.5 } shader_type_t;
7.6
7.7 -typedef struct uniform {
7.8 - const char *name;
7.9 - const char *var_name;
7.10 -} *uniform_t;
7.11 -
7.12 typedef struct shader {
7.13 shader_type_t type;
7.14 const char *name;
7.15 char *body;
7.16 - GList *uniforms;
7.17 } *shader_t;
7.18
7.19 typedef struct program {
7.20 @@ -92,7 +86,6 @@
7.21 shader->name = strdup(g_strstrip(buf+8));
7.22 shader->body = malloc(DEF_ALLOC_SIZE);
7.23 shader->body[0] = '\0';
7.24 - shader->uniforms = 0;
7.25 current_size = DEF_ALLOC_SIZE;
7.26 current_posn = 0;
7.27 result->shaders = g_list_append(result->shaders, shader);
7.28 @@ -103,14 +96,12 @@
7.29 shader->name = strdup(g_strstrip(buf+10));
7.30 shader->body = malloc(DEF_ALLOC_SIZE);
7.31 shader->body[0] = '\0';
7.32 - shader->uniforms = 0;
7.33 current_size = DEF_ALLOC_SIZE;
7.34 current_posn = 0;
7.35 result->shaders = g_list_append(result->shaders, shader);
7.36 } else if( strncmp( buf, "#program ", 9 ) == 0 ) {
7.37 shader = NULL;
7.38 program_t program = malloc(sizeof(struct program));
7.39 - assert( program != NULL );
7.40 char *rest = buf+9;
7.41 char *equals = strchr(rest, '=');
7.42 if( equals == NULL ) {
7.43 @@ -124,23 +115,6 @@
7.44 for(i=0;program->shader_names[i] != NULL; i++ );
7.45 if( i > result->max_shaders )
7.46 result->max_shaders = i;
7.47 - } else if( strncmp( buf, "#uniform ", 9 ) == 0 ) {
7.48 - uniform_t uniform = malloc(sizeof(struct uniform));
7.49 - assert( uniform != NULL );
7.50 - if( shader == NULL ) {
7.51 - fprintf( stderr, "Error: #uniform specified outside of shader: %s\n", buf );
7.52 - exit(2);
7.53 - }
7.54 - char *rest = buf+9;
7.55 - char *equals = strchr(rest, '=');
7.56 - if( equals == NULL ) {
7.57 - fprintf( stderr, "Error: invalid program line %s\n", buf );
7.58 - exit(2);
7.59 - }
7.60 - *equals = '\0';
7.61 - uniform->name = g_strdup(g_strstrip(rest));
7.62 - uniform->var_name = g_strdup(g_strstrip(equals+1));
7.63 - shader->uniforms = g_list_append(shader->uniforms, uniform);
7.64 } else if( shader != NULL ) {
7.65 size_t len = strlen(buf);
7.66 if( current_posn + len > current_size ) {
7.67 @@ -175,17 +149,6 @@
7.68 }
7.69 }
7.70
7.71 -static uniform_t find_uniform_name( GList *list, const char *name )
7.72 -{
7.73 - GList *ptr;
7.74 - for( ptr = list; ptr != NULL; ptr = ptr->next ) {
7.75 - uniform_t data = (uniform_t)list->data;
7.76 - if( strcmp( data->name, name ) == 0 )
7.77 - return data;
7.78 - }
7.79 - return NULL;
7.80 -}
7.81 -
7.82 static void writeHeader( FILE *out, glsldata_t data )
7.83 {
7.84 fprintf( out, "/*\n * This file automatically generated by genglsl from %s\n */\n", data->filename );
7.85 @@ -205,22 +168,12 @@
7.86 fprintf( f, "typedef enum {\n" );
7.87 const char *last_name = NULL;
7.88 int count = 0;
7.89 - GList *unique_uniforms;
7.90 - int uniform_count = 0;
7.91 GList *shader_ptr;
7.92 for( shader_ptr = data->shaders; shader_ptr != NULL; shader_ptr = shader_ptr->next ) {
7.93 count++;
7.94 shader_t shader = (shader_t)shader_ptr->data;
7.95 fprintf( f, " %s,\n", shader->name );
7.96 last_name = shader->name;
7.97 - GList *uniform_ptr;
7.98 - for( uniform_ptr = shader->uniforms; uniform_ptr != NULL; uniform_ptr = uniform_ptr->next ) {
7.99 - uniform_t uniform = (uniform_t)uniform_ptr->data;
7.100 - if( find_uniform_name(unique_uniforms, uniform->name) == NULL ) {
7.101 - unique_uniforms = g_list_append( unique_uniforms, uniform );
7.102 - uniform_count++;
7.103 - }
7.104 - }
7.105 }
7.106 fprintf( f, "} shader_id;\n\n" );
7.107
7.108 @@ -231,7 +184,6 @@
7.109 fprintf( f, "#define GLSL_NO_SHADER -1\n\n" );
7.110 fprintf( f, "#define GLSL_VERTEX_SHADER 1\n" );
7.111 fprintf( f, "#define GLSL_FRAGMENT_SHADER 2\n" );
7.112 - fprintf( f, "#define GLSL_NUM_UNIFORMS %d\n", uniform_count );
7.113
7.114 fprintf( f, "typedef enum {\n" );
7.115 last_name = NULL;
8.1 --- a/test/pvr.c Thu Dec 23 17:50:10 2010 +1000
8.2 +++ b/test/pvr.c Thu Dec 23 18:14:29 2010 +1000
8.3 @@ -42,7 +42,6 @@
8.4 #define RENDER_ADDR2 (PVR_BASE+0x064)
8.5 #define RENDER_HCLIP (PVR_BASE+0x068)
8.6 #define RENDER_VCLIP (PVR_BASE+0x06C)
8.7 -#define RENDER_SHADOW (PVR_BASE+0x074)
8.8 #define RENDER_NEARCLIP (PVR_BASE+0x078)
8.9 #define RENDER_FARCLIP (PVR_BASE+0x088)
8.10 #define RENDER_BGPLANE (PVR_BASE+0x08C)
8.11 @@ -253,7 +252,6 @@
8.12 long_write( RENDER_POLYBASE, config->polybuf );
8.13 long_write( RENDER_TILEBASE, config->tilemap );
8.14 long_write( RENDER_ADDR1, config->render_addr );
8.15 - long_write( RENDER_SHADOW, 0x140 );
8.16 long_write( RENDER_SIZE, modulo >> 3 );
8.17 long_write( RENDER_ADDR2, config->render_addr + modulo ); /* Not used? */
8.18 long_write( RENDER_HCLIP, (config->width - 1) << 16 );
.