-/* $Id: sse.c,v 1.1 2001/03/29 06:46:16 gareth Exp $ */
-
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 6.0
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
#include "glheader.h"
#include "context.h"
-#include "mtypes.h"
-#include "sse.h"
-
-#include "math/m_vertices.h"
#include "math/m_xform.h"
-
#include "tnl/t_context.h"
+#include "sse.h"
+#include "common_x86_macros.h"
+
#ifdef DEBUG
#include "math/m_debug.h"
#endif
-#define XFORM_ARGS GLvector4f *to_vec, \
- const GLfloat m[16], \
- const GLvector4f *from_vec, \
- const GLubyte *mask, \
- const GLubyte flag
-
-
-#define DECLARE_XFORM_GROUP( pfx, sz ) \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_general( XFORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_identity( XFORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d_no_rot( XFORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_perspective( XFORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d( XFORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_2d_no_rot( XFORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_points##sz##_3d( XFORM_ARGS );
-
-
-#define ASSIGN_XFORM_GROUP( pfx, sz ) \
- _mesa_transform_tab[0][sz][MATRIX_GENERAL] = \
- _mesa_##pfx##_transform_points##sz##_general; \
- _mesa_transform_tab[0][sz][MATRIX_IDENTITY] = \
- _mesa_##pfx##_transform_points##sz##_identity; \
- _mesa_transform_tab[0][sz][MATRIX_3D_NO_ROT] = \
- _mesa_##pfx##_transform_points##sz##_3d_no_rot; \
- _mesa_transform_tab[0][sz][MATRIX_PERSPECTIVE] = \
- _mesa_##pfx##_transform_points##sz##_perspective; \
- _mesa_transform_tab[0][sz][MATRIX_2D] = \
- _mesa_##pfx##_transform_points##sz##_2d; \
- _mesa_transform_tab[0][sz][MATRIX_2D_NO_ROT] = \
- _mesa_##pfx##_transform_points##sz##_2d_no_rot; \
- _mesa_transform_tab[0][sz][MATRIX_3D] = \
- _mesa_##pfx##_transform_points##sz##_3d;
-
-
-
-#define NORM_ARGS const GLmatrix *mat, \
- GLfloat scale, \
- const GLvector3f *in, \
- const GLfloat *lengths, \
- const GLubyte mask[], \
- GLvector3f *dest
-
-
-#define DECLARE_NORM_GROUP( pfx ) \
-extern void _ASMAPI _mesa_##pfx##_rescale_normals( NORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_normalize_normals( NORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_normals( NORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_normals_no_rot( NORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals( NORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_rescale_normals_no_rot( NORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals( NORM_ARGS ); \
-extern void _ASMAPI _mesa_##pfx##_transform_normalize_normals_no_rot( NORM_ARGS );
-
-
-#define ASSIGN_NORM_GROUP( pfx ) \
- _mesa_normal_tab[NORM_RESCALE][0] = \
- _mesa_##pfx##_rescale_normals; \
- _mesa_normal_tab[NORM_NORMALIZE][0] = \
- _mesa_##pfx##_normalize_normals; \
- _mesa_normal_tab[NORM_TRANSFORM][0] = \
- _mesa_##pfx##_transform_normals; \
- _mesa_normal_tab[NORM_TRANSFORM_NO_ROT][0] = \
- _mesa_##pfx##_transform_normals_no_rot; \
- _mesa_normal_tab[NORM_TRANSFORM|NORM_RESCALE][0] = \
- _mesa_##pfx##_transform_rescale_normals; \
- _mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_RESCALE][0] = \
- _mesa_##pfx##_transform_rescale_normals_no_rot; \
- _mesa_normal_tab[NORM_TRANSFORM|NORM_NORMALIZE][0] = \
- _mesa_##pfx##_transform_normalize_normals; \
- _mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_NORMALIZE][0] = \
- _mesa_##pfx##_transform_normalize_normals_no_rot;
-
-
#ifdef USE_SSE_ASM
DECLARE_XFORM_GROUP( sse, 2 )
DECLARE_XFORM_GROUP( sse, 3 )
#if 1
/* Some functions are not written in SSE-assembly, because the fpu ones are faster */
-extern void _mesa_sse_transform_normals_no_rot( NORM_ARGS );
-extern void _mesa_sse_transform_rescale_normals( NORM_ARGS );
-extern void _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS );
-
-extern void _mesa_sse_transform_points4_general( XFORM_ARGS );
-extern void _mesa_sse_transform_points4_3d( XFORM_ARGS );
-extern void _mesa_sse_transform_points4_identity( XFORM_ARGS );
+extern void _ASMAPI _mesa_sse_transform_normals_no_rot( NORM_ARGS );
+extern void _ASMAPI _mesa_sse_transform_rescale_normals( NORM_ARGS );
+extern void _ASMAPI _mesa_sse_transform_rescale_normals_no_rot( NORM_ARGS );
+
+extern void _ASMAPI _mesa_sse_transform_points4_general( XFORM_ARGS );
+extern void _ASMAPI _mesa_sse_transform_points4_3d( XFORM_ARGS );
+/* XXX this function segfaults, see below */
+extern void _ASMAPI _mesa_sse_transform_points4_identity( XFORM_ARGS );
+/* XXX this one works, see below */
+extern void _ASMAPI _mesa_x86_transform_points4_identity( XFORM_ARGS );
#else
DECLARE_NORM_GROUP( sse )
#endif
#if 1
/* TODO: Finish these off.
*/
- _mesa_normal_tab[NORM_TRANSFORM_NO_ROT][0] =
+ _mesa_transform_tab[4][MATRIX_GENERAL] =
+ _mesa_sse_transform_points4_general;
+ _mesa_transform_tab[4][MATRIX_3D] =
+ _mesa_sse_transform_points4_3d;
+ /* XXX NOTE: _mesa_sse_transform_points4_identity segfaults with the
+ conformance tests, so use the x86 version.
+ */
+ _mesa_transform_tab[4][MATRIX_IDENTITY] =
+ _mesa_x86_transform_points4_identity;/*_mesa_sse_transform_points4_identity;*/
+
+ _mesa_normal_tab[NORM_TRANSFORM_NO_ROT] =
_mesa_sse_transform_normals_no_rot;
- _mesa_normal_tab[NORM_TRANSFORM|NORM_RESCALE][0] =
+ _mesa_normal_tab[NORM_TRANSFORM | NORM_RESCALE] =
_mesa_sse_transform_rescale_normals;
- _mesa_normal_tab[NORM_TRANSFORM_NO_ROT|NORM_RESCALE][0] =
+ _mesa_normal_tab[NORM_TRANSFORM_NO_ROT | NORM_RESCALE] =
_mesa_sse_transform_rescale_normals_no_rot;
-
- _mesa_transform_tab[0][4][MATRIX_GENERAL] =
- _mesa_sse_transform_points4_general;
- _mesa_transform_tab[0][4][MATRIX_3D] =
- _mesa_sse_transform_points4_3d;
- _mesa_transform_tab[0][4][MATRIX_IDENTITY] =
- _mesa_sse_transform_points4_identity;
#else
+ ASSIGN_XFORM_GROUP( sse, 4 );
+
ASSIGN_NORM_GROUP( sse );
#endif
#endif
}
-void _mesa_init_sse_vertex_asm( void )
-{
-#ifdef USE_SSE_ASM
- _mesa_xform_points3_v16_general = _mesa_v16_sse_general_xform;
-#if 0
- /* GH: These are broken. I'm fixing them now.
- */
- _mesa_project_v16 = _mesa_sse_project_vertices;
- _mesa_project_clipped_v16 = _mesa_sse_project_clipped_vertices;
-#endif
-
-#ifdef DEBUG_NOT
- _math_test_all_vertex_functions( "SSE" );
-#endif
-#endif
-}