winMath.cpp
Engine/source/platformWin32/winMath.cpp
Public Functions
DefineEngineStringlyVariadicFunction(mathInit , void , 1 , 10 , "( ... )" "@brief Install the math library with specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">extensions.\n\n</a>" "Possible parameters <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">are:\n\n</a>" " - 'DETECT' Autodetect math lib <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">settings.\n\n</a>" " - 'C' Enable the C math routines. C routines are always <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enabled.\n\n</a>" " - 'FPU' Enable floating point unit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" " - 'MMX' Enable MMX math <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" " - '3DNOW' Enable 3dNow! math <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" " - 'SSE' Enable SSE math <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" "@ingroup <a href="/coding/class/structmath/">Math</a>" )
Detailed Description
Public Functions
DefineEngineStringlyVariadicFunction(mathInit , void , 1 , 10 , "( ... )" "@brief Install the math library with specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">extensions.\n\n</a>" "Possible parameters <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">are:\n\n</a>" " - 'DETECT' Autodetect math lib <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">settings.\n\n</a>" " - 'C' Enable the C math routines. C routines are always <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">enabled.\n\n</a>" " - 'FPU' Enable floating point unit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" " - 'MMX' Enable MMX math <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" " - '3DNOW' Enable 3dNow! math <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" " - 'SSE' Enable SSE math <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">routines.\n\n</a>" "@ingroup <a href="/coding/class/structmath/">Math</a>" )
mInstall_AMD_Math()
mInstall_Library_SSE()
mInstallLibrary_ASM()
mInstallLibrary_C()
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "core/strings/stringFunctions.h" 25#include "console/console.h" 26#include "console/engineAPI.h" 27 28#include "math/mMath.h" 29 30 31extern void mInstallLibrary_C(); 32extern void mInstallLibrary_ASM(); 33extern void mInstall_AMD_Math(); 34extern void mInstall_Library_SSE(); 35 36//-------------------------------------- 37DefineEngineStringlyVariadicFunction( mathInit, void, 1, 10, "( ... )" 38 "@brief Install the math library with specified extensions.\n\n" 39 "Possible parameters are:\n\n" 40 " - 'DETECT' Autodetect math lib settings.\n\n" 41 " - 'C' Enable the C math routines. C routines are always enabled.\n\n" 42 " - 'FPU' Enable floating point unit routines.\n\n" 43 " - 'MMX' Enable MMX math routines.\n\n" 44 " - '3DNOW' Enable 3dNow! math routines.\n\n" 45 " - 'SSE' Enable SSE math routines.\n\n" 46 "@ingroup Math") 47 48 49{ 50 U32 properties = CPU_PROP_C; // C entensions are always used 51 52 if (argc == 1) 53 { 54 Math::init(0); 55 return; 56 } 57 for (argc--, argv++; argc; argc--, argv++) 58 { 59 if (dStricmp(*argv, "DETECT") == 0) { 60 Math::init(0); 61 return; 62 } 63 if (dStricmp(*argv, "C") == 0) { 64 properties |= CPU_PROP_C; 65 continue; 66 } 67 if (dStricmp(*argv, "FPU") == 0) { 68 properties |= CPU_PROP_FPU; 69 continue; 70 } 71 if (dStricmp(*argv, "MMX") == 0) { 72 properties |= CPU_PROP_MMX; 73 continue; 74 } 75 if (dStricmp(*argv, "3DNOW") == 0) { 76 properties |= CPU_PROP_3DNOW; 77 continue; 78 } 79 if (dStricmp(*argv, "SSE") == 0) { 80 properties |= CPU_PROP_SSE; 81 continue; 82 } 83 Con::printf("Error: MathInit(): ignoring unknown math extension '%s'", argv->getStringValue()); 84 } 85 Math::init(properties); 86} 87 88 89 90//------------------------------------------------------------------------------ 91void Math::init(U32 properties) 92{ 93 if (!properties) 94 // detect what's available 95 properties = Platform::SystemInfo.processor.properties; 96 else 97 // Make sure we're not asking for anything that's not supported 98 properties &= Platform::SystemInfo.processor.properties; 99 100 Con::printf("Math Init:"); 101 Con::printf(" Installing Standard C extensions"); 102 mInstallLibrary_C(); 103 104 Con::printf(" Installing Assembly extensions"); 105 mInstallLibrary_ASM(); 106 107 if (properties & CPU_PROP_FPU) 108 { 109 Con::printf(" Installing FPU extensions"); 110 } 111 112 if (properties & CPU_PROP_MMX) 113 { 114 Con::printf(" Installing MMX extensions"); 115 if (properties & CPU_PROP_3DNOW) 116 { 117 Con::printf(" Installing 3DNow extensions"); 118 mInstall_AMD_Math(); 119 } 120 } 121 122 if (properties & CPU_PROP_SSE) 123 { 124 Con::printf(" Installing SSE extensions"); 125 mInstall_Library_SSE(); 126 } 127 128 Con::printf(" "); 129} 130 131 132