2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
26 * PentiumIII-SIMD (SSE) optimizations contributed by
27 * Andre Werthmann <wertmann@cs.uni-potsdam.de>
30 #include "main/glheader.h"
31 #include "main/context.h"
32 #include "math/m_xform.h"
33 #include "tnl/t_context.h"
36 #include "x86_xform.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 _mesa_sse_transform_normals_no_rot( NORM_ARGS
);
50 extern void _mesa_sse_transform_rescale_normals( NORM_ARGS
);
51 extern void _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS
);
53 extern void _mesa_sse_transform_points4_general( XFORM_ARGS
);
54 extern void _mesa_sse_transform_points4_3d( XFORM_ARGS
);
55 /* XXX this function segfaults, see below */
56 extern void _mesa_sse_transform_points4_identity( XFORM_ARGS
);
57 /* XXX this one works, see below */
58 extern void _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" );