diff --git a/CMakeLists.txt b/CMakeLists.txt index 10bb1af0..2325ebf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,7 +245,17 @@ add_subdirectory(test) set(GLM_INSTALL_CONFIGDIR "${CMAKE_INSTALL_LIBDIR}/cmake/glm") install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +# CMake automatically adds an architecture compatibility check to make sure +# 32 and 64 bit code is not accidentally mixed. For a header-only library this +# is not required. The check can be disabled by temporarily unsetting +# CMAKE_SIZEOF_VOID_P. In CMake 3.14 and later this can be achieved more cleanly +# with write_basic_package_version_file(ARCH_INDEPENDENT). +# TODO: Use this once a newer CMake can be required. +set(GLM_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) +unset(CMAKE_SIZEOF_VOID_P) write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake" VERSION ${GLM_VERSION} COMPATIBILITY AnyNewerVersion) +set(CMAKE_SIZEOF_VOID_P ${GLM_SIZEOF_VOID_P}) # build tree package config configure_file(cmake/glmBuildConfig.cmake.in glmConfig.cmake @ONLY) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index b987de63..85b9ae73 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -259,7 +259,7 @@ namespace detail { GLM_FUNC_QUALIFIER static vec call(vec const& edge0, vec const& edge1, vec const& x) { - GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'step' only accept floating-point inputs"); + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs"); vec const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast(0), static_cast(1))); return tmp * tmp * (static_cast(3) - static_cast(2) * tmp); } diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index d59808e7..87d2ffc9 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -119,7 +119,7 @@ # define GLM_LANG (GLM_LANG_CXX2A | GLM_LANG_EXT) # elif __cplusplus == 201703L || GLM_LANG_PLATFORM == 201703L # define GLM_LANG (GLM_LANG_CXX17 | GLM_LANG_EXT) -# elif __cplusplus == 201402L || GLM_LANG_PLATFORM == 201402L +# elif __cplusplus == 201402L || __cplusplus == 201500L || GLM_LANG_PLATFORM == 201402L # define GLM_LANG (GLM_LANG_CXX14 | GLM_LANG_EXT) # elif __cplusplus == 201103L || GLM_LANG_PLATFORM == 201103L # define GLM_LANG (GLM_LANG_CXX11 | GLM_LANG_EXT) @@ -298,7 +298,7 @@ # if (GLM_COMPILER & GLM_COMPILER_CLANG) # define GLM_HAS_IF_CONSTEXPR __has_feature(cxx_if_constexpr) # elif (GLM_COMPILER & GLM_COMPILER_GCC) -# define GLM_HAS_IF_CONSTEXPR GLM_COMPILER >= GLM_COMPILER_GCC7 +# define GLM_HAS_IF_CONSTEXPR (__cplusplus >= 201703L) # elif (GLM_LANG & GLM_LANG_CXX17_FLAG) # define GLM_HAS_IF_CONSTEXPR 1 # else @@ -529,6 +529,48 @@ # define GLM_EXPLICIT #endif +/////////////////////////////////////////////////////////////////////////////////// +// SYCL + +#if GLM_COMPILER==GLM_COMPILER_SYCL + +#include +#include + +namespace glm { +namespace std { + // Import SYCL's functions into the namespace glm::std to force their usages. + // It's important to use the math built-in function (sin, exp, ...) + // of SYCL instead the std ones. + using namespace cl::sycl; + + /////////////////////////////////////////////////////////////////////////////// + // Import some "harmless" std's stuffs used by glm into + // the new glm::std namespace. + template + using numeric_limits = ::std::numeric_limits; + + using ::std::size_t; + + using ::std::uint8_t; + using ::std::uint16_t; + using ::std::uint32_t; + using ::std::uint64_t; + + using ::std::int8_t; + using ::std::int16_t; + using ::std::int32_t; + using ::std::int64_t; + + using ::std::make_unsigned; + /////////////////////////////////////////////////////////////////////////////// +} //namespace std +} //namespace glm + +#endif + +/////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////// // Length type: all length functions returns a length_t type. // When GLM_FORCE_SIZE_T_LENGTH is defined, length_t is a typedef of size_t otherwise diff --git a/glm/ext/vector_double1.hpp b/glm/ext/vector_double1.hpp index ef12def4..38826677 100644 --- a/glm/ext/vector_double1.hpp +++ b/glm/ext/vector_double1.hpp @@ -16,7 +16,7 @@ #include "../detail/type_vec1.hpp" #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) -# pragma message("GLM: GLM_EXT_vector_dvec1 extension included") +# pragma message("GLM: GLM_EXT_vector_double1 extension included") #endif namespace glm diff --git a/glm/gtc/packing.hpp b/glm/gtc/packing.hpp index 28523952..7c64aba3 100644 --- a/glm/gtc/packing.hpp +++ b/glm/gtc/packing.hpp @@ -601,7 +601,7 @@ namespace glm - /// Convert each component from an integer vector into a packed unsigned integer. + /// Convert each component from an integer vector into a packed integer. /// /// @see gtc_packing /// @see i8vec2 unpackInt2x8(int16 p) @@ -625,7 +625,7 @@ namespace glm /// @see uint16 packInt2x8(u8vec2 const& v) GLM_FUNC_DECL u8vec2 unpackUint2x8(uint16 p); - /// Convert each component from an integer vector into a packed unsigned integer. + /// Convert each component from an integer vector into a packed integer. /// /// @see gtc_packing /// @see i8vec4 unpackInt4x8(int32 p) @@ -649,7 +649,7 @@ namespace glm /// @see uint32 packUint4x8(u8vec2 const& v) GLM_FUNC_DECL u8vec4 unpackUint4x8(uint32 p); - /// Convert each component from an integer vector into a packed unsigned integer. + /// Convert each component from an integer vector into a packed integer. /// /// @see gtc_packing /// @see i16vec2 unpackInt2x16(int p) @@ -661,7 +661,7 @@ namespace glm /// @see int packInt2x16(i16vec2 const& v) GLM_FUNC_DECL i16vec2 unpackInt2x16(int p); - /// Convert each component from an integer vector into a packed unsigned integer. + /// Convert each component from an integer vector into a packed integer. /// /// @see gtc_packing /// @see i16vec4 unpackInt4x16(int64 p) @@ -697,7 +697,7 @@ namespace glm /// @see uint64 packUint4x16(u16vec4 const& v) GLM_FUNC_DECL u16vec4 unpackUint4x16(uint64 p); - /// Convert each component from an integer vector into a packed unsigned integer. + /// Convert each component from an integer vector into a packed integer. /// /// @see gtc_packing /// @see i32vec2 unpackInt2x32(int p) diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl index de10a409..70485098 100644 --- a/glm/gtc/random.inl +++ b/glm/gtc/random.inl @@ -228,7 +228,7 @@ namespace detail w = x1 * x1 + x2 * x2; } while(w > genType(1)); - return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean; + return static_cast(x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean); } template diff --git a/glm/gtx/hash.hpp b/glm/gtx/hash.hpp index 93b1bc2d..05dae9f4 100644 --- a/glm/gtx/hash.hpp +++ b/glm/gtx/hash.hpp @@ -73,9 +73,9 @@ namespace std }; template - struct hash> + struct hash> { - GLM_FUNC_DECL size_t operator()(glm::tquat const& q) const; + GLM_FUNC_DECL size_t operator()(glm::qua const& q) const; }; template diff --git a/glm/gtx/hash.inl b/glm/gtx/hash.inl index 64443ef8..ff71ca9f 100644 --- a/glm/gtx/hash.inl +++ b/glm/gtx/hash.inl @@ -62,7 +62,7 @@ namespace std } template - GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tquat const& q) const + GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::qua const& q) const { size_t seed = 0; hash hasher; @@ -77,7 +77,7 @@ namespace std GLM_FUNC_QUALIFIER size_t hash>::operator()(glm::tdualquat const& q) const { size_t seed = 0; - hash> hasher; + hash> hasher; glm::detail::hash_combine(seed, hasher(q.real)); glm::detail::hash_combine(seed, hasher(q.dual)); return seed; diff --git a/glm/simd/platform.h b/glm/simd/platform.h index f74b8c7f..58168205 100644 --- a/glm/simd/platform.h +++ b/glm/simd/platform.h @@ -81,6 +81,9 @@ #define GLM_COMPILER_CUDA75 0x100000B0 #define GLM_COMPILER_CUDA80 0x100000C0 +// SYCL +#define GLM_COMPILER_SYCL 0x00300000 + // Clang #define GLM_COMPILER_CLANG 0x20000000 #define GLM_COMPILER_CLANG34 0x20000050 @@ -129,6 +132,10 @@ # error "GLM requires CUDA 7.0 or higher" # endif +// SYCL +#elif defined(__SYCL_DEVICE_ONLY__) +# define GLM_COMPILER GLM_COMPILER_SYCL + // Clang #elif defined(__clang__) # if defined(__apple_build_version__) diff --git a/readme.md b/readme.md index 59e24734..8147b7eb 100644 --- a/readme.md +++ b/readme.md @@ -15,6 +15,7 @@ This library works perfectly with *[OpenGL](https://www.opengl.org)* but it also - [LLVM](http://llvm.org/) 3.4 and higher - [Visual C++](http://www.visualstudio.com/) 2013 and higher - [CUDA](https://developer.nvidia.com/about-cuda) 7.0 and higher (experimental) +- [SYCL](https://www.khronos.org/sycl/) (experimental: only [ComputeCpp](https://codeplay.com/products/computesuite/computecpp) implementation has been tested). - Any C++11 compiler For more information about *GLM*, please have a look at the [manual](manual.md) and the [API reference documentation](http://glm.g-truc.net/0.9.8/api/index.html). @@ -54,9 +55,17 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate) ### [GLM 0.9.9.6](https://github.com/g-truc/glm/tree/master) #### Improvements: +- Added SYCL support #914 - Added Visual C++ 2019 detection - Added Visual C++ 2017 15.8 and 15.9 detection +#### Fixes: +- Fixed for g++6 where -std=c++1z sets __cplusplus to 201500 instead of 201402 #921 +- Fixed hash hashes qua instead of tquat #919 +- Fixed .natvis as structs renamed #915 +- Fixed ldexp and frexp declaration #895 +- Fixed missing const to quaternion conversion operators #890 + ### [GLM 0.9.9.5](https://github.com/g-truc/glm/releases/tag/0.9.9.5) - 2019-04-01 #### Fixes: - Fixed build errors when defining GLM_ENABLE_EXPERIMENTAL #884 #883 diff --git a/util/glm.natvis b/util/glm.natvis index d13bf30e..7687f8bb 100644 --- a/util/glm.natvis +++ b/util/glm.natvis @@ -1,17 +1,22 @@ - - + + + + + + - + + {x} x - + {x}, {y} x @@ -19,7 +24,7 @@ - + {x}, {y}, {z} x @@ -28,7 +33,7 @@ - + {x}, {y}, {z}, {w} x @@ -38,18 +43,8 @@ - - - - ({x}, {y}, {z}), {w} + + {x}, {y}, {z}, {w} x y @@ -65,5 +60,6 @@ dual +