From 16a0c960f7c04949fff39f714deea917d9a149b8 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 15 Nov 2014 00:20:56 +0100 Subject: [PATCH] Move more performance tests inside GLM_PERF_ENABLE --- test/core/core_func_integer_bit_count.cpp | 4 ++++ test/core/core_func_integer_find_lsb.cpp | 4 ++++ test/gtc/gtc_bitfield.cpp | 26 ++++++++++++++--------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/test/core/core_func_integer_bit_count.cpp b/test/core/core_func_integer_bit_count.cpp index 3082f5e7..bc9124d4 100644 --- a/test/core/core_func_integer_bit_count.cpp +++ b/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 } diff --git a/test/core/core_func_integer_find_lsb.cpp b/test/core/core_func_integer_find_lsb.cpp index 4e3442ad..21dd124a 100644 --- a/test/core/core_func_integer_find_lsb.cpp +++ b/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 } diff --git a/test/gtc/gtc_bitfield.cpp b/test/gtc/gtc_bitfield.cpp index b203c749..828208bb 100644 --- a/test/gtc/gtc_bitfield.cpp +++ b/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 Data(x_max * y_max); - std::vector 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 Data(x_max * y_max); + std::vector 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;