1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: math_Config.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_MATH_MATH_CONFIG_H_ 17 #define NN_MATH_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 // When 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 47 #if ! defined( NN_MATH_UNUSE_ASM ) && ! defined( NN_MATH_USE_ASM ) 48 #define NN_MATH_USE_ASM 49 #endif 50 51 #endif 52 */ 53 54 //#define D_BENCH_FUNC // Use C code with API call during configuration, use with function individual measurements 55 // Use fastest code with API call when not configured, use with API measurement 56 #define D_MEASURE_SWITCH // Switch source when compile switch exists in the function 57 // Measure the target function during configuration with "C_FAST" 58 // Measure the target function when not configured with "C_FAST_ALGO" 59 60 //------------------------------------------------------------------------------ 61 #define D_ORG (1) // Original source code 62 #define D_FAST_C (2) // Optimized code with C 63 #define D_FAST_ASM (3) // Optimized code by assembler 64 #define D_FAST_C_ALGO (4) // Optimized code by modifying algorithms 65 #define D_FAST_ASM_ALGO (5) // Optimized code by assembling and modifying algorithms 66 67 #if defined( D_BENCH_FUNC ) || defined( NN_BUILD_NOOPT ) 68 //----------------------------------------------------------------------------- 69 // Set benchmark measurements 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 #define TRIANGULAR_SINCOSIDX_CONFIG D_ORG 130 131 #ifdef D_MEASURE_SWITCH 132 #define MTX34ROTAXISRAD__CONFIG D_ORG 133 #define MTX44PERSPECTIVERAD_CONFIG D_ORG 134 #define MTX44ROTAXISRAD__CONFIG D_ORG 135 #else 136 #define MTX34ROTAXISRAD__CONFIG D_FAST_C_ALGO 137 #define MTX44PERSPECTIVERAD_CONFIG D_FAST_C_ALGO 138 #define MTX44ROTAXISRAD__CONFIG D_FAST_C_ALGO 139 140 #endif 141 142 //----------------------------------------------------------------------------- 143 144 #else 145 //----------------------------------------------------------------------------- 146 // Set fastest 147 #define HERMITE_5_CONFIG D_FAST_C 148 #define HERMITE_6_CONFIG D_FAST_C 149 #define MTX33COPY_CONFIG D_FAST_ASM 150 #define MTX33MADD_CONFIG D_FAST_ASM 151 #define MTX33MULT_CONFIG D_FAST_ASM 152 #define MTX33TOMTX34_CONFIG D_FAST_C 153 #define MTX34ADD_CONFIG D_FAST_ASM 154 #define MTX34CAMERAROTATE_CONFIG D_FAST_C 155 #define MTX34COPY_CONFIG D_FAST_ASM 156 #define MTX34INVERSE_CONFIG D_FAST_ASM 157 #define MTX34INVTRANSPOSE_34TO34_CONFIG D_FAST_ASM 158 #define MTX34LOOKAT_VEC3_CONFIG D_FAST_C 159 #define MTX34LOOKAT_F32_CONFIG D_FAST_C 160 #define MTX34MADD_CONFIG D_FAST_ASM 161 #define MTX34MULT_34_CONFIG D_FAST_ASM 162 #define MTX34MULT_F32_CONFIG D_FAST_ASM 163 #define MTX34MULTSCALE_RIGHT_CONFIG D_FAST_ASM 164 #define MTX34MULTSCALE_LEFT_CONFIG D_FAST_ASM 165 #define MTX34MULTTRANSLATE_RIGHT_CONFIG D_FAST_ASM 166 #define MTX34MULTTRANSLATE_LEFT_CONFIG D_FAST_ASM 167 #define MTX34ROTXYZFIDX_CONFIG D_FAST_C 168 #define MTX34SCALE_CONFIG D_FAST_C 169 #define MTX34TOMTX33_CONFIG D_FAST_ASM 170 #define MTX34TOQUAT_CONFIG D_FAST_C 171 #define MTX34TRANSLATE_CONFIG D_FAST_C 172 #define MTX34TRANSPOSE_34TO34_CONFIG D_FAST_ASM 173 #define MTX34TRANSPOSE_34TO43_CONFIG D_FAST_ASM 174 #define MTX43ADD_CONFIG D_FAST_ASM 175 #define MTX43COPY_CONFIG D_FAST_ASM 176 #define MTX43MULT_43_CONFIG D_FAST_ASM 177 #define MTX43MULT_F32_CONFIG D_FAST_ASM 178 #define MTX43TRANSPOSE_CONFIG D_FAST_ASM 179 #define MTX44ADD_ASM_CONFIG D_FAST_ASM 180 #define MTX44COPY_CONFIG D_FAST_ASM 181 #define MTX44FRUSTUM_CONFIG D_FAST_C 182 #define MTX44INVERSE_CONFIG D_FAST_C_ALGO 183 #define MTX44MULT_44_CONFIG D_FAST_ASM 184 #define MTX44MULT_F32_CONFIG D_FAST_ASM 185 #define MTX44MULTSCALE_RIGHT_CONFIG D_FAST_ASM 186 #define MTX44MULTSCALE_LEFT_CONFIG D_FAST_ASM 187 #define MTX44MULTTRANSLATE_RIGHT_CONFIG D_FAST_ASM 188 #define MTX44MULTTRANSLATE_LEFT_CONFIG D_FAST_ASM 189 #define MTX44ORTHO_CONFIG D_FAST_C 190 #define MTX44ROTXYZFIDX_CONFIG D_FAST_C 191 #define MTX44SCALE_CONFIG D_FAST_C 192 #define MTX44TEXTUREMATRIXFORMAX_CONFIG D_FAST_C 193 #define MTX44TEXTUREMATRIXFORMAYA_CONFIG D_FAST_C 194 #define MTX44TEXTUREMATRIXFORSOFTIMAGE_CONFIG D_FAST_C 195 #define MTX44TRANSLATE_CONFIG D_FAST_C 196 #define MTX44TRANSPOSE_44_CONFIG D_FAST_ASM 197 #define QUATINVERSE_CONFIG D_FAST_C 198 #define QUATMULT_CONFIG D_FAST_C 199 #define QUATNORMALIZE_CONFIG D_FAST_C 200 #define QUATTOMTX34_CONFIG D_FAST_C 201 #define VEC3NORMALIZE__CONFIG D_FAST_C 202 #define VEC3TRANSFORM_33XVEC3_CONFIG D_FAST_ASM 203 #define VEC3TRANSFORM_34XVEC3_CONFIG D_FAST_ASM 204 #define VEC3TRANSFORM_44XVEC3_CONFIG D_FAST_ASM 205 #define MTX44PIVOT_CONFIG D_FAST_C 206 #define TRIANGULAR_SINCOSIDX_CONFIG D_FAST_ASM 207 208 #define MTX34ROTAXISRAD__CONFIG D_FAST_C_ALGO 209 #define MTX44PERSPECTIVERAD_CONFIG D_FAST_C_ALGO 210 #define MTX44ROTAXISRAD__CONFIG D_FAST_C_ALGO 211 212 //----------------------------------------------------------------------------- 213 #endif 214 215 /* NN_MATH_MATH_CONFIG_H_ */ 216 #endif 217