1 /// @ref core 2 /// @file glm/detail/setup.hpp 3 4 #pragma once 5 6 #if (defined(GLM_FORCE_SWIZZLE) || defined(GLM_SWIZZLE)) && defined(GLM_FORCE_UNRESTRICTED_GENTYPE) 7 # error "Both GLM_FORCE_SWIZZLE and GLM_FORCE_UNRESTRICTED_GENTYPE can't be defined at the same time" 8 #endif 9 10 /////////////////////////////////////////////////////////////////////////////////// 11 // Messages 12 13 #ifdef GLM_MESSAGES 14 # pragma message("GLM: GLM_MESSAGES is deprecated, use GLM_FORCE_MESSAGES instead") 15 #endif 16 17 #define GLM_MESSAGES_ENABLED 1 18 #define GLM_MESSAGES_DISABLE 0 19 20 #if defined(GLM_FORCE_MESSAGES) || defined(GLM_MESSAGES) 21 # undef GLM_MESSAGES 22 # define GLM_MESSAGES GLM_MESSAGES_ENABLED 23 #else 24 # undef GLM_MESSAGES 25 # define GLM_MESSAGES GLM_MESSAGES_DISABLE 26 #endif 27 28 #include <cassert> 29 #include <cstddef> 30 #include "../simd/platform.h" 31 32 /////////////////////////////////////////////////////////////////////////////////// 33 // Version 34 35 #define GLM_VERSION 98 36 #define GLM_VERSION_MAJOR 0 37 #define GLM_VERSION_MINOR 9 38 #define GLM_VERSION_PATCH 8 39 #define GLM_VERSION_REVISION 4 40 41 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_VERSION_DISPLAYED) 42 # define GLM_MESSAGE_VERSION_DISPLAYED 43 # pragma message ("GLM: version 0.9.8.4") 44 #endif//GLM_MESSAGES 45 46 // Report compiler detection 47 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_COMPILER_DISPLAYED) 48 # define GLM_MESSAGE_COMPILER_DISPLAYED 49 # if GLM_COMPILER & GLM_COMPILER_CUDA 50 # pragma message("GLM: CUDA compiler detected") 51 # elif GLM_COMPILER & GLM_COMPILER_VC 52 # pragma message("GLM: Visual C++ compiler detected") 53 # elif GLM_COMPILER & GLM_COMPILER_CLANG 54 # pragma message("GLM: Clang compiler detected") 55 # elif GLM_COMPILER & GLM_COMPILER_INTEL 56 # pragma message("GLM: Intel Compiler detected") 57 # elif GLM_COMPILER & GLM_COMPILER_GCC 58 # pragma message("GLM: GCC compiler detected") 59 # else 60 # pragma message("GLM: Compiler not detected") 61 # endif 62 #endif//GLM_MESSAGES 63 64 /////////////////////////////////////////////////////////////////////////////////// 65 // Build model 66 67 #if defined(__arch64__) || defined(__LP64__) || defined(_M_X64) || defined(__ppc64__) || defined(__x86_64__) 68 # define GLM_MODEL GLM_MODEL_64 69 #elif defined(__i386__) || defined(__ppc__) 70 # define GLM_MODEL GLM_MODEL_32 71 #else 72 # define GLM_MODEL GLM_MODEL_32 73 #endif// 74 75 #if !defined(GLM_MODEL) && GLM_COMPILER != 0 76 # error "GLM_MODEL undefined, your compiler may not be supported by GLM. Add #define GLM_MODEL 0 to ignore this message." 77 #endif//GLM_MODEL 78 79 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_MODEL_DISPLAYED) 80 # define GLM_MESSAGE_MODEL_DISPLAYED 81 # if(GLM_MODEL == GLM_MODEL_64) 82 # pragma message("GLM: 64 bits model") 83 # elif(GLM_MODEL == GLM_MODEL_32) 84 # pragma message("GLM: 32 bits model") 85 # endif//GLM_MODEL 86 #endif//GLM_MESSAGES 87 88 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_ARCH_DISPLAYED) 89 # define GLM_MESSAGE_ARCH_DISPLAYED 90 # if(GLM_ARCH == GLM_ARCH_PURE) 91 # pragma message("GLM: Platform independent code") 92 # elif(GLM_ARCH == GLM_ARCH_AVX2) 93 # pragma message("GLM: AVX2 instruction set") 94 # elif(GLM_ARCH == GLM_ARCH_AVX) 95 # pragma message("GLM: AVX instruction set") 96 # elif(GLM_ARCH == GLM_ARCH_SSE42) 97 # pragma message("GLM: SSE4.2 instruction set") 98 # elif(GLM_ARCH == GLM_ARCH_SSE41) 99 # pragma message("GLM: SSE4.1 instruction set") 100 # elif(GLM_ARCH == GLM_ARCH_SSSE3) 101 # pragma message("GLM: SSSE3 instruction set") 102 # elif(GLM_ARCH == GLM_ARCH_SSE3) 103 # pragma message("GLM: SSE3 instruction set") 104 # elif(GLM_ARCH == GLM_ARCH_SSE2) 105 # pragma message("GLM: SSE2 instruction set") 106 # elif(GLM_ARCH == GLM_ARCH_X86) 107 # pragma message("GLM: x86 instruction set") 108 # elif(GLM_ARCH == GLM_ARCH_NEON) 109 # pragma message("GLM: NEON instruction set") 110 # elif(GLM_ARCH == GLM_ARCH_ARM) 111 # pragma message("GLM: ARM instruction set") 112 # elif(GLM_ARCH == GLM_ARCH_MIPS) 113 # pragma message("GLM: MIPS instruction set") 114 # elif(GLM_ARCH == GLM_ARCH_PPC) 115 # pragma message("GLM: PowerPC architechture") 116 # endif//GLM_ARCH 117 #endif//GLM_MESSAGES 118 119 /////////////////////////////////////////////////////////////////////////////////// 120 // C++ Version 121 122 // User defines: GLM_FORCE_CXX98, GLM_FORCE_CXX03, GLM_FORCE_CXX11, GLM_FORCE_CXX14 123 124 #define GLM_LANG_CXX98_FLAG (1 << 1) 125 #define GLM_LANG_CXX03_FLAG (1 << 2) 126 #define GLM_LANG_CXX0X_FLAG (1 << 3) 127 #define GLM_LANG_CXX11_FLAG (1 << 4) 128 #define GLM_LANG_CXX1Y_FLAG (1 << 5) 129 #define GLM_LANG_CXX14_FLAG (1 << 6) 130 #define GLM_LANG_CXX1Z_FLAG (1 << 7) 131 #define GLM_LANG_CXXMS_FLAG (1 << 8) 132 #define GLM_LANG_CXXGNU_FLAG (1 << 9) 133 134 #define GLM_LANG_CXX98 GLM_LANG_CXX98_FLAG 135 #define GLM_LANG_CXX03 (GLM_LANG_CXX98 | GLM_LANG_CXX03_FLAG) 136 #define GLM_LANG_CXX0X (GLM_LANG_CXX03 | GLM_LANG_CXX0X_FLAG) 137 #define GLM_LANG_CXX11 (GLM_LANG_CXX0X | GLM_LANG_CXX11_FLAG) 138 #define GLM_LANG_CXX1Y (GLM_LANG_CXX11 | GLM_LANG_CXX1Y_FLAG) 139 #define GLM_LANG_CXX14 (GLM_LANG_CXX1Y | GLM_LANG_CXX14_FLAG) 140 #define GLM_LANG_CXX1Z (GLM_LANG_CXX14 | GLM_LANG_CXX1Z_FLAG) 141 #define GLM_LANG_CXXMS GLM_LANG_CXXMS_FLAG 142 #define GLM_LANG_CXXGNU GLM_LANG_CXXGNU_FLAG 143 144 #if defined(GLM_FORCE_CXX14) 145 # if((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER <= GLM_COMPILER_GCC50)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER <= GLM_COMPILER_CLANG34)) 146 # pragma message("GLM: Using GLM_FORCE_CXX14 with a compiler that doesn't fully support C++14") 147 # elif GLM_COMPILER & GLM_COMPILER_VC 148 # pragma message("GLM: Using GLM_FORCE_CXX14 but there is no known version of Visual C++ compiler that fully supports C++14") 149 # elif GLM_COMPILER & GLM_COMPILER_INTEL 150 # pragma message("GLM: Using GLM_FORCE_CXX14 but there is no known version of ICC compiler that fully supports C++14") 151 # endif 152 # define GLM_LANG GLM_LANG_CXX14 153 # define GLM_LANG_STL11_FORCED 154 #elif defined(GLM_FORCE_CXX11) 155 # if((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER <= GLM_COMPILER_GCC48)) || ((GLM_COMPILER & GLM_COMPILER_CLANG) && (GLM_COMPILER <= GLM_COMPILER_CLANG33)) 156 # pragma message("GLM: Using GLM_FORCE_CXX11 with a compiler that doesn't fully support C++11") 157 # elif GLM_COMPILER & GLM_COMPILER_VC 158 # pragma message("GLM: Using GLM_FORCE_CXX11 but there is no known version of Visual C++ compiler that fully supports C++11") 159 # elif GLM_COMPILER & GLM_COMPILER_INTEL 160 # pragma message("GLM: Using GLM_FORCE_CXX11 but there is no known version of ICC compiler that fully supports C++11") 161 # endif 162 # define GLM_LANG GLM_LANG_CXX11 163 # define GLM_LANG_STL11_FORCED 164 #elif defined(GLM_FORCE_CXX03) 165 # define GLM_LANG GLM_LANG_CXX03 166 #elif defined(GLM_FORCE_CXX98) 167 # define GLM_LANG GLM_LANG_CXX98 168 #else 169 # if GLM_COMPILER & GLM_COMPILER_CLANG 170 # if __cplusplus >= 201402L // GLM_COMPILER_CLANG34 + -std=c++14 171 # define GLM_LANG GLM_LANG_CXX14 172 # elif __has_feature(cxx_decltype_auto) && __has_feature(cxx_aggregate_nsdmi) // GLM_COMPILER_CLANG33 + -std=c++1y 173 # define GLM_LANG GLM_LANG_CXX1Y 174 # elif __cplusplus >= 201103L // GLM_COMPILER_CLANG33 + -std=c++11 175 # define GLM_LANG GLM_LANG_CXX11 176 # elif __has_feature(cxx_static_assert) // GLM_COMPILER_CLANG29 + -std=c++11 177 # define GLM_LANG GLM_LANG_CXX0X 178 # elif __cplusplus >= 199711L 179 # define GLM_LANG GLM_LANG_CXX98 180 # else 181 # define GLM_LANG GLM_LANG_CXX 182 # endif 183 # elif GLM_COMPILER & GLM_COMPILER_GCC 184 # if __cplusplus >= 201402L 185 # define GLM_LANG GLM_LANG_CXX14 186 # elif __cplusplus >= 201103L 187 # define GLM_LANG GLM_LANG_CXX11 188 # elif defined(__GXX_EXPERIMENTAL_CXX0X__) 189 # define GLM_LANG GLM_LANG_CXX0X 190 # else 191 # define GLM_LANG GLM_LANG_CXX98 192 # endif 193 # elif GLM_COMPILER & GLM_COMPILER_VC 194 # ifdef _MSC_EXTENSIONS 195 # if __cplusplus >= 201402L 196 # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_CXXMS_FLAG) 197 //# elif GLM_COMPILER >= GLM_COMPILER_VC14 198 //# define GLM_LANG (GLM_LANG_CXX1Y | GLM_LANG_CXXMS_FLAG) 199 # elif __cplusplus >= 201103L 200 # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_CXXMS_FLAG) 201 # elif GLM_COMPILER >= GLM_COMPILER_VC10 202 # define GLM_LANG (GLM_LANG_CXX0X | GLM_LANG_CXXMS_FLAG) 203 # elif __cplusplus >= 199711L 204 # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) 205 # else 206 # define GLM_LANG (GLM_LANG_CXX | GLM_LANG_CXXMS_FLAG) 207 # endif 208 # else 209 # if __cplusplus >= 201402L 210 # define GLM_LANG GLM_LANG_CXX14 211 # elif __cplusplus >= 201103L 212 # define GLM_LANG GLM_LANG_CXX11 213 # elif GLM_COMPILER >= GLM_COMPILER_VC10 214 # define GLM_LANG GLM_LANG_CXX0X 215 # elif __cplusplus >= 199711L 216 # define GLM_LANG GLM_LANG_CXX98 217 # else 218 # define GLM_LANG GLM_LANG_CXX 219 # endif 220 # endif 221 # elif GLM_COMPILER & GLM_COMPILER_INTEL 222 # ifdef _MSC_EXTENSIONS 223 # define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG 224 # else 225 # define GLM_MSC_EXT 0 226 # endif 227 # if __cplusplus >= 201402L 228 # define GLM_LANG (GLM_LANG_CXX14 | GLM_MSC_EXT) 229 # elif __cplusplus >= 201103L 230 # define GLM_LANG (GLM_LANG_CXX11 | GLM_MSC_EXT) 231 # elif __INTEL_CXX11_MODE__ 232 # define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT) 233 # elif __cplusplus >= 199711L 234 # define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT) 235 # else 236 # define GLM_LANG (GLM_LANG_CXX | GLM_MSC_EXT) 237 # endif 238 # elif GLM_COMPILER & GLM_COMPILER_CUDA 239 # ifdef _MSC_EXTENSIONS 240 # define GLM_MSC_EXT GLM_LANG_CXXMS_FLAG 241 # else 242 # define GLM_MSC_EXT 0 243 # endif 244 # if GLM_COMPILER >= GLM_COMPILER_CUDA75 245 # define GLM_LANG (GLM_LANG_CXX0X | GLM_MSC_EXT) 246 # else 247 # define GLM_LANG (GLM_LANG_CXX98 | GLM_MSC_EXT) 248 # endif 249 # else // Unknown compiler 250 # if __cplusplus >= 201402L 251 # define GLM_LANG GLM_LANG_CXX14 252 # elif __cplusplus >= 201103L 253 # define GLM_LANG GLM_LANG_CXX11 254 # elif __cplusplus >= 199711L 255 # define GLM_LANG GLM_LANG_CXX98 256 # else 257 # define GLM_LANG GLM_LANG_CXX // Good luck with that! 258 # endif 259 # ifndef GLM_FORCE_PURE 260 # define GLM_FORCE_PURE 261 # endif 262 # endif 263 #endif 264 265 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_LANG_DISPLAYED) 266 # define GLM_MESSAGE_LANG_DISPLAYED 267 268 # if GLM_LANG & GLM_LANG_CXX1Z_FLAG 269 # pragma message("GLM: C++1z") 270 # elif GLM_LANG & GLM_LANG_CXX14_FLAG 271 # pragma message("GLM: C++14") 272 # elif GLM_LANG & GLM_LANG_CXX1Y_FLAG 273 # pragma message("GLM: C++1y") 274 # elif GLM_LANG & GLM_LANG_CXX11_FLAG 275 # pragma message("GLM: C++11") 276 # elif GLM_LANG & GLM_LANG_CXX0X_FLAG 277 # pragma message("GLM: C++0x") 278 # elif GLM_LANG & GLM_LANG_CXX03_FLAG 279 # pragma message("GLM: C++03") 280 # elif GLM_LANG & GLM_LANG_CXX98_FLAG 281 # pragma message("GLM: C++98") 282 # else 283 # pragma message("GLM: C++ language undetected") 284 # endif//GLM_LANG 285 286 # if GLM_LANG & (GLM_LANG_CXXGNU_FLAG | GLM_LANG_CXXMS_FLAG) 287 # pragma message("GLM: Language extensions enabled") 288 # endif//GLM_LANG 289 #endif//GLM_MESSAGES 290 291 /////////////////////////////////////////////////////////////////////////////////// 292 // Has of C++ features 293 294 // http://clang.llvm.org/cxx_status.html 295 // http://gcc.gnu.org/projects/cxx0x.html 296 // http://msdn.microsoft.com/en-us/library/vstudio/hh567368(v=vs.120).aspx 297 298 // Android has multiple STLs but C++11 STL detection doesn't always work #284 #564 299 #if GLM_PLATFORM == GLM_PLATFORM_ANDROID && !defined(GLM_LANG_STL11_FORCED) 300 # define GLM_HAS_CXX11_STL 0 301 #elif GLM_COMPILER & GLM_COMPILER_CLANG 302 # if (defined(_LIBCPP_VERSION) && GLM_LANG & GLM_LANG_CXX11_FLAG) || defined(GLM_LANG_STL11_FORCED) 303 # define GLM_HAS_CXX11_STL 1 304 # else 305 # define GLM_HAS_CXX11_STL 0 306 # endif 307 #else 308 # define GLM_HAS_CXX11_STL ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 309 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ 310 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ 311 ((GLM_PLATFORM != GLM_PLATFORM_WINDOWS) && (GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)))) 312 #endif 313 314 // N1720 315 #if GLM_COMPILER & GLM_COMPILER_CLANG 316 # define GLM_HAS_STATIC_ASSERT __has_feature(cxx_static_assert) 317 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 318 # define GLM_HAS_STATIC_ASSERT 1 319 #else 320 # define GLM_HAS_STATIC_ASSERT ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 321 ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ 322 ((GLM_COMPILER & GLM_COMPILER_CUDA)) || \ 323 ((GLM_COMPILER & GLM_COMPILER_VC)))) 324 #endif 325 326 // N1988 327 #if GLM_LANG & GLM_LANG_CXX11_FLAG 328 # define GLM_HAS_EXTENDED_INTEGER_TYPE 1 329 #else 330 # define GLM_HAS_EXTENDED_INTEGER_TYPE (\ 331 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \ 332 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CUDA)) || \ 333 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC)) || \ 334 ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_CLANG))) 335 #endif 336 337 // N2235 338 #if GLM_COMPILER & GLM_COMPILER_CLANG 339 # define GLM_HAS_CONSTEXPR __has_feature(cxx_constexpr) 340 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR 341 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 342 # define GLM_HAS_CONSTEXPR 1 343 # define GLM_HAS_CONSTEXPR_PARTIAL GLM_HAS_CONSTEXPR 344 #else 345 # define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 346 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \ 347 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)))) // GCC 4.6 support constexpr but there is a compiler bug causing a crash 348 # define GLM_HAS_CONSTEXPR_PARTIAL (GLM_HAS_CONSTEXPR || ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14))) 349 #endif 350 351 // N2672 352 #if GLM_COMPILER & GLM_COMPILER_CLANG 353 # define GLM_HAS_INITIALIZER_LISTS __has_feature(cxx_generalized_initializers) 354 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 355 # define GLM_HAS_INITIALIZER_LISTS 1 356 #else 357 # define GLM_HAS_INITIALIZER_LISTS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 358 ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ 359 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ 360 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75)))) 361 #endif 362 363 // N2544 Unrestricted unions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf 364 #if GLM_COMPILER & GLM_COMPILER_CLANG 365 # define GLM_HAS_UNRESTRICTED_UNIONS __has_feature(cxx_unrestricted_unions) 366 #elif GLM_LANG & (GLM_LANG_CXX11_FLAG | GLM_LANG_CXXMS_FLAG) 367 # define GLM_HAS_UNRESTRICTED_UNIONS 1 368 #else 369 # define GLM_HAS_UNRESTRICTED_UNIONS (GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 370 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)) || \ 371 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA75)) || \ 372 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46))) 373 #endif 374 375 // N2346 376 #if defined(GLM_FORCE_UNRESTRICTED_GENTYPE) 377 # define GLM_HAS_DEFAULTED_FUNCTIONS 0 378 #elif GLM_COMPILER & GLM_COMPILER_CLANG 379 # define GLM_HAS_DEFAULTED_FUNCTIONS __has_feature(cxx_defaulted_functions) 380 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 381 # define GLM_HAS_DEFAULTED_FUNCTIONS 1 382 #else 383 # define GLM_HAS_DEFAULTED_FUNCTIONS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 384 ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ 385 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ 386 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12)) || \ 387 (GLM_COMPILER & GLM_COMPILER_CUDA))) 388 #endif 389 390 // N2118 391 #if GLM_COMPILER & GLM_COMPILER_CLANG 392 # define GLM_HAS_RVALUE_REFERENCES __has_feature(cxx_rvalue_references) 393 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 394 # define GLM_HAS_RVALUE_REFERENCES 1 395 #else 396 # define GLM_HAS_RVALUE_REFERENCES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 397 ((GLM_COMPILER & GLM_COMPILER_GCC)) || \ 398 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \ 399 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) 400 #endif 401 402 // N2437 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf 403 #if GLM_COMPILER & GLM_COMPILER_CLANG 404 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS __has_feature(cxx_explicit_conversions) 405 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 406 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS 1 407 #else 408 # define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 409 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \ 410 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14)) || \ 411 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ 412 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) 413 #endif 414 415 // N2258 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf 416 #if GLM_COMPILER & GLM_COMPILER_CLANG 417 # define GLM_HAS_TEMPLATE_ALIASES __has_feature(cxx_alias_templates) 418 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 419 # define GLM_HAS_TEMPLATE_ALIASES 1 420 #else 421 # define GLM_HAS_TEMPLATE_ALIASES ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 422 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL12_1)) || \ 423 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC47)) || \ 424 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ 425 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) 426 #endif 427 428 // N2930 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html 429 #if GLM_COMPILER & GLM_COMPILER_CLANG 430 # define GLM_HAS_RANGE_FOR __has_feature(cxx_range_for) 431 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 432 # define GLM_HAS_RANGE_FOR 1 433 #else 434 # define GLM_HAS_RANGE_FOR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 435 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ 436 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL13)) || \ 437 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11)) || \ 438 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) 439 #endif 440 441 // N2341 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf 442 #if GLM_COMPILER & GLM_COMPILER_CLANG 443 # define GLM_HAS_ALIGNOF __has_feature(c_alignof) 444 #elif GLM_LANG & GLM_LANG_CXX11_FLAG 445 # define GLM_HAS_ALIGNOF 1 446 #else 447 # define GLM_HAS_ALIGNOF ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 448 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC48)) || \ 449 ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL15)) || \ 450 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14)) || \ 451 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA70)))) 452 #endif 453 454 #define GLM_HAS_ONLY_XYZW ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER < GLM_COMPILER_GCC46)) 455 #if GLM_HAS_ONLY_XYZW 456 # pragma message("GLM: GCC older than 4.6 has a bug presenting the use of rgba and stpq components") 457 #endif 458 459 // 460 #if GLM_LANG & GLM_LANG_CXX11_FLAG 461 # define GLM_HAS_ASSIGNABLE 1 462 #else 463 # define GLM_HAS_ASSIGNABLE ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 464 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15)) || \ 465 ((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))) 466 #endif 467 468 // 469 #define GLM_HAS_TRIVIAL_QUERIES 0 470 471 // 472 #if GLM_LANG & GLM_LANG_CXX11_FLAG 473 # define GLM_HAS_MAKE_SIGNED 1 474 #else 475 # define GLM_HAS_MAKE_SIGNED ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (\ 476 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)) || \ 477 ((GLM_COMPILER & GLM_COMPILER_CUDA) && (GLM_COMPILER >= GLM_COMPILER_CUDA50)))) 478 #endif 479 480 #if GLM_ARCH == GLM_ARCH_PURE 481 # define GLM_HAS_BITSCAN_WINDOWS 0 482 #else 483 # define GLM_HAS_BITSCAN_WINDOWS ((GLM_PLATFORM & GLM_PLATFORM_WINDOWS) && (\ 484 ((GLM_COMPILER & GLM_COMPILER_INTEL)) || \ 485 ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC14) && (GLM_ARCH & GLM_ARCH_X86_BIT)))) 486 #endif 487 488 // OpenMP 489 #ifdef _OPENMP 490 # if GLM_COMPILER & GLM_COMPILER_GCC 491 # if GLM_COMPILER >= GLM_COMPILER_GCC61 492 # define GLM_HAS_OPENMP 45 493 # elif GLM_COMPILER >= GLM_COMPILER_GCC49 494 # define GLM_HAS_OPENMP 40 495 # elif GLM_COMPILER >= GLM_COMPILER_GCC47 496 # define GLM_HAS_OPENMP 31 497 # elif GLM_COMPILER >= GLM_COMPILER_GCC44 498 # define GLM_HAS_OPENMP 30 499 # elif GLM_COMPILER >= GLM_COMPILER_GCC42 500 # define GLM_HAS_OPENMP 25 501 # else 502 # define GLM_HAS_OPENMP 0 503 # endif 504 # elif GLM_COMPILER & GLM_COMPILER_CLANG 505 # if GLM_COMPILER >= GLM_COMPILER_CLANG38 506 # define GLM_HAS_OPENMP 31 507 # else 508 # define GLM_HAS_OPENMP 0 509 # endif 510 # elif GLM_COMPILER & GLM_COMPILER_VC 511 # if GLM_COMPILER >= GLM_COMPILER_VC10 512 # define GLM_HAS_OPENMP 20 513 # else 514 # define GLM_HAS_OPENMP 0 515 # endif 516 # elif GLM_COMPILER & GLM_COMPILER_INTEL 517 # if GLM_COMPILER >= GLM_COMPILER_INTEL16 518 # define GLM_HAS_OPENMP 40 519 # elif GLM_COMPILER >= GLM_COMPILER_INTEL12 520 # define GLM_HAS_OPENMP 31 521 # else 522 # define GLM_HAS_OPENMP 0 523 # endif 524 # else 525 # define GLM_HAS_OPENMP 0 526 # endif// GLM_COMPILER & GLM_COMPILER_VC 527 #endif 528 529 /////////////////////////////////////////////////////////////////////////////////// 530 // Static assert 531 532 #if GLM_HAS_STATIC_ASSERT 533 # define GLM_STATIC_ASSERT(x, message) static_assert(x, message) 534 #elif defined(BOOST_STATIC_ASSERT) 535 # define GLM_STATIC_ASSERT(x, message) BOOST_STATIC_ASSERT(x) 536 #elif GLM_COMPILER & GLM_COMPILER_VC 537 # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1] 538 #else 539 # define GLM_STATIC_ASSERT(x, message) 540 # define GLM_STATIC_ASSERT_NULL 541 #endif//GLM_LANG 542 543 /////////////////////////////////////////////////////////////////////////////////// 544 // Qualifiers 545 546 #if GLM_COMPILER & GLM_COMPILER_CUDA 547 # define GLM_CUDA_FUNC_DEF __device__ __host__ 548 # define GLM_CUDA_FUNC_DECL __device__ __host__ 549 #else 550 # define GLM_CUDA_FUNC_DEF 551 # define GLM_CUDA_FUNC_DECL 552 #endif 553 554 #if GLM_COMPILER & GLM_COMPILER_GCC 555 # define GLM_VAR_USED __attribute__ ((unused)) 556 #else 557 # define GLM_VAR_USED 558 #endif 559 560 #if defined(GLM_FORCE_INLINE) 561 # if GLM_COMPILER & GLM_COMPILER_VC 562 # define GLM_INLINE __forceinline 563 # define GLM_NEVER_INLINE __declspec((noinline)) 564 # elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG) 565 # define GLM_INLINE inline __attribute__((__always_inline__)) 566 # define GLM_NEVER_INLINE __attribute__((__noinline__)) 567 # elif GLM_COMPILER & GLM_COMPILER_CUDA 568 # define GLM_INLINE __forceinline__ 569 # define GLM_NEVER_INLINE __noinline__ 570 # else 571 # define GLM_INLINE inline 572 # define GLM_NEVER_INLINE 573 # endif//GLM_COMPILER 574 #else 575 # define GLM_INLINE inline 576 # define GLM_NEVER_INLINE 577 #endif//defined(GLM_FORCE_INLINE) 578 579 #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL 580 #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE 581 582 /////////////////////////////////////////////////////////////////////////////////// 583 // Swizzle operators 584 585 // User defines: GLM_FORCE_SWIZZLE 586 587 #ifdef GLM_SWIZZLE 588 # pragma message("GLM: GLM_SWIZZLE is deprecated, use GLM_FORCE_SWIZZLE instead") 589 #endif 590 591 #define GLM_SWIZZLE_ENABLED 1 592 #define GLM_SWIZZLE_DISABLE 0 593 594 #if defined(GLM_FORCE_SWIZZLE) || defined(GLM_SWIZZLE) 595 # undef GLM_SWIZZLE 596 # define GLM_SWIZZLE GLM_SWIZZLE_ENABLED 597 #else 598 # undef GLM_SWIZZLE 599 # define GLM_SWIZZLE GLM_SWIZZLE_DISABLE 600 #endif 601 602 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_SWIZZLE_DISPLAYED) 603 # define GLM_MESSAGE_SWIZZLE_DISPLAYED 604 # if GLM_SWIZZLE == GLM_SWIZZLE_ENABLED 605 # pragma message("GLM: Swizzling operators enabled") 606 # else 607 # pragma message("GLM: Swizzling operators disabled, #define GLM_SWIZZLE to enable swizzle operators") 608 # endif 609 #endif//GLM_MESSAGES 610 611 /////////////////////////////////////////////////////////////////////////////////// 612 // Allows using not basic types as genType 613 614 // #define GLM_FORCE_UNRESTRICTED_GENTYPE 615 616 #ifdef GLM_FORCE_UNRESTRICTED_GENTYPE 617 # define GLM_UNRESTRICTED_GENTYPE 1 618 #else 619 # define GLM_UNRESTRICTED_GENTYPE 0 620 #endif 621 622 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED) 623 # define GLM_MESSAGE_UNRESTRICTED_GENTYPE_DISPLAYED 624 # ifdef GLM_FORCE_UNRESTRICTED_GENTYPE 625 # pragma message("GLM: Use unrestricted genType") 626 # endif 627 #endif//GLM_MESSAGES 628 629 /////////////////////////////////////////////////////////////////////////////////// 630 // Clip control 631 632 #ifdef GLM_DEPTH_ZERO_TO_ONE // Legacy 0.9.8 development 633 # error Define GLM_FORCE_DEPTH_ZERO_TO_ONE instead of GLM_DEPTH_ZERO_TO_ONE to use 0 to 1 clip space. 634 #endif 635 636 #define GLM_DEPTH_ZERO_TO_ONE 0x00000001 637 #define GLM_DEPTH_NEGATIVE_ONE_TO_ONE 0x00000002 638 639 #ifdef GLM_FORCE_DEPTH_ZERO_TO_ONE 640 # define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_ZERO_TO_ONE 641 #else 642 # define GLM_DEPTH_CLIP_SPACE GLM_DEPTH_NEGATIVE_ONE_TO_ONE 643 #endif 644 645 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_DEPTH_DISPLAYED) 646 # define GLM_MESSAGE_DEPTH_DISPLAYED 647 # if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE 648 # pragma message("GLM: Depth clip space: Zero to one") 649 # else 650 # pragma message("GLM: Depth clip space: negative one to one") 651 # endif 652 #endif//GLM_MESSAGES 653 654 /////////////////////////////////////////////////////////////////////////////////// 655 // Coordinate system, define GLM_FORCE_LEFT_HANDED before including GLM 656 // to use left handed coordinate system by default. 657 658 #ifdef GLM_LEFT_HANDED // Legacy 0.9.8 development 659 # error Define GLM_FORCE_LEFT_HANDED instead of GLM_LEFT_HANDED left handed coordinate system by default. 660 #endif 661 662 #define GLM_LEFT_HANDED 0x00000001 // For DirectX, Metal, Vulkan 663 #define GLM_RIGHT_HANDED 0x00000002 // For OpenGL, default in GLM 664 665 #ifdef GLM_FORCE_LEFT_HANDED 666 # define GLM_COORDINATE_SYSTEM GLM_LEFT_HANDED 667 #else 668 # define GLM_COORDINATE_SYSTEM GLM_RIGHT_HANDED 669 #endif 670 671 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_HANDED_DISPLAYED) 672 # define GLM_MESSAGE_HANDED_DISPLAYED 673 # if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED 674 # pragma message("GLM: Coordinate system: left handed") 675 # else 676 # pragma message("GLM: Coordinate system: right handed") 677 # endif 678 #endif//GLM_MESSAGES 679 680 /////////////////////////////////////////////////////////////////////////////////// 681 // Qualifiers 682 683 #if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)) 684 # define GLM_DEPRECATED __declspec(deprecated) 685 # define GLM_ALIGN(x) __declspec(align(x)) 686 # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x)) 687 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name 688 # define GLM_RESTRICT_FUNC __declspec(restrict) 689 # define GLM_RESTRICT __restrict 690 # if GLM_COMPILER >= GLM_COMPILER_VC12 691 # define GLM_VECTOR_CALL __vectorcall 692 # else 693 # define GLM_VECTOR_CALL 694 # endif 695 #elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL) 696 # define GLM_DEPRECATED __attribute__((__deprecated__)) 697 # define GLM_ALIGN(x) __attribute__((aligned(x))) 698 # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) 699 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __attribute__((aligned(alignment))) 700 # define GLM_RESTRICT_FUNC __restrict__ 701 # define GLM_RESTRICT __restrict__ 702 # if GLM_COMPILER & GLM_COMPILER_CLANG 703 # if GLM_COMPILER >= GLM_COMPILER_CLANG37 704 # define GLM_VECTOR_CALL __vectorcall 705 # else 706 # define GLM_VECTOR_CALL 707 # endif 708 # else 709 # define GLM_VECTOR_CALL 710 # endif 711 #elif GLM_COMPILER & GLM_COMPILER_CUDA 712 # define GLM_DEPRECATED 713 # define GLM_ALIGN(x) __align__(x) 714 # define GLM_ALIGNED_STRUCT(x) struct __align__(x) 715 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x) 716 # define GLM_RESTRICT_FUNC __restrict__ 717 # define GLM_RESTRICT __restrict__ 718 # define GLM_VECTOR_CALL 719 #else 720 # define GLM_DEPRECATED 721 # define GLM_ALIGN 722 # define GLM_ALIGNED_STRUCT(x) struct 723 # define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name 724 # define GLM_RESTRICT_FUNC 725 # define GLM_RESTRICT 726 # define GLM_VECTOR_CALL 727 #endif//GLM_COMPILER 728 729 #if GLM_HAS_DEFAULTED_FUNCTIONS 730 # define GLM_DEFAULT = default 731 # ifdef GLM_FORCE_NO_CTOR_INIT 732 # define GLM_DEFAULT_CTOR = default 733 # else 734 # define GLM_DEFAULT_CTOR 735 # endif 736 #else 737 # define GLM_DEFAULT 738 # define GLM_DEFAULT_CTOR 739 #endif 740 741 #if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL 742 # define GLM_CONSTEXPR constexpr 743 # if GLM_COMPILER & GLM_COMPILER_VC // Visual C++ has a bug #594 https://github.com/g-truc/glm/issues/594 744 # define GLM_CONSTEXPR_CTOR 745 # else 746 # define GLM_CONSTEXPR_CTOR constexpr 747 # endif 748 #else 749 # define GLM_CONSTEXPR 750 # define GLM_CONSTEXPR_CTOR 751 #endif 752 753 #if GLM_HAS_CONSTEXPR 754 # define GLM_RELAXED_CONSTEXPR constexpr 755 #else 756 # define GLM_RELAXED_CONSTEXPR const 757 #endif 758 759 #if GLM_ARCH == GLM_ARCH_PURE 760 # define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR_CTOR 761 #else 762 # define GLM_CONSTEXPR_SIMD 763 #endif 764 765 #ifdef GLM_FORCE_EXPLICIT_CTOR 766 # define GLM_EXPLICIT explicit 767 #else 768 # define GLM_EXPLICIT 769 #endif 770 771 /////////////////////////////////////////////////////////////////////////////////// 772 773 #define GLM_HAS_ALIGNED_TYPE GLM_HAS_UNRESTRICTED_UNIONS 774 775 /////////////////////////////////////////////////////////////////////////////////// 776 // Length type 777 778 // User defines: GLM_FORCE_SIZE_T_LENGTH GLM_FORCE_SIZE_FUNC 779 780 namespace glm 781 { 782 using std::size_t; 783 # if defined(GLM_FORCE_SIZE_T_LENGTH) 784 typedef size_t length_t; 785 # else 786 typedef int length_t; 787 # endif 788 }//namespace glm 789 790 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_MESSAGE_FORCE_SIZE_T_LENGTH) 791 # define GLM_MESSAGE_FORCE_SIZE_T_LENGTH 792 # if defined GLM_FORCE_SIZE_T_LENGTH 793 # pragma message("GLM: .length() returns glm::length_t, a typedef of std::size_t") 794 # else 795 # pragma message("GLM: .length() returns glm::length_t, a typedef of int following the GLSL specification") 796 # endif 797 #endif//GLM_MESSAGES 798 799 /////////////////////////////////////////////////////////////////////////////////// 800 // countof 801 802 #ifndef __has_feature 803 # define __has_feature(x) 0 // Compatibility with non-clang compilers. 804 #endif 805 806 #if GLM_HAS_CONSTEXPR_PARTIAL 807 namespace glm 808 { 809 template <typename T, std::size_t N> countof(T const (&)[N])810 constexpr std::size_t countof(T const (&)[N]) 811 { 812 return N; 813 } 814 }//namespace glm 815 # define GLM_COUNTOF(arr) glm::countof(arr) 816 #elif defined(_MSC_VER) 817 # define GLM_COUNTOF(arr) _countof(arr) 818 #else 819 # define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0]) 820 #endif 821 822 /////////////////////////////////////////////////////////////////////////////////// 823 // Uninitialize constructors 824 825 namespace glm 826 { 827 enum ctor{uninitialize}; 828 }//namespace glm 829