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