Clarify the support of constexpr
This commit is contained in:
parent
bde7af55b1
commit
2fdc2dc748
@ -274,12 +274,14 @@
|
||||
|
||||
// N2235 Generalized Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
|
||||
// N3652 Extended Constant Expressions http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html
|
||||
#if (GLM_COMPILER & GLM_COMPILER_CLANG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT)
|
||||
#if (GLM_ARCH & GLM_ARCH_SIMD_BIT) // Compiler SIMD intrinsics don't support constexpr...
|
||||
# define GLM_HAS_CONSTEXPR 0
|
||||
#elif (GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
# define GLM_HAS_CONSTEXPR __has_feature(cxx_relaxed_constexpr)
|
||||
#elif (GLM_LANG & GLM_LANG_CXX14_FLAG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT)
|
||||
#elif (GLM_LANG & GLM_LANG_CXX14_FLAG)
|
||||
# define GLM_HAS_CONSTEXPR 1
|
||||
#else
|
||||
# define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && !(GLM_ARCH & GLM_ARCH_SIMD_BIT) && GLM_HAS_INITIALIZER_LISTS && (\
|
||||
# define GLM_HAS_CONSTEXPR ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && GLM_HAS_INITIALIZER_LISTS && (\
|
||||
((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL17)) || \
|
||||
((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC15))))
|
||||
#endif
|
||||
|
@ -390,12 +390,14 @@ For example, if a program is compiled with Visual Studio using `/arch:AVX`, GLM
|
||||
It’s possible to avoid the instruction set detection by forcing the use of a specific instruction set with one of the fallowing define:
|
||||
`GLM_FORCE_SSE2`, `GLM_FORCE_SSE3`, `GLM_FORCE_SSSE3`, `GLM_FORCE_SSE41`, `GLM_FORCE_SSE42`, `GLM_FORCE_AVX`, `GLM_FORCE_AVX2` or `GLM_FORCE_AVX512`.
|
||||
|
||||
The use of intrinsic functions by GLM implementation can be avoided using the define `GLM_FORCE_PURE` before any inclusion of GLM headers.
|
||||
The use of intrinsic functions by GLM implementation can be avoided using the define `GLM_FORCE_PURE` before any inclusion of GLM headers. This can be particularly useful if we want to rely on C++14 `constexpr`.
|
||||
|
||||
```cpp
|
||||
#define GLM_FORCE_PURE
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
static_assert(glm::vec4::length() == 4, "Using GLM C++ 14 constexpr support for compile time tests");
|
||||
|
||||
// GLM code will be compiled using pure C++ code without any intrinsics
|
||||
```
|
||||
|
||||
|
@ -67,6 +67,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
|
||||
- Added identity functions #765
|
||||
- Splitted headers into EXT extensions to improve compilation time #670
|
||||
- Added separated performance tests
|
||||
- Refactor manual, lists all configuration defines
|
||||
|
||||
#### Fixes:
|
||||
- Fixed SIMD detection on Clang and GCC
|
||||
|
Loading…
Reference in New Issue
Block a user