diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2001-01-13 05:48:25 +0000 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2001-01-13 05:48:25 +0000 |
commit | 321f67c4729adeebd7aa9ef9e22c95e709952851 (patch) | |
tree | 8661da8a994f3c554c4428afdd53642c0814854b /src/mesa/x86 | |
parent | a087c7421bef25747e1d692f62062393d849c501 (diff) | |
download | external_mesa3d-321f67c4729adeebd7aa9ef9e22c95e709952851.zip external_mesa3d-321f67c4729adeebd7aa9ef9e22c95e709952851.tar.gz external_mesa3d-321f67c4729adeebd7aa9ef9e22c95e709952851.tar.bz2 |
Fix crash in book/stencil.
Allow drivers to perform the perspective divide themselves. Assembly
to do cliptesting without perspective divide for size-4 vectors.
Diffstat (limited to 'src/mesa/x86')
-rw-r--r-- | src/mesa/x86/x86.c | 10 | ||||
-rw-r--r-- | src/mesa/x86/x86_cliptest.S | 162 |
2 files changed, 170 insertions, 2 deletions
diff --git a/src/mesa/x86/x86.c b/src/mesa/x86/x86.c index fd8a224..b49965f 100644 --- a/src/mesa/x86/x86.c +++ b/src/mesa/x86/x86.c @@ -1,4 +1,4 @@ -/* $Id: x86.c,v 1.14 2000/12/27 19:57:37 keithw Exp $ */ +/* $Id: x86.c,v 1.15 2001/01/13 05:48:25 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -93,6 +93,13 @@ extern GLvector4f * _ASMAPI gl_x86_cliptest_points4( GLvector4f *clip_vec, GLubyte *andMask ); +extern GLvector4f * _ASMAPI gl_x86_cliptest_points4_np( GLvector4f *clip_vec, + GLvector4f *proj_vec, + GLubyte clipMask[], + GLubyte *orMask, + GLubyte *andMask ); + + extern void _ASMAPI gl_v16_x86_cliptest_points4( GLfloat *first_vert, GLfloat *last_vert, GLubyte *or_mask, @@ -121,6 +128,7 @@ void gl_init_x86_transform_asm( void ) /* XXX this function has been found to cause FP overflow exceptions */ gl_clip_tab[4] = gl_x86_cliptest_points4; + gl_clip_np_tab[4] = gl_x86_cliptest_points4_np; #ifdef DEBUG gl_test_all_transform_functions( "x86" ); diff --git a/src/mesa/x86/x86_cliptest.S b/src/mesa/x86/x86_cliptest.S index 0258a9b..8679bcb 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.3 2000/12/26 05:09:31 keithw Exp $ */ +/* $Id: x86_cliptest.S,v 1.4 2001/01/13 05:48:25 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -246,3 +246,163 @@ LLBL( ctp4_finish ): POP_L( ESI ) RET + + + + + + + +ALIGNTEXT16 +GLOBL GLNAME( gl_x86_cliptest_points4_np ) +GLNAME( gl_x86_cliptest_points4_np ): + +#ifdef ELFPIC +#define FRAME_OFFSET 20 +#else +#define FRAME_OFFSET 16 +#endif + PUSH_L( ESI ) + PUSH_L( EDI ) + PUSH_L( EBP ) + PUSH_L( EBX ) + +#ifdef ELFPIC + /* store pointer to clip_table on stack */ + CALL( LLBL( ctp4_np_get_eip ) ) + ADD_L( CONST(_GLOBAL_OFFSET_TABLE_), EBX ) + MOV_L( REGOFF(clip_table@GOT, EBX), EBX ) + PUSH_L( EBX ) + JMP( LLBL( ctp4_np_clip_table_ready ) ) + +LLBL( ctp4_np_get_eip ): + /* store eip in ebx */ + MOV_L( REGIND(ESP), EBX ) + RET + +LLBL( ctp4_np_clip_table_ready ): +#endif + + MOV_L( ARG_SOURCE, ESI ) + /* slot */ + + MOV_L( ARG_CLIP, EDX ) + MOV_L( ARG_OR, EBX ) + + MOV_L( ARG_AND, EBP ) + MOV_L( REGOFF(V4F_STRIDE, ESI), EAX ) + + MOV_L( REGOFF(V4F_COUNT, ESI), ECX ) + MOV_L( REGOFF(V4F_START, ESI), ESI ) + + MOV_L( EAX, ARG_DEST ) /* put stride in ARG_DEST */ + ADD_L( EDX, ECX ) + + MOV_L( ECX, EDI ) /* put clipmask + count in EDI */ + CMP_L( ECX, EDX ) + + MOV_B( REGIND(EBX), AL ) + MOV_B( REGIND(EBP), AH ) + + JZ( LLBL( ctp4_np_finish ) ) + +ALIGNTEXT16 +LLBL( ctp4_np_top ): + + MOV_L( SRC(3), EBP ) + MOV_L( SRC(2), EBX ) + + XOR_L( ECX, ECX ) + ADD_L( EBP, EBP ) /* ebp = abs(S(3))*2 ; carry = sign of S(3) */ + + ADC_L( ECX, ECX ) + ADD_L( EBX, EBX ) /* ebx = abs(S(2))*2 ; carry = sign of S(2) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(2))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC(1), EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(1))*2 ; carry = sign of S(1) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(1))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + MOV_L( SRC(0), EBX ) + + ADD_L( EBX, EBX ) /* ebx = abs(S(0))*2 ; carry = sign of S(0) */ + + ADC_L( ECX, ECX ) + CMP_L( EBX, EBP ) /* carry = abs(S(0))*2 > abs(S(3))*2 */ + + ADC_L( ECX, ECX ) + +#ifdef ELFPIC + MOV_L( REGIND(ESP), EBP ) /* clip_table */ + + MOV_B( REGBI(EBP, ECX), CL ) +#else + MOV_B( REGOFF(clip_table,ECX), CL ) +#endif + + OR_B( CL, AL ) + AND_B( CL, AH ) + + TEST_B( CL, CL ) + MOV_B( CL, REGIND(EDX) ) + + INC_L( EDX ) + /* slot */ + + ADD_L( ARG_DEST, ESI ) + CMP_L( EDX, EDI ) + + JNZ( LLBL( ctp4_np_top ) ) + + MOV_L( ARG_OR, ECX ) + MOV_L( ARG_AND, EDX ) + + MOV_B( AL, REGIND(ECX) ) + MOV_B( AH, REGIND(EDX) ) + +LLBL( ctp4_np_finish ): + + MOV_L( ARG_SOURCE, EAX ) +#ifdef ELFPIC + POP_L( ESI ) /* discard ptr to clip_table */ +#endif + POP_L( EBX ) + POP_L( EBP ) + POP_L( EDI ) + POP_L( ESI ) + + RET + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file |