3dnow.c revision 7117f1b4
17117f1b4Smrg/* $Id: 3dnow.c,v 1.1.1.1 2008/07/29 05:10:22 mrg Exp $ */
27117f1b4Smrg
37117f1b4Smrg/*
47117f1b4Smrg * Mesa 3-D graphics library
57117f1b4Smrg * Version:  5.0.1
67117f1b4Smrg *
77117f1b4Smrg * Copyright (C) 1999-2003  Brian Paul   All Rights Reserved.
87117f1b4Smrg *
97117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
107117f1b4Smrg * copy of this software and associated documentation files (the "Software"),
117117f1b4Smrg * to deal in the Software without restriction, including without limitation
127117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
137117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
147117f1b4Smrg * Software is furnished to do so, subject to the following conditions:
157117f1b4Smrg *
167117f1b4Smrg * The above copyright notice and this permission notice shall be included
177117f1b4Smrg * in all copies or substantial portions of the Software.
187117f1b4Smrg *
197117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
207117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
217117f1b4Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
227117f1b4Smrg * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
237117f1b4Smrg * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
247117f1b4Smrg * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
257117f1b4Smrg */
267117f1b4Smrg
277117f1b4Smrg/*
287117f1b4Smrg * 3DNow! optimizations contributed by
297117f1b4Smrg * Holger Waechtler <holger@akaflieg.extern.tu-berlin.de>
307117f1b4Smrg */
317117f1b4Smrg
327117f1b4Smrg#include "glheader.h"
337117f1b4Smrg#include "context.h"
347117f1b4Smrg#include "math/m_xform.h"
357117f1b4Smrg#include "tnl/t_context.h"
367117f1b4Smrg
377117f1b4Smrg#include "3dnow.h"
387117f1b4Smrg#include "common_x86_macros.h"
397117f1b4Smrg
407117f1b4Smrg#ifdef DEBUG_MATH
417117f1b4Smrg#include "math/m_debug.h"
427117f1b4Smrg#endif
437117f1b4Smrg
447117f1b4Smrg
457117f1b4Smrg#ifdef USE_3DNOW_ASM
467117f1b4SmrgDECLARE_XFORM_GROUP( 3dnow, 2 )
477117f1b4SmrgDECLARE_XFORM_GROUP( 3dnow, 3 )
487117f1b4SmrgDECLARE_XFORM_GROUP( 3dnow, 4 )
497117f1b4Smrg
507117f1b4SmrgDECLARE_NORM_GROUP( 3dnow )
517117f1b4Smrg
527117f1b4Smrg
537117f1b4Smrgextern void _ASMAPI
547117f1b4Smrg_mesa_v16_3dnow_general_xform( GLfloat *first_vert,
557117f1b4Smrg			       const GLfloat *m,
567117f1b4Smrg			       const GLfloat *src,
577117f1b4Smrg			       GLuint src_stride,
587117f1b4Smrg			       GLuint count );
597117f1b4Smrg
607117f1b4Smrgextern void _ASMAPI
617117f1b4Smrg_mesa_3dnow_project_vertices( GLfloat *first,
627117f1b4Smrg			      GLfloat *last,
637117f1b4Smrg			      const GLfloat *m,
647117f1b4Smrg			      GLuint stride );
657117f1b4Smrg
667117f1b4Smrgextern void _ASMAPI
677117f1b4Smrg_mesa_3dnow_project_clipped_vertices( GLfloat *first,
687117f1b4Smrg				      GLfloat *last,
697117f1b4Smrg				      const GLfloat *m,
707117f1b4Smrg				      GLuint stride,
717117f1b4Smrg				      const GLubyte *clipmask );
727117f1b4Smrg#endif
737117f1b4Smrg
747117f1b4Smrg
757117f1b4Smrgvoid _mesa_init_3dnow_transform_asm( void )
767117f1b4Smrg{
777117f1b4Smrg#ifdef USE_3DNOW_ASM
787117f1b4Smrg   ASSIGN_XFORM_GROUP( 3dnow, 2 );
797117f1b4Smrg   ASSIGN_XFORM_GROUP( 3dnow, 3 );
807117f1b4Smrg   ASSIGN_XFORM_GROUP( 3dnow, 4 );
817117f1b4Smrg
827117f1b4Smrg   /* There's a bug somewhere in the 3dnow_normal.S file that causes
837117f1b4Smrg    * bad shading.  Disable for now.
847117f1b4Smrg   ASSIGN_NORM_GROUP( 3dnow );
857117f1b4Smrg   */
867117f1b4Smrg
877117f1b4Smrg#ifdef DEBUG_MATH
887117f1b4Smrg   _math_test_all_transform_functions( "3DNow!" );
897117f1b4Smrg   _math_test_all_normal_transform_functions( "3DNow!" );
907117f1b4Smrg#endif
917117f1b4Smrg#endif
927117f1b4Smrg}
93