Browse Source

Added a CMake option to execute GLM performance tests. Made quat and dualquat trivially constructible #263

Christophe Riccio 11 years ago
parent
commit
0b8ca1a5b6

+ 5 - 0
CMakeLists.txt

@@ -14,6 +14,11 @@ if(NOT GLM_TEST_ENABLE)
 	message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench")
 	message(STATUS "GLM is a header only library, no need to build it. Set the option GLM_TEST_ENABLE with ON to build and run the test bench")
 endif()
 endif()
 
 
+option(GLM_PERF_ENABLE "GLM perf" OFF)
+if(GLM_PERF_ENABLE)
+	add_definitions(-DGLM_TEST_ENABLE_PERF)
+endif()
+
 if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX))
 if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") AND UNIX))
 	option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
 	option(GLM_TEST_ENABLE_CXX_98 "Enable C++ 98" OFF)
 	option(GLM_TEST_ENABLE_CXX_0X "Enable C++ 0x" OFF)
 	option(GLM_TEST_ENABLE_CXX_0X "Enable C++ 0x" OFF)

+ 0 - 1
glm/gtc/quaternion.hpp

@@ -82,7 +82,6 @@ namespace glm
 		// Implicit basic constructors
 		// Implicit basic constructors
 
 
 		GLM_FUNC_DECL tquat();
 		GLM_FUNC_DECL tquat();
-		GLM_FUNC_DECL tquat(tquat<T, P> const & q);
 		template <precision Q>
 		template <precision Q>
 		GLM_FUNC_DECL tquat(tquat<T, Q> const & q);
 		GLM_FUNC_DECL tquat(tquat<T, Q> const & q);
 
 

+ 0 - 5
glm/gtc/quaternion.inl

@@ -86,11 +86,6 @@ namespace detail
 #		endif
 #		endif
 	{}
 	{}
 
 
-	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tquat<T, P> const & q)
-		: x(q.x), y(q.y), z(q.z), w(q.w)
-	{}
-
 	template <typename T, precision P>
 	template <typename T, precision P>
 	template <precision Q>
 	template <precision Q>
 	GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tquat<T, Q> const & q)
 	GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tquat<T, Q> const & q)

+ 0 - 1
glm/gtx/dual_quaternion.hpp

@@ -75,7 +75,6 @@ namespace glm
 		// Implicit basic constructors
 		// Implicit basic constructors
 
 
 		GLM_FUNC_DECL tdualquat();
 		GLM_FUNC_DECL tdualquat();
-		GLM_FUNC_DECL tdualquat(tdualquat<T, P> const & d);
 		template <precision Q>
 		template <precision Q>
 		GLM_FUNC_DECL tdualquat(tdualquat<T, Q> const & d);
 		GLM_FUNC_DECL tdualquat(tdualquat<T, Q> const & d);
 
 

+ 0 - 5
glm/gtx/dual_quaternion.inl

@@ -53,11 +53,6 @@ namespace glm
 #		endif
 #		endif
 	{}
 	{}
 
 
-	template <typename T, precision P>
-	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat(tdualquat<T, P> const & d)
-		: real(d.real), dual(d.dual)
-	{}
-
 	template <typename T, precision P>
 	template <typename T, precision P>
 	template <precision Q>
 	template <precision Q>
 	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat(tdualquat<T, Q> const & d)
 	GLM_FUNC_QUALIFIER tdualquat<T, P>::tdualquat(tdualquat<T, Q> const & d)

+ 11 - 10
readme.txt

@@ -58,15 +58,6 @@ Features:
 - Added GTC_integer extension, promoted GTX_bit
 - Added GTC_integer extension, promoted GTX_bit
 - Added GTC_round extension, promoted GTX_bit
 - Added GTC_round extension, promoted GTX_bit
 
 
-Deprecation:
-- Removed degrees for function parameters
-- Removed GLM_FORCE_RADIANS, active by default
-- Removed VC 2005 / 8 and 2008 / 9 support
-- Removed GCC 3.4 to 4.5 support
-- Removed LLVM GCC support
-- Removed LLVM 2.6 to 2.9 support
-- Removed CUDA 3.0 to 4.0 support
-
 Improvements:
 Improvements:
 - Rely on C++11 to implement isinf and isnan
 - Rely on C++11 to implement isinf and isnan
 - Removed GLM_FORCE_CUDA, Cuda is implicitly detected
 - Removed GLM_FORCE_CUDA, Cuda is implicitly detected
@@ -79,7 +70,8 @@ Improvements:
 - Optimized bitfieldReverse and bitCount functions
 - Optimized bitfieldReverse and bitCount functions
 - Optimized matrix-vector multiple performance with Cuda #257, #258
 - Optimized matrix-vector multiple performance with Cuda #257, #258
 - Reduced integer type redifinitions #233
 - Reduced integer type redifinitions #233
-- Rewrite of GTX_fast_trigonometry #264 #265
+- Rewrited of GTX_fast_trigonometry #264 #265
+- Made types trivially copyable #263
 
 
 Fixes:
 Fixes:
 - Fixed std::nextafter not supported with C++11 on Android #217
 - Fixed std::nextafter not supported with C++11 on Android #217
@@ -90,6 +82,15 @@ Fixes:
 - Fixed implicit conversion from another tvec2 type to another tvec2 #241
 - Fixed implicit conversion from another tvec2 type to another tvec2 #241
 - Fixed lack of consistency of quat and dualquat constructors
 - Fixed lack of consistency of quat and dualquat constructors
 
 
+Deprecation:
+- Removed degrees for function parameters
+- Removed GLM_FORCE_RADIANS, active by default
+- Removed VC 2005 / 8 and 2008 / 9 support
+- Removed GCC 3.4 to 4.5 support
+- Removed LLVM GCC support
+- Removed LLVM 2.6 to 2.9 support
+- Removed CUDA 3.0 to 4.0 support
+
 ================================================================================
 ================================================================================
 GLM 0.9.5.4: 2014-06-21
 GLM 0.9.5.4: 2014-06-21
 --------------------------------------------------------------------------------
 --------------------------------------------------------------------------------

+ 4 - 1
test/core/core_func_common.cpp

@@ -1018,7 +1018,6 @@ int main()
 	int Error(0);
 	int Error(0);
 
 
 	Error += sign::test();
 	Error += sign::test();
-	Error += sign::perf();
 	Error += test_floor();
 	Error += test_floor();
 	Error += test_modf();
 	Error += test_modf();
 	Error += test_floatBitsToInt();
 	Error += test_floatBitsToInt();
@@ -1032,6 +1031,10 @@ int main()
 	Error += test_isnan();
 	Error += test_isnan();
 	Error += test_isinf();
 	Error += test_isinf();
 
 
+#	ifdef GLM_TEST_ENABLE_PERF
+		Error += sign::perf();
+#	endif
+
 	return Error;
 	return Error;
 }
 }
 
 

+ 6 - 3
test/core/core_func_integer.cpp

@@ -1321,11 +1321,8 @@ int main()
 	int Error = 0;
 	int Error = 0;
 
 
 	Error += ::bitCount::test();
 	Error += ::bitCount::test();
-	Error += ::bitCount::perf();
 	Error += ::bitfieldReverse::test();
 	Error += ::bitfieldReverse::test();
-	Error += ::bitfieldReverse::perf();
 	Error += ::findMSB::test();
 	Error += ::findMSB::test();
-	Error += ::findMSB::perf();
 	Error += ::findLSB::test();
 	Error += ::findLSB::test();
 	Error += ::umulExtended::test();
 	Error += ::umulExtended::test();
 	Error += ::imulExtended::test();
 	Error += ::imulExtended::test();
@@ -1334,5 +1331,11 @@ int main()
 	Error += ::bitfieldInsert::test();
 	Error += ::bitfieldInsert::test();
 	Error += ::bitfieldExtract::test();
 	Error += ::bitfieldExtract::test();
 
 
+#	ifdef GLM_TEST_ENABLE_PERF
+		Error += ::bitCount::perf();
+		Error += ::bitfieldReverse::perf();
+		Error += ::findMSB::perf();
+#	endif
+
 	return Error;
 	return Error;
 }
 }

+ 4 - 0
test/core/core_func_matrix.cpp

@@ -240,11 +240,15 @@ int main()
 	Error += test_transpose();
 	Error += test_transpose();
 	Error += test_determinant();
 	Error += test_determinant();
 	Error += test_inverse();
 	Error += test_inverse();
+
+#	ifdef GLM_TEST_ENABLE_PERF
 	for(std::size_t i = 0; i < 1; ++i)
 	for(std::size_t i = 0; i < 1; ++i)
 	{
 	{
 		Error += test_inverse_perf<glm::vec3, glm::mat4>(i, "mat4");
 		Error += test_inverse_perf<glm::vec3, glm::mat4>(i, "mat4");
 		Error += test_inverse_perf<glm::dvec3, glm::dmat4>(i, "dmat4");
 		Error += test_inverse_perf<glm::dvec3, glm::dmat4>(i, "dmat4");
 	}
 	}
+#	endif
+
 	return Error;
 	return Error;
 }
 }
 
 

+ 5 - 2
test/core/core_type_vec4.cpp

@@ -425,8 +425,11 @@ int main()
 
 
 	std::size_t const Size(1000000);
 	std::size_t const Size(1000000);
 
 
-	Error += test_vec4_perf_AoS(Size);
-	Error += test_vec4_perf_SoA(Size);
+#	ifdef GLM_TEST_ENABLE_PERF
+		Error += test_vec4_perf_AoS(Size);
+		Error += test_vec4_perf_SoA(Size);
+#	endif
+
 	Error += test_vec4_ctor();
 	Error += test_vec4_ctor();
 	Error += test_vec4_size();
 	Error += test_vec4_size();
 	Error += test_vec4_operators();
 	Error += test_vec4_operators();

+ 3 - 1
test/gtc/gtc_bitfield.cpp

@@ -637,7 +637,9 @@ int main()
 	Error += ::bitfieldInterleave::test();
 	Error += ::bitfieldInterleave::test();
 	//Error += ::bitRevert::test();
 	//Error += ::bitRevert::test();
 
 
-	Error += ::mask::perf();
+#	ifdef GLM_TEST_ENABLE_PERF
+		Error += ::mask::perf();
+#	endif
 
 
 	return Error;
 	return Error;
 }
 }

+ 14 - 0
test/gtc/gtc_quaternion.cpp

@@ -273,6 +273,20 @@ int test_quat_ctr()
 {
 {
 	int Error(0);
 	int Error(0);
 
 
+#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
+//	Error += std::is_trivially_default_constructible<glm::quat>::value ? 0 : 1;
+//	Error += std::is_trivially_default_constructible<glm::dquat>::value ? 0 : 1;
+//	Error += std::is_trivially_copy_assignable<glm::quat>::value ? 0 : 1;
+//	Error += std::is_trivially_copy_assignable<glm::dquat>::value ? 0 : 1;
+	Error += std::is_trivially_copyable<glm::quat>::value ? 0 : 1;
+	Error += std::is_trivially_copyable<glm::dquat>::value ? 0 : 1;
+
+	Error += std::has_trivial_copy_constructor<glm::quat>::value ? 0 : 1;
+	Error += std::has_trivial_copy_constructor<glm::dquat>::value ? 0 : 1;
+	Error += std::is_copy_constructible<glm::quat>::value ? 0 : 1;
+	Error += std::is_copy_constructible<glm::dquat>::value ? 0 : 1;
+#endif
+
 #	if GLM_HAS_INITIALIZER_LISTS
 #	if GLM_HAS_INITIALIZER_LISTS
 	{
 	{
 		glm::quat A{0, 1, 2, 3};
 		glm::quat A{0, 1, 2, 3};

+ 4 - 1
test/gtc/gtc_round.cpp

@@ -299,7 +299,10 @@ int main()
 
 
 	Error += isPowerOfTwo::test();
 	Error += isPowerOfTwo::test();
 	Error += ceilPowerOfTwo::test();
 	Error += ceilPowerOfTwo::test();
-	Error += ceilPowerOfTwo::perf();
+
+#	ifdef GLM_TEST_ENABLE_PERF
+		Error += ceilPowerOfTwo::perf();
+#	endif
 
 
 	return Error;
 	return Error;
 }
 }

+ 14 - 6
test/gtx/gtx_fast_trigonometry.cpp

@@ -31,6 +31,7 @@ namespace fastCos
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		std::printf("fastCos Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("fastCos Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("cos Time %d clocks\n", static_cast<unsigned int>(time_default));
 		std::printf("cos Time %d clocks\n", static_cast<unsigned int>(time_default));
+
 		return time_fast < time_default ? 0 : 1;
 		return time_fast < time_default ? 0 : 1;
 	}
 	}
 }//namespace fastCos
 }//namespace fastCos
@@ -53,6 +54,7 @@ namespace fastSin
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		std::printf("fastSin Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("fastSin Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("sin Time %d clocks\n", static_cast<unsigned int>(time_default));
 		std::printf("sin Time %d clocks\n", static_cast<unsigned int>(time_default));
+
 		return time_fast < time_default ? 0 : 1;
 		return time_fast < time_default ? 0 : 1;
 	}
 	}
 }//namespace fastSin
 }//namespace fastSin
@@ -75,6 +77,7 @@ namespace fastTan
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		std::printf("fastTan Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("fastTan Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("tan Time %d clocks\n", static_cast<unsigned int>(time_default));
 		std::printf("tan Time %d clocks\n", static_cast<unsigned int>(time_default));
+
 		return time_fast < time_default ? 0 : 1;
 		return time_fast < time_default ? 0 : 1;
 	}
 	}
 }//namespace fastTan
 }//namespace fastTan
@@ -97,6 +100,7 @@ namespace fastAcos
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		std::printf("fastAcos Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("fastAcos Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("acos Time %d clocks\n", static_cast<unsigned int>(time_default));
 		std::printf("acos Time %d clocks\n", static_cast<unsigned int>(time_default));
+
 		return time_fast < time_default ? 0 : 1;
 		return time_fast < time_default ? 0 : 1;
 	}
 	}
 }//namespace fastAcos
 }//namespace fastAcos
@@ -119,6 +123,7 @@ namespace fastAsin
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		std::printf("fastAsin Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("fastAsin Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("asin Time %d clocks\n", static_cast<unsigned int>(time_default));
 		std::printf("asin Time %d clocks\n", static_cast<unsigned int>(time_default));
+
 		return time_fast < time_default ? 0 : 1;
 		return time_fast < time_default ? 0 : 1;
 	}
 	}
 }//namespace fastAsin
 }//namespace fastAsin
@@ -141,6 +146,7 @@ namespace fastAtan
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		const std::clock_t time_default = timestamp3 - timestamp2;
 		std::printf("fastAtan Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("fastAtan Time %d clocks\n", static_cast<unsigned int>(time_fast));
 		std::printf("atan Time %d clocks\n", static_cast<unsigned int>(time_default));
 		std::printf("atan Time %d clocks\n", static_cast<unsigned int>(time_default));
+
 		return time_fast < time_default ? 0 : 1;
 		return time_fast < time_default ? 0 : 1;
 	}
 	}
 }//namespace fastAtan
 }//namespace fastAtan
@@ -149,12 +155,14 @@ int main()
 {
 {
 	int Error(0);
 	int Error(0);
 
 
-	Error += ::fastCos::perf();
-	Error += ::fastSin::perf();
-	Error += ::fastTan::perf();
-	Error += ::fastAcos::perf();
-	Error += ::fastAsin::perf();
-	Error += ::fastAtan::perf();
+#	ifdef GLM_TEST_ENABLE_PERF
+		Error += ::fastCos::perf();
+		Error += ::fastSin::perf();
+		Error += ::fastTan::perf();
+		Error += ::fastAcos::perf();
+		Error += ::fastAsin::perf();
+		Error += ::fastAtan::perf();
+#	endif
 
 
 	return Error;
 	return Error;
 }
 }