2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * PentiumIII-SIMD (SSE) optimizations contributed by
27 * Andre Werthmann <wertmann@cs.uni-potsdam.de>
32 #include "math/m_xform.h"
33 #include "tnl/t_context.h"
36 #include "common_x86_macros.h"
39 #include "math/m_debug.h"
44 DECLARE_XFORM_GROUP( sse
, 2 )
45 DECLARE_XFORM_GROUP( sse
, 3 )
48 /* Some functions are not written in SSE-assembly, because the fpu ones are faster */
49 extern void _ASMAPI
_mesa_sse_transform_normals_no_rot( NORM_ARGS
);
50 extern void _ASMAPI
_mesa_sse_transform_rescale_normals( NORM_ARGS
);
51 extern void _ASMAPI
_mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS
);
53 extern void _ASMAPI
_mesa_sse_transform_points4_general( XFORM_ARGS
);
54 extern void _ASMAPI
_mesa_sse_transform_points4_3d( XFORM_ARGS
);
55 /* XXX this function segfaults, see below */
56 extern void _ASMAPI
_mesa_sse_transform_points4_identity( XFORM_ARGS
);
57 /* XXX this one works, see below */
58 extern void _ASMAPI
_mesa_x86_transform_points4_identity( XFORM_ARGS
);
60 DECLARE_NORM_GROUP( sse
)
65 _mesa_v16_sse_general_xform( GLfloat
*first_vert
,
72 _mesa_sse_project_vertices( GLfloat
*first
,
78 _mesa_sse_project_clipped_vertices( GLfloat
*first
,
82 const GLubyte
*clipmask
);
86 void _mesa_init_sse_transform_asm( void )
89 ASSIGN_XFORM_GROUP( sse
, 2 );
90 ASSIGN_XFORM_GROUP( sse
, 3 );
93 /* TODO: Finish these off.
95 _mesa_transform_tab
[4][MATRIX_GENERAL
] =
96 _mesa_sse_transform_points4_general
;
97 _mesa_transform_tab
[4][MATRIX_3D
] =
98 _mesa_sse_transform_points4_3d
;
99 /* XXX NOTE: _mesa_sse_transform_points4_identity segfaults with the
100 conformance tests, so use the x86 version.
102 _mesa_transform_tab
[4][MATRIX_IDENTITY
] =
103 _mesa_x86_transform_points4_identity
;/*_mesa_sse_transform_points4_identity;*/
105 _mesa_normal_tab
[NORM_TRANSFORM_NO_ROT
] =
106 _mesa_sse_transform_normals_no_rot
;
107 _mesa_normal_tab
[NORM_TRANSFORM
| NORM_RESCALE
] =
108 _mesa_sse_transform_rescale_normals
;
109 _mesa_normal_tab
[NORM_TRANSFORM_NO_ROT
| NORM_RESCALE
] =
110 _mesa_sse_transform_rescale_normals_no_rot
;
112 ASSIGN_XFORM_GROUP( sse
, 4 );
114 ASSIGN_NORM_GROUP( sse
);
118 _math_test_all_transform_functions( "SSE" );
119 _math_test_all_normal_transform_functions( "SSE" );