Fix long-standing FP exception bug in _mesa_x86_cliptest_points4().
[mesa.git] / src / mesa / x86 / x86.c
1 /* $Id: x86.c,v 1.22 2001/05/13 18:55:15 gareth Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27 /*
28 * Intel x86 assembly code by Josh Vanderhoof
29 */
30
31 #include "glheader.h"
32 #include "context.h"
33 #include "math/m_vertices.h"
34 #include "math/m_xform.h"
35 #include "tnl/t_context.h"
36
37 #include "x86.h"
38 #include "common_x86_macros.h"
39
40 #ifdef DEBUG
41 #include "math/m_debug.h"
42 #endif
43
44
45 #ifdef USE_X86_ASM
46 DECLARE_XFORM_GROUP( x86, 2 )
47 DECLARE_XFORM_GROUP( x86, 3 )
48 DECLARE_XFORM_GROUP( x86, 4 )
49
50
51 extern GLvector4f * _ASMAPI
52 _mesa_x86_cliptest_points4( GLvector4f *clip_vec,
53 GLvector4f *proj_vec,
54 GLubyte clipMask[],
55 GLubyte *orMask,
56 GLubyte *andMask );
57
58 extern GLvector4f * _ASMAPI
59 _mesa_x86_cliptest_points4_np( GLvector4f *clip_vec,
60 GLvector4f *proj_vec,
61 GLubyte clipMask[],
62 GLubyte *orMask,
63 GLubyte *andMask );
64
65 extern void _ASMAPI
66 _mesa_v16_x86_cliptest_points4( GLfloat *first_vert,
67 GLfloat *last_vert,
68 GLubyte *or_mask,
69 GLubyte *and_mask,
70 GLubyte *clip_mask );
71
72 extern void _ASMAPI
73 _mesa_v16_x86_general_xform( GLfloat *dest,
74 const GLfloat *m,
75 const GLfloat *src,
76 GLuint src_stride,
77 GLuint count );
78 #endif
79
80
81 void _mesa_init_x86_transform_asm( void )
82 {
83 #ifdef USE_X86_ASM
84 ASSIGN_XFORM_GROUP( x86, 2 );
85 ASSIGN_XFORM_GROUP( x86, 3 );
86 ASSIGN_XFORM_GROUP( x86, 4 );
87
88 _mesa_clip_tab[4] = _mesa_x86_cliptest_points4;
89 _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np;
90
91 #ifdef DEBUG
92 _math_test_all_transform_functions( "x86" );
93 #endif
94 #endif
95 }
96
97 void _mesa_init_x86_vertex_asm( void )
98 {
99 #ifdef USE_X86_ASM
100 _mesa_xform_points3_v16_general = _mesa_v16_x86_general_xform;
101 _mesa_cliptest_points4_v16 = _mesa_v16_x86_cliptest_points4;
102
103 #ifdef DEBUG
104 _math_test_all_vertex_functions( "x86" );
105 #endif
106 #endif
107 }