Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenx86-64.c
Go to the documentation of this file.
00001 00002 /* 00003 * Mesa 3-D graphics library 00004 * Version: 6.3 00005 * 00006 * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining a 00009 * copy of this software and associated documentation files (the "Software"), 00010 * to deal in the Software without restriction, including without limitation 00011 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00012 * and/or sell copies of the Software, and to permit persons to whom the 00013 * Software is furnished to do so, subject to the following conditions: 00014 * 00015 * The above copyright notice and this permission notice shall be included 00016 * in all copies or substantial portions of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00019 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00021 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00022 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00023 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00024 */ 00025 00026 /* 00027 * x86-64 optimizations shamelessy converted from x86/sse/3dnow assembly by 00028 * Mikko Tiihonen 00029 */ 00030 00031 #ifdef USE_X86_64_ASM 00032 00033 #include "main/glheader.h" 00034 #include "main/context.h" 00035 #include "math/m_xform.h" 00036 #include "tnl/t_context.h" 00037 #include "x86-64.h" 00038 #include "../x86/common_x86_macros.h" 00039 00040 #ifdef DEBUG 00041 #include "math/m_debug.h" 00042 #endif 00043 00044 extern void _mesa_x86_64_cpuid(unsigned int *regs); 00045 00046 DECLARE_XFORM_GROUP( x86_64, 4 ) 00047 DECLARE_XFORM_GROUP( 3dnow, 4 ) 00048 00049 #else 00050 /* just to silence warning below */ 00051 #include "x86-64.h" 00052 #endif 00053 00054 /* 00055 extern void _mesa_x86_64_transform_points4_general( XFORM_ARGS ); 00056 extern void _mesa_x86_64_transform_points4_identity( XFORM_ARGS ); 00057 extern void _mesa_x86_64_transform_points4_perspective( XFORM_ARGS ); 00058 extern void _mesa_x86_64_transform_points4_3d( XFORM_ARGS ); 00059 extern void _mesa_x86_64_transform_points4_3d_no_rot( XFORM_ARGS ); 00060 extern void _mesa_x86_64_transform_points4_2d_no_rot( XFORM_ARGS ); 00061 extern void _mesa_x86_64_transform_points4_2d( XFORM_ARGS ); 00062 */ 00063 00064 #ifdef USE_X86_64_ASM 00065 static void message( const char *msg ) 00066 { 00067 GLboolean debug; 00068 #ifdef DEBUG 00069 debug = GL_TRUE; 00070 #else 00071 if ( _mesa_getenv( "MESA_DEBUG" ) ) { 00072 debug = GL_TRUE; 00073 } else { 00074 debug = GL_FALSE; 00075 } 00076 #endif 00077 if ( debug ) { 00078 _mesa_debug( NULL, "%s", msg ); 00079 } 00080 } 00081 #endif 00082 00083 00084 void _mesa_init_all_x86_64_transform_asm(void) 00085 { 00086 #ifdef USE_X86_64_ASM 00087 unsigned int regs[4]; 00088 00089 if ( _mesa_getenv( "MESA_NO_ASM" ) ) { 00090 return; 00091 } 00092 00093 message("Initializing x86-64 optimizations\n"); 00094 00095 00096 _mesa_transform_tab[4][MATRIX_GENERAL] = 00097 _mesa_x86_64_transform_points4_general; 00098 _mesa_transform_tab[4][MATRIX_IDENTITY] = 00099 _mesa_x86_64_transform_points4_identity; 00100 _mesa_transform_tab[4][MATRIX_3D] = 00101 _mesa_x86_64_transform_points4_3d; 00102 00103 regs[0] = 0x80000001; 00104 regs[1] = 0x00000000; 00105 regs[2] = 0x00000000; 00106 regs[3] = 0x00000000; 00107 _mesa_x86_64_cpuid(regs); 00108 if (regs[3] & (1U << 31)) { 00109 message("3Dnow! detected\n"); 00110 _mesa_transform_tab[4][MATRIX_3D_NO_ROT] = 00111 _mesa_3dnow_transform_points4_3d_no_rot; 00112 _mesa_transform_tab[4][MATRIX_PERSPECTIVE] = 00113 _mesa_3dnow_transform_points4_perspective; 00114 _mesa_transform_tab[4][MATRIX_2D_NO_ROT] = 00115 _mesa_3dnow_transform_points4_2d_no_rot; 00116 _mesa_transform_tab[4][MATRIX_2D] = 00117 _mesa_3dnow_transform_points4_2d; 00118 00119 } 00120 00121 00122 #ifdef DEBUG_MATH 00123 _math_test_all_transform_functions("x86_64"); 00124 _math_test_all_cliptest_functions("x86_64"); 00125 _math_test_all_normal_transform_functions("x86_64"); 00126 #endif 00127 00128 #endif 00129 } Generated on Sun May 27 2012 04:20:49 for ReactOS by
1.7.6.1
|