1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: math_Config.h 4 Copyright (C)2009-2010 Nintendo Co., Ltd. All rights reserved. 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 $Revision: 17675 $ 11 *--------------------------------------------------------------------------- 12 13 14 */ 15 16 #ifndef NN_MATH_CONFIG_H_ 17 #define NN_MATH_CONFIG_H_ 18 19 #include <nn/types.h> 20 21 #define NN_MATH_WARNING NN_WARNING 22 #define NN_MATH_REPORT NN_LOG 23 24 // If NN_SWITCH_ENABLE_MEMBER_NAME_SHORTCUT is defined, NN_MATH_USE_ANONYMOUS_STRUCT is enabled. 25 26 #if defined(NN_SWITCH_ENABLE_MEMBER_NAME_SHORTCUT) 27 #define NN_MATH_USE_ANONYMOUS_STRUCT 28 #endif 29 30 #ifndef NN_MATH_MINMAXLT_ASSERT 31 #define NN_MATH_MINMAXLT_ASSERT(exp, min, max) \ 32 NN_ASSERTMSG( (exp) >= (min) && (exp) < (max), #exp " is out of bounds(%d)\n%d <= "#exp" < %d not satisfied.", static_cast<int>(exp), static_cast<int>(min), static_cast<int>(max)) 33 #endif 34 35 #define NN_MATH_AS_INLINE 36 37 #if defined(NN_MATH_AS_INLINE) 38 #define NN_MATH_INLINE inline 39 #else 40 #define NN_MATH_INLINE 41 #endif 42 43 44 /* 45 #if defined( NN_HARDWARE_CTR ) ! defined( NN_BUILD_NOOPT ) 46 #if ! defined( NN_MATH_UNUSE_ASM ) ! defined( NN_MATH_USE_ASM ) 47 #define NN_MATH_USE_ASM 48 #endif 49 #endif 50 51 52 */ 53 54 //#define D_BENCH_FUNC // When set, function calls use C code; Used in measurements for individual functions 55 // When not set, function calls use the fastest code; Used for API measurements 56 #define D_MEASURE_SWITCH // If there is a compile switch in the function's implementation, switch the source code 57 // If set, the target function is measured using "C_FAST" 58 // If not set, the target function is measured using "C_FAST_ALGO" 59 60 //------------------------------------------------------------------------------ 61 #define D_ORG (1) // Original source code 62 #define D_FAST_C (2) // Optimized code using the C language 63 #define D_FAST_ASM (3) // Optimized code using assembler 64 #define D_FAST_C_ALGO (4) // Optimized code using improved algorithm 65 #define D_FAST_ASM_ALGO (5) // Optimized code using assember and algorithm improvement 66 67 #if defined( D_BENCH_FUNC ) || defined( NN_BUILD_NOOPT ) 68 //----------------------------------------------------------------------------- 69 // Benchmark measurement settings 70 #define HERMITE_5_CONFIG D_ORG 71 #define HERMITE_6_CONFIG D_ORG 72 #define MTX33COPY_CONFIG D_ORG 73 #define MTX33MADD_CONFIG D_ORG 74 #define MTX33MULT_CONFIG D_ORG 75 #define MTX33TOMTX34_CONFIG D_ORG 76 #define MTX34ADD_CONFIG D_ORG 77 #define MTX34CAMERAROTATE_CONFIG D_ORG 78 #define MTX34COPY_CONFIG D_ORG 79 #define MTX34INVERSE_CONFIG D_ORG 80 #define MTX34INVTRANSPOSE_34TO34_CONFIG D_ORG 81 #define MTX34LOOKAT_VEC3_CONFIG D_ORG 82 #define MTX34LOOKAT_F32_CONFIG D_ORG 83 #define MTX34MADD_CONFIG D_ORG 84 #define MTX34MULT_34_CONFIG D_ORG 85 #define MTX34MULT_F32_CONFIG D_ORG 86 #define MTX34MULTSCALE_RIGHT_CONFIG D_ORG 87 #define MTX34MULTSCALE_LEFT_CONFIG D_ORG 88 #define MTX34MULTTRANSLATE_RIGHT_CONFIG D_ORG 89 #define MTX34MULTTRANSLATE_LEFT_CONFIG D_ORG 90 #define MTX34ROTXYZFIDX_CONFIG D_ORG 91 #define MTX34SCALE_CONFIG D_ORG 92 #define MTX34TOMTX33_CONFIG D_ORG 93 #define MTX34TOQUAT_CONFIG D_ORG 94 #define MTX34TRANSLATE_CONFIG D_ORG 95 #define MTX34TRANSPOSE_34TO34_CONFIG D_ORG 96 #define MTX34TRANSPOSE_34TO43_CONFIG D_ORG 97 #define MTX43ADD_CONFIG D_ORG 98 #define MTX43COPY_CONFIG D_ORG 99 #define MTX43MULT_43_CONFIG D_ORG 100 #define MTX43MULT_F32_CONFIG D_ORG 101 #define MTX43TRANSPOSE_CONFIG D_ORG 102 #define MTX44ADD_ASM_CONFIG D_ORG 103 #define MTX44COPY_CONFIG D_ORG 104 #define MTX44FRUSTUM_CONFIG D_ORG 105 #define MTX44INVERSE_CONFIG D_ORG 106 #define MTX44MULT_44_CONFIG D_ORG 107 #define MTX44MULT_F32_CONFIG D_ORG 108 #define MTX44MULTSCALE_RIGHT_CONFIG D_ORG 109 #define MTX44MULTSCALE_LEFT_CONFIG D_ORG 110 #define MTX44MULTTRANSLATE_RIGHT_CONFIG D_ORG 111 #define MTX44MULTTRANSLATE_LEFT_CONFIG D_ORG 112 #define MTX44ORTHO_CONFIG D_ORG 113 #define MTX44ROTXYZFIDX_CONFIG D_ORG 114 #define MTX44TEXTUREMATRIXFORMAX_CONFIG D_ORG 115 #define MTX44TEXTUREMATRIXFORMAYA_CONFIG D_ORG 116 #define MTX44TEXTUREMATRIXFORSOFTIMAGE_CONFIG D_ORG 117 #define MTX44SCALE_CONFIG D_ORG 118 #define MTX44TRANSLATE_CONFIG D_ORG 119 #define MTX44TRANSPOSE_44_CONFIG D_ORG 120 #define QUATINVERSE_CONFIG D_ORG 121 #define QUATMULT_CONFIG D_ORG 122 #define QUATNORMALIZE_CONFIG D_ORG 123 #define QUATTOMTX34_CONFIG D_ORG 124 #define VEC3NORMALIZE__CONFIG D_ORG 125 #define VEC3TRANSFORM_33XVEC3_CONFIG D_ORG 126 #define VEC3TRANSFORM_34XVEC3_CONFIG D_ORG 127 #define VEC3TRANSFORM_44XVEC3_CONFIG D_ORG 128 #define MTX44PIVOT_CONFIG D_ORG 129 130 #ifdef D_MEASURE_SWITCH 131 #define MTX34ROTAXISRAD__CONFIG D_ORG 132 #define MTX44PERSPECTIVERAD_CONFIG D_ORG 133 #define MTX44ROTAXISRAD__CONFIG D_ORG 134 #else 135 #define MTX34ROTAXISRAD__CONFIG D_FAST_C_ALGO 136 #define MTX44PERSPECTIVERAD_CONFIG D_FAST_C_ALGO 137 #define MTX44ROTAXISRAD__CONFIG D_FAST_C_ALGO 138 139 #endif 140 141 //----------------------------------------------------------------------------- 142 143 #else 144 //----------------------------------------------------------------------------- 145 // Fastest setting 146 #define HERMITE_5_CONFIG D_FAST_C 147 #define HERMITE_6_CONFIG D_FAST_C 148 #define MTX33COPY_CONFIG D_FAST_ASM 149 #define MTX33MADD_CONFIG D_FAST_ASM 150 #define MTX33MULT_CONFIG D_FAST_ASM 151 #define MTX33TOMTX34_CONFIG D_FAST_C 152 #define MTX34ADD_CONFIG D_FAST_ASM 153 #define MTX34CAMERAROTATE_CONFIG D_FAST_C 154 #define MTX34COPY_CONFIG D_FAST_ASM 155 #define MTX34INVERSE_CONFIG D_FAST_ASM 156 #define MTX34INVTRANSPOSE_34TO34_CONFIG D_FAST_ASM 157 #define MTX34LOOKAT_VEC3_CONFIG D_FAST_C 158 #define MTX34LOOKAT_F32_CONFIG D_FAST_C 159 #define MTX34MADD_CONFIG D_FAST_ASM 160 #define MTX34MULT_34_CONFIG D_FAST_ASM 161 #define MTX34MULT_F32_CONFIG D_FAST_ASM 162 #define MTX34MULTSCALE_RIGHT_CONFIG D_FAST_ASM 163 #define MTX34MULTSCALE_LEFT_CONFIG D_FAST_ASM 164 #define MTX34MULTTRANSLATE_RIGHT_CONFIG D_FAST_ASM 165 #define MTX34MULTTRANSLATE_LEFT_CONFIG D_FAST_ASM 166 #define MTX34ROTXYZFIDX_CONFIG D_FAST_C 167 #define MTX34SCALE_CONFIG D_FAST_C 168 #define MTX34TOMTX33_CONFIG D_FAST_ASM 169 #define MTX34TOQUAT_CONFIG D_FAST_C 170 #define MTX34TRANSLATE_CONFIG D_FAST_C 171 #define MTX34TRANSPOSE_34TO34_CONFIG D_FAST_ASM 172 #define MTX34TRANSPOSE_34TO43_CONFIG D_FAST_ASM 173 #define MTX43ADD_CONFIG D_FAST_ASM 174 #define MTX43COPY_CONFIG D_FAST_ASM 175 #define MTX43MULT_43_CONFIG D_FAST_ASM 176 #define MTX43MULT_F32_CONFIG D_FAST_ASM 177 #define MTX43TRANSPOSE_CONFIG D_FAST_ASM 178 #define MTX44ADD_ASM_CONFIG D_FAST_ASM 179 #define MTX44COPY_CONFIG D_FAST_ASM 180 #define MTX44FRUSTUM_CONFIG D_FAST_C 181 #define MTX44INVERSE_CONFIG D_FAST_C_ALGO 182 #define MTX44MULT_44_CONFIG D_FAST_ASM 183 #define MTX44MULT_F32_CONFIG D_FAST_ASM 184 #define MTX44MULTSCALE_RIGHT_CONFIG D_FAST_ASM 185 #define MTX44MULTSCALE_LEFT_CONFIG D_FAST_ASM 186 #define MTX44MULTTRANSLATE_RIGHT_CONFIG D_FAST_ASM 187 #define MTX44MULTTRANSLATE_LEFT_CONFIG D_FAST_ASM 188 #define MTX44ORTHO_CONFIG D_FAST_C 189 #define MTX44ROTXYZFIDX_CONFIG D_FAST_C 190 #define MTX44SCALE_CONFIG D_FAST_C 191 #define MTX44TEXTUREMATRIXFORMAX_CONFIG D_FAST_C 192 #define MTX44TEXTUREMATRIXFORMAYA_CONFIG D_FAST_C 193 #define MTX44TEXTUREMATRIXFORSOFTIMAGE_CONFIG D_FAST_C 194 #define MTX44TRANSLATE_CONFIG D_FAST_C 195 #define MTX44TRANSPOSE_44_CONFIG D_FAST_ASM 196 #define QUATINVERSE_CONFIG D_FAST_C 197 #define QUATMULT_CONFIG D_FAST_C 198 #define QUATNORMALIZE_CONFIG D_FAST_C 199 #define QUATTOMTX34_CONFIG D_FAST_C 200 #define VEC3NORMALIZE__CONFIG D_FAST_C 201 #define VEC3TRANSFORM_33XVEC3_CONFIG D_FAST_ASM 202 #define VEC3TRANSFORM_34XVEC3_CONFIG D_FAST_ASM 203 #define VEC3TRANSFORM_44XVEC3_CONFIG D_FAST_ASM 204 #define MTX44PIVOT_CONFIG D_FAST_C 205 206 #define MTX34ROTAXISRAD__CONFIG D_FAST_C_ALGO 207 #define MTX44PERSPECTIVERAD_CONFIG D_FAST_C_ALGO 208 #define MTX44ROTAXISRAD__CONFIG D_FAST_C_ALGO 209 210 //----------------------------------------------------------------------------- 211 #endif 212 213 /* NN_MATH_CONFIG_H_ */ 214 #endif 215