revision 194:7fcecbcd5f01
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 194:7fcecbcd5f01 |
parent | 193:31151fcc3cb7 |
child | 195:1c43bdb83748 |
author | nkeynes |
date | Sat Aug 05 00:02:41 2006 +0000 (17 years ago) |
Add an input error event when terminating a list while there's an active
vertex list.
vertex list.
src/pvr2/tacore.c | view | annotate | diff | log |
1.1 --- a/src/pvr2/tacore.c Fri Aug 04 01:38:30 2006 +00001.2 +++ b/src/pvr2/tacore.c Sat Aug 05 00:02:41 2006 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: tacore.c,v 1.2 2006-08-04 01:38:27 nkeynes Exp $1.6 + * $Id: tacore.c,v 1.3 2006-08-05 00:02:41 nkeynes Exp $1.7 *1.8 * PVR2 Tile Accelerator implementation1.9 *1.10 @@ -20,9 +20,10 @@1.12 #define STATE_IDLE 01.13 #define STATE_IN_LIST 11.14 -#define STATE_EXPECT_POLY_BLOCK2 21.15 -#define STATE_EXPECT_VERTEX_BLOCK2 31.16 -#define STATE_ERROR 41.17 +#define STATE_IN_POLYGON 21.18 +#define STATE_EXPECT_POLY_BLOCK2 31.19 +#define STATE_EXPECT_VERTEX_BLOCK2 41.20 +#define STATE_ERROR 51.21 #define STATE_EXPECT_END_VERTEX_BLOCK2 71.23 #define TA_CMD(i) ( (i) >> 29 )1.24 @@ -77,6 +78,7 @@1.26 static int strip_lengths[4] = {3,4,6,8}; /* in vertexes */1.27 #define TA_POLYCMD_LISTTYPE(i) ( ((i) >> 24) & 0x0F )1.28 +#define TA_POLYCMD_USELENGTH(i) ( i & 0x00800000 )1.29 #define TA_POLYCMD_LENGTH(i) strip_lengths[((i >> 18) & 0x03)]1.30 #define TA_POLYCMD_CLIP(i) ((i>>16)&0x03)1.31 #define TA_POLYCMD_COLOURFMT(i) (i & 0x00000030)1.32 @@ -272,6 +274,10 @@1.33 static void ta_end_list() {1.34 if( ta_status.current_list_type != TA_LIST_NONE ) {1.35 asic_event( list_events[ta_status.current_list_type] );1.36 + if( ta_status.state == STATE_IN_POLYGON ) {1.37 + asic_event( EVENT_TA_ERROR );1.38 + asic_event( EVENT_PVR_BAD_INPUT );1.39 + }1.40 ta_status.current_list_type = TA_LIST_NONE;1.41 ta_status.current_vertex_type = -1;1.42 ta_status.state = STATE_IDLE;1.43 @@ -604,7 +610,9 @@1.44 */1.45 static void ta_parse_polygon_context( union ta_data *data ) {1.46 int colourfmt = TA_POLYCMD_COLOURFMT(data[0].i);1.47 - ta_status.max_vertex = TA_POLYCMD_LENGTH(data[0].i);1.48 + if( TA_POLYCMD_USELENGTH(data[0].i) ) {1.49 + ta_status.max_vertex = TA_POLYCMD_LENGTH(data[0].i);1.50 + }1.51 ta_status.vertex_count = 0;1.52 ta_status.poly_context[0] =1.53 (data[1].i & 0xFC1FFFFF) | ((data[0].i & 0x0B) << 22);1.54 @@ -935,7 +943,7 @@1.55 vertex->z = data[1].f;1.56 break;1.57 }1.58 - ta_status.state = STATE_IN_LIST;1.59 + ta_status.state = STATE_IN_POLYGON;1.60 }1.62 /**1.63 @@ -970,8 +978,10 @@1.64 ta_commit_polygon();1.65 ta_status.vertex_count = 0;1.66 ta_status.poly_parity = 0;1.67 -1.68 + ta_status.state = STATE_IN_LIST;1.69 + break;1.70 case STATE_IN_LIST:1.71 + case STATE_IN_POLYGON:1.72 case STATE_IDLE:1.73 switch( TA_CMD( data->i ) ) {1.74 case TA_CMD_END_LIST:1.75 @@ -1011,6 +1021,7 @@1.76 ta_parse_sprite_context(data);1.77 break;1.78 case TA_CMD_VERTEX:1.79 + ta_status.state = STATE_IN_POLYGON;1.80 ta_parse_vertex(data);1.82 if( ta_status.state == STATE_EXPECT_VERTEX_BLOCK2 ) {1.83 @@ -1021,6 +1032,7 @@1.84 ta_commit_polygon();1.85 ta_status.vertex_count = 0;1.86 ta_status.poly_parity = 0;1.87 + ta_status.state = STATE_IN_LIST;1.88 } else if( ta_status.vertex_count == ta_status.max_vertex ) {1.89 ta_split_polygon();1.90 }
.