revision 206:f5de539c0fcb
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 206:f5de539c0fcb |
parent | 205:d30b6109b382 |
child | 207:135a2dc75b10 |
author | nkeynes |
date | Sun Aug 06 07:47:26 2006 +0000 (16 years ago) |
Add more bad_input calls
Start adding the no-list handling (not finished)
Start adding the no-list handling (not finished)
![]() | src/pvr2/tacore.c | view | annotate | diff | log |
1.1 --- a/src/pvr2/tacore.c Sun Aug 06 07:45:11 2006 +00001.2 +++ b/src/pvr2/tacore.c Sun Aug 06 07:47:26 2006 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: tacore.c,v 1.7 2006-08-06 06:13:51 nkeynes Exp $1.6 + * $Id: tacore.c,v 1.8 2006-08-06 07:47:26 nkeynes Exp $1.7 *1.8 * PVR2 Tile Accelerator implementation1.9 *1.10 @@ -73,6 +73,7 @@1.11 #define TA_VERTEX_SPRITE 0x801.12 #define TA_VERTEX_TEX_SPRITE 0x881.13 #define TA_VERTEX_MOD_VOLUME 0x811.14 +#define TA_VERTEX_LISTLESS 0xFF1.16 #define TA_IS_NORMAL_POLY() (ta_status.current_vertex_type < TA_VERTEX_SPRITE)1.18 @@ -194,6 +195,9 @@1.19 ta_status.poly_parity = 0;1.20 ta_status.vertex_count = 0;1.21 ta_status.max_vertex = 3;1.22 + ta_status.current_vertex_type = TA_VERTEX_LISTLESS;1.23 + ta_status.poly_vertex_size = 0;1.24 + memset(&ta_status.poly_context[1], 0, 4);1.25 ta_status.last_triangle_bounds.x1 = -1;1.26 ta_status.accept_vertexes = TRUE;1.27 ta_status.clip.x1 = 0;1.28 @@ -312,14 +316,17 @@1.29 static void ta_end_list() {1.30 if( ta_status.current_list_type != TA_LIST_NONE ) {1.31 asic_event( list_events[ta_status.current_list_type] );1.32 - if( ta_status.state == STATE_IN_POLYGON ) {1.33 - asic_event( EVENT_TA_ERROR );1.34 - asic_event( EVENT_PVR_BAD_INPUT );1.35 - }1.36 - ta_status.current_list_type = TA_LIST_NONE;1.37 - ta_status.current_vertex_type = -1;1.38 - ta_status.state = STATE_IDLE;1.39 }1.40 + ta_status.current_list_type = TA_LIST_NONE;1.41 + ta_status.current_vertex_type = TA_VERTEX_LISTLESS;1.42 + ta_status.poly_vertex_size = 0;1.43 + memset(&ta_status.poly_context[1], 0, 4);1.44 + ta_status.state = STATE_IDLE;1.45 +}1.46 +1.47 +static void ta_bad_input_error() {1.48 + asic_event( EVENT_TA_ERROR );1.49 + asic_event( EVENT_PVR_BAD_INPUT );1.50 }1.52 /**1.53 @@ -488,9 +495,6 @@1.54 struct tile_bounds polygon_bound;1.55 uint32_t poly_context[5];1.57 - if( ta_status.vertex_count < 2 ) {1.58 - return; /* No polygons - ignore */1.59 - }1.60 memcpy( poly_context, ta_status.poly_context, ta_status.poly_context_size * 4 );1.62 /* Compute the tile coordinates for each vertex (need to be careful with1.63 @@ -748,6 +752,10 @@1.64 static void ta_parse_modifier_context( union ta_data *data ) {1.65 ta_status.current_vertex_type = TA_VERTEX_MOD_VOLUME;1.66 ta_status.poly_vertex_size = 0;1.67 + ta_status.clip_mode = TA_POLYCMD_CLIP(data[0].i);1.68 + if( ta_status.clip_mode == 1 ) { /* Reserved - treat as CLIP_INSIDE */1.69 + ta_status.clip_mode = TA_POLYCMD_CLIP_INSIDE;1.70 + }1.71 ta_status.poly_context_size = 3;1.72 ta_status.poly_context[0] = (data[1].i & 0xFC1FFFFF) |1.73 ((data[0].i & 0x0B)<<22);1.74 @@ -910,6 +918,7 @@1.75 case TA_VERTEX_SPRITE:1.76 case TA_VERTEX_TEX_SPRITE:1.77 case TA_VERTEX_MOD_VOLUME:1.78 + case TA_VERTEX_LISTLESS:1.79 vertex++;1.80 vertex->x = data[4].f;1.81 vertex->y = data[5].f;1.82 @@ -1010,6 +1019,7 @@1.83 ta_status.poly_vertex[2].detail[0] = data[7].i;1.84 break;1.85 case TA_VERTEX_MOD_VOLUME:1.86 + case TA_VERTEX_LISTLESS:1.87 vertex->y = data[0].f;1.88 vertex->z = data[1].f;1.89 break;1.90 @@ -1025,7 +1035,7 @@1.92 switch( ta_status.state ) {1.93 case STATE_ERROR:1.94 - /* Error raised - stop processing until reset */1.95 + /* Fatal error raised - stop processing until reset */1.96 return;1.98 case STATE_EXPECT_POLY_BLOCK2:1.99 @@ -1046,7 +1056,11 @@1.101 case STATE_EXPECT_END_VERTEX_BLOCK2:1.102 ta_parse_vertex_block2( data );1.103 - ta_commit_polygon();1.104 + if( ta_status.vertex_count < 3 ) {1.105 + ta_bad_input_error();1.106 + } else {1.107 + ta_commit_polygon();1.108 + }1.109 ta_status.vertex_count = 0;1.110 ta_status.poly_parity = 0;1.111 ta_status.state = STATE_IN_LIST;1.112 @@ -1056,12 +1070,18 @@1.113 case STATE_IDLE:1.114 switch( TA_CMD( data->i ) ) {1.115 case TA_CMD_END_LIST:1.116 - ta_end_list();1.117 + if( ta_status.state == STATE_IN_POLYGON ) {1.118 + ta_bad_input_error();1.119 + ta_end_list();1.120 + ta_status.state = STATE_ERROR; /* Abort further processing */1.121 + } else {1.122 + ta_end_list();1.123 + }1.124 break;1.125 case TA_CMD_CLIP:1.126 if( ta_status.state == STATE_IN_POLYGON ) {1.127 - asic_event( EVENT_PVR_BAD_INPUT );1.128 - asic_event( EVENT_TA_ERROR );1.129 + ta_bad_input_error();1.130 + ta_status.accept_vertexes = FALSE;1.131 /* Enter stuffed up mode */1.132 }1.133 ta_status.clip.x1 = data[4].i & 0x3F;1.134 @@ -1080,10 +1100,8 @@1.136 if( ta_status.vertex_count != 0 ) {1.137 /* Error, and not a very well handled one either */1.138 - asic_event( EVENT_PVR_BAD_INPUT );1.139 - asic_event( EVENT_TA_ERROR );1.140 + ta_bad_input_error();1.141 ta_status.accept_vertexes = FALSE;1.142 - ta_fill_vertexes();1.143 } else {1.144 if( TA_IS_MODIFIER_LIST( ta_status.current_list_type ) ) {1.145 ta_parse_modifier_context(data);1.146 @@ -1113,7 +1131,11 @@1.147 ta_status.state = STATE_EXPECT_END_VERTEX_BLOCK2;1.148 }1.149 } else if( TA_IS_END_VERTEX(data->i) ) {1.150 - ta_commit_polygon();1.151 + if( ta_status.vertex_count < 3 ) {1.152 + ta_bad_input_error();1.153 + } else {1.154 + ta_commit_polygon();1.155 + }1.156 ta_status.vertex_count = 0;1.157 ta_status.poly_parity = 0;1.158 ta_status.state = STATE_IN_LIST;1.159 @@ -1121,6 +1143,10 @@1.160 ta_split_polygon();1.161 }1.162 break;1.163 + default:1.164 + if( ta_status.state == STATE_IN_POLYGON ) {1.165 + ta_bad_input_error();1.166 + }1.167 }1.168 break;1.169 }
.