Browse Source

Merged master

Christophe 6 years ago
parent
commit
27b622e968

+ 10 - 0
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)

+ 1 - 1
glm/detail/func_common.inl

@@ -259,7 +259,7 @@ namespace detail
 	{
 		GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& edge0, vec<L, T, Q> const& edge1, vec<L, T, Q> const& x)
 		{
-			GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'step' only accept floating-point inputs");
+			GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'smoothstep' only accept floating-point inputs");
 			vec<L, T, Q> const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast<T>(0), static_cast<T>(1)));
 			return tmp * tmp * (static_cast<T>(3) - static_cast<T>(2) * tmp);
 		}

+ 44 - 2
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 <CL/sycl.hpp>
+#include <limits>
+
+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<typename T>
+	using numeric_limits = ::std::numeric_limits<T>;
+
+	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

+ 1 - 1
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

+ 5 - 5
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)

+ 1 - 1
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<genType>(x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean);
 	}
 
 	template<length_t L, typename T, qualifier Q>

+ 2 - 2
glm/gtx/hash.hpp

@@ -73,9 +73,9 @@ namespace std
 	};
 
 	template<typename T, glm::qualifier Q>
-	struct hash<glm::tquat<T,Q>>
+	struct hash<glm::qua<T,Q>>
 	{
-		GLM_FUNC_DECL size_t operator()(glm::tquat<T, Q> const& q) const;
+		GLM_FUNC_DECL size_t operator()(glm::qua<T, Q> const& q) const;
 	};
 
 	template<typename T, glm::qualifier Q>

+ 2 - 2
glm/gtx/hash.inl

@@ -62,7 +62,7 @@ namespace std
 	}
 
 	template<typename T, glm::qualifier Q>
-	GLM_FUNC_QUALIFIER size_t hash<glm::tquat<T, Q>>::operator()(glm::tquat<T,Q> const& q) const
+	GLM_FUNC_QUALIFIER size_t hash<glm::qua<T, Q>>::operator()(glm::qua<T,Q> const& q) const
 	{
 		size_t seed = 0;
 		hash<T> hasher;
@@ -77,7 +77,7 @@ namespace std
 	GLM_FUNC_QUALIFIER size_t hash<glm::tdualquat<T, Q>>::operator()(glm::tdualquat<T, Q> const& q) const
 	{
 		size_t seed = 0;
-		hash<glm::tquat<T, Q>> hasher;
+		hash<glm::qua<T, Q>> hasher;
 		glm::detail::hash_combine(seed, hasher(q.real));
 		glm::detail::hash_combine(seed, hasher(q.dual));
 		return seed;

+ 7 - 0
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__)

+ 9 - 0
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

+ 14 - 18
util/glm.natvis

@@ -1,17 +1,22 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<!-- GLM visualizers for Visual Studio 2012 -->
-<!-- Put them into My Documents/Visual Studio 2012/Visualizers/ -->
+<!-- GLM visualizers for Visual Studio -->
+<!-- Copy this file to -->
+<!-- %USERPROFILE%\Douments\Visual Studio 2019\Visualizers\ (replace '2019' when necessary) -->
+<!-- or -->
+<!-- %VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers\ (requires admin access) -->
+<!-- See also https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects -->
 
 <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
-	<Type Name="glm::tvec1&lt;*&gt;">
+
+	<Type Name="glm::vec&lt;1,*&gt;">
 		<DisplayString>{x}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
 		</Expand>
 	</Type>
 
-	<Type Name="glm::tvec2&lt;*&gt;">
+	<Type Name="glm::vec&lt;2,*&gt;">
 		<DisplayString>{x}, {y}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
@@ -19,7 +24,7 @@
 		</Expand>
 	</Type>
 
-	<Type Name="glm::tvec3&lt;*&gt;">
+	<Type Name="glm::vec&lt;3,*&gt;">
 		<DisplayString>{x}, {y}, {z}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
@@ -28,7 +33,7 @@
 		</Expand>
 	</Type>
 
-	<Type Name="glm::tvec4&lt;*&gt;">
+	<Type Name="glm::vec&lt;4,*&gt;">
 		<DisplayString>{x}, {y}, {z}, {w}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
@@ -38,18 +43,8 @@
 		</Expand>
 	</Type>
 
-	<!--Type Name="glm::tmat4&lt;*&gt;">
-		<DisplayString>{value[0]}, {value[1]}, {value[2]}, {value[3]}</DisplayString>
-		<Expand>
-			<Item Name="[0]">value[0]</Item>
-			<Item Name="[1]">value[1]</Item>
-			<Item Name="[2]">value[2]</Item>
-			<Item Name="[3]">value[3]</Item>
-		</Expand>
-	</Type-->
-
-	<Type Name="glm::tquat&lt;*&gt;">
-		<DisplayString>({x}, {y}, {z}), {w}</DisplayString>
+	<Type Name="glm::qua&lt;*&gt;">
+		<DisplayString>{x}, {y}, {z}, {w}</DisplayString>
 		<Expand>
 			<Item Name="x">x</Item>
 			<Item Name="y">y</Item>
@@ -65,5 +60,6 @@
 			<Item Name="dual">dual</Item>
 		</Expand>
 	</Type>
+
 </AutoVisualizer>