14a49301eSmrg
24a49301eSmrg/*
34a49301eSmrg * Mesa 3-D graphics library
44a49301eSmrg *
54a49301eSmrg * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
64a49301eSmrg *
74a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
84a49301eSmrg * copy of this software and associated documentation files (the "Software"),
94a49301eSmrg * to deal in the Software without restriction, including without limitation
104a49301eSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
114a49301eSmrg * and/or sell copies of the Software, and to permit persons to whom the
124a49301eSmrg * Software is furnished to do so, subject to the following conditions:
134a49301eSmrg *
144a49301eSmrg * The above copyright notice and this permission notice shall be included
154a49301eSmrg * in all copies or substantial portions of the Software.
164a49301eSmrg *
174a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
184a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
194a49301eSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
244a49301eSmrg */
254a49301eSmrg
264a49301eSmrg/*
274a49301eSmrg * Intel x86 assembly code by Josh Vanderhoof
284a49301eSmrg */
294a49301eSmrg
304a49301eSmrg#include "main/glheader.h"
314a49301eSmrg#include "main/context.h"
324a49301eSmrg#include "math/m_xform.h"
334a49301eSmrg
344a49301eSmrg#include "x86_xform.h"
354a49301eSmrg#include "common_x86_asm.h"
364a49301eSmrg
374a49301eSmrg#ifdef USE_X86_ASM
384a49301eSmrg#ifdef USE_3DNOW_ASM
394a49301eSmrg#include "3dnow.h"
404a49301eSmrg#endif
414a49301eSmrg#ifdef USE_SSE_ASM
424a49301eSmrg#include "sse.h"
434a49301eSmrg#endif
444a49301eSmrg#endif
454a49301eSmrg
464a49301eSmrg#ifdef DEBUG_MATH
474a49301eSmrg#include "math/m_debug.h"
484a49301eSmrg#endif
494a49301eSmrg
504a49301eSmrg
514a49301eSmrg#ifdef USE_X86_ASM
524a49301eSmrgDECLARE_XFORM_GROUP( x86, 2 )
534a49301eSmrgDECLARE_XFORM_GROUP( x86, 3 )
544a49301eSmrgDECLARE_XFORM_GROUP( x86, 4 )
554a49301eSmrg
564a49301eSmrg
5701e04c3fSmrgextern GLvector4f *
584a49301eSmrg_mesa_x86_cliptest_points4( GLvector4f *clip_vec,
594a49301eSmrg			    GLvector4f *proj_vec,
604a49301eSmrg			    GLubyte clipMask[],
614a49301eSmrg			    GLubyte *orMask,
624a49301eSmrg			    GLubyte *andMask,
634a49301eSmrg			    GLboolean viewport_z_clip );
644a49301eSmrg
6501e04c3fSmrgextern GLvector4f *
664a49301eSmrg_mesa_x86_cliptest_points4_np( GLvector4f *clip_vec,
674a49301eSmrg			       GLvector4f *proj_vec,
684a49301eSmrg			       GLubyte clipMask[],
694a49301eSmrg			       GLubyte *orMask,
704a49301eSmrg			       GLubyte *andMask,
714a49301eSmrg			       GLboolean viewport_z_clip );
724a49301eSmrg
7301e04c3fSmrgextern void
744a49301eSmrg_mesa_v16_x86_cliptest_points4( GLfloat *first_vert,
754a49301eSmrg				GLfloat *last_vert,
764a49301eSmrg				GLubyte *or_mask,
774a49301eSmrg				GLubyte *and_mask,
784a49301eSmrg				GLubyte *clip_mask,
794a49301eSmrg				GLboolean viewport_z_clip );
804a49301eSmrg
8101e04c3fSmrgextern void
824a49301eSmrg_mesa_v16_x86_general_xform( GLfloat *dest,
834a49301eSmrg			     const GLfloat *m,
844a49301eSmrg			     const GLfloat *src,
854a49301eSmrg			     GLuint src_stride,
864a49301eSmrg			     GLuint count );
874a49301eSmrg#endif
884a49301eSmrg
894a49301eSmrg
904a49301eSmrg#ifdef USE_X86_ASM
914a49301eSmrgstatic void _mesa_init_x86_transform_asm( void )
924a49301eSmrg{
934a49301eSmrg   ASSIGN_XFORM_GROUP( x86, 2 );
944a49301eSmrg   ASSIGN_XFORM_GROUP( x86, 3 );
954a49301eSmrg   ASSIGN_XFORM_GROUP( x86, 4 );
964a49301eSmrg
974a49301eSmrg   _mesa_clip_tab[4] = _mesa_x86_cliptest_points4;
984a49301eSmrg   _mesa_clip_np_tab[4] = _mesa_x86_cliptest_points4_np;
994a49301eSmrg
1004a49301eSmrg#ifdef DEBUG_MATH
1014a49301eSmrg   _math_test_all_transform_functions( "x86" );
1024a49301eSmrg   _math_test_all_cliptest_functions( "x86" );
1034a49301eSmrg#endif
1044a49301eSmrg}
1054a49301eSmrg#endif
1064a49301eSmrg
1074a49301eSmrg
1084a49301eSmrgvoid _mesa_init_all_x86_transform_asm( void )
1094a49301eSmrg{
1104a49301eSmrg   _mesa_get_x86_features();
1114a49301eSmrg
1124a49301eSmrg#ifdef USE_X86_ASM
1134a49301eSmrg   if ( _mesa_x86_cpu_features ) {
1144a49301eSmrg      _mesa_init_x86_transform_asm();
1154a49301eSmrg   }
1164a49301eSmrg
1173464ebd5Sriastradh   if (cpu_has_3dnow) {
1183464ebd5Sriastradh      _mesa_init_3dnow_transform_asm();
1194a49301eSmrg   }
1204a49301eSmrg
1214a49301eSmrg   if ( cpu_has_xmm ) {
1223464ebd5Sriastradh      _mesa_init_sse_transform_asm();
1234a49301eSmrg   }
1243464ebd5Sriastradh
1254a49301eSmrg#endif
1264a49301eSmrg}
127