Browse Source

Move more performance tests inside GLM_PERF_ENABLE

Christophe Riccio 11 years ago
parent
commit
16a0c960f7

+ 4 - 0
test/core/core_func_integer_bit_count.cpp

@@ -166,6 +166,8 @@ void error(int x, int y) {
 
 int main()
 {
+#	ifdef GLM_TEST_ENABLE_PERF
+
 	int i, n;
 	static int test[] = {0,0, 1,1, 2,1, 3,2, 4,1, 5,2, 6,2, 7,3,
 		8,1, 9,2, 10,2, 11,3, 12,2, 13,3, 14,3, 15,4, 16,1, 17,2,
@@ -274,4 +276,6 @@ int main()
 
 	if (errors == 0)
 		printf("Passed all %d cases.\n", sizeof(test)/8);
+
+#	endif//GLM_TEST_ENABLE_PERF
 }

+ 4 - 0
test/core/core_func_integer_find_lsb.cpp

@@ -310,6 +310,8 @@ void error(int x, int y) {
 
 int main()
 {
+#	ifdef GLM_TEST_ENABLE_PERF
+
 	int i, n;
 	static unsigned test[] = {0,32, 1,31, 2,30, 3,30, 4,29, 5,29, 6,29,
 		7,29, 8,28, 9,28, 16,27, 32,26, 64,25, 128,24, 255,24, 256,23,
@@ -440,4 +442,6 @@ int main()
 
 	if (errors == 0)
 		printf("Passed all %d cases.\n", sizeof(test)/8);
+
+#	endif//GLM_TEST_ENABLE_PERF
 }

+ 16 - 10
test/gtc/gtc_bitfield.cpp

@@ -472,15 +472,6 @@ namespace bitfieldInterleave
 
 	int test()
 	{
-		glm::uint32 x_max = 1 << 11;
-		glm::uint32 y_max = 1 << 10;
-
-		// ALU
-		std::vector<glm::uint64> Data(x_max * y_max);
-		std::vector<glm::u32vec2> Param(x_max * y_max);
-		for(glm::uint32 i = 0; i < Param.size(); ++i)
-			Param[i] = glm::u32vec2(i % x_max, i / y_max);
-
 		{
 			for(glm::uint32 y = 0; y < (1 << 10); ++y)
 			for(glm::uint32 x = 0; x < (1 << 10); ++x)
@@ -525,6 +516,20 @@ namespace bitfieldInterleave
 			}
 		}
 
+		return 0;
+	}
+
+	int perf()
+	{
+		glm::uint32 x_max = 1 << 11;
+		glm::uint32 y_max = 1 << 10;
+
+		// ALU
+		std::vector<glm::uint64> Data(x_max * y_max);
+		std::vector<glm::u32vec2> Param(x_max * y_max);
+		for(glm::uint32 i = 0; i < Param.size(); ++i)
+			Param[i] = glm::u32vec2(i % x_max, i / y_max);
+
 		{
 			std::clock_t LastTime = std::clock();
 
@@ -625,7 +630,7 @@ namespace bitfieldInterleave
 
 		return 0;
 	}
-}
+}//namespace bitfieldInterleave
 
 int main()
 {
@@ -639,6 +644,7 @@ int main()
 
 #	ifdef GLM_TEST_ENABLE_PERF
 		Error += ::mask::perf();
+		Error += ::bitfieldInterleave::perf();
 #	endif
 
 	return Error;