From: Gareth Hughes Date: Sun, 13 May 2001 18:55:15 +0000 (+0000) Subject: Fix long-standing FP exception bug in _mesa_x86_cliptest_points4(). X-Git-Tag: 062012170305~27147 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53e4ebd4e36c0ae462d71c87cda3533f9d001324;p=profile%2Fivi%2Fmesa.git Fix long-standing FP exception bug in _mesa_x86_cliptest_points4(). --- diff --git a/src/mesa/x86/x86.c b/src/mesa/x86/x86.c index ddcfe86..b2b442c 100644 --- a/src/mesa/x86/x86.c +++ b/src/mesa/x86/x86.c @@ -1,4 +1,4 @@ -/* $Id: x86.c,v 1.21 2001/03/30 14:44:43 gareth Exp $ */ +/* $Id: x86.c,v 1.22 2001/05/13 18:55:15 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -85,7 +85,6 @@ void _mesa_init_x86_transform_asm( void ) ASSIGN_XFORM_GROUP( x86, 3 ); ASSIGN_XFORM_GROUP( x86, 4 ); - /* XXX this function has been found to cause FP overflow exceptions */ _mesa_clip_tab[4] = _mesa_x86_cliptest_points4; _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np; diff --git a/src/mesa/x86/x86_cliptest.S b/src/mesa/x86/x86_cliptest.S index f228274..76f34d5 100644 --- a/src/mesa/x86/x86_cliptest.S +++ b/src/mesa/x86/x86_cliptest.S @@ -1,4 +1,4 @@ -/* $Id: x86_cliptest.S,v 1.6 2001/03/28 20:44:44 gareth Exp $ */ +/* $Id: x86_cliptest.S,v 1.7 2001/05/13 18:55:15 gareth Exp $ */ /* * Mesa 3-D graphics library @@ -149,7 +149,12 @@ LLBL( ctp4_clip_table_ready ): ALIGNTEXT16 LLBL( ctp4_top ): - FLD1 /* F3 */ + MOV_L( SRC(3), ECX ) + FLD1 /* F3 */ + + TEST_L( ECX, ECX ) /* GH: If src[3] is zero, abort */ + JZ( LLBL( ctp4_noproj ) ) + FDIV_S( SRC(3) ) MOV_L( SRC(3), EBP ) @@ -198,7 +203,15 @@ LLBL( ctp4_top ): JZ( LLBL( ctp4_proj ) ) - FSTP( ST(0) ) /* */ +LLBL( ctp4_noproj ): + + FLDZ /* F0 F3 */ + + FST_S( DST(0) ) /* F0 F3 */ + FST_S( DST(1) ) /* F0 F3 */ + FSTP_S( DST(2) ) /* F3 */ + FSTP_S( DST(3) ) /* */ + JMP( LLBL( ctp4_next ) ) LLBL( ctp4_proj ):