Search
lxdream.org :: lxdream :: r199:4433d9c1638c
lxdream 0.9.1
released Jun 29
Download Now
changeset199:4433d9c1638c
parent198:627220aa0e3b
child200:c3bdcd373b6d
authornkeynes
dateSun Aug 06 03:50:36 2006 +0000 (13 years ago)
Handle NAN vertexes "correctly" (TA treats them as +/- INF)
src/pvr2/tacore.c
1.1 --- a/src/pvr2/tacore.c Sun Aug 06 03:36:51 2006 +0000
1.2 +++ b/src/pvr2/tacore.c Sun Aug 06 03:50:36 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: tacore.c,v 1.4 2006-08-06 03:36:51 nkeynes Exp $
1.6 + * $Id: tacore.c,v 1.5 2006-08-06 03:50:36 nkeynes Exp $
1.7 *
1.8 * PVR2 Tile Accelerator implementation
1.9 *
1.10 @@ -100,6 +100,12 @@
1.11
1.12 #define TA_IS_END_VERTEX(i) (i & 0x10000000)
1.13
1.14 +/** Note these are not the IEEE 754 definitions - the TA treats NANs
1.15 + * as if they were INFs of the appropriate sign.
1.16 + */
1.17 +#define TA_IS_INF(f) (((*((uint32_t *)&f)) & 0xFF800000) == 0x7F800000)
1.18 +#define TA_IS_NINF(f) (((*((uint32_t *)&f)) & 0xFF800000) == 0xFF800000)
1.19 +
1.20 #define MIN3( x1, x2, x3 ) ( (x1)<(x2)? ((x1)<(x3)?(x1):(x3)) : ((x2)<(x3)?(x2):(x3)) )
1.21 #define MAX3( x1, x2, x3 ) ( (x1)>(x2)? ((x1)>(x3)?(x1):(x3)) : ((x2)>(x3)?(x2):(x3)) )
1.22
1.23 @@ -457,16 +463,16 @@
1.24 * clamping here)
1.25 */
1.26 for( i=0; i<ta_status.vertex_count; i++ ) {
1.27 - if( ta_status.poly_vertex[i].x < 0.0 ) {
1.28 + if( ta_status.poly_vertex[i].x < 0.0 || TA_IS_NINF(ta_status.poly_vertex[i].x) ) {
1.29 tx[i] = -1;
1.30 - } else if( ta_status.poly_vertex[i].x > (float)INT_MAX ) {
1.31 + } else if( ta_status.poly_vertex[i].x > (float)INT_MAX || TA_IS_INF(ta_status.poly_vertex[i].x) ) {
1.32 tx[i] = INT_MAX/32;
1.33 } else {
1.34 tx[i] = (int)(ta_status.poly_vertex[i].x / 32.0);
1.35 }
1.36 - if( ta_status.poly_vertex[i].y < 0.0 ) {
1.37 + if( ta_status.poly_vertex[i].y < 0.0 || TA_IS_NINF(ta_status.poly_vertex[i].y)) {
1.38 ty[i] = -1;
1.39 - } else if( ta_status.poly_vertex[i].y > (float)INT_MAX ) {
1.40 + } else if( ta_status.poly_vertex[i].y > (float)INT_MAX || TA_IS_INF(ta_status.poly_vertex[i].y) ) {
1.41 ty[i] = INT_MAX/32;
1.42 } else {
1.43 ty[i] = (int)(ta_status.poly_vertex[i].y / 32.0);
.