1 /* $Id: x86.c,v 1.19 2001/03/28 20:44:44 gareth Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
28 * Intel x86 assembly code by Josh Vanderhoof
36 #include "math/m_vertices.h"
37 #include "math/m_xform.h"
39 #include "tnl/t_context.h"
42 #include "math/m_debug.h"
46 #define XFORM_ARGS GLvector4f *to_vec, \
47 const GLfloat m[16], \
48 const GLvector4f *from_vec, \
49 const GLubyte *mask, \
53 #define DECLARE_XFORM_GROUP( pfx, sz, masked ) \
54 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general_##masked( XFORM_ARGS ); \
55 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity_##masked( XFORM_ARGS ); \
56 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked( XFORM_ARGS ); \
57 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective_##masked( XFORM_ARGS ); \
58 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_##masked( XFORM_ARGS ); \
59 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot_##masked( XFORM_ARGS ); \
60 extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_##masked( XFORM_ARGS );
63 #define ASSIGN_XFORM_GROUP( pfx, cma, sz, masked ) \
64 _mesa_transform_tab[cma][sz][MATRIX_GENERAL] = \
65 _mesa_##pfx##_transform_points##sz##_general_##masked; \
66 _mesa_transform_tab[cma][sz][MATRIX_IDENTITY] = \
67 _mesa_##pfx##_transform_points##sz##_identity_##masked; \
68 _mesa_transform_tab[cma][sz][MATRIX_3D_NO_ROT] = \
69 _mesa_##pfx##_transform_points##sz##_3d_no_rot_##masked; \
70 _mesa_transform_tab[cma][sz][MATRIX_PERSPECTIVE] = \
71 _mesa_##pfx##_transform_points##sz##_perspective_##masked; \
72 _mesa_transform_tab[cma][sz][MATRIX_2D] = \
73 _mesa_##pfx##_transform_points##sz##_2d_##masked; \
74 _mesa_transform_tab[cma][sz][MATRIX_2D_NO_ROT] = \
75 _mesa_##pfx##_transform_points##sz##_2d_no_rot_##masked; \
76 _mesa_transform_tab[cma][sz][MATRIX_3D] = \
77 _mesa_##pfx##_transform_points##sz##_3d_##masked;
81 DECLARE_XFORM_GROUP( x86
, 2, raw
)
82 DECLARE_XFORM_GROUP( x86
, 3, raw
)
83 DECLARE_XFORM_GROUP( x86
, 4, raw
)
84 DECLARE_XFORM_GROUP( x86
, 2, masked
)
85 DECLARE_XFORM_GROUP( x86
, 3, masked
)
86 DECLARE_XFORM_GROUP( x86
, 4, masked
)
89 extern GLvector4f
* _ASMAPI
90 _mesa_x86_cliptest_points4( GLvector4f
*clip_vec
,
96 extern GLvector4f
* _ASMAPI
97 _mesa_x86_cliptest_points4_np( GLvector4f
*clip_vec
,
104 _mesa_v16_x86_cliptest_points4( GLfloat
*first_vert
,
108 GLubyte
*clip_mask
);
111 _mesa_v16_x86_general_xform( GLfloat
*dest
,
119 void _mesa_init_x86_transform_asm( void )
122 ASSIGN_XFORM_GROUP( x86
, 0, 2, raw
);
123 ASSIGN_XFORM_GROUP( x86
, 0, 3, raw
);
124 ASSIGN_XFORM_GROUP( x86
, 0, 4, raw
);
126 /* ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 2, masked ); */
127 /* ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 3, masked ); */
128 /* ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 4, masked ); */
130 /* XXX this function has been found to cause FP overflow exceptions */
131 _mesa_clip_tab
[4] = _mesa_x86_cliptest_points4
;
132 _mesa_clip_np_tab
[4] = _mesa_x86_cliptest_points4_np
;
135 _math_test_all_transform_functions( "x86" );
140 void _mesa_init_x86_vertex_asm( void )
143 _mesa_xform_points3_v16_general
= _mesa_v16_x86_general_xform
;
144 _mesa_cliptest_points4_v16
= _mesa_v16_x86_cliptest_points4
;
147 _math_test_all_vertex_functions( "x86" );