Search
lxdream.org :: lxdream/src/pvr2/ta.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/ta.c
changeset 103:9b9cfc5855e0
prev100:995e42e96cc9
next108:565de331ccec
author nkeynes
date Mon Mar 13 12:39:07 2006 +0000 (16 years ago)
permissions -rw-r--r--
last change More rendering work in progress. Almost there now...
file annotate diff log raw
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.3 @@ -1,5 +1,5 @@
1.4 /**
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.7 *
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.10 @@ -42,27 +42,48 @@
1.11 float f;
1.12 };
1.13
1.14 +struct pvr2_ta_status {
1.15 + uint32_t *length;
1.16 + unsigned int last_poly_type;
1.17 +} pvr2_ta_status = {NULL,0};
1.18 +
1.19 /**
1.20 * (Re)initialize the tile accelerator in preparation for the next scene.
1.21 * Normally called immediately before commencing polygon transmission.
1.22 */
1.23 void pvr2_ta_init( void )
1.24 {
1.25 -
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.31 }
1.32
1.33 -char pvr2ta_remainder[8];
1.34 -unsigned int pvr2_last_poly_type = 0;
1.35 -
1.36 /**
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.40 + *
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.44 */
1.45 void pvr2_ta_write( char *buf, uint32_t length )
1.46 {
1.47 int i;
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.52 + obj_addr += 4;
1.53 + *pvr2_ta_status.length = length;
1.54 + } else {
1.55 + *pvr2_ta_status.length = *pvr2_ta_status.length + length;
1.56 + }
1.57 + mem_copy_to_sh4( PVR2_RAM_BASE + obj_addr, buf, length );
1.58 + MMIO_WRITE( PVR2, TAOBJPOS, obj_addr + length );
1.59 +
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.63 @@ -74,7 +95,7 @@
1.64 }
1.65 if( type == 0 ) {
1.66 /* End of list */
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.71 break;
1.72 @@ -91,9 +112,9 @@
1.73 asic_event( EVENT_PVR_PUNCHOUT_DONE );
1.74 break;
1.75 }
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;
1.81 }
1.82 }
1.83 }
.