1.1 --- a/src/pvr2/ta.c Wed Feb 15 13:11:50 2006 +0000
1.2 +++ b/src/pvr2/ta.c Mon Mar 13 12:39:07 2006 +0000
1.5 - * $Id: ta.c,v 1.1 2006-02-15 13:11:46 nkeynes Exp $
1.6 + * $Id: ta.c,v 1.2 2006-03-13 12:39:07 nkeynes Exp $
1.8 * PVR2 Tile Accelerator support. In principle this does a lot more work
1.9 * than is currently implemented - we cheat. A lot.
1.14 +struct pvr2_ta_status {
1.16 + unsigned int last_poly_type;
1.17 +} pvr2_ta_status = {NULL,0};
1.20 * (Re)initialize the tile accelerator in preparation for the next scene.
1.21 * Normally called immediately before commencing polygon transmission.
1.23 void pvr2_ta_init( void )
1.26 + /* Set the buffer indexes */
1.27 + MMIO_WRITE( PVR2, TAOBJPOS, MMIO_READ( PVR2, TAOBJBASE ) );
1.28 + MMIO_WRITE( PVR2, TAOBJPPOS, MMIO_READ( PVR2, TAOBJPBASE ) );
1.29 + pvr2_ta_status.last_poly_type = 0;
1.30 + pvr2_ta_status.length = NULL;
1.33 -char pvr2ta_remainder[8];
1.34 -unsigned int pvr2_last_poly_type = 0;
1.37 * Write a block of data to the tile accelerator, adding the data to the
1.38 * current scene. We don't make any particular attempt to interpret the data
1.39 * at this stage, deferring that until render time.
1.41 + * Currently copies the data verbatim to the vertex buffer, processing only
1.42 + * far enough to generate the correct end-of-list events. Tile buffer is
1.43 + * entirely ignored.
1.45 void pvr2_ta_write( char *buf, uint32_t length )
1.48 struct tacmd *cmd_list = (struct tacmd *)buf;
1.49 + uint32_t obj_addr = MMIO_READ( PVR2, TAOBJPOS );
1.50 + if( pvr2_ta_status.length == NULL ) { /* Start */
1.51 + pvr2_ta_status.length = (uint32_t *)mem_get_region( PVR2_RAM_BASE + obj_addr );
1.53 + *pvr2_ta_status.length = length;
1.55 + *pvr2_ta_status.length = *pvr2_ta_status.length + length;
1.57 + mem_copy_to_sh4( PVR2_RAM_BASE + obj_addr, buf, length );
1.58 + MMIO_WRITE( PVR2, TAOBJPOS, obj_addr + length );
1.60 int count = length >> 5;
1.61 for( i=0; i<count; i++ ){
1.62 unsigned int type = (cmd_list[i].command >> 24) & 0xFF;
1.67 - switch( pvr2_last_poly_type ) {
1.68 + switch( pvr2_ta_status.last_poly_type ) {
1.69 case 0x80: /* Opaque polys */
1.70 asic_event( EVENT_PVR_OPAQUE_DONE );
1.73 asic_event( EVENT_PVR_PUNCHOUT_DONE );
1.76 - pvr2_last_poly_type = 0;
1.77 + pvr2_ta_status.last_poly_type = 0;
1.78 } else if( type >= 0x80 && type <= 0x84 ) {
1.79 - pvr2_last_poly_type = type;
1.80 + pvr2_ta_status.last_poly_type = type;