diff options
author | rtk0c <[email protected]> | 2025-08-16 11:23:49 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2025-08-16 11:23:49 -0700 |
commit | 047f294de1b4d385b811ac9f5afc393d81cc4ae9 (patch) | |
tree | f96100a813a4ffb28dcd074455d3a2f8ee426430 /3rdparty/glm/source/test/gtc | |
parent | 488fb8b4b9da7f99a5cc37e39fff9f1cb700f2a8 (diff) |
Copy changes from the no-history fork, generated back in 2023
Original commit message:
> commit f138311d2d2e0cc9ba0496d523bb46f2c1c9fb73
> Author: rtk0c <[email protected]>
> Date: Wed Sep 20 23:58:58 2023 -0700
>
> Copy from the PlasticSCM repo, replace vendored glm wtih conan
In reality, this also introduced a few uncommitted changes in the
original PlasticSCM repo. See the modified and new files in this patch.
Diffstat (limited to '3rdparty/glm/source/test/gtc')
22 files changed, 0 insertions, 5722 deletions
diff --git a/3rdparty/glm/source/test/gtc/CMakeLists.txt b/3rdparty/glm/source/test/gtc/CMakeLists.txt deleted file mode 100644 index 4aef24a..0000000 --- a/3rdparty/glm/source/test/gtc/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -glmCreateTestGTC(gtc_bitfield) -glmCreateTestGTC(gtc_color_space) -glmCreateTestGTC(gtc_constants) -glmCreateTestGTC(gtc_epsilon) -glmCreateTestGTC(gtc_integer) -glmCreateTestGTC(gtc_matrix_access) -glmCreateTestGTC(gtc_matrix_integer) -glmCreateTestGTC(gtc_matrix_inverse) -glmCreateTestGTC(gtc_matrix_transform) -glmCreateTestGTC(gtc_noise) -glmCreateTestGTC(gtc_packing) -glmCreateTestGTC(gtc_quaternion) -glmCreateTestGTC(gtc_random) -glmCreateTestGTC(gtc_round) -glmCreateTestGTC(gtc_reciprocal) -glmCreateTestGTC(gtc_type_aligned) -glmCreateTestGTC(gtc_type_precision) -glmCreateTestGTC(gtc_type_ptr) -glmCreateTestGTC(gtc_ulp) -glmCreateTestGTC(gtc_vec1) diff --git a/3rdparty/glm/source/test/gtc/gtc_bitfield.cpp b/3rdparty/glm/source/test/gtc/gtc_bitfield.cpp deleted file mode 100644 index 95c41f1..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_bitfield.cpp +++ /dev/null @@ -1,936 +0,0 @@ -#include <glm/gtc/bitfield.hpp> -#include <glm/gtc/type_precision.hpp> -#include <glm/vector_relational.hpp> -#include <glm/integer.hpp> -#include <ctime> -#include <cstdio> -#include <vector> - -namespace mask -{ - template<typename genType> - struct type - { - genType Value; - genType Return; - }; - - inline int mask_zero(int Bits) - { - return ~((~0) << Bits); - } - - inline int mask_mix(int Bits) - { - return Bits >= sizeof(int) * 8 ? 0xffffffff : (static_cast<int>(1) << Bits) - static_cast<int>(1); - } - - inline int mask_half(int Bits) - { - // We do the shift in two steps because 1 << 32 on an int is undefined. - - int const Half = Bits >> 1; - int const Fill = ~0; - int const ShiftHaft = (Fill << Half); - int const Rest = Bits - Half; - int const Reversed = ShiftHaft << Rest; - - return ~Reversed; - } - - inline int mask_loop(int Bits) - { - int Mask = 0; - for(int Bit = 0; Bit < Bits; ++Bit) - Mask |= (static_cast<int>(1) << Bit); - return Mask; - } - - int perf() - { - int const Count = 100000000; - - std::clock_t Timestamp1 = std::clock(); - - { - std::vector<int> Mask; - Mask.resize(Count); - for(int i = 0; i < Count; ++i) - Mask[i] = mask_mix(i % 32); - } - - std::clock_t Timestamp2 = std::clock(); - - { - std::vector<int> Mask; - Mask.resize(Count); - for(int i = 0; i < Count; ++i) - Mask[i] = mask_loop(i % 32); - } - - std::clock_t Timestamp3 = std::clock(); - - { - std::vector<int> Mask; - Mask.resize(Count); - for(int i = 0; i < Count; ++i) - Mask[i] = glm::mask(i % 32); - } - - std::clock_t Timestamp4 = std::clock(); - - { - std::vector<int> Mask; - Mask.resize(Count); - for(int i = 0; i < Count; ++i) - Mask[i] = mask_zero(i % 32); - } - - std::clock_t Timestamp5 = std::clock(); - - { - std::vector<int> Mask; - Mask.resize(Count); - for(int i = 0; i < Count; ++i) - Mask[i] = mask_half(i % 32); - } - - std::clock_t Timestamp6 = std::clock(); - - std::clock_t TimeMix = Timestamp2 - Timestamp1; - std::clock_t TimeLoop = Timestamp3 - Timestamp2; - std::clock_t TimeDefault = Timestamp4 - Timestamp3; - std::clock_t TimeZero = Timestamp5 - Timestamp4; - std::clock_t TimeHalf = Timestamp6 - Timestamp5; - - std::printf("mask[mix]: %d\n", static_cast<unsigned int>(TimeMix)); - std::printf("mask[loop]: %d\n", static_cast<unsigned int>(TimeLoop)); - std::printf("mask[default]: %d\n", static_cast<unsigned int>(TimeDefault)); - std::printf("mask[zero]: %d\n", static_cast<unsigned int>(TimeZero)); - std::printf("mask[half]: %d\n", static_cast<unsigned int>(TimeHalf)); - - return TimeDefault < TimeLoop ? 0 : 1; - } - - int test_uint() - { - type<glm::uint> const Data[] = - { - { 0, 0x00000000}, - { 1, 0x00000001}, - { 2, 0x00000003}, - { 3, 0x00000007}, - {31, 0x7fffffff}, - {32, 0xffffffff} - }; - - int Error = 0; -/* mask_zero is sadly not a correct code - for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i) - { - int Result = mask_zero(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } -*/ - for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i) - { - int Result = mask_mix(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i) - { - int Result = mask_half(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i) - { - int Result = mask_loop(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - for(std::size_t i = 0; i < sizeof(Data) / sizeof(type<int>); ++i) - { - int Result = glm::mask(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - return Error; - } - - int test_uvec4() - { - type<glm::ivec4> const Data[] = - { - {glm::ivec4( 0), glm::ivec4(0x00000000)}, - {glm::ivec4( 1), glm::ivec4(0x00000001)}, - {glm::ivec4( 2), glm::ivec4(0x00000003)}, - {glm::ivec4( 3), glm::ivec4(0x00000007)}, - {glm::ivec4(31), glm::ivec4(0x7fffffff)}, - {glm::ivec4(32), glm::ivec4(0xffffffff)} - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::ivec4>); i < n; ++i) - { - glm::ivec4 Result = glm::mask(Data[i].Value); - Error += glm::all(glm::equal(Data[i].Return, Result)) ? 0 : 1; - } - - return Error; - } - - int test() - { - int Error(0); - - Error += test_uint(); - Error += test_uvec4(); - - return Error; - } -}//namespace mask - -namespace bitfieldInterleave3 -{ - template<typename PARAM, typename RET> - inline RET refBitfieldInterleave(PARAM x, PARAM y, PARAM z) - { - RET Result = 0; - for(RET i = 0; i < sizeof(PARAM) * 8; ++i) - { - Result |= ((RET(x) & (RET(1U) << i)) << ((i << 1) + 0)); - Result |= ((RET(y) & (RET(1U) << i)) << ((i << 1) + 1)); - Result |= ((RET(z) & (RET(1U) << i)) << ((i << 1) + 2)); - } - return Result; - } - - int test() - { - int Error(0); - - glm::uint16 x_max = 1 << 11; - glm::uint16 y_max = 1 << 11; - glm::uint16 z_max = 1 << 11; - - for(glm::uint16 z = 0; z < z_max; z += 27) - for(glm::uint16 y = 0; y < y_max; y += 27) - for(glm::uint16 x = 0; x < x_max; x += 27) - { - glm::uint64 ResultA = refBitfieldInterleave<glm::uint16, glm::uint64>(x, y, z); - glm::uint64 ResultB = glm::bitfieldInterleave(x, y, z); - Error += ResultA == ResultB ? 0 : 1; - } - - return Error; - } -} - -namespace bitfieldInterleave4 -{ - template<typename PARAM, typename RET> - inline RET loopBitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w) - { - RET const v[4] = {x, y, z, w}; - RET Result = 0; - for(RET i = 0; i < sizeof(PARAM) * 8; i++) - { - Result |= ((((v[0] >> i) & 1U)) << ((i << 2) + 0)); - Result |= ((((v[1] >> i) & 1U)) << ((i << 2) + 1)); - Result |= ((((v[2] >> i) & 1U)) << ((i << 2) + 2)); - Result |= ((((v[3] >> i) & 1U)) << ((i << 2) + 3)); - } - return Result; - } - - int test() - { - int Error(0); - - glm::uint16 x_max = 1 << 11; - glm::uint16 y_max = 1 << 11; - glm::uint16 z_max = 1 << 11; - glm::uint16 w_max = 1 << 11; - - for(glm::uint16 w = 0; w < w_max; w += 27) - for(glm::uint16 z = 0; z < z_max; z += 27) - for(glm::uint16 y = 0; y < y_max; y += 27) - for(glm::uint16 x = 0; x < x_max; x += 27) - { - glm::uint64 ResultA = loopBitfieldInterleave<glm::uint16, glm::uint64>(x, y, z, w); - glm::uint64 ResultB = glm::bitfieldInterleave(x, y, z, w); - Error += ResultA == ResultB ? 0 : 1; - } - - return Error; - } -} - -namespace bitfieldInterleave -{ - inline glm::uint64 fastBitfieldInterleave(glm::uint32 x, glm::uint32 y) - { - glm::uint64 REG1; - glm::uint64 REG2; - - REG1 = x; - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333); - REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555); - - REG2 = y; - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333); - REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555); - - return REG1 | (REG2 << 1); - } - - inline glm::uint64 interleaveBitfieldInterleave(glm::uint32 x, glm::uint32 y) - { - glm::uint64 REG1; - glm::uint64 REG2; - - REG1 = x; - REG2 = y; - - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF); - - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF); - - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F); - - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333); - - REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555); - REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555); - - return REG1 | (REG2 << 1); - } -/* - inline glm::uint64 loopBitfieldInterleave(glm::uint32 x, glm::uint32 y) - { - static glm::uint64 const Mask[5] = - { - 0x5555555555555555, - 0x3333333333333333, - 0x0F0F0F0F0F0F0F0F, - 0x00FF00FF00FF00FF, - 0x0000FFFF0000FFFF - }; - - glm::uint64 REG1 = x; - glm::uint64 REG2 = y; - for(int i = 4; i >= 0; --i) - { - REG1 = ((REG1 << (1 << i)) | REG1) & Mask[i]; - REG2 = ((REG2 << (1 << i)) | REG2) & Mask[i]; - } - - return REG1 | (REG2 << 1); - } -*/ -#if GLM_ARCH & GLM_ARCH_SSE2_BIT - inline glm::uint64 sseBitfieldInterleave(glm::uint32 x, glm::uint32 y) - { - __m128i const Array = _mm_set_epi32(0, y, 0, x); - - __m128i const Mask4 = _mm_set1_epi32(0x0000FFFF); - __m128i const Mask3 = _mm_set1_epi32(0x00FF00FF); - __m128i const Mask2 = _mm_set1_epi32(0x0F0F0F0F); - __m128i const Mask1 = _mm_set1_epi32(0x33333333); - __m128i const Mask0 = _mm_set1_epi32(0x55555555); - - __m128i Reg1; - __m128i Reg2; - - // REG1 = x; - // REG2 = y; - Reg1 = _mm_load_si128(&Array); - - //REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF); - //REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF); - Reg2 = _mm_slli_si128(Reg1, 2); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask4); - - //REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF); - //REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF); - Reg2 = _mm_slli_si128(Reg1, 1); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask3); - - //REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F); - //REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F); - Reg2 = _mm_slli_epi32(Reg1, 4); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask2); - - //REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333); - //REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333); - Reg2 = _mm_slli_epi32(Reg1, 2); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask1); - - //REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555); - //REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555); - Reg2 = _mm_slli_epi32(Reg1, 1); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask0); - - //return REG1 | (REG2 << 1); - Reg2 = _mm_slli_epi32(Reg1, 1); - Reg2 = _mm_srli_si128(Reg2, 8); - Reg1 = _mm_or_si128(Reg1, Reg2); - - __m128i Result; - _mm_store_si128(&Result, Reg1); - return *reinterpret_cast<glm::uint64*>(&Result); - } - - inline glm::uint64 sseUnalignedBitfieldInterleave(glm::uint32 x, glm::uint32 y) - { - __m128i const Array = _mm_set_epi32(0, y, 0, x); - - __m128i const Mask4 = _mm_set1_epi32(0x0000FFFF); - __m128i const Mask3 = _mm_set1_epi32(0x00FF00FF); - __m128i const Mask2 = _mm_set1_epi32(0x0F0F0F0F); - __m128i const Mask1 = _mm_set1_epi32(0x33333333); - __m128i const Mask0 = _mm_set1_epi32(0x55555555); - - __m128i Reg1; - __m128i Reg2; - - // REG1 = x; - // REG2 = y; - Reg1 = _mm_loadu_si128(&Array); - - //REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFF); - //REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFF); - Reg2 = _mm_slli_si128(Reg1, 2); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask4); - - //REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FF); - //REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FF); - Reg2 = _mm_slli_si128(Reg1, 1); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask3); - - //REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0F); - //REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0F); - Reg2 = _mm_slli_epi32(Reg1, 4); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask2); - - //REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333); - //REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333); - Reg2 = _mm_slli_epi32(Reg1, 2); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask1); - - //REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555); - //REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555); - Reg2 = _mm_slli_epi32(Reg1, 1); - Reg1 = _mm_or_si128(Reg2, Reg1); - Reg1 = _mm_and_si128(Reg1, Mask0); - - //return REG1 | (REG2 << 1); - Reg2 = _mm_slli_epi32(Reg1, 1); - Reg2 = _mm_srli_si128(Reg2, 8); - Reg1 = _mm_or_si128(Reg1, Reg2); - - __m128i Result; - _mm_store_si128(&Result, Reg1); - return *reinterpret_cast<glm::uint64*>(&Result); - } -#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT - - int test() - { - int Error = 0; - -/* - { - for(glm::uint32 y = 0; y < (1 << 10); ++y) - for(glm::uint32 x = 0; x < (1 << 10); ++x) - { - glm::uint64 A = glm::bitfieldInterleave(x, y); - glm::uint64 B = fastBitfieldInterleave(x, y); - //glm::uint64 C = loopBitfieldInterleave(x, y); - glm::uint64 D = interleaveBitfieldInterleave(x, y); - - assert(A == B); - //assert(A == C); - assert(A == D); - -# if GLM_ARCH & GLM_ARCH_SSE2_BIT - glm::uint64 E = sseBitfieldInterleave(x, y); - glm::uint64 F = sseUnalignedBitfieldInterleave(x, y); - assert(A == E); - assert(A == F); - - __m128i G = glm_i128_interleave(_mm_set_epi32(0, y, 0, x)); - glm::uint64 Result[2]; - _mm_storeu_si128((__m128i*)Result, G); - assert(A == Result[0]); -# endif//GLM_ARCH & GLM_ARCH_SSE2_BIT - } - } -*/ - { - for(glm::uint8 y = 0; y < 127; ++y) - for(glm::uint8 x = 0; x < 127; ++x) - { - glm::uint64 A(glm::bitfieldInterleave(glm::u8vec2(x, y))); - glm::uint64 B(glm::bitfieldInterleave(glm::u16vec2(x, y))); - glm::uint64 C(glm::bitfieldInterleave(glm::u32vec2(x, y))); - - Error += A == B ? 0 : 1; - Error += A == C ? 0 : 1; - - glm::u32vec2 const& D = glm::bitfieldDeinterleave(C); - Error += D.x == x ? 0 : 1; - Error += D.y == y ? 0 : 1; - } - } - - { - for(glm::uint8 y = 0; y < 127; ++y) - for(glm::uint8 x = 0; x < 127; ++x) - { - glm::int64 A(glm::bitfieldInterleave(glm::int8(x), glm::int8(y))); - glm::int64 B(glm::bitfieldInterleave(glm::int16(x), glm::int16(y))); - glm::int64 C(glm::bitfieldInterleave(glm::int32(x), glm::int32(y))); - - Error += A == B ? 0 : 1; - Error += A == C ? 0 : 1; - } - } - - return Error; - } - - 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(); - - for(std::size_t i = 0; i < Data.size(); ++i) - Data[i] = glm::bitfieldInterleave(Param[i].x, Param[i].y); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("glm::bitfieldInterleave Time %d clocks\n", static_cast<int>(Time)); - } - - { - std::clock_t LastTime = std::clock(); - - for(std::size_t i = 0; i < Data.size(); ++i) - Data[i] = fastBitfieldInterleave(Param[i].x, Param[i].y); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("fastBitfieldInterleave Time %d clocks\n", static_cast<int>(Time)); - } -/* - { - std::clock_t LastTime = std::clock(); - - for(std::size_t i = 0; i < Data.size(); ++i) - Data[i] = loopBitfieldInterleave(Param[i].x, Param[i].y); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("loopBitfieldInterleave Time %d clocks\n", static_cast<int>(Time)); - } -*/ - { - std::clock_t LastTime = std::clock(); - - for(std::size_t i = 0; i < Data.size(); ++i) - Data[i] = interleaveBitfieldInterleave(Param[i].x, Param[i].y); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("interleaveBitfieldInterleave Time %d clocks\n", static_cast<int>(Time)); - } - -# if GLM_ARCH & GLM_ARCH_SSE2_BIT - { - std::clock_t LastTime = std::clock(); - - for(std::size_t i = 0; i < Data.size(); ++i) - Data[i] = sseBitfieldInterleave(Param[i].x, Param[i].y); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("sseBitfieldInterleave Time %d clocks\n", static_cast<int>(Time)); - } - - { - std::clock_t LastTime = std::clock(); - - for(std::size_t i = 0; i < Data.size(); ++i) - Data[i] = sseUnalignedBitfieldInterleave(Param[i].x, Param[i].y); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("sseUnalignedBitfieldInterleave Time %d clocks\n", static_cast<int>(Time)); - } -# endif//GLM_ARCH & GLM_ARCH_SSE2_BIT - - { - std::clock_t LastTime = std::clock(); - - for(std::size_t i = 0; i < Data.size(); ++i) - Data[i] = glm::bitfieldInterleave(Param[i].x, Param[i].y, Param[i].x); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("glm::detail::bitfieldInterleave Time %d clocks\n", static_cast<int>(Time)); - } - -# if(GLM_ARCH & GLM_ARCH_SSE2_BIT && !(GLM_COMPILER & GLM_COMPILER_GCC)) - { - // SIMD - std::vector<__m128i> SimdData; - SimdData.resize(static_cast<std::size_t>(x_max * y_max)); - std::vector<__m128i> SimdParam; - SimdParam.resize(static_cast<std::size_t>(x_max * y_max)); - for(std::size_t i = 0; i < SimdParam.size(); ++i) - SimdParam[i] = _mm_set_epi32(static_cast<int>(i % static_cast<std::size_t>(x_max)), 0, static_cast<int>(i / static_cast<std::size_t>(y_max)), 0); - - std::clock_t LastTime = std::clock(); - - for(std::size_t i = 0; i < SimdData.size(); ++i) - SimdData[i] = glm_i128_interleave(SimdParam[i]); - - std::clock_t Time = std::clock() - LastTime; - - std::printf("_mm_bit_interleave_si128 Time %d clocks\n", static_cast<int>(Time)); - } -# endif//GLM_ARCH & GLM_ARCH_SSE2_BIT - - return 0; - } -}//namespace bitfieldInterleave - -namespace bitfieldInterleave5 -{ - GLM_FUNC_QUALIFIER glm::uint16 bitfieldInterleave_u8vec2(glm::uint8 x, glm::uint8 y) - { - glm::uint32 Result = (glm::uint32(y) << 16) | glm::uint32(x); - Result = ((Result << 4) | Result) & 0x0F0F0F0F; - Result = ((Result << 2) | Result) & 0x33333333; - Result = ((Result << 1) | Result) & 0x55555555; - return static_cast<glm::uint16>((Result & 0x0000FFFF) | (Result >> 15)); - } - - GLM_FUNC_QUALIFIER glm::u8vec2 bitfieldDeinterleave_u8vec2(glm::uint16 InterleavedBitfield) - { - glm::uint32 Result(InterleavedBitfield); - Result = ((Result << 15) | Result) & 0x55555555; - Result = ((Result >> 1) | Result) & 0x33333333; - Result = ((Result >> 2) | Result) & 0x0F0F0F0F; - Result = ((Result >> 4) | Result) & 0x00FF00FF; - return glm::u8vec2(Result & 0x0000FFFF, Result >> 16); - } - - GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u8vec4(glm::uint8 x, glm::uint8 y, glm::uint8 z, glm::uint8 w) - { - glm::uint64 Result = (glm::uint64(w) << 48) | (glm::uint64(z) << 32) | (glm::uint64(y) << 16) | glm::uint64(x); - Result = ((Result << 12) | Result) & 0x000F000F000F000Full; - Result = ((Result << 6) | Result) & 0x0303030303030303ull; - Result = ((Result << 3) | Result) & 0x1111111111111111ull; - - const glm::uint32 a = static_cast<glm::uint32>((Result & 0x000000000000FFFF) >> ( 0 - 0)); - const glm::uint32 b = static_cast<glm::uint32>((Result & 0x00000000FFFF0000) >> (16 - 3)); - const glm::uint32 c = static_cast<glm::uint32>((Result & 0x0000FFFF00000000) >> (32 - 6)); - const glm::uint32 d = static_cast<glm::uint32>((Result & 0xFFFF000000000000) >> (48 - 12)); - - return a | b | c | d; - } - - GLM_FUNC_QUALIFIER glm::u8vec4 bitfieldDeinterleave_u8vec4(glm::uint32 InterleavedBitfield) - { - glm::uint64 Result(InterleavedBitfield); - Result = ((Result << 15) | Result) & 0x9249249249249249ull; - Result = ((Result >> 1) | Result) & 0x30C30C30C30C30C3ull; - Result = ((Result >> 2) | Result) & 0xF00F00F00F00F00Full; - Result = ((Result >> 4) | Result) & 0x00FF0000FF0000FFull; - return glm::u8vec4( - (Result >> 0) & 0x000000000000FFFFull, - (Result >> 16) & 0x00000000FFFF0000ull, - (Result >> 32) & 0x0000FFFF00000000ull, - (Result >> 48) & 0xFFFF000000000000ull); - } - - GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u16vec2(glm::uint16 x, glm::uint16 y) - { - glm::uint64 Result = (glm::uint64(y) << 32) | glm::uint64(x); - Result = ((Result << 8) | Result) & static_cast<glm::uint32>(0x00FF00FF00FF00FFull); - Result = ((Result << 4) | Result) & static_cast<glm::uint32>(0x0F0F0F0F0F0F0F0Full); - Result = ((Result << 2) | Result) & static_cast<glm::uint32>(0x3333333333333333ull); - Result = ((Result << 1) | Result) & static_cast<glm::uint32>(0x5555555555555555ull); - return static_cast<glm::uint32>((Result & 0x00000000FFFFFFFFull) | (Result >> 31)); - } - - GLM_FUNC_QUALIFIER glm::u16vec2 bitfieldDeinterleave_u16vec2(glm::uint32 InterleavedBitfield) - { - glm::uint64 Result(InterleavedBitfield); - Result = ((Result << 31) | Result) & 0x5555555555555555ull; - Result = ((Result >> 1) | Result) & 0x3333333333333333ull; - Result = ((Result >> 2) | Result) & 0x0F0F0F0F0F0F0F0Full; - Result = ((Result >> 4) | Result) & 0x00FF00FF00FF00FFull; - Result = ((Result >> 8) | Result) & 0x0000FFFF0000FFFFull; - return glm::u16vec2(Result & 0x00000000FFFFFFFFull, Result >> 32); - } - - int test() - { - int Error = 0; - - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - { - glm::uint16 A = bitfieldInterleave_u8vec2(glm::uint8(i), glm::uint8(j)); - glm::uint16 B = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)); - Error += A == B ? 0 : 1; - - glm::u8vec2 C = bitfieldDeinterleave_u8vec2(A); - Error += C.x == glm::uint8(i) ? 0 : 1; - Error += C.y == glm::uint8(j) ? 0 : 1; - } - - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - { - glm::uint32 A = bitfieldInterleave_u8vec4(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)); - glm::uint32 B = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)); - Error += A == B ? 0 : 1; -/* - glm::u8vec4 C = bitfieldDeinterleave_u8vec4(A); - Error += C.x == glm::uint8(i) ? 0 : 1; - Error += C.y == glm::uint8(j) ? 0 : 1; - Error += C.z == glm::uint8(i) ? 0 : 1; - Error += C.w == glm::uint8(j) ? 0 : 1; -*/ - } - - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - { - glm::uint32 A = bitfieldInterleave_u16vec2(glm::uint16(i), glm::uint16(j)); - glm::uint32 B = glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)); - Error += A == B ? 0 : 1; - } - - return Error; - } - - int perf_old_u8vec2(std::vector<glm::uint16>& Result) - { - int Error = 0; - - const std::clock_t BeginTime = std::clock(); - - for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)) ? 0 : 1; - - const std::clock_t EndTime = std::clock(); - - std::printf("glm::bitfieldInterleave<u8vec2> Time %d clocks\n", static_cast<int>(EndTime - BeginTime)); - - return Error; - } - - int perf_new_u8vec2(std::vector<glm::uint16>& Result) - { - int Error = 0; - - const std::clock_t BeginTime = std::clock(); - - for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == bitfieldInterleave_u8vec2(glm::uint8(i), glm::uint8(j)) ? 0 : 1; - - const std::clock_t EndTime = std::clock(); - - std::printf("bitfieldInterleave_u8vec2 Time %d clocks\n", static_cast<int>(EndTime - BeginTime)); - - return Error; - } - - int perf_old_u8vec4(std::vector<glm::uint32>& Result) - { - int Error = 0; - - const std::clock_t BeginTime = std::clock(); - - for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)) ? 0 : 1; - - const std::clock_t EndTime = std::clock(); - - std::printf("glm::bitfieldInterleave<u8vec4> Time %d clocks\n", static_cast<int>(EndTime - BeginTime)); - - return Error; - } - - int perf_new_u8vec4(std::vector<glm::uint32>& Result) - { - int Error = 0; - - const std::clock_t BeginTime = std::clock(); - - for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == bitfieldInterleave_u8vec4(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)) ? 0 : 1; - - const std::clock_t EndTime = std::clock(); - - std::printf("bitfieldInterleave_u8vec4 Time %d clocks\n", static_cast<int>(EndTime - BeginTime)); - - return Error; - } - - int perf_old_u16vec2(std::vector<glm::uint32>& Result) - { - int Error = 0; - - const std::clock_t BeginTime = std::clock(); - - for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)) ? 0 : 1; - - const std::clock_t EndTime = std::clock(); - - std::printf("glm::bitfieldInterleave<u16vec2> Time %d clocks\n", static_cast<int>(EndTime - BeginTime)); - - return Error; - } - - int perf_new_u16vec2(std::vector<glm::uint32>& Result) - { - int Error = 0; - - const std::clock_t BeginTime = std::clock(); - - for(glm::size_t k = 0; k < 10000; ++k) - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Error += Result[j * 256 + i] == bitfieldInterleave_u16vec2(glm::uint16(i), glm::uint16(j)) ? 0 : 1; - - const std::clock_t EndTime = std::clock(); - - std::printf("bitfieldInterleave_u16vec2 Time %d clocks\n", static_cast<int>(EndTime - BeginTime)); - - return Error; - } - - int perf() - { - int Error = 0; - - std::printf("bitfieldInterleave perf: init\r"); - - std::vector<glm::uint16> Result_u8vec2(256 * 256, 0); - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Result_u8vec2[j * 256 + i] = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j)); - - Error += perf_old_u8vec2(Result_u8vec2); - Error += perf_new_u8vec2(Result_u8vec2); - - std::vector<glm::uint32> Result_u8vec4(256 * 256, 0); - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Result_u8vec4[j * 256 + i] = glm::bitfieldInterleave(glm::uint8(i), glm::uint8(j), glm::uint8(i), glm::uint8(j)); - - Error += perf_old_u8vec4(Result_u8vec4); - Error += perf_new_u8vec4(Result_u8vec4); - - std::vector<glm::uint32> Result_u16vec2(256 * 256, 0); - for(glm::size_t j = 0; j < 256; ++j) - for(glm::size_t i = 0; i < 256; ++i) - Result_u16vec2[j * 256 + i] = glm::bitfieldInterleave(glm::uint16(i), glm::uint16(j)); - - Error += perf_old_u16vec2(Result_u16vec2); - Error += perf_new_u16vec2(Result_u16vec2); - - std::printf("bitfieldInterleave perf: %d Errors\n", Error); - - return Error; - } - -}//namespace bitfieldInterleave5 - -static int test_bitfieldRotateRight() -{ - glm::ivec4 const A = glm::bitfieldRotateRight(glm::ivec4(2), 1); - glm::ivec4 const B = glm::ivec4(2) >> 1; - - return A == B; -} - -static int test_bitfieldRotateLeft() -{ - glm::ivec4 const A = glm::bitfieldRotateLeft(glm::ivec4(2), 1); - glm::ivec4 const B = glm::ivec4(2) << 1; - - return A == B; -} - -int main() -{ - int Error = 0; - -/* Tests for a faster and to reserve bitfieldInterleave - Error += ::bitfieldInterleave5::test(); - Error += ::bitfieldInterleave5::perf(); -*/ - Error += ::mask::test(); - Error += ::bitfieldInterleave3::test(); - Error += ::bitfieldInterleave4::test(); - Error += ::bitfieldInterleave::test(); - - Error += test_bitfieldRotateRight(); - Error += test_bitfieldRotateLeft(); - -# ifdef NDEBUG - Error += ::mask::perf(); - Error += ::bitfieldInterleave::perf(); -# endif//NDEBUG - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_color_space.cpp b/3rdparty/glm/source/test/gtc/gtc_color_space.cpp deleted file mode 100644 index 67650c5..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_color_space.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include <glm/gtc/color_space.hpp> -#include <glm/gtc/epsilon.hpp> -#include <glm/gtc/constants.hpp> - -namespace srgb -{ - int test() - { - int Error(0); - - glm::vec3 const ColorSourceRGB(1.0, 0.5, 0.0); - - { - glm::vec3 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGB); - glm::vec3 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB); - Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1; - } - - { - glm::vec3 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGB, 2.8f); - glm::vec3 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB, 2.8f); - Error += glm::all(glm::epsilonEqual(ColorSourceRGB, ColorRGB, 0.00001f)) ? 0 : 1; - } - - glm::vec4 const ColorSourceRGBA(1.0, 0.5, 0.0, 1.0); - - { - glm::vec4 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGBA); - glm::vec4 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB); - Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1; - } - - { - glm::vec4 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceRGBA, 2.8f); - glm::vec4 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB, 2.8f); - Error += glm::all(glm::epsilonEqual(ColorSourceRGBA, ColorRGB, 0.00001f)) ? 0 : 1; - } - - glm::vec4 const ColorSourceGNI = glm::vec4(107, 107, 104, 131) / glm::vec4(255); - - { - glm::vec4 const ColorGNA = glm::convertSRGBToLinear(ColorSourceGNI) * glm::vec4(255); - glm::vec4 const ColorGNE = glm::convertLinearToSRGB(ColorSourceGNI) * glm::vec4(255); - glm::vec4 const ColorSRGB = glm::convertLinearToSRGB(ColorSourceGNI); - glm::vec4 const ColorRGB = glm::convertSRGBToLinear(ColorSRGB); - Error += glm::all(glm::epsilonEqual(ColorSourceGNI, ColorRGB, 0.00001f)) ? 0 : 1; - } - - return Error; - } -}//namespace srgb - -namespace srgb_lowp -{ - int test() - { - int Error(0); - - for(float Color = 0.0f; Color < 1.0f; Color += 0.01f) - { - glm::highp_vec3 const HighpSRGB = glm::convertLinearToSRGB(glm::highp_vec3(Color)); - glm::lowp_vec3 const LowpSRGB = glm::convertLinearToSRGB(glm::lowp_vec3(Color)); - Error += glm::all(glm::epsilonEqual(glm::abs(HighpSRGB - glm::highp_vec3(LowpSRGB)), glm::highp_vec3(0), 0.1f)) ? 0 : 1; - } - - return Error; - } -}//namespace srgb_lowp - -int main() -{ - int Error(0); - - Error += srgb::test(); - Error += srgb_lowp::test(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_constants.cpp b/3rdparty/glm/source/test/gtc/gtc_constants.cpp deleted file mode 100644 index 3897cd0..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_constants.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include <glm/gtc/constants.hpp> - -int test_epsilon() -{ - int Error = 0; - - { - float Test = glm::epsilon<float>(); - Error += Test > 0.0f ? 0 : 1; - } - - { - double Test = glm::epsilon<double>(); - Error += Test > 0.0 ? 0 : 1; - } - - return Error; -} - -int main() -{ - int Error(0); - - //float MinHalf = 0.0f; - //while (glm::half(MinHalf) == glm::half(0.0f)) - // MinHalf += std::numeric_limits<float>::epsilon(); - Error += test_epsilon(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_epsilon.cpp b/3rdparty/glm/source/test/gtc/gtc_epsilon.cpp deleted file mode 100644 index f0e6c8a..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_epsilon.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include <glm/gtc/epsilon.hpp> -#include <glm/gtc/constants.hpp> -#include <glm/gtc/quaternion.hpp> -#include <glm/vector_relational.hpp> - -int test_defined() -{ - glm::epsilonEqual(glm::vec2(), glm::vec2(), glm::vec2()); - glm::epsilonEqual(glm::vec3(), glm::vec3(), glm::vec3()); - glm::epsilonEqual(glm::vec4(), glm::vec4(), glm::vec4()); - - glm::epsilonNotEqual(glm::vec2(), glm::vec2(), glm::vec2()); - glm::epsilonNotEqual(glm::vec3(), glm::vec3(), glm::vec3()); - glm::epsilonNotEqual(glm::vec4(), glm::vec4(), glm::vec4()); - - glm::epsilonEqual(glm::vec2(), glm::vec2(), 0.0f); - glm::epsilonEqual(glm::vec3(), glm::vec3(), 0.0f); - glm::epsilonEqual(glm::vec4(), glm::vec4(), 0.0f); - glm::epsilonEqual(glm::quat(), glm::quat(), 0.0f); - - glm::epsilonNotEqual(glm::vec2(), glm::vec2(), 0.0f); - glm::epsilonNotEqual(glm::vec3(), glm::vec3(), 0.0f); - glm::epsilonNotEqual(glm::vec4(), glm::vec4(), 0.0f); - glm::epsilonNotEqual(glm::quat(), glm::quat(), 0.0f); - - return 0; -} - -template<typename T> -int test_equal() -{ - int Error(0); - - { - T A = glm::epsilon<T>(); - T B = glm::epsilon<T>(); - Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1; - } - - { - T A(0); - T B = static_cast<T>(0) + glm::epsilon<T>(); - Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1; - } - - { - T A(0); - T B = static_cast<T>(0) - glm::epsilon<T>(); - Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1; - } - - { - T A = static_cast<T>(0) + glm::epsilon<T>(); - T B = static_cast<T>(0); - Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1; - } - - { - T A = static_cast<T>(0) - glm::epsilon<T>(); - T B = static_cast<T>(0); - Error += glm::epsilonEqual(A, B, glm::epsilon<T>() * T(2)) ? 0 : 1; - } - - return Error; -} - -int main() -{ - int Error(0); - - Error += test_defined(); - Error += test_equal<float>(); - Error += test_equal<double>(); - - return Error; -} - - diff --git a/3rdparty/glm/source/test/gtc/gtc_integer.cpp b/3rdparty/glm/source/test/gtc/gtc_integer.cpp deleted file mode 100644 index 769d969..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_integer.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#define GLM_ENABLE_EXPERIMENTAL -#define GLM_FORCE_INLINE -#include <glm/gtc/epsilon.hpp> -#include <glm/gtc/integer.hpp> -#include <glm/gtc/type_precision.hpp> -#include <glm/gtc/vec1.hpp> -#include <glm/gtx/type_aligned.hpp> -#include <glm/vector_relational.hpp> -#include <glm/vec2.hpp> -#include <glm/vec3.hpp> -#include <glm/vec4.hpp> -#include <ctime> -#include <cstdio> -#include <vector> -#include <cmath> - -namespace log2_ -{ - int test() - { - int Error = 0; - - int A0 = static_cast<int>(glm::log2(16.f)); - glm::ivec1 B0(glm::log2(glm::vec1(16.f))); - glm::ivec2 C0(glm::log2(glm::vec2(16.f))); - glm::ivec3 D0(glm::log2(glm::vec3(16.f))); - glm::ivec4 E0(glm::log2(glm::vec4(16.f))); - - int A1 = glm::log2(int(16)); - glm::ivec1 B1 = glm::log2(glm::ivec1(16)); - glm::ivec2 C1 = glm::log2(glm::ivec2(16)); - glm::ivec3 D1 = glm::log2(glm::ivec3(16)); - glm::ivec4 E1 = glm::log2(glm::ivec4(16)); - - Error += A0 == A1 ? 0 : 1; - Error += glm::all(glm::equal(B0, B1)) ? 0 : 1; - Error += glm::all(glm::equal(C0, C1)) ? 0 : 1; - Error += glm::all(glm::equal(D0, D1)) ? 0 : 1; - Error += glm::all(glm::equal(E0, E1)) ? 0 : 1; - - glm::uint64 A2 = glm::log2(glm::uint64(16)); - glm::u64vec1 B2 = glm::log2(glm::u64vec1(16)); - glm::u64vec2 C2 = glm::log2(glm::u64vec2(16)); - glm::u64vec3 D2 = glm::log2(glm::u64vec3(16)); - glm::u64vec4 E2 = glm::log2(glm::u64vec4(16)); - - Error += A2 == glm::uint64(4) ? 0 : 1; - Error += glm::all(glm::equal(B2, glm::u64vec1(4))) ? 0 : 1; - Error += glm::all(glm::equal(C2, glm::u64vec2(4))) ? 0 : 1; - Error += glm::all(glm::equal(D2, glm::u64vec3(4))) ? 0 : 1; - Error += glm::all(glm::equal(E2, glm::u64vec4(4))) ? 0 : 1; - - return Error; - } - - int perf(std::size_t Count) - { - int Error = 0; - - { - std::vector<int> Result; - Result.resize(Count); - - std::clock_t Begin = clock(); - - for(int i = 0; i < static_cast<int>(Count); ++i) - Result[i] = glm::log2(static_cast<int>(i)); - - std::clock_t End = clock(); - - std::printf("glm::log2<int>: %d clocks\n", static_cast<int>(End - Begin)); - } - - { - std::vector<glm::ivec4> Result; - Result.resize(Count); - - std::clock_t Begin = clock(); - - for(int i = 0; i < static_cast<int>(Count); ++i) - Result[i] = glm::log2(glm::ivec4(i)); - - std::clock_t End = clock(); - - std::printf("glm::log2<ivec4>: %d clocks\n", static_cast<int>(End - Begin)); - } - -# if GLM_HAS_BITSCAN_WINDOWS - { - std::vector<glm::ivec4> Result; - Result.resize(Count); - - std::clock_t Begin = clock(); - - for(std::size_t i = 0; i < Count; ++i) - { - glm::vec<4, unsigned long, glm::defaultp> Tmp; - _BitScanReverse(&Tmp.x, i); - _BitScanReverse(&Tmp.y, i); - _BitScanReverse(&Tmp.z, i); - _BitScanReverse(&Tmp.w, i); - Result[i] = glm::ivec4(Tmp); - } - - std::clock_t End = clock(); - - std::printf("glm::log2<ivec4> inlined: %d clocks\n", static_cast<int>(End - Begin)); - } - - - { - std::vector<glm::vec<4, unsigned long, glm::defaultp> > Result; - Result.resize(Count); - - std::clock_t Begin = clock(); - - for(std::size_t i = 0; i < Count; ++i) - { - _BitScanReverse(&Result[i].x, i); - _BitScanReverse(&Result[i].y, i); - _BitScanReverse(&Result[i].z, i); - _BitScanReverse(&Result[i].w, i); - } - - std::clock_t End = clock(); - - std::printf("glm::log2<ivec4> inlined no cast: %d clocks\n", static_cast<int>(End - Begin)); - } - - - { - std::vector<glm::ivec4> Result; - Result.resize(Count); - - std::clock_t Begin = clock(); - - for(std::size_t i = 0; i < Count; ++i) - { - _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].x), i); - _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].y), i); - _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].z), i); - _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].w), i); - } - - std::clock_t End = clock(); - - std::printf("glm::log2<ivec4> reinterpret: %d clocks\n", static_cast<int>(End - Begin)); - } -# endif//GLM_HAS_BITSCAN_WINDOWS - - { - std::vector<float> Result; - Result.resize(Count); - - std::clock_t Begin = clock(); - - for(std::size_t i = 0; i < Count; ++i) - Result[i] = glm::log2(static_cast<float>(i)); - - std::clock_t End = clock(); - - std::printf("glm::log2<float>: %d clocks\n", static_cast<int>(End - Begin)); - } - - { - std::vector<glm::vec4> Result; - Result.resize(Count); - - std::clock_t Begin = clock(); - - for(int i = 0; i < static_cast<int>(Count); ++i) - Result[i] = glm::log2(glm::vec4(static_cast<float>(i))); - - std::clock_t End = clock(); - - std::printf("glm::log2<vec4>: %d clocks\n", static_cast<int>(End - Begin)); - } - - return Error; - } -}//namespace log2_ - -namespace iround -{ - int test() - { - int Error = 0; - - for(float f = 0.0f; f < 3.1f; f += 0.05f) - { - int RoundFast = static_cast<int>(glm::iround(f)); - int RoundSTD = static_cast<int>(glm::round(f)); - Error += RoundFast == RoundSTD ? 0 : 1; - assert(!Error); - } - - return Error; - } -}//namespace iround - -namespace uround -{ - int test() - { - int Error = 0; - - for(float f = 0.0f; f < 3.1f; f += 0.05f) - { - int RoundFast = static_cast<int>(glm::uround(f)); - int RoundSTD = static_cast<int>(glm::round(f)); - Error += RoundFast == RoundSTD ? 0 : 1; - assert(!Error); - } - - return Error; - } -}//namespace uround - -int main() -{ - int Error(0); - - Error += ::log2_::test(); - Error += ::iround::test(); - Error += ::uround::test(); - -# ifdef NDEBUG - std::size_t const Samples(1000); - Error += ::log2_::perf(Samples); -# endif//NDEBUG - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_matrix_access.cpp b/3rdparty/glm/source/test/gtc/gtc_matrix_access.cpp deleted file mode 100644 index 1b966e2..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_matrix_access.cpp +++ /dev/null @@ -1,383 +0,0 @@ -#include <glm/ext/vector_relational.hpp> -#include <glm/gtc/constants.hpp> -#include <glm/gtc/matrix_access.hpp> -#include <glm/mat2x2.hpp> -#include <glm/mat2x3.hpp> -#include <glm/mat2x4.hpp> -#include <glm/mat3x2.hpp> -#include <glm/mat3x3.hpp> -#include <glm/mat3x4.hpp> -#include <glm/mat4x2.hpp> -#include <glm/mat4x3.hpp> -#include <glm/mat4x4.hpp> - -int test_mat2x2_row_set() -{ - int Error = 0; - - glm::mat2x2 m(1); - - m = glm::row(m, 0, glm::vec2( 0, 1)); - m = glm::row(m, 1, glm::vec2( 4, 5)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat2x2_col_set() -{ - int Error = 0; - - glm::mat2x2 m(1); - - m = glm::column(m, 0, glm::vec2( 0, 1)); - m = glm::column(m, 1, glm::vec2( 4, 5)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat2x3_row_set() -{ - int Error = 0; - - glm::mat2x3 m(1); - - m = glm::row(m, 0, glm::vec2( 0, 1)); - m = glm::row(m, 1, glm::vec2( 4, 5)); - m = glm::row(m, 2, glm::vec2( 8, 9)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat2x3_col_set() -{ - int Error = 0; - - glm::mat2x3 m(1); - - m = glm::column(m, 0, glm::vec3( 0, 1, 2)); - m = glm::column(m, 1, glm::vec3( 4, 5, 6)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat2x4_row_set() -{ - int Error = 0; - - glm::mat2x4 m(1); - - m = glm::row(m, 0, glm::vec2( 0, 1)); - m = glm::row(m, 1, glm::vec2( 4, 5)); - m = glm::row(m, 2, glm::vec2( 8, 9)); - m = glm::row(m, 3, glm::vec2(12, 13)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 3), glm::vec2(12, 13), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat2x4_col_set() -{ - int Error = 0; - - glm::mat2x4 m(1); - - m = glm::column(m, 0, glm::vec4( 0, 1, 2, 3)); - m = glm::column(m, 1, glm::vec4( 4, 5, 6, 7)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat3x2_row_set() -{ - int Error = 0; - - glm::mat3x2 m(1); - - m = glm::row(m, 0, glm::vec3( 0, 1, 2)); - m = glm::row(m, 1, glm::vec3( 4, 5, 6)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat3x2_col_set() -{ - int Error = 0; - - glm::mat3x2 m(1); - - m = glm::column(m, 0, glm::vec2( 0, 1)); - m = glm::column(m, 1, glm::vec2( 4, 5)); - m = glm::column(m, 2, glm::vec2( 8, 9)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat3x3_row_set() -{ - int Error = 0; - - glm::mat3x3 m(1); - - m = glm::row(m, 0, glm::vec3( 0, 1, 2)); - m = glm::row(m, 1, glm::vec3( 4, 5, 6)); - m = glm::row(m, 2, glm::vec3( 8, 9, 10)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat3x3_col_set() -{ - int Error = 0; - - glm::mat3x3 m(1); - - m = glm::column(m, 0, glm::vec3( 0, 1, 2)); - m = glm::column(m, 1, glm::vec3( 4, 5, 6)); - m = glm::column(m, 2, glm::vec3( 8, 9, 10)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat3x4_row_set() -{ - int Error = 0; - - glm::mat3x4 m(1); - - m = glm::row(m, 0, glm::vec3( 0, 1, 2)); - m = glm::row(m, 1, glm::vec3( 4, 5, 6)); - m = glm::row(m, 2, glm::vec3( 8, 9, 10)); - m = glm::row(m, 3, glm::vec3(12, 13, 14)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 3), glm::vec3(12, 13, 14), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat3x4_col_set() -{ - int Error = 0; - - glm::mat3x4 m(1); - - m = glm::column(m, 0, glm::vec4( 0, 1, 2, 3)); - m = glm::column(m, 1, glm::vec4( 4, 5, 6, 7)); - m = glm::column(m, 2, glm::vec4( 8, 9, 10, 11)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x2_row_set() -{ - int Error = 0; - - glm::mat4x2 m(1); - - m = glm::row(m, 0, glm::vec4( 0, 1, 2, 3)); - m = glm::row(m, 1, glm::vec4( 4, 5, 6, 7)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x2_col_set() -{ - int Error = 0; - - glm::mat4x2 m(1); - - m = glm::column(m, 0, glm::vec2( 0, 1)); - m = glm::column(m, 1, glm::vec2( 4, 5)); - m = glm::column(m, 2, glm::vec2( 8, 9)); - m = glm::column(m, 3, glm::vec2(12, 13)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec2( 0, 1), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec2( 4, 5), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 2), glm::vec2( 8, 9), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 3), glm::vec2(12, 13), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x3_row_set() -{ - int Error = 0; - - glm::mat4x3 m(1); - - m = glm::row(m, 0, glm::vec4( 0, 1, 2, 3)); - m = glm::row(m, 1, glm::vec4( 4, 5, 6, 7)); - m = glm::row(m, 2, glm::vec4( 8, 9, 10, 11)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x3_col_set() -{ - int Error = 0; - - glm::mat4x3 m(1); - - m = glm::column(m, 0, glm::vec3( 0, 1, 2)); - m = glm::column(m, 1, glm::vec3( 4, 5, 6)); - m = glm::column(m, 2, glm::vec3( 8, 9, 10)); - m = glm::column(m, 3, glm::vec3(12, 13, 14)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec3( 0, 1, 2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec3( 4, 5, 6), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 2), glm::vec3( 8, 9, 10), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 3), glm::vec3(12, 13, 14), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x4_row_set() -{ - int Error = 0; - - glm::mat4 m(1); - - m = glm::row(m, 0, glm::vec4( 0, 1, 2, 3)); - m = glm::row(m, 1, glm::vec4( 4, 5, 6, 7)); - m = glm::row(m, 2, glm::vec4( 8, 9, 10, 11)); - m = glm::row(m, 3, glm::vec4(12, 13, 14, 15)); - - Error += glm::all(glm::equal(glm::row(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::row(m, 3), glm::vec4(12, 13, 14, 15), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x4_col_set() -{ - int Error = 0; - - glm::mat4 m(1); - - m = glm::column(m, 0, glm::vec4( 0, 1, 2, 3)); - m = glm::column(m, 1, glm::vec4( 4, 5, 6, 7)); - m = glm::column(m, 2, glm::vec4( 8, 9, 10, 11)); - m = glm::column(m, 3, glm::vec4(12, 13, 14, 15)); - - Error += glm::all(glm::equal(glm::column(m, 0), glm::vec4( 0, 1, 2, 3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 1), glm::vec4( 4, 5, 6, 7), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 2), glm::vec4( 8, 9, 10, 11), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(glm::column(m, 3), glm::vec4(12, 13, 14, 15), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x4_row_get() -{ - int Error = 0; - - glm::mat4 m(1); - - glm::vec4 A = glm::row(m, 0); - Error += glm::all(glm::equal(A, glm::vec4(1, 0, 0, 0), glm::epsilon<float>())) ? 0 : 1; - glm::vec4 B = glm::row(m, 1); - Error += glm::all(glm::equal(B, glm::vec4(0, 1, 0, 0), glm::epsilon<float>())) ? 0 : 1; - glm::vec4 C = glm::row(m, 2); - Error += glm::all(glm::equal(C, glm::vec4(0, 0, 1, 0), glm::epsilon<float>())) ? 0 : 1; - glm::vec4 D = glm::row(m, 3); - Error += glm::all(glm::equal(D, glm::vec4(0, 0, 0, 1), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int test_mat4x4_col_get() -{ - int Error = 0; - - glm::mat4 m(1); - - glm::vec4 A = glm::column(m, 0); - Error += glm::all(glm::equal(A, glm::vec4(1, 0, 0, 0), glm::epsilon<float>())) ? 0 : 1; - glm::vec4 B = glm::column(m, 1); - Error += glm::all(glm::equal(B, glm::vec4(0, 1, 0, 0), glm::epsilon<float>())) ? 0 : 1; - glm::vec4 C = glm::column(m, 2); - Error += glm::all(glm::equal(C, glm::vec4(0, 0, 1, 0), glm::epsilon<float>())) ? 0 : 1; - glm::vec4 D = glm::column(m, 3); - Error += glm::all(glm::equal(D, glm::vec4(0, 0, 0, 1), glm::epsilon<float>())) ? 0 : 1; - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_mat2x2_row_set(); - Error += test_mat2x2_col_set(); - Error += test_mat2x3_row_set(); - Error += test_mat2x3_col_set(); - Error += test_mat2x4_row_set(); - Error += test_mat2x4_col_set(); - Error += test_mat3x2_row_set(); - Error += test_mat3x2_col_set(); - Error += test_mat3x3_row_set(); - Error += test_mat3x3_col_set(); - Error += test_mat3x4_row_set(); - Error += test_mat3x4_col_set(); - Error += test_mat4x2_row_set(); - Error += test_mat4x2_col_set(); - Error += test_mat4x3_row_set(); - Error += test_mat4x3_col_set(); - Error += test_mat4x4_row_set(); - Error += test_mat4x4_col_set(); - - Error += test_mat4x4_row_get(); - Error += test_mat4x4_col_get(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_matrix_integer.cpp b/3rdparty/glm/source/test/gtc/gtc_matrix_integer.cpp deleted file mode 100644 index 108016a..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_matrix_integer.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include <glm/gtc/matrix_integer.hpp> - -int main() -{ - int Error = 0; - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp b/3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp deleted file mode 100644 index eaec6e1..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_matrix_inverse.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include <glm/gtc/matrix_inverse.hpp> -#include <glm/gtc/epsilon.hpp> - -int test_affine() -{ - int Error = 0; - - { - glm::mat3 const M( - 2.f, 0.f, 0.f, - 0.f, 2.f, 0.f, - 0.f, 0.f, 1.f); - glm::mat3 const A = glm::affineInverse(M); - glm::mat3 const I = glm::inverse(M); - glm::mat3 const R = glm::affineInverse(A); - - for(glm::length_t i = 0; i < A.length(); ++i) - { - Error += glm::all(glm::epsilonEqual(M[i], R[i], 0.01f)) ? 0 : 1; - Error += glm::all(glm::epsilonEqual(A[i], I[i], 0.01f)) ? 0 : 1; - } - } - - { - glm::mat4 const M( - 2.f, 0.f, 0.f, 0.f, - 0.f, 2.f, 0.f, 0.f, - 0.f, 0.f, 2.f, 0.f, - 0.f, 0.f, 0.f, 1.f); - glm::mat4 const A = glm::affineInverse(M); - glm::mat4 const I = glm::inverse(M); - glm::mat4 const R = glm::affineInverse(A); - - for(glm::length_t i = 0; i < A.length(); ++i) - { - Error += glm::all(glm::epsilonEqual(M[i], R[i], 0.01f)) ? 0 : 1; - Error += glm::all(glm::epsilonEqual(A[i], I[i], 0.01f)) ? 0 : 1; - } - } - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_affine(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_matrix_transform.cpp b/3rdparty/glm/source/test/gtc/gtc_matrix_transform.cpp deleted file mode 100644 index b50666e..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_matrix_transform.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include <glm/gtc/matrix_transform.hpp> -#include <glm/gtc/constants.hpp> -#include <glm/ext/matrix_relational.hpp> - -int test_perspective() -{ - int Error = 0; - - glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f); - - return Error; -} - -int test_pick() -{ - int Error = 0; - - glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240)); - - return Error; -} - -int test_tweakedInfinitePerspective() -{ - int Error = 0; - - glm::mat4 ProjectionA = glm::tweakedInfinitePerspective(45.f, 640.f/480.f, 1.0f); - glm::mat4 ProjectionB = glm::tweakedInfinitePerspective(45.f, 640.f/480.f, 1.0f, 0.001f); - - - return Error; -} - -int test_translate() -{ - int Error = 0; - - glm::lowp_vec3 v(1.0); - glm::lowp_mat4 m(0); - glm::lowp_mat4 t = glm::translate(m, v); - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_translate(); - Error += test_tweakedInfinitePerspective(); - Error += test_pick(); - Error += test_perspective(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_noise.cpp b/3rdparty/glm/source/test/gtc/gtc_noise.cpp deleted file mode 100644 index 6ecec22..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_noise.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#define GLM_ENABLE_EXPERIMENTAL -#include <glm/gtc/noise.hpp> -#include <glm/gtc/type_precision.hpp> -#include <glm/gtx/raw_data.hpp> - -static int test_simplex_float() -{ - int Error = 0; - - glm::u8vec4 const PixelSimplex2D(glm::byte(glm::abs(glm::simplex(glm::vec2(0.f, 0.f))) * 255.f)); - glm::u8vec4 const PixelSimplex3D(glm::byte(glm::abs(glm::simplex(glm::vec3(0.f, 0.f, 0.f))) * 255.f)); - glm::u8vec4 const PixelSimplex4D(glm::byte(glm::abs(glm::simplex(glm::vec4(0.f, 0.f, 0.f, 0.f))) * 255.f)); - - return Error; -} - -static int test_simplex_double() -{ - int Error = 0; - - glm::u8vec4 const PixelSimplex2D(glm::byte(glm::abs(glm::simplex(glm::dvec2(0.f, 0.f))) * 255.)); - glm::u8vec4 const PixelSimplex3D(glm::byte(glm::abs(glm::simplex(glm::dvec3(0.f, 0.f, 0.f))) * 255.)); - glm::u8vec4 const PixelSimplex4D(glm::byte(glm::abs(glm::simplex(glm::dvec4(0.f, 0.f, 0.f, 0.f))) * 255.)); - - return Error; -} - -static int test_perlin_float() -{ - int Error = 0; - - glm::u8vec4 const PixelPerlin2D(glm::byte(glm::abs(glm::perlin(glm::vec2(0.f, 0.f))) * 255.f)); - glm::u8vec4 const PixelPerlin3D(glm::byte(glm::abs(glm::perlin(glm::vec3(0.f, 0.f, 0.f))) * 255.f)); - glm::u8vec4 const PixelPerlin4D(glm::byte(glm::abs(glm::perlin(glm::vec4(0.f, 0.f, 0.f, 0.f))) * 255.f)); - - return Error; -} - -static int test_perlin_double() -{ - int Error = 0; - - glm::u8vec4 const PixelPerlin2D(glm::byte(glm::abs(glm::perlin(glm::dvec2(0.f, 0.f))) * 255.)); - glm::u8vec4 const PixelPerlin3D(glm::byte(glm::abs(glm::perlin(glm::dvec3(0.f, 0.f, 0.f))) * 255.)); - glm::u8vec4 const PixelPerlin4D(glm::byte(glm::abs(glm::perlin(glm::dvec4(0.f, 0.f, 0.f, 0.f))) * 255.)); - - return Error; -} - -static int test_perlin_pedioric_float() -{ - int Error = 0; - - glm::u8vec4 const PixelPeriodic2D(glm::byte(glm::abs(glm::perlin(glm::vec2(0.f, 0.f), glm::vec2(2.0f))) * 255.f)); - glm::u8vec4 const PixelPeriodic3D(glm::byte(glm::abs(glm::perlin(glm::vec3(0.f, 0.f, 0.f), glm::vec3(2.0f))) * 255.f)); - glm::u8vec4 const PixelPeriodic4D(glm::byte(glm::abs(glm::perlin(glm::vec4(0.f, 0.f, 0.f, 0.f), glm::vec4(2.0f))) * 255.f)); - - return Error; -} - -static int test_perlin_pedioric_double() -{ - int Error = 0; - - glm::u8vec4 const PixelPeriodic2D(glm::byte(glm::abs(glm::perlin(glm::dvec2(0.f, 0.f), glm::dvec2(2.0))) * 255.)); - glm::u8vec4 const PixelPeriodic3D(glm::byte(glm::abs(glm::perlin(glm::dvec3(0.f, 0.f, 0.f), glm::dvec3(2.0))) * 255.)); - glm::u8vec4 const PixelPeriodic4D(glm::byte(glm::abs(glm::perlin(glm::dvec4(0.f, 0.f, 0.f, 0.f), glm::dvec4(2.0))) * 255.)); - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_simplex_float(); - Error += test_simplex_double(); - - Error += test_perlin_float(); - Error += test_perlin_double(); - - Error += test_perlin_pedioric_float(); - Error += test_perlin_pedioric_double(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_packing.cpp b/3rdparty/glm/source/test/gtc/gtc_packing.cpp deleted file mode 100644 index df5b3bb..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_packing.cpp +++ /dev/null @@ -1,878 +0,0 @@ -#include <glm/packing.hpp> -#include <glm/gtc/packing.hpp> -#include <glm/gtc/epsilon.hpp> -#include <glm/ext/vector_relational.hpp> -#include <cstdio> -#include <vector> - -void print_bits(float const& s) -{ - union - { - float f; - unsigned int i; - } uif; - - uif.f = s; - - std::printf("f32: "); - for(std::size_t j = sizeof(s) * 8; j > 0; --j) - { - if(j == 23 || j == 31) - std::printf(" "); - std::printf("%d", (uif.i & (1 << (j - 1))) ? 1 : 0); - } -} - -void print_10bits(glm::uint const& s) -{ - std::printf("10b: "); - for(std::size_t j = 10; j > 0; --j) - { - if(j == 5) - std::printf(" "); - std::printf("%d", (s & (1 << (j - 1))) ? 1 : 0); - } -} - -void print_11bits(glm::uint const& s) -{ - std::printf("11b: "); - for(std::size_t j = 11; j > 0; --j) - { - if(j == 6) - std::printf(" "); - std::printf("%d", (s & (1 << (j - 1))) ? 1 : 0); - } -} - -void print_value(float const& s) -{ - std::printf("%2.5f, ", static_cast<double>(s)); - print_bits(s); - std::printf(", "); -// print_11bits(detail::floatTo11bit(s)); -// std::printf(", "); -// print_10bits(detail::floatTo10bit(s)); - std::printf("\n"); -} - -int test_Half1x16() -{ - int Error = 0; - - std::vector<float> Tests; - Tests.push_back(0.0f); - Tests.push_back(1.0f); - Tests.push_back(-1.0f); - Tests.push_back(2.0f); - Tests.push_back(-2.0f); - Tests.push_back(1.9f); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint16 p0 = glm::packHalf1x16(Tests[i]); - float v0 = glm::unpackHalf1x16(p0); - glm::uint16 p1 = glm::packHalf1x16(v0); - float v1 = glm::unpackHalf1x16(p1); - Error += glm::epsilonEqual(v0, v1, glm::epsilon<float>()) ? 0 : 1; - } - - return Error; -} - -int test_Half4x16() -{ - int Error = 0; - - std::vector<glm::vec4> Tests; - Tests.push_back(glm::vec4(1.0f)); - Tests.push_back(glm::vec4(0.0f)); - Tests.push_back(glm::vec4(2.0f)); - Tests.push_back(glm::vec4(0.1f)); - Tests.push_back(glm::vec4(0.5f)); - Tests.push_back(glm::vec4(-0.9f)); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint64 p0 = glm::packHalf4x16(Tests[i]); - glm::vec4 v0 = glm::unpackHalf4x16(p0); - glm::uint64 p1 = glm::packHalf4x16(v0); - glm::vec4 v1 = glm::unpackHalf4x16(p1); - glm::u16vec4 p2 = glm::packHalf(v0); - glm::vec4 v2 = glm::unpackHalf(p2); - - Error += glm::all(glm::equal(v0, v1, glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(v0, v2, glm::epsilon<float>())) ? 0 : 1; - } - - return Error; -} - -int test_I3x10_1x2() -{ - int Error = 0; - - std::vector<glm::ivec4> Tests; - Tests.push_back(glm::ivec4(0)); - Tests.push_back(glm::ivec4(1)); - Tests.push_back(glm::ivec4(-1)); - Tests.push_back(glm::ivec4(2)); - Tests.push_back(glm::ivec4(-2)); - Tests.push_back(glm::ivec4(3)); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint32 p0 = glm::packI3x10_1x2(Tests[i]); - glm::ivec4 v0 = glm::unpackI3x10_1x2(p0); - glm::uint32 p1 = glm::packI3x10_1x2(v0); - glm::ivec4 v1 = glm::unpackI3x10_1x2(p1); - Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; - } - - return Error; -} - -int test_U3x10_1x2() -{ - int Error = 0; - - std::vector<glm::uvec4> Tests; - Tests.push_back(glm::uvec4(0)); - Tests.push_back(glm::uvec4(1)); - Tests.push_back(glm::uvec4(2)); - Tests.push_back(glm::uvec4(3)); - Tests.push_back(glm::uvec4(4)); - Tests.push_back(glm::uvec4(5)); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint32 p0 = glm::packU3x10_1x2(Tests[i]); - glm::uvec4 v0 = glm::unpackU3x10_1x2(p0); - glm::uint32 p1 = glm::packU3x10_1x2(v0); - glm::uvec4 v1 = glm::unpackU3x10_1x2(p1); - Error += glm::all(glm::equal(v0, v1)) ? 0 : 1; - } - - glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33); - glm::uint32 const p0 = *reinterpret_cast<glm::uint32 const*>(&v0[0]); - glm::uint32 const r0 = 0x330077ff; - - Error += p0 == r0 ? 0 : 1; - - glm::uvec4 const v1(0xff, 0x77, 0x0, 0x33); - glm::uint32 const p1 = glm::packU3x10_1x2(v1); - glm::uint32 const r1 = 0xc001dcff; - - Error += p1 == r1 ? 0 : 1; - - return Error; -} - -int test_Snorm3x10_1x2() -{ - int Error = 0; - - std::vector<glm::vec4> Tests; - Tests.push_back(glm::vec4(1.0f)); - Tests.push_back(glm::vec4(0.0f)); - Tests.push_back(glm::vec4(2.0f)); - Tests.push_back(glm::vec4(0.1f)); - Tests.push_back(glm::vec4(0.5f)); - Tests.push_back(glm::vec4(0.9f)); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint32 p0 = glm::packSnorm3x10_1x2(Tests[i]); - glm::vec4 v0 = glm::unpackSnorm3x10_1x2(p0); - glm::uint32 p1 = glm::packSnorm3x10_1x2(v0); - glm::vec4 v1 = glm::unpackSnorm3x10_1x2(p1); - - Error += glm::all(glm::epsilonEqual(v0, v1, 0.01f)) ? 0 : 1; - } - - return Error; -} - -int test_Unorm3x10_1x2() -{ - int Error = 0; - - std::vector<glm::vec4> Tests; - Tests.push_back(glm::vec4(1.0f)); - Tests.push_back(glm::vec4(0.0f)); - Tests.push_back(glm::vec4(2.0f)); - Tests.push_back(glm::vec4(0.1f)); - Tests.push_back(glm::vec4(0.5f)); - Tests.push_back(glm::vec4(0.9f)); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint32 p0 = glm::packUnorm3x10_1x2(Tests[i]); - glm::vec4 v0 = glm::unpackUnorm3x10_1x2(p0); - glm::uint32 p1 = glm::packUnorm3x10_1x2(v0); - glm::vec4 v1 = glm::unpackUnorm3x10_1x2(p1); - - Error += glm::all(glm::epsilonEqual(v0, v1, 0.001f)) ? 0 : 1; - } - - return Error; -} - -int test_F2x11_1x10() -{ - int Error = 0; - - std::vector<glm::vec3> Tests; - Tests.push_back(glm::vec3(1.0f)); - Tests.push_back(glm::vec3(0.0f)); - Tests.push_back(glm::vec3(2.0f)); - Tests.push_back(glm::vec3(0.1f)); - Tests.push_back(glm::vec3(0.5f)); - Tests.push_back(glm::vec3(0.9f)); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint32 p0 = glm::packF2x11_1x10(Tests[i]); - glm::vec3 v0 = glm::unpackF2x11_1x10(p0); - glm::uint32 p1 = glm::packF2x11_1x10(v0); - glm::vec3 v1 = glm::unpackF2x11_1x10(p1); - Error += glm::all(glm::equal(v0, v1, glm::epsilon<float>())) ? 0 : 1; - } - - return Error; -} - -int test_F3x9_E1x5() -{ - int Error = 0; - - std::vector<glm::vec3> Tests; - Tests.push_back(glm::vec3(1.0f)); - Tests.push_back(glm::vec3(0.0f)); - Tests.push_back(glm::vec3(2.0f)); - Tests.push_back(glm::vec3(0.1f)); - Tests.push_back(glm::vec3(0.5f)); - Tests.push_back(glm::vec3(0.9f)); - - for(std::size_t i = 0; i < Tests.size(); ++i) - { - glm::uint32 p0 = glm::packF3x9_E1x5(Tests[i]); - glm::vec3 v0 = glm::unpackF3x9_E1x5(p0); - glm::uint32 p1 = glm::packF3x9_E1x5(v0); - glm::vec3 v1 = glm::unpackF3x9_E1x5(p1); - Error += glm::all(glm::equal(v0, v1, glm::epsilon<float>())) ? 0 : 1; - } - - return Error; -} - -int test_RGBM() -{ - int Error = 0; - - for(std::size_t i = 0; i < 1024; ++i) - { - glm::vec3 const Color(static_cast<float>(i)); - glm::vec4 const RGBM = glm::packRGBM(Color); - glm::vec3 const Result= glm::unpackRGBM(RGBM); - - Error += glm::all(glm::equal(Color, Result, 0.01f)) ? 0 : 1; - } - - return Error; -} - -int test_packUnorm1x16() -{ - int Error = 0; - - std::vector<glm::vec1> A; - A.push_back(glm::vec1(1.0f)); - A.push_back(glm::vec1(0.5f)); - A.push_back(glm::vec1(0.1f)); - A.push_back(glm::vec1(0.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec1 B(A[i]); - glm::uint16 C = glm::packUnorm1x16(B.x); - glm::vec1 D(glm::unpackUnorm1x16(C)); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 65535.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packSnorm1x16() -{ - int Error = 0; - - std::vector<glm::vec1> A; - A.push_back(glm::vec1( 1.0f)); - A.push_back(glm::vec1( 0.0f)); - A.push_back(glm::vec1(-0.5f)); - A.push_back(glm::vec1(-0.1f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec1 B(A[i]); - glm::uint16 C = glm::packSnorm1x16(B.x); - glm::vec1 D(glm::unpackSnorm1x16(C)); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1; - } - - return Error; -} - -int test_packUnorm2x16() -{ - int Error = 0; - - std::vector<glm::vec2> A; - A.push_back(glm::vec2(1.0f, 0.0f)); - A.push_back(glm::vec2(0.5f, 0.7f)); - A.push_back(glm::vec2(0.1f, 0.2f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec2 B(A[i]); - glm::uint32 C = glm::packUnorm2x16(B); - glm::vec2 D = glm::unpackUnorm2x16(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 65535.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packSnorm2x16() -{ - int Error = 0; - - std::vector<glm::vec2> A; - A.push_back(glm::vec2( 1.0f, 0.0f)); - A.push_back(glm::vec2(-0.5f,-0.7f)); - A.push_back(glm::vec2(-0.1f, 0.1f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec2 B(A[i]); - glm::uint32 C = glm::packSnorm2x16(B); - glm::vec2 D = glm::unpackSnorm2x16(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm4x16() -{ - int Error = 0; - - std::vector<glm::vec4> A; - A.push_back(glm::vec4(1.0f)); - A.push_back(glm::vec4(0.5f)); - A.push_back(glm::vec4(0.1f)); - A.push_back(glm::vec4(0.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec4 B(A[i]); - glm::uint64 C = glm::packUnorm4x16(B); - glm::vec4 D(glm::unpackUnorm4x16(C)); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 65535.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packSnorm4x16() -{ - int Error = 0; - - std::vector<glm::vec4> A; - A.push_back(glm::vec4( 1.0f, 0.0f, -0.5f, 0.5f)); - A.push_back(glm::vec4(-0.3f,-0.7f, 0.3f, 0.7f)); - A.push_back(glm::vec4(-0.1f, 0.1f, -0.2f, 0.2f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec4 B(A[i]); - glm::uint64 C = glm::packSnorm4x16(B); - glm::vec4 D(glm::unpackSnorm4x16(C)); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm1x8() -{ - int Error = 0; - - std::vector<glm::vec1> A; - A.push_back(glm::vec1(1.0f)); - A.push_back(glm::vec1(0.5f)); - A.push_back(glm::vec1(0.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec1 B(A[i]); - glm::uint8 C = glm::packUnorm1x8(B.x); - glm::vec1 D(glm::unpackUnorm1x8(C)); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packSnorm1x8() -{ - int Error = 0; - - std::vector<glm::vec1> A; - A.push_back(glm::vec1( 1.0f)); - A.push_back(glm::vec1(-0.7f)); - A.push_back(glm::vec1(-1.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec1 B(A[i]); - glm::uint8 C = glm::packSnorm1x8(B.x); - glm::vec1 D(glm::unpackSnorm1x8(C)); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 127.f)) ? 0 : 1; - } - - return Error; -} - -int test_packUnorm2x8() -{ - int Error = 0; - - std::vector<glm::vec2> A; - A.push_back(glm::vec2(1.0f, 0.7f)); - A.push_back(glm::vec2(0.5f, 0.1f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec2 B(A[i]); - glm::uint16 C = glm::packUnorm2x8(B); - glm::vec2 D = glm::unpackUnorm2x8(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packSnorm2x8() -{ - int Error = 0; - - std::vector<glm::vec2> A; - A.push_back(glm::vec2( 1.0f, 0.0f)); - A.push_back(glm::vec2(-0.7f,-0.1f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec2 B(A[i]); - glm::uint16 C = glm::packSnorm2x8(B); - glm::vec2 D = glm::unpackSnorm2x8(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 127.f)) ? 0 : 1; - } - - return Error; -} - -int test_packUnorm4x8() -{ - int Error = 0; - - std::vector<glm::vec4> A; - A.push_back(glm::vec4(1.0f, 0.7f, 0.3f, 0.0f)); - A.push_back(glm::vec4(0.5f, 0.1f, 0.2f, 0.3f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec4 B(A[i]); - glm::uint32 C = glm::packUnorm4x8(B); - glm::vec4 D = glm::unpackUnorm4x8(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packSnorm4x8() -{ - int Error = 0; - - std::vector<glm::vec4> A; - A.push_back(glm::vec4( 1.0f, 0.0f,-0.5f,-1.0f)); - A.push_back(glm::vec4(-0.7f,-0.1f, 0.1f, 0.7f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec4 B(A[i]); - glm::uint32 C = glm::packSnorm4x8(B); - glm::vec4 D = glm::unpackSnorm4x8(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 127.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm() -{ - int Error = 0; - - std::vector<glm::vec2> A; - A.push_back(glm::vec2(1.0f, 0.7f)); - A.push_back(glm::vec2(0.5f, 0.1f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec2 B(A[i]); - glm::u16vec2 C = glm::packUnorm<glm::uint16>(B); - glm::vec2 D = glm::unpackUnorm<float>(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 255.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packSnorm() -{ - int Error = 0; - - std::vector<glm::vec2> A; - A.push_back(glm::vec2( 1.0f, 0.0f)); - A.push_back(glm::vec2(-0.5f,-0.7f)); - A.push_back(glm::vec2(-0.1f, 0.1f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec2 B(A[i]); - glm::i16vec2 C = glm::packSnorm<glm::int16>(B); - glm::vec2 D = glm::unpackSnorm<float>(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm2x4() -{ - int Error = 0; - - std::vector<glm::vec2> A; - A.push_back(glm::vec2(1.0f, 0.7f)); - A.push_back(glm::vec2(0.5f, 0.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec2 B(A[i]); - glm::uint8 C = glm::packUnorm2x4(B); - glm::vec2 D = glm::unpackUnorm2x4(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm4x4() -{ - int Error = 0; - - std::vector<glm::vec4> A; - A.push_back(glm::vec4(1.0f, 0.7f, 0.5f, 0.0f)); - A.push_back(glm::vec4(0.5f, 0.1f, 0.0f, 1.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec4 B(A[i]); - glm::uint16 C = glm::packUnorm4x4(B); - glm::vec4 D = glm::unpackUnorm4x4(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm3x5_1x1() -{ - int Error = 0; - - std::vector<glm::vec4> A; - A.push_back(glm::vec4(1.0f, 0.7f, 0.5f, 0.0f)); - A.push_back(glm::vec4(0.5f, 0.1f, 0.0f, 1.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec4 B(A[i]); - glm::uint16 C = glm::packUnorm3x5_1x1(B); - glm::vec4 D = glm::unpackUnorm3x5_1x1(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm1x5_1x6_1x5() -{ - int Error = 0; - - std::vector<glm::vec3> A; - A.push_back(glm::vec3(1.0f, 0.7f, 0.5f)); - A.push_back(glm::vec3(0.5f, 0.1f, 0.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec3 B(A[i]); - glm::uint16 C = glm::packUnorm1x5_1x6_1x5(B); - glm::vec3 D = glm::unpackUnorm1x5_1x6_1x5(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 15.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUnorm2x3_1x2() -{ - int Error = 0; - - std::vector<glm::vec3> A; - A.push_back(glm::vec3(1.0f, 0.7f, 0.5f)); - A.push_back(glm::vec3(0.5f, 0.1f, 0.0f)); - - for(std::size_t i = 0; i < A.size(); ++i) - { - glm::vec3 B(A[i]); - glm::uint8 C = glm::packUnorm2x3_1x2(B); - glm::vec3 D = glm::unpackUnorm2x3_1x2(C); - Error += glm::all(glm::epsilonEqual(B, D, 1.0f / 3.f)) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_packUint2x8() -{ - int Error = 0; - - glm::u8vec2 const Source(1, 2); - - glm::uint16 const Packed = glm::packUint2x8(Source); - Error += Packed != 0 ? 0 : 1; - - glm::u8vec2 const Unpacked = glm::unpackUint2x8(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packUint4x8() -{ - int Error = 0; - - glm::u8vec4 const Source(1, 2, 3, 4); - - glm::uint32 const Packed = glm::packUint4x8(Source); - Error += Packed != 0 ? 0 : 1; - - glm::u8vec4 const Unpacked = glm::unpackUint4x8(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packUint2x16() -{ - int Error = 0; - - glm::u16vec2 const Source(1, 2); - - glm::uint32 const Packed = glm::packUint2x16(Source); - Error += Packed != 0 ? 0 : 1; - - glm::u16vec2 const Unpacked = glm::unpackUint2x16(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packUint4x16() -{ - int Error = 0; - - glm::u16vec4 const Source(1, 2, 3, 4); - - glm::uint64 const Packed = glm::packUint4x16(Source); - Error += Packed != 0 ? 0 : 1; - - glm::u16vec4 const Unpacked = glm::unpackUint4x16(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packUint2x32() -{ - int Error = 0; - - glm::u32vec2 const Source(1, 2); - - glm::uint64 const Packed = glm::packUint2x32(Source); - Error += Packed != 0 ? 0 : 1; - - glm::u32vec2 const Unpacked = glm::unpackUint2x32(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packInt2x8() -{ - int Error = 0; - - glm::i8vec2 const Source(1, 2); - - glm::int16 const Packed = glm::packInt2x8(Source); - Error += Packed != 0 ? 0 : 1; - - glm::i8vec2 const Unpacked = glm::unpackInt2x8(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packInt4x8() -{ - int Error = 0; - - glm::i8vec4 const Source(1, 2, 3, 4); - - glm::int32 const Packed = glm::packInt4x8(Source); - Error += Packed != 0 ? 0 : 1; - - glm::i8vec4 const Unpacked = glm::unpackInt4x8(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packInt2x16() -{ - int Error = 0; - - glm::i16vec2 const Source(1, 2); - - glm::int32 const Packed = glm::packInt2x16(Source); - Error += Packed != 0 ? 0 : 1; - - glm::i16vec2 const Unpacked = glm::unpackInt2x16(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packInt4x16() -{ - int Error = 0; - - glm::i16vec4 const Source(1, 2, 3, 4); - - glm::int64 const Packed = glm::packInt4x16(Source); - Error += Packed != 0 ? 0 : 1; - - glm::i16vec4 const Unpacked = glm::unpackInt4x16(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int test_packInt2x32() -{ - int Error = 0; - - glm::i32vec2 const Source(1, 2); - - glm::int64 const Packed = glm::packInt2x32(Source); - Error += Packed != 0 ? 0 : 1; - - glm::i32vec2 const Unpacked = glm::unpackInt2x32(Packed); - Error += Source == Unpacked ? 0 : 1; - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_packUnorm(); - Error += test_packSnorm(); - - Error += test_packSnorm1x16(); - Error += test_packSnorm2x16(); - Error += test_packSnorm4x16(); - - Error += test_packSnorm1x8(); - Error += test_packSnorm2x8(); - Error += test_packSnorm4x8(); - - Error += test_packUnorm1x16(); - Error += test_packUnorm2x16(); - Error += test_packUnorm4x16(); - - Error += test_packUnorm1x8(); - Error += test_packUnorm2x8(); - Error += test_packUnorm4x8(); - - Error += test_packUnorm2x4(); - Error += test_packUnorm4x4(); - Error += test_packUnorm3x5_1x1(); - Error += test_packUnorm1x5_1x6_1x5(); - Error += test_packUnorm2x3_1x2(); - - Error += test_packUint2x8(); - Error += test_packUint4x8(); - Error += test_packUint2x16(); - Error += test_packUint4x16(); - Error += test_packUint2x32(); - - Error += test_packInt2x8(); - Error += test_packInt4x8(); - Error += test_packInt2x16(); - Error += test_packInt4x16(); - Error += test_packInt2x32(); - - Error += test_F2x11_1x10(); - Error += test_F3x9_E1x5(); - Error += test_RGBM(); - Error += test_Unorm3x10_1x2(); - Error += test_Snorm3x10_1x2(); - - Error += test_I3x10_1x2(); - Error += test_U3x10_1x2(); - Error += test_Half1x16(); - Error += test_Half4x16(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_quaternion.cpp b/3rdparty/glm/source/test/gtc/gtc_quaternion.cpp deleted file mode 100644 index 540ca42..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_quaternion.cpp +++ /dev/null @@ -1,345 +0,0 @@ -#include <glm/gtc/constants.hpp> -#include <glm/gtc/quaternion.hpp> -#include <glm/gtc/matrix_transform.hpp> -#include <glm/ext/matrix_relational.hpp> -#include <glm/ext/vector_relational.hpp> -#include <glm/ext/scalar_relational.hpp> -#include <glm/glm.hpp> -#include <vector> - -int test_quat_angle() -{ - int Error = 0; - - { - glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1)); - glm::quat N = glm::normalize(Q); - float L = glm::length(N); - Error += glm::equal(L, 1.0f, 0.01f) ? 0 : 1; - float A = glm::angle(N); - Error += glm::equal(A, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1; - } - { - glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::normalize(glm::vec3(0, 1, 1))); - glm::quat N = glm::normalize(Q); - float L = glm::length(N); - Error += glm::equal(L, 1.0f, 0.01f) ? 0 : 1; - float A = glm::angle(N); - Error += glm::equal(A, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1; - } - { - glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::normalize(glm::vec3(1, 2, 3))); - glm::quat N = glm::normalize(Q); - float L = glm::length(N); - Error += glm::equal(L, 1.0f, 0.01f) ? 0 : 1; - float A = glm::angle(N); - Error += glm::equal(A, glm::pi<float>() * 0.25f, 0.01f) ? 0 : 1; - } - - return Error; -} - -int test_quat_angleAxis() -{ - int Error = 0; - - glm::quat A = glm::angleAxis(0.f, glm::vec3(0.f, 0.f, 1.f)); - glm::quat B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1)); - glm::quat C = glm::mix(A, B, 0.5f); - glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1)); - - Error += glm::equal(C.x, D.x, 0.01f) ? 0 : 1; - Error += glm::equal(C.y, D.y, 0.01f) ? 0 : 1; - Error += glm::equal(C.z, D.z, 0.01f) ? 0 : 1; - Error += glm::equal(C.w, D.w, 0.01f) ? 0 : 1; - - return Error; -} - -int test_quat_mix() -{ - int Error = 0; - - glm::quat A = glm::angleAxis(0.f, glm::vec3(0.f, 0.f, 1.f)); - glm::quat B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1)); - glm::quat C = glm::mix(A, B, 0.5f); - glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1)); - - Error += glm::equal(C.x, D.x, 0.01f) ? 0 : 1; - Error += glm::equal(C.y, D.y, 0.01f) ? 0 : 1; - Error += glm::equal(C.z, D.z, 0.01f) ? 0 : 1; - Error += glm::equal(C.w, D.w, 0.01f) ? 0 : 1; - - return Error; -} - -int test_quat_normalize() -{ - int Error(0); - - { - glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1)); - glm::quat N = glm::normalize(Q); - float L = glm::length(N); - Error += glm::equal(L, 1.0f, 0.000001f) ? 0 : 1; - } - { - glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 2)); - glm::quat N = glm::normalize(Q); - float L = glm::length(N); - Error += glm::equal(L, 1.0f, 0.000001f) ? 0 : 1; - } - { - glm::quat Q = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(1, 2, 3)); - glm::quat N = glm::normalize(Q); - float L = glm::length(N); - Error += glm::equal(L, 1.0f, 0.000001f) ? 0 : 1; - } - - return Error; -} - -int test_quat_euler() -{ - int Error = 0; - - { - glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); - float Roll = glm::roll(q); - float Pitch = glm::pitch(q); - float Yaw = glm::yaw(q); - glm::vec3 Angles = glm::eulerAngles(q); - Error += glm::all(glm::equal(Angles, glm::vec3(Pitch, Yaw, Roll), 0.000001f)) ? 0 : 1; - } - - { - glm::dquat q(1.0, 0.0, 0.0, 1.0); - double Roll = glm::roll(q); - double Pitch = glm::pitch(q); - double Yaw = glm::yaw(q); - glm::dvec3 Angles = glm::eulerAngles(q); - Error += glm::all(glm::equal(Angles, glm::dvec3(Pitch, Yaw, Roll), 0.000001)) ? 0 : 1; - } - - return Error; -} - -int test_quat_slerp() -{ - int Error = 0; - - float const Epsilon = 0.0001f;//glm::epsilon<float>(); - - float sqrt2 = std::sqrt(2.0f)/2.0f; - glm::quat id(static_cast<float>(1), static_cast<float>(0), static_cast<float>(0), static_cast<float>(0)); - glm::quat Y90rot(sqrt2, 0.0f, sqrt2, 0.0f); - glm::quat Y180rot(0.0f, 0.0f, 1.0f, 0.0f); - - // Testing a == 0 - // Must be id - glm::quat id2 = glm::slerp(id, Y90rot, 0.0f); - Error += glm::all(glm::equal(id, id2, Epsilon)) ? 0 : 1; - - // Testing a == 1 - // Must be 90� rotation on Y : 0 0.7 0 0.7 - glm::quat Y90rot2 = glm::slerp(id, Y90rot, 1.0f); - Error += glm::all(glm::equal(Y90rot, Y90rot2, Epsilon)) ? 0 : 1; - - // Testing standard, easy case - // Must be 45� rotation on Y : 0 0.38 0 0.92 - glm::quat Y45rot1 = glm::slerp(id, Y90rot, 0.5f); - - // Testing reverse case - // Must be 45� rotation on Y : 0 0.38 0 0.92 - glm::quat Ym45rot2 = glm::slerp(Y90rot, id, 0.5f); - - // Testing against full circle around the sphere instead of shortest path - // Must be 45� rotation on Y - // certainly not a 135� rotation - glm::quat Y45rot3 = glm::slerp(id , -Y90rot, 0.5f); - float Y45angle3 = glm::angle(Y45rot3); - Error += glm::equal(Y45angle3, glm::pi<float>() * 0.25f, Epsilon) ? 0 : 1; - Error += glm::all(glm::equal(Ym45rot2, Y45rot3, Epsilon)) ? 0 : 1; - - // Same, but inverted - // Must also be 45� rotation on Y : 0 0.38 0 0.92 - // -0 -0.38 -0 -0.92 is ok too - glm::quat Y45rot4 = glm::slerp(-Y90rot, id, 0.5f); - Error += glm::all(glm::equal(Ym45rot2, -Y45rot4, Epsilon)) ? 0 : 1; - - // Testing q1 = q2 - // Must be 90� rotation on Y : 0 0.7 0 0.7 - glm::quat Y90rot3 = glm::slerp(Y90rot, Y90rot, 0.5f); - Error += glm::all(glm::equal(Y90rot, Y90rot3, Epsilon)) ? 0 : 1; - - // Testing 180� rotation - // Must be 90� rotation on almost any axis that is on the XZ plane - glm::quat XZ90rot = glm::slerp(id, -Y90rot, 0.5f); - float XZ90angle = glm::angle(XZ90rot); // Must be PI/4 = 0.78; - Error += glm::equal(XZ90angle, glm::pi<float>() * 0.25f, Epsilon) ? 0 : 1; - - // Testing almost equal quaternions (this test should pass through the linear interpolation) - // Must be 0 0.00X 0 0.99999 - glm::quat almostid = glm::slerp(id, glm::angleAxis(0.1f, glm::vec3(0.0f, 1.0f, 0.0f)), 0.5f); - - // Testing quaternions with opposite sign - { - glm::quat a(-1, 0, 0, 0); - - glm::quat result = glm::slerp(a, id, 0.5f); - - Error += glm::equal(glm::pow(glm::dot(id, result), 2.f), 1.f, 0.01f) ? 0 : 1; - } - - return Error; -} - -int test_quat_slerp_spins() -{ - int Error = 0; - - float const Epsilon = 0.0001f;//glm::epsilon<float>(); - - float sqrt2 = std::sqrt(2.0f) / 2.0f; - glm::quat id(static_cast<float>(1), static_cast<float>(0), static_cast<float>(0), static_cast<float>(0)); - glm::quat Y90rot(sqrt2, 0.0f, sqrt2, 0.0f); - glm::quat Y180rot(0.0f, 0.0f, 1.0f, 0.0f); - - // Testing a == 0, k == 1 - // Must be id - glm::quat id2 = glm::slerp(id, id, 1.0f, 1); - Error += glm::all(glm::equal(id, id2, Epsilon)) ? 0 : 1; - - // Testing a == 1, k == 2 - // Must be id - glm::quat id3 = glm::slerp(id, id, 1.0f, 2); - Error += glm::all(glm::equal(id, id3, Epsilon)) ? 0 : 1; - - // Testing a == 1, k == 1 - // Must be 90� rotation on Y : 0 0.7 0 0.7 - // Negative quaternion is representing same orientation - glm::quat Y90rot2 = glm::slerp(id, Y90rot, 1.0f, 1); - Error += glm::all(glm::equal(Y90rot, -Y90rot2, Epsilon)) ? 0 : 1; - - // Testing a == 1, k == 2 - // Must be id - glm::quat Y90rot3 = glm::slerp(id, Y90rot, 8.0f / 9.0f, 2); - Error += glm::all(glm::equal(id, Y90rot3, Epsilon)) ? 0 : 1; - - // Testing a == 1, k == 1 - // Must be 90� rotation on Y : 0 0.7 0 0.7 - glm::quat Y90rot4 = glm::slerp(id, Y90rot, 0.2f, 1); - Error += glm::all(glm::equal(Y90rot, Y90rot4, Epsilon)) ? 0 : 1; - - // Testing reverse case - // Must be 45� rotation on Y : 0 0.38 0 0.92 - // Negative quaternion is representing same orientation - glm::quat Ym45rot2 = glm::slerp(Y90rot, id, 0.9f, 1); - glm::quat Ym45rot3 = glm::slerp(Y90rot, id, 0.5f); - Error += glm::all(glm::equal(-Ym45rot2, Ym45rot3, Epsilon)) ? 0 : 1; - - // Testing against full circle around the sphere instead of shortest path - // Must be 45� rotation on Y - // certainly not a 135� rotation - glm::quat Y45rot3 = glm::slerp(id, -Y90rot, 0.5f, 0); - float Y45angle3 = glm::angle(Y45rot3); - Error += glm::equal(Y45angle3, glm::pi<float>() * 0.25f, Epsilon) ? 0 : 1; - Error += glm::all(glm::equal(Ym45rot3, Y45rot3, Epsilon)) ? 0 : 1; - - // Same, but inverted - // Must also be 45� rotation on Y : 0 0.38 0 0.92 - // -0 -0.38 -0 -0.92 is ok too - glm::quat Y45rot4 = glm::slerp(-Y90rot, id, 0.5f, 0); - Error += glm::all(glm::equal(Ym45rot2, Y45rot4, Epsilon)) ? 0 : 1; - - // Testing q1 = q2 k == 2 - // Must be 90� rotation on Y : 0 0.7 0 0.7 - glm::quat Y90rot5 = glm::slerp(Y90rot, Y90rot, 0.5f, 2); - Error += glm::all(glm::equal(Y90rot, Y90rot5, Epsilon)) ? 0 : 1; - - // Testing 180� rotation - // Must be 90� rotation on almost any axis that is on the XZ plane - glm::quat XZ90rot = glm::slerp(id, -Y90rot, 0.5f, 1); - float XZ90angle = glm::angle(XZ90rot); // Must be PI/4 = 0.78; - Error += glm::equal(XZ90angle, glm::pi<float>() * 1.25f, Epsilon) ? 0 : 1; - - // Testing rotation over long arc - // Distance from id to 90� is 270�, so 2/3 of it should be 180� - // Negative quaternion is representing same orientation - glm::quat Neg90rot = glm::slerp(id, Y90rot, 2.0f / 3.0f, -1); - Error += glm::all(glm::equal(Y180rot, -Neg90rot, Epsilon)) ? 0 : 1; - - return Error; -} - -static int test_quat_mul_vec() -{ - int Error(0); - - glm::quat q = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1)); - glm::vec3 v(1, 0, 0); - glm::vec3 u(q * v); - glm::vec3 w(u * q); - - Error += glm::all(glm::equal(v, w, 0.01f)) ? 0 : 1; - - return Error; -} - -static int test_mul() -{ - int Error = 0; - - glm::quat temp1 = glm::normalize(glm::quat(1.0f, glm::vec3(0.0, 1.0, 0.0))); - glm::quat temp2 = glm::normalize(glm::quat(0.5f, glm::vec3(1.0, 0.0, 0.0))); - - glm::vec3 transformed0 = (temp1 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp1)); - glm::vec3 temp4 = temp2 * transformed0 * glm::inverse(temp2); - - glm::quat temp5 = glm::normalize(temp1 * temp2); - glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5); - - glm::quat temp7(1.0f, glm::vec3(0.0, 1.0, 0.0)); - - temp7 *= temp5; - temp7 *= glm::inverse(temp5); - - Error += glm::any(glm::notEqual(temp7, glm::quat(1.0f, glm::vec3(0.0, 1.0, 0.0)), glm::epsilon<float>())) ? 1 : 0; - - return Error; -} - -int test_identity() -{ - int Error = 0; - - glm::quat const Q = glm::identity<glm::quat>(); - - Error += glm::all(glm::equal(Q, glm::quat(1, 0, 0, 0), 0.0001f)) ? 0 : 1; - Error += glm::any(glm::notEqual(Q, glm::quat(1, 0, 0, 0), 0.0001f)) ? 1 : 0; - - glm::mat4 const M = glm::identity<glm::mat4x4>(); - glm::mat4 const N(1.0f); - - Error += glm::all(glm::equal(M, N, 0.0001f)) ? 0 : 1; - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_mul(); - Error += test_quat_mul_vec(); - Error += test_quat_angle(); - Error += test_quat_angleAxis(); - Error += test_quat_mix(); - Error += test_quat_normalize(); - Error += test_quat_euler(); - Error += test_quat_slerp(); - Error += test_quat_slerp_spins(); - Error += test_identity(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_random.cpp b/3rdparty/glm/source/test/gtc/gtc_random.cpp deleted file mode 100644 index 60fb60c..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_random.cpp +++ /dev/null @@ -1,381 +0,0 @@ -#define GLM_FORCE_DEFAULT_ALIGNED_GENTYPES -#include <glm/gtc/random.hpp> -#include <glm/gtc/epsilon.hpp> -#include <glm/gtc/type_precision.hpp> -#if GLM_LANG & GLM_LANG_CXX0X_FLAG -# include <array> -#endif - -std::size_t const TestSamples = 10000; - -int test_linearRand() -{ - int Error = 0; - - glm::int32 const Min = 16; - glm::int32 const Max = 32; - - { - glm::u8vec2 AMin(std::numeric_limits<glm::u8>::max()); - glm::u8vec2 AMax(std::numeric_limits<glm::u8>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::u8vec2 A = glm::linearRand(glm::u8vec2(Min), glm::u8vec2(Max)); - AMin = glm::min(AMin, A); - AMax = glm::max(AMax, A); - - if(!glm::all(glm::lessThanEqual(A, glm::u8vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(A, glm::u8vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(AMin, glm::u8vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(AMax, glm::u8vec2(Max))) ? 0 : 1; - assert(!Error); - } - - glm::u16vec2 BMin(std::numeric_limits<glm::u16>::max()); - glm::u16vec2 BMax(std::numeric_limits<glm::u16>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::u16vec2 B = glm::linearRand(glm::u16vec2(Min), glm::u16vec2(Max)); - BMin = glm::min(BMin, B); - BMax = glm::max(BMax, B); - - if(!glm::all(glm::lessThanEqual(B, glm::u16vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(B, glm::u16vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(BMin, glm::u16vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(BMax, glm::u16vec2(Max))) ? 0 : 1; - assert(!Error); - } - - glm::u32vec2 CMin(std::numeric_limits<glm::u32>::max()); - glm::u32vec2 CMax(std::numeric_limits<glm::u32>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::u32vec2 C = glm::linearRand(glm::u32vec2(Min), glm::u32vec2(Max)); - CMin = glm::min(CMin, C); - CMax = glm::max(CMax, C); - - if(!glm::all(glm::lessThanEqual(C, glm::u32vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(C, glm::u32vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(CMin, glm::u32vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(CMax, glm::u32vec2(Max))) ? 0 : 1; - assert(!Error); - } - - glm::u64vec2 DMin(std::numeric_limits<glm::u64>::max()); - glm::u64vec2 DMax(std::numeric_limits<glm::u64>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::u64vec2 D = glm::linearRand(glm::u64vec2(Min), glm::u64vec2(Max)); - DMin = glm::min(DMin, D); - DMax = glm::max(DMax, D); - - if(!glm::all(glm::lessThanEqual(D, glm::u64vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(D, glm::u64vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(DMin, glm::u64vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(DMax, glm::u64vec2(Max))) ? 0 : 1; - assert(!Error); - } - } - - { - glm::i8vec2 AMin(std::numeric_limits<glm::i8>::max()); - glm::i8vec2 AMax(std::numeric_limits<glm::i8>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::i8vec2 A = glm::linearRand(glm::i8vec2(Min), glm::i8vec2(Max)); - AMin = glm::min(AMin, A); - AMax = glm::max(AMax, A); - - if(!glm::all(glm::lessThanEqual(A, glm::i8vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(A, glm::i8vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(AMin, glm::i8vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(AMax, glm::i8vec2(Max))) ? 0 : 1; - assert(!Error); - } - - glm::i16vec2 BMin(std::numeric_limits<glm::i16>::max()); - glm::i16vec2 BMax(std::numeric_limits<glm::i16>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::i16vec2 B = glm::linearRand(glm::i16vec2(Min), glm::i16vec2(Max)); - BMin = glm::min(BMin, B); - BMax = glm::max(BMax, B); - - if(!glm::all(glm::lessThanEqual(B, glm::i16vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(B, glm::i16vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(BMin, glm::i16vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(BMax, glm::i16vec2(Max))) ? 0 : 1; - assert(!Error); - } - - glm::i32vec2 CMin(std::numeric_limits<glm::i32>::max()); - glm::i32vec2 CMax(std::numeric_limits<glm::i32>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::i32vec2 C = glm::linearRand(glm::i32vec2(Min), glm::i32vec2(Max)); - CMin = glm::min(CMin, C); - CMax = glm::max(CMax, C); - - if(!glm::all(glm::lessThanEqual(C, glm::i32vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(C, glm::i32vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(CMin, glm::i32vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(CMax, glm::i32vec2(Max))) ? 0 : 1; - assert(!Error); - } - - glm::i64vec2 DMin(std::numeric_limits<glm::i64>::max()); - glm::i64vec2 DMax(std::numeric_limits<glm::i64>::min()); - { - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::i64vec2 D = glm::linearRand(glm::i64vec2(Min), glm::i64vec2(Max)); - DMin = glm::min(DMin, D); - DMax = glm::max(DMax, D); - - if(!glm::all(glm::lessThanEqual(D, glm::i64vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(D, glm::i64vec2(Min)))) - ++Error; - assert(!Error); - } - - Error += glm::all(glm::equal(DMin, glm::i64vec2(Min))) ? 0 : 1; - Error += glm::all(glm::equal(DMax, glm::i64vec2(Max))) ? 0 : 1; - assert(!Error); - } - } - - for(std::size_t i = 0; i < TestSamples; ++i) - { - glm::f32vec2 const A(glm::linearRand(glm::f32vec2(static_cast<float>(Min)), glm::f32vec2(static_cast<float>(Max)))); - if(!glm::all(glm::lessThanEqual(A, glm::f32vec2(static_cast<float>(Max))))) - ++Error; - if(!glm::all(glm::greaterThanEqual(A, glm::f32vec2(static_cast<float>(Min))))) - ++Error; - - glm::f64vec2 const B(glm::linearRand(glm::f64vec2(Min), glm::f64vec2(Max))); - if(!glm::all(glm::lessThanEqual(B, glm::f64vec2(Max)))) - ++Error; - if(!glm::all(glm::greaterThanEqual(B, glm::f64vec2(Min)))) - ++Error; - assert(!Error); - } - - { - float ResultFloat = 0.0f; - double ResultDouble = 0.0; - for(std::size_t i = 0; i < TestSamples; ++i) - { - ResultFloat += glm::linearRand(-1.0f, 1.0f); - ResultDouble += glm::linearRand(-1.0, 1.0); - } - - Error += glm::epsilonEqual(ResultFloat, 0.0f, 0.0001f); - Error += glm::epsilonEqual(ResultDouble, 0.0, 0.0001); - assert(!Error); - } - - return Error; -} - -int test_circularRand() -{ - int Error = 0; - - { - std::size_t Max = TestSamples; - float ResultFloat = 0.0f; - double ResultDouble = 0.0; - double Radius = 2.0; - - for(std::size_t i = 0; i < Max; ++i) - { - ResultFloat += glm::length(glm::circularRand(1.0f)); - ResultDouble += glm::length(glm::circularRand(Radius)); - } - - Error += glm::epsilonEqual(ResultFloat, float(Max), 0.01f) ? 0 : 1; - Error += glm::epsilonEqual(ResultDouble, double(Max) * double(Radius), 0.01) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_sphericalRand() -{ - int Error = 0; - - { - std::size_t Max = TestSamples; - float ResultFloatA = 0.0f; - float ResultFloatB = 0.0f; - float ResultFloatC = 0.0f; - double ResultDoubleA = 0.0; - double ResultDoubleB = 0.0; - double ResultDoubleC = 0.0; - - for(std::size_t i = 0; i < Max; ++i) - { - ResultFloatA += glm::length(glm::sphericalRand(1.0f)); - ResultDoubleA += glm::length(glm::sphericalRand(1.0)); - ResultFloatB += glm::length(glm::sphericalRand(2.0f)); - ResultDoubleB += glm::length(glm::sphericalRand(2.0)); - ResultFloatC += glm::length(glm::sphericalRand(3.0f)); - ResultDoubleC += glm::length(glm::sphericalRand(3.0)); - } - - Error += glm::epsilonEqual(ResultFloatA, float(Max), 0.01f) ? 0 : 1; - Error += glm::epsilonEqual(ResultDoubleA, double(Max), 0.0001) ? 0 : 1; - Error += glm::epsilonEqual(ResultFloatB, float(Max * 2), 0.01f) ? 0 : 1; - Error += glm::epsilonEqual(ResultDoubleB, double(Max * 2), 0.0001) ? 0 : 1; - Error += glm::epsilonEqual(ResultFloatC, float(Max * 3), 0.01f) ? 0 : 1; - Error += glm::epsilonEqual(ResultDoubleC, double(Max * 3), 0.01) ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_diskRand() -{ - int Error = 0; - - { - float ResultFloat = 0.0f; - double ResultDouble = 0.0; - - for(std::size_t i = 0; i < TestSamples; ++i) - { - ResultFloat += glm::length(glm::diskRand(2.0f)); - ResultDouble += glm::length(glm::diskRand(2.0)); - } - - Error += ResultFloat < float(TestSamples) * 2.f ? 0 : 1; - Error += ResultDouble < double(TestSamples) * 2.0 ? 0 : 1; - assert(!Error); - } - - return Error; -} - -int test_ballRand() -{ - int Error = 0; - - { - float ResultFloat = 0.0f; - double ResultDouble = 0.0; - - for(std::size_t i = 0; i < TestSamples; ++i) - { - ResultFloat += glm::length(glm::ballRand(2.0f)); - ResultDouble += glm::length(glm::ballRand(2.0)); - } - - Error += ResultFloat < float(TestSamples) * 2.f ? 0 : 1; - Error += ResultDouble < double(TestSamples) * 2.0 ? 0 : 1; - assert(!Error); - } - - return Error; -} -/* -#if(GLM_LANG & GLM_LANG_CXX0X_FLAG) -int test_grid() -{ - int Error = 0; - - typedef std::array<int, 8> colors; - typedef std::array<int, 8 * 8> grid; - - grid Grid; - colors Colors; - - grid GridBest; - colors ColorsBest; - - while(true) - { - for(std::size_t i = 0; i < Grid.size(); ++i) - Grid[i] = int(glm::linearRand(0.0, 8.0 * 8.0 * 8.0 - 1.0) / 64.0); - - for(std::size_t i = 0; i < Grid.size(); ++i) - ++Colors[Grid[i]]; - - bool Exit = true; - for(std::size_t i = 0; i < Colors.size(); ++i) - { - if(Colors[i] == 8) - continue; - - Exit = false; - break; - } - - if(Exit == true) - break; - } - - return Error; -} -#endif -*/ -int main() -{ - int Error = 0; - - Error += test_linearRand(); - Error += test_circularRand(); - Error += test_sphericalRand(); - Error += test_diskRand(); - Error += test_ballRand(); -/* -#if(GLM_LANG & GLM_LANG_CXX0X_FLAG) - Error += test_grid(); -#endif -*/ - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_reciprocal.cpp b/3rdparty/glm/source/test/gtc/gtc_reciprocal.cpp deleted file mode 100644 index 5158413..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_reciprocal.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include <glm/gtc/reciprocal.hpp> -#include <ctime> - -int main() -{ - return 0; -} - diff --git a/3rdparty/glm/source/test/gtc/gtc_round.cpp b/3rdparty/glm/source/test/gtc/gtc_round.cpp deleted file mode 100644 index 60d9a85..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_round.cpp +++ /dev/null @@ -1,458 +0,0 @@ -#include <glm/gtc/round.hpp> -#include <glm/gtc/type_precision.hpp> -#include <glm/gtc/vec1.hpp> -#include <glm/gtc/epsilon.hpp> -#include <vector> -#include <ctime> -#include <cstdio> - -namespace isPowerOfTwo -{ - template<typename genType> - struct type - { - genType Value; - bool Return; - }; - - int test_int16() - { - type<glm::int16> const Data[] = - { - {0x0001, true}, - {0x0002, true}, - {0x0004, true}, - {0x0080, true}, - {0x0000, true}, - {0x0003, false} - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::int16>); i < n; ++i) - { - bool Result = glm::isPowerOfTwo(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - return Error; - } - - int test_uint16() - { - type<glm::uint16> const Data[] = - { - {0x0001, true}, - {0x0002, true}, - {0x0004, true}, - {0x0000, true}, - {0x0000, true}, - {0x0003, false} - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::uint16>); i < n; ++i) - { - bool Result = glm::isPowerOfTwo(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - return Error; - } - - int test_int32() - { - type<int> const Data[] = - { - {0x00000001, true}, - {0x00000002, true}, - {0x00000004, true}, - {0x0000000f, false}, - {0x00000000, true}, - {0x00000003, false} - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<int>); i < n; ++i) - { - bool Result = glm::isPowerOfTwo(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<int>); i < n; ++i) - { - glm::bvec1 Result = glm::isPowerOfTwo(glm::ivec1(Data[i].Value)); - Error += glm::all(glm::equal(glm::bvec1(Data[i].Return), Result)) ? 0 : 1; - } - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<int>); i < n; ++i) - { - glm::bvec2 Result = glm::isPowerOfTwo(glm::ivec2(Data[i].Value)); - Error += glm::all(glm::equal(glm::bvec2(Data[i].Return), Result)) ? 0 : 1; - } - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<int>); i < n; ++i) - { - glm::bvec3 Result = glm::isPowerOfTwo(glm::ivec3(Data[i].Value)); - Error += glm::all(glm::equal(glm::bvec3(Data[i].Return), Result)) ? 0 : 1; - } - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<int>); i < n; ++i) - { - glm::bvec4 Result = glm::isPowerOfTwo(glm::ivec4(Data[i].Value)); - Error += glm::all(glm::equal(glm::bvec4(Data[i].Return), Result)) ? 0 : 1; - } - - return Error; - } - - int test_uint32() - { - type<glm::uint> const Data[] = - { - {0x00000001, true}, - {0x00000002, true}, - {0x00000004, true}, - {0x80000000, true}, - {0x00000000, true}, - {0x00000003, false} - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::uint>); i < n; ++i) - { - bool Result = glm::isPowerOfTwo(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - return Error; - } - - int test() - { - int Error(0); - - Error += test_int16(); - Error += test_uint16(); - Error += test_int32(); - Error += test_uint32(); - - return Error; - } -}//isPowerOfTwo - -namespace ceilPowerOfTwo_advanced -{ - template<typename genIUType> - GLM_FUNC_QUALIFIER genIUType highestBitValue(genIUType Value) - { - genIUType tmp = Value; - genIUType result = genIUType(0); - while(tmp) - { - result = (tmp & (~tmp + 1)); // grab lowest bit - tmp &= ~result; // clear lowest bit - } - return result; - } - - template<typename genType> - GLM_FUNC_QUALIFIER genType ceilPowerOfTwo_loop(genType value) - { - return glm::isPowerOfTwo(value) ? value : highestBitValue(value) << 1; - } - - template<typename genType> - struct type - { - genType Value; - genType Return; - }; - - int test_int32() - { - type<glm::int32> const Data[] = - { - {0x0000ffff, 0x00010000}, - {-3, -4}, - {-8, -8}, - {0x00000001, 0x00000001}, - {0x00000002, 0x00000002}, - {0x00000004, 0x00000004}, - {0x00000007, 0x00000008}, - {0x0000fff0, 0x00010000}, - {0x0000f000, 0x00010000}, - {0x08000000, 0x08000000}, - {0x00000000, 0x00000000}, - {0x00000003, 0x00000004} - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::int32>); i < n; ++i) - { - glm::int32 Result = glm::ceilPowerOfTwo(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - return Error; - } - - int test_uint32() - { - type<glm::uint32> const Data[] = - { - {0x00000001, 0x00000001}, - {0x00000002, 0x00000002}, - {0x00000004, 0x00000004}, - {0x00000007, 0x00000008}, - {0x0000ffff, 0x00010000}, - {0x0000fff0, 0x00010000}, - {0x0000f000, 0x00010000}, - {0x80000000, 0x80000000}, - {0x00000000, 0x00000000}, - {0x00000003, 0x00000004} - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::uint32>); i < n; ++i) - { - glm::uint32 Result = glm::ceilPowerOfTwo(Data[i].Value); - Error += Data[i].Return == Result ? 0 : 1; - } - - return Error; - } - - int perf() - { - int Error(0); - - std::vector<glm::uint> v; - v.resize(100000000); - - std::clock_t Timestramp0 = std::clock(); - - for(glm::uint32 i = 0, n = static_cast<glm::uint>(v.size()); i < n; ++i) - v[i] = ceilPowerOfTwo_loop(i); - - std::clock_t Timestramp1 = std::clock(); - - for(glm::uint32 i = 0, n = static_cast<glm::uint>(v.size()); i < n; ++i) - v[i] = glm::ceilPowerOfTwo(i); - - std::clock_t Timestramp2 = std::clock(); - - std::printf("ceilPowerOfTwo_loop: %d clocks\n", static_cast<int>(Timestramp1 - Timestramp0)); - std::printf("glm::ceilPowerOfTwo: %d clocks\n", static_cast<int>(Timestramp2 - Timestramp1)); - - return Error; - } - - int test() - { - int Error(0); - - Error += test_int32(); - Error += test_uint32(); - - return Error; - } -}//namespace ceilPowerOfTwo_advanced - -namespace roundPowerOfTwo -{ - int test() - { - int Error = 0; - - glm::uint32 const A = glm::roundPowerOfTwo(7u); - Error += A == 8u ? 0 : 1; - - glm::uint32 const B = glm::roundPowerOfTwo(15u); - Error += B == 16u ? 0 : 1; - - glm::uint32 const C = glm::roundPowerOfTwo(31u); - Error += C == 32u ? 0 : 1; - - glm::uint32 const D = glm::roundPowerOfTwo(9u); - Error += D == 8u ? 0 : 1; - - glm::uint32 const E = glm::roundPowerOfTwo(17u); - Error += E == 16u ? 0 : 1; - - glm::uint32 const F = glm::roundPowerOfTwo(33u); - Error += F == 32u ? 0 : 1; - - return Error; - } -}//namespace roundPowerOfTwo - -namespace floorPowerOfTwo -{ - int test() - { - int Error = 0; - - glm::uint32 const A = glm::floorPowerOfTwo(7u); - Error += A == 4u ? 0 : 1; - - glm::uint32 const B = glm::floorPowerOfTwo(15u); - Error += B == 8u ? 0 : 1; - - glm::uint32 const C = glm::floorPowerOfTwo(31u); - Error += C == 16u ? 0 : 1; - - return Error; - } -}//namespace floorPowerOfTwo - -namespace ceilPowerOfTwo -{ - int test() - { - int Error = 0; - - glm::uint32 const A = glm::ceilPowerOfTwo(7u); - Error += A == 8u ? 0 : 1; - - glm::uint32 const B = glm::ceilPowerOfTwo(15u); - Error += B == 16u ? 0 : 1; - - glm::uint32 const C = glm::ceilPowerOfTwo(31u); - Error += C == 32u ? 0 : 1; - - return Error; - } -}//namespace ceilPowerOfTwo - -namespace floorMultiple -{ - template<typename genType> - struct type - { - genType Source; - genType Multiple; - genType Return; - genType Epsilon; - }; - - int test_float() - { - type<glm::float64> const Data[] = - { - {3.4, 0.3, 3.3, 0.0001}, - {-1.4, 0.3, -1.5, 0.0001}, - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::float64>); i < n; ++i) - { - glm::float64 Result = glm::floorMultiple(Data[i].Source, Data[i].Multiple); - Error += glm::epsilonEqual(Data[i].Return, Result, Data[i].Epsilon) ? 0 : 1; - } - - return Error; - } - - int test() - { - int Error(0); - - Error += test_float(); - - return Error; - } -}//namespace floorMultiple - -namespace ceilMultiple -{ - template<typename genType> - struct type - { - genType Source; - genType Multiple; - genType Return; - genType Epsilon; - }; - - int test_float() - { - type<glm::float64> const Data[] = - { - {3.4, 0.3, 3.6, 0.0001}, - {-1.4, 0.3, -1.2, 0.0001}, - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<glm::float64>); i < n; ++i) - { - glm::float64 Result = glm::ceilMultiple(Data[i].Source, Data[i].Multiple); - Error += glm::epsilonEqual(Data[i].Return, Result, Data[i].Epsilon) ? 0 : 1; - } - - return Error; - } - - int test_int() - { - type<int> const Data[] = - { - {3, 4, 4, 0}, - {7, 4, 8, 0}, - {5, 4, 8, 0}, - {1, 4, 4, 0}, - {1, 3, 3, 0}, - {4, 3, 6, 0}, - {4, 1, 4, 0}, - {1, 1, 1, 0}, - {7, 1, 7, 0}, - }; - - int Error(0); - - for(std::size_t i = 0, n = sizeof(Data) / sizeof(type<int>); i < n; ++i) - { - int Result = glm::ceilMultiple(Data[i].Source, Data[i].Multiple); - Error += Data[i].Return == Result ? 0 : 1; - } - - return Error; - } - - int test() - { - int Error(0); - - Error += test_int(); - Error += test_float(); - - return Error; - } -}//namespace ceilMultiple - -int main() -{ - int Error(0); - - Error += isPowerOfTwo::test(); - Error += floorPowerOfTwo::test(); - Error += roundPowerOfTwo::test(); - Error += ceilPowerOfTwo::test(); - Error += ceilPowerOfTwo_advanced::test(); - -# ifdef NDEBUG - Error += ceilPowerOfTwo_advanced::perf(); -# endif//NDEBUG - - Error += floorMultiple::test(); - Error += ceilMultiple::test(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_type_aligned.cpp b/3rdparty/glm/source/test/gtc/gtc_type_aligned.cpp deleted file mode 100644 index 3c071ef..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_type_aligned.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include <glm/glm.hpp> - -#if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE -#include <glm/gtc/type_aligned.hpp> -#include <glm/gtc/type_precision.hpp> -#include <glm/ext/vector_relational.hpp> -#include <glm/ext/matrix_relational.hpp> - -GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_lowp>::value, "aligned_lowp is not aligned"); -GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_mediump>::value, "aligned_mediump is not aligned"); -GLM_STATIC_ASSERT(glm::detail::is_aligned<glm::aligned_highp>::value, "aligned_highp is not aligned"); -GLM_STATIC_ASSERT(!glm::detail::is_aligned<glm::packed_highp>::value, "packed_highp is aligned"); -GLM_STATIC_ASSERT(!glm::detail::is_aligned<glm::packed_mediump>::value, "packed_mediump is aligned"); -GLM_STATIC_ASSERT(!glm::detail::is_aligned<glm::packed_lowp>::value, "packed_lowp is aligned"); - -struct my_vec4_packed -{ - glm::uint32 a; - glm::vec4 b; -}; -GLM_STATIC_ASSERT(sizeof(my_vec4_packed) == sizeof(glm::uint32) + sizeof(glm::vec4), "glm::vec4 packed is not correct"); - -struct my_vec4_aligned -{ - glm::uint32 a; - glm::aligned_vec4 b; -}; -GLM_STATIC_ASSERT(sizeof(my_vec4_aligned) == sizeof(glm::aligned_vec4) * 2, "glm::vec4 aligned is not correct"); - -struct my_dvec4_packed -{ - glm::uint64 a; - glm::dvec4 b; -}; -GLM_STATIC_ASSERT(sizeof(my_dvec4_packed) == sizeof(glm::uint64) + sizeof(glm::dvec4), "glm::dvec4 packed is not correct"); - -struct my_dvec4_aligned -{ - glm::uint64 a; - glm::aligned_dvec4 b; -}; -//GLM_STATIC_ASSERT(sizeof(my_dvec4_aligned) == sizeof(glm::aligned_dvec4) * 2, "glm::dvec4 aligned is not correct"); - -struct my_ivec4_packed -{ - glm::uint32 a; - glm::ivec4 b; -}; -GLM_STATIC_ASSERT(sizeof(my_ivec4_packed) == sizeof(glm::uint32) + sizeof(glm::ivec4), "glm::ivec4 packed is not correct"); - -struct my_ivec4_aligned -{ - glm::uint32 a; - glm::aligned_ivec4 b; -}; -GLM_STATIC_ASSERT(sizeof(my_ivec4_aligned) == sizeof(glm::aligned_ivec4) * 2, "glm::ivec4 aligned is not correct"); - -struct my_u8vec4_packed -{ - glm::uint32 a; - glm::u8vec4 b; -}; -GLM_STATIC_ASSERT(sizeof(my_u8vec4_packed) == sizeof(glm::uint32) + sizeof(glm::u8vec4), "glm::u8vec4 packed is not correct"); - -static int test_copy() -{ - int Error = 0; - - { - glm::aligned_ivec4 const a(1, 2, 3, 4); - glm::ivec4 const u(a); - - Error += a.x == u.x ? 0 : 1; - Error += a.y == u.y ? 0 : 1; - Error += a.z == u.z ? 0 : 1; - Error += a.w == u.w ? 0 : 1; - } - - { - my_ivec4_aligned a; - a.b = glm::ivec4(1, 2, 3, 4); - - my_ivec4_packed u; - u.b = a.b; - - Error += a.b.x == u.b.x ? 0 : 1; - Error += a.b.y == u.b.y ? 0 : 1; - Error += a.b.z == u.b.z ? 0 : 1; - Error += a.b.w == u.b.w ? 0 : 1; - } - - return Error; -} - -static int test_ctor() -{ - int Error = 0; - -# if GLM_HAS_CONSTEXPR - { - constexpr glm::aligned_ivec4 v(1); - - Error += v.x == 1 ? 0 : 1; - Error += v.y == 1 ? 0 : 1; - Error += v.z == 1 ? 0 : 1; - Error += v.w == 1 ? 0 : 1; - } - - { - constexpr glm::packed_ivec4 v(1); - - Error += v.x == 1 ? 0 : 1; - Error += v.y == 1 ? 0 : 1; - Error += v.z == 1 ? 0 : 1; - Error += v.w == 1 ? 0 : 1; - } - - { - constexpr glm::ivec4 v(1); - - Error += v.x == 1 ? 0 : 1; - Error += v.y == 1 ? 0 : 1; - Error += v.z == 1 ? 0 : 1; - Error += v.w == 1 ? 0 : 1; - } -# endif//GLM_HAS_CONSTEXPR - - return Error; -} - -static int test_aligned_ivec4() -{ - int Error = 0; - - glm::aligned_ivec4 const v(1, 2, 3, 4); - Error += glm::all(glm::equal(v, glm::aligned_ivec4(1, 2, 3, 4))) ? 0 : 1; - - glm::aligned_ivec4 const u = v * 2; - Error += glm::all(glm::equal(u, glm::aligned_ivec4(2, 4, 6, 8))) ? 0 : 1; - - return Error; -} - -static int test_aligned_mat4() -{ - int Error = 0; - - glm::aligned_vec4 const u(1.f, 2.f, 3.f, 4.f); - Error += glm::all(glm::equal(u, glm::aligned_vec4(1.f, 2.f, 3.f, 4.f), 0.0001f)) ? 0 : 1; - - glm::aligned_vec4 const v(1, 2, 3, 4); - Error += glm::all(glm::equal(v, glm::aligned_vec4(1.f, 2.f, 3.f, 4.f), 0.0001f)) ? 0 : 1; - - glm::aligned_mat4 const m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - glm::aligned_mat4 const t = glm::transpose(m); - glm::aligned_mat4 const expected = glm::mat4(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15); - Error += glm::all(glm::equal(t, expected, 0.0001f)) ? 0 : 1; - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_ctor(); - Error += test_copy(); - Error += test_aligned_ivec4(); - Error += test_aligned_mat4(); - - return Error; -} - -#else - -int main() -{ - return 0; -} - -#endif diff --git a/3rdparty/glm/source/test/gtc/gtc_type_precision.cpp b/3rdparty/glm/source/test/gtc/gtc_type_precision.cpp deleted file mode 100644 index 77f0686..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_type_precision.cpp +++ /dev/null @@ -1,1041 +0,0 @@ -#include <glm/gtc/type_precision.hpp> -#include <glm/gtc/quaternion.hpp> -#include <glm/gtc/constants.hpp> -#include <glm/ext/vector_relational.hpp> -#include <vector> -#if GLM_HAS_OPENMP -# include <omp.h> -#endif - -#if GLM_HAS_STATIC_ASSERT -static_assert(sizeof(glm::lowp_u8vec1) == 1, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec1) == 1, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec1) == 1, "uint8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec1) == 2, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec1) == 2, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec1) == 2, "uint16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec1) == 4, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec1) == 4, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec1) == 4, "uint32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec1) == 8, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec1) == 8, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec1) == 8, "uint64 size isn't 8 bytes on this platform"); - - -static_assert(sizeof(glm::lowp_u8vec2) == 2, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec2) == 2, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec2) == 2, "uint8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec2) == 4, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec2) == 4, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec2) == 4, "uint16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec2) == 8, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec2) == 8, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec2) == 8, "uint32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec2) == 16, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec2) == 16, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec2) == 16, "uint64 size isn't 8 bytes on this platform"); - - -static_assert(sizeof(glm::lowp_u8vec3) == 3, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec3) == 3, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec3) == 3, "uint8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec3) == 6, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec3) == 6, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec3) == 6, "uint16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec3) == 12, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec3) == 12, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec3) == 12, "uint32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec3) == 24, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec3) == 24, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec3) == 24, "uint64 size isn't 8 bytes on this platform"); - - -static_assert(sizeof(glm::lowp_u8vec4) == 4, "int8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec4) == 4, "int8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec4) == 4, "int8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec4) == 8, "int16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec4) == 8, "int16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec4) == 8, "int16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec4) == 16, "int32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec4) == 16, "int32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec4) == 16, "int32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec4) == 32, "int64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec4) == 32, "int64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec4) == 32, "int64 size isn't 8 bytes on this platform"); - - -static_assert(sizeof(glm::lowp_u8vec1) == 1, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec1) == 1, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec1) == 1, "uint8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec1) == 2, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec1) == 2, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec1) == 2, "uint16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec1) == 4, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec1) == 4, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec1) == 4, "uint32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec1) == 8, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec1) == 8, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec1) == 8, "uint64 size isn't 8 bytes on this platform"); - - -static_assert(sizeof(glm::lowp_u8vec2) == 2, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec2) == 2, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec2) == 2, "uint8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec2) == 4, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec2) == 4, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec2) == 4, "uint16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec2) == 8, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec2) == 8, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec2) == 8, "uint32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec2) == 16, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec2) == 16, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec2) == 16, "uint64 size isn't 8 bytes on this platform"); - - -static_assert(sizeof(glm::lowp_u8vec3) == 3, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec3) == 3, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec3) == 3, "uint8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec3) == 6, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec3) == 6, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec3) == 6, "uint16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec3) == 12, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec3) == 12, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec3) == 12, "uint32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec3) == 24, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec3) == 24, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec3) == 24, "uint64 size isn't 8 bytes on this platform"); - - -static_assert(sizeof(glm::lowp_u8vec4) == 4, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::mediump_u8vec4) == 4, "uint8 size isn't 1 byte on this platform"); -static_assert(sizeof(glm::highp_u8vec4) == 4, "uint8 size isn't 1 byte on this platform"); - -static_assert(sizeof(glm::lowp_u16vec4) == 8, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::mediump_u16vec4) == 8, "uint16 size isn't 2 bytes on this platform"); -static_assert(sizeof(glm::highp_u16vec4) == 8, "uint16 size isn't 2 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u32vec4) == 16, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::mediump_u32vec4) == 16, "uint32 size isn't 4 bytes on this platform"); -static_assert(sizeof(glm::highp_u32vec4) == 16, "uint32 size isn't 4 bytes on this platform"); - -static_assert(sizeof(glm::lowp_u64vec4) == 32, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::mediump_u64vec4) == 32, "uint64 size isn't 8 bytes on this platform"); -static_assert(sizeof(glm::highp_u64vec4) == 32, "uint64 size isn't 8 bytes on this platform"); - -#endif - -static int test_scalar_size() -{ - int Error = 0; - - Error += sizeof(glm::int8) != 1; - Error += sizeof(glm::int16) != 2; - Error += sizeof(glm::int32) != 4; - Error += sizeof(glm::int64) != 8; - Error += sizeof(glm::uint8) != 1; - Error += sizeof(glm::uint16) != 2; - Error += sizeof(glm::uint32) != 4; - Error += sizeof(glm::uint64) != 8; - Error += sizeof(glm::float32) != 4; - Error += sizeof(glm::float64) != 8; - - Error += sizeof(glm::lowp_int8) != 1; - Error += sizeof(glm::lowp_int16) != 2; - Error += sizeof(glm::lowp_int32) != 4; - Error += sizeof(glm::lowp_int64) != 8; - Error += sizeof(glm::lowp_uint8) != 1; - Error += sizeof(glm::lowp_uint16) != 2; - Error += sizeof(glm::lowp_uint32) != 4; - Error += sizeof(glm::lowp_uint64) != 8; - Error += sizeof(glm::lowp_float32) != 4; - Error += sizeof(glm::lowp_float64) != 8; - - Error += sizeof(glm::mediump_int8) != 1; - Error += sizeof(glm::mediump_int16) != 2; - Error += sizeof(glm::mediump_int32) != 4; - Error += sizeof(glm::mediump_int64) != 8; - Error += sizeof(glm::mediump_uint8) != 1; - Error += sizeof(glm::mediump_uint16) != 2; - Error += sizeof(glm::mediump_uint32) != 4; - Error += sizeof(glm::mediump_uint64) != 8; - Error += sizeof(glm::mediump_float32) != 4; - Error += sizeof(glm::mediump_float64) != 8; - - Error += sizeof(glm::highp_int8) != 1; - Error += sizeof(glm::highp_int16) != 2; - Error += sizeof(glm::highp_int32) != 4; - Error += sizeof(glm::highp_int64) != 8; - Error += sizeof(glm::highp_uint8) != 1; - Error += sizeof(glm::highp_uint16) != 2; - Error += sizeof(glm::highp_uint32) != 4; - Error += sizeof(glm::highp_uint64) != 8; - Error += sizeof(glm::highp_float32) != 4; - Error += sizeof(glm::highp_float64) != 8; - - return Error; -} - -static int test_fvec_size() -{ - int Error = 0; - - Error += sizeof(glm::f32vec2) != 8; - Error += sizeof(glm::f32vec3) != 12; - Error += sizeof(glm::f32vec4) != 16; - Error += sizeof(glm::f64vec2) != 16; - Error += sizeof(glm::f64vec3) != 24; - Error += sizeof(glm::f64vec4) != 32; - - Error += sizeof(glm::lowp_f32vec2) != 8; - Error += sizeof(glm::lowp_f32vec3) != 12; - Error += sizeof(glm::lowp_f32vec4) != 16; - Error += sizeof(glm::lowp_f64vec2) != 16; - Error += sizeof(glm::lowp_f64vec3) != 24; - Error += sizeof(glm::lowp_f64vec4) != 32; - - Error += sizeof(glm::mediump_f32vec2) != 8; - Error += sizeof(glm::mediump_f32vec3) != 12; - Error += sizeof(glm::mediump_f32vec4) != 16; - Error += sizeof(glm::mediump_f64vec2) != 16; - Error += sizeof(glm::mediump_f64vec3) != 24; - Error += sizeof(glm::mediump_f64vec4) != 32; - - Error += sizeof(glm::highp_f32vec2) != 8; - Error += sizeof(glm::highp_f32vec3) != 12; - Error += sizeof(glm::highp_f32vec4) != 16; - Error += sizeof(glm::highp_f64vec2) != 16; - Error += sizeof(glm::highp_f64vec3) != 24; - Error += sizeof(glm::highp_f64vec4) != 32; - - return Error; -} - -static int test_fvec_precision() -{ - int Error = 0; - - { - glm::f32vec2 v1(1.f); - glm::lowp_f32vec2 v2(v1); - glm::mediump_f32vec2 v3(v1); - glm::highp_f32vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f32vec2(v2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f32vec2(v3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f32vec2(v4), glm::epsilon<float>())) ? 0 : 1; - } - - { - glm::f32vec3 v1(1.f); - glm::lowp_f32vec3 v2(v1); - glm::mediump_f32vec3 v3(v1); - glm::highp_f32vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f32vec3(v2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f32vec3(v3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f32vec3(v4), glm::epsilon<float>())) ? 0 : 1; - } - - { - glm::f32vec4 v1(1.f); - glm::lowp_f32vec4 v2(v1); - glm::mediump_f32vec4 v3(v1); - glm::highp_f32vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f32vec4(v2), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f32vec4(v3), glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f32vec4(v4), glm::epsilon<float>())) ? 0 : 1; - } - - return Error; -} - -static int test_dvec_precision() -{ - int Error = 0; - - { - glm::f64vec2 v1(1.0); - glm::lowp_f64vec2 v2(v1); - glm::mediump_f64vec2 v3(v1); - glm::highp_f64vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f64vec2(v2), glm::epsilon<double>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f64vec2(v3), glm::epsilon<double>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f64vec2(v4), glm::epsilon<double>())) ? 0 : 1; - } - - { - glm::f64vec3 v1(1.0); - glm::lowp_f64vec3 v2(v1); - glm::mediump_f64vec3 v3(v1); - glm::highp_f64vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f64vec3(v2), glm::epsilon<double>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f64vec3(v3), glm::epsilon<double>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f64vec3(v4), glm::epsilon<double>())) ? 0 : 1; - } - - { - glm::f64vec4 v1(1.0); - glm::lowp_f64vec4 v2(v1); - glm::mediump_f64vec4 v3(v1); - glm::highp_f64vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f64vec4(v2), glm::epsilon<double>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f64vec4(v3), glm::epsilon<double>())) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f64vec4(v4), glm::epsilon<double>())) ? 0 : 1; - } - - return Error; -} - -static int test_ivec_size() -{ - int Error = 0; - - Error += sizeof(glm::i8vec2) != 2; - Error += sizeof(glm::i8vec3) != 3; - Error += sizeof(glm::i8vec4) != 4; - Error += sizeof(glm::i16vec2) != 4; - Error += sizeof(glm::i16vec3) != 6; - Error += sizeof(glm::i16vec4) != 8; - Error += sizeof(glm::i32vec2) != 8; - Error += sizeof(glm::i32vec3) != 12; - Error += sizeof(glm::i32vec4) != 16; - Error += sizeof(glm::i64vec2) != 16; - Error += sizeof(glm::i64vec3) != 24; - Error += sizeof(glm::i64vec4) != 32; - - Error += sizeof(glm::lowp_i8vec2) != 2; - Error += sizeof(glm::lowp_i8vec3) != 3; - Error += sizeof(glm::lowp_i8vec4) != 4; - Error += sizeof(glm::lowp_i16vec2) != 4; - Error += sizeof(glm::lowp_i16vec3) != 6; - Error += sizeof(glm::lowp_i16vec4) != 8; - Error += sizeof(glm::lowp_i32vec2) != 8; - Error += sizeof(glm::lowp_i32vec3) != 12; - Error += sizeof(glm::lowp_i32vec4) != 16; - Error += sizeof(glm::lowp_i64vec2) != 16; - Error += sizeof(glm::lowp_i64vec3) != 24; - Error += sizeof(glm::lowp_i64vec4) != 32; - - Error += sizeof(glm::mediump_i8vec2) != 2; - Error += sizeof(glm::mediump_i8vec3) != 3; - Error += sizeof(glm::mediump_i8vec4) != 4; - Error += sizeof(glm::mediump_i16vec2) != 4; - Error += sizeof(glm::mediump_i16vec3) != 6; - Error += sizeof(glm::mediump_i16vec4) != 8; - Error += sizeof(glm::mediump_i32vec2) != 8; - Error += sizeof(glm::mediump_i32vec3) != 12; - Error += sizeof(glm::mediump_i32vec4) != 16; - Error += sizeof(glm::mediump_i64vec2) != 16; - Error += sizeof(glm::mediump_i64vec3) != 24; - Error += sizeof(glm::mediump_i64vec4) != 32; - - Error += sizeof(glm::highp_i8vec2) != 2; - Error += sizeof(glm::highp_i8vec3) != 3; - Error += sizeof(glm::highp_i8vec4) != 4; - Error += sizeof(glm::highp_i16vec2) != 4; - Error += sizeof(glm::highp_i16vec3) != 6; - Error += sizeof(glm::highp_i16vec4) != 8; - Error += sizeof(glm::highp_i32vec2) != 8; - Error += sizeof(glm::highp_i32vec3) != 12; - Error += sizeof(glm::highp_i32vec4) != 16; - Error += sizeof(glm::highp_i64vec2) != 16; - Error += sizeof(glm::highp_i64vec3) != 24; - Error += sizeof(glm::highp_i64vec4) != 32; - - return Error; -} - -static int test_ivec_precision() -{ - int Error = 0; - - { - glm::i8vec2 v1(0); - glm::lowp_i8vec2 v2(v1); - glm::mediump_i8vec2 v3(v1); - glm::highp_i8vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i8vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i8vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i8vec2(v4))) ? 0 : 1; - } - - { - glm::i8vec3 v1(0); - glm::lowp_i8vec3 v2(v1); - glm::mediump_i8vec3 v3(v1); - glm::highp_i8vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i8vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i8vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i8vec3(v4))) ? 0 : 1; - } - - { - glm::i8vec4 v1(0); - glm::lowp_i8vec4 v2(v1); - glm::mediump_i8vec4 v3(v1); - glm::highp_i8vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i8vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i8vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i8vec4(v4))) ? 0 : 1; - } - - { - glm::i16vec2 v1(0); - glm::lowp_i16vec2 v2(v1); - glm::mediump_i16vec2 v3(v1); - glm::highp_i16vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i16vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i16vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i16vec2(v4))) ? 0 : 1; - } - - { - glm::i16vec3 v1(0); - glm::lowp_i16vec3 v2(v1); - glm::mediump_i16vec3 v3(v1); - glm::highp_i16vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i16vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i16vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i16vec3(v4))) ? 0 : 1; - } - - { - glm::i16vec4 v1(0); - glm::lowp_i16vec4 v2(v1); - glm::mediump_i16vec4 v3(v1); - glm::highp_i16vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i16vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i16vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i16vec4(v4))) ? 0 : 1; - } - - { - glm::i32vec2 v1(0); - glm::lowp_i32vec2 v2(v1); - glm::mediump_i32vec2 v3(v1); - glm::highp_i32vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i32vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i32vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i32vec2(v4))) ? 0 : 1; - } - - { - glm::i32vec3 v1(0); - glm::lowp_i32vec3 v2(v1); - glm::mediump_i32vec3 v3(v1); - glm::highp_i32vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i32vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i32vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i32vec3(v4))) ? 0 : 1; - } - - { - glm::i32vec4 v1(0); - glm::lowp_i32vec4 v2(v1); - glm::mediump_i32vec4 v3(v1); - glm::highp_i32vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i32vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i32vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i32vec4(v4))) ? 0 : 1; - } - - { - glm::i64vec2 v1(0); - glm::lowp_i64vec2 v2(v1); - glm::mediump_i64vec2 v3(v1); - glm::highp_i64vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i64vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i64vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i64vec2(v4))) ? 0 : 1; - } - - { - glm::i64vec3 v1(0); - glm::lowp_i64vec3 v2(v1); - glm::mediump_i64vec3 v3(v1); - glm::highp_i64vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i64vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i64vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i64vec3(v4))) ? 0 : 1; - } - - { - glm::i64vec4 v1(0); - glm::lowp_i64vec4 v2(v1); - glm::mediump_i64vec4 v3(v1); - glm::highp_i64vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::i64vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i64vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::i64vec4(v4))) ? 0 : 1; - } - - return Error; -} - -static int test_uvec_size() -{ - int Error = 0; - - Error += sizeof(glm::u8vec2) != 2; - Error += sizeof(glm::u8vec3) != 3; - Error += sizeof(glm::u8vec4) != 4; - Error += sizeof(glm::u16vec2) != 4; - Error += sizeof(glm::u16vec3) != 6; - Error += sizeof(glm::u16vec4) != 8; - Error += sizeof(glm::u32vec2) != 8; - Error += sizeof(glm::u32vec3) != 12; - Error += sizeof(glm::u32vec4) != 16; - Error += sizeof(glm::u64vec2) != 16; - Error += sizeof(glm::u64vec3) != 24; - Error += sizeof(glm::u64vec4) != 32; - - Error += sizeof(glm::lowp_u8vec2) != 2; - Error += sizeof(glm::lowp_u8vec3) != 3; - Error += sizeof(glm::lowp_u8vec4) != 4; - Error += sizeof(glm::lowp_u16vec2) != 4; - Error += sizeof(glm::lowp_u16vec3) != 6; - Error += sizeof(glm::lowp_u16vec4) != 8; - Error += sizeof(glm::lowp_u32vec2) != 8; - Error += sizeof(glm::lowp_u32vec3) != 12; - Error += sizeof(glm::lowp_u32vec4) != 16; - Error += sizeof(glm::lowp_u64vec2) != 16; - Error += sizeof(glm::lowp_u64vec3) != 24; - Error += sizeof(glm::lowp_u64vec4) != 32; - - Error += sizeof(glm::mediump_u8vec2) != 2; - Error += sizeof(glm::mediump_u8vec3) != 3; - Error += sizeof(glm::mediump_u8vec4) != 4; - Error += sizeof(glm::mediump_u16vec2) != 4; - Error += sizeof(glm::mediump_u16vec3) != 6; - Error += sizeof(glm::mediump_u16vec4) != 8; - Error += sizeof(glm::mediump_u32vec2) != 8; - Error += sizeof(glm::mediump_u32vec3) != 12; - Error += sizeof(glm::mediump_u32vec4) != 16; - Error += sizeof(glm::mediump_u64vec2) != 16; - Error += sizeof(glm::mediump_u64vec3) != 24; - Error += sizeof(glm::mediump_u64vec4) != 32; - - Error += sizeof(glm::highp_u8vec2) != 2; - Error += sizeof(glm::highp_u8vec3) != 3; - Error += sizeof(glm::highp_u8vec4) != 4; - Error += sizeof(glm::highp_u16vec2) != 4; - Error += sizeof(glm::highp_u16vec3) != 6; - Error += sizeof(glm::highp_u16vec4) != 8; - Error += sizeof(glm::highp_u32vec2) != 8; - Error += sizeof(glm::highp_u32vec3) != 12; - Error += sizeof(glm::highp_u32vec4) != 16; - Error += sizeof(glm::highp_u64vec2) != 16; - Error += sizeof(glm::highp_u64vec3) != 24; - Error += sizeof(glm::highp_u64vec4) != 32; - - return Error; -} - -static int test_uvec_precision() -{ - int Error = 0; - - { - glm::u8vec2 v1(0); - glm::lowp_u8vec2 v2(v1); - glm::mediump_u8vec2 v3(v1); - glm::highp_u8vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u8vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u8vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u8vec2(v4))) ? 0 : 1; - } - - { - glm::u8vec3 v1(0); - glm::lowp_u8vec3 v2(v1); - glm::mediump_u8vec3 v3(v1); - glm::highp_u8vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u8vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u8vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u8vec3(v4))) ? 0 : 1; - } - - { - glm::u8vec4 v1(0); - glm::lowp_u8vec4 v2(v1); - glm::mediump_u8vec4 v3(v1); - glm::highp_u8vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u8vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u8vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u8vec4(v4))) ? 0 : 1; - } - - { - glm::u16vec2 v1(0); - glm::lowp_u16vec2 v2(v1); - glm::mediump_u16vec2 v3(v1); - glm::highp_u16vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u16vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u16vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u16vec2(v4))) ? 0 : 1; - } - - { - glm::u16vec3 v1(0); - glm::lowp_u16vec3 v2(v1); - glm::mediump_u16vec3 v3(v1); - glm::highp_u16vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u16vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u16vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u16vec3(v4))) ? 0 : 1; - } - - { - glm::u16vec4 v1(0); - glm::lowp_u16vec4 v2(v1); - glm::mediump_u16vec4 v3(v1); - glm::highp_u16vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u16vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u16vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u16vec4(v4))) ? 0 : 1; - } - - { - glm::u32vec2 v1(0); - glm::lowp_u32vec2 v2(v1); - glm::mediump_u32vec2 v3(v1); - glm::highp_u32vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u32vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u32vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u32vec2(v4))) ? 0 : 1; - } - - { - glm::u32vec3 v1(0); - glm::lowp_u32vec3 v2(v1); - glm::mediump_u32vec3 v3(v1); - glm::highp_u32vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u32vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u32vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u32vec3(v4))) ? 0 : 1; - } - - { - glm::u32vec4 v1(0); - glm::lowp_u32vec4 v2(v1); - glm::mediump_u32vec4 v3(v1); - glm::highp_u32vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u32vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u32vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u32vec4(v4))) ? 0 : 1; - } - - { - glm::u64vec2 v1(0); - glm::lowp_u64vec2 v2(v1); - glm::mediump_u64vec2 v3(v1); - glm::highp_u64vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u64vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u64vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u64vec2(v4))) ? 0 : 1; - } - - { - glm::u64vec3 v1(0); - glm::lowp_u64vec3 v2(v1); - glm::mediump_u64vec3 v3(v1); - glm::highp_u64vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u64vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u64vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u64vec3(v4))) ? 0 : 1; - } - - { - glm::u64vec4 v1(0); - glm::lowp_u64vec4 v2(v1); - glm::mediump_u64vec4 v3(v1); - glm::highp_u64vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::u64vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u64vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::u64vec4(v4))) ? 0 : 1; - } - - return Error; -} - -static int test_fmat_size() -{ - int Error = 0; - - Error += sizeof(glm::mat2) != 16; - Error += sizeof(glm::mat3) != 36; - Error += sizeof(glm::mat4) != 64; - Error += sizeof(glm::mat2x2) != 16; - Error += sizeof(glm::mat2x3) != 24; - Error += sizeof(glm::mat2x4) != 32; - Error += sizeof(glm::mat3x2) != 24; - Error += sizeof(glm::mat3x3) != 36; - Error += sizeof(glm::mat3x4) != 48; - Error += sizeof(glm::mat4x2) != 32; - Error += sizeof(glm::mat4x3) != 48; - Error += sizeof(glm::mat4x4) != 64; - - Error += sizeof(glm::fmat2) != 16; - Error += sizeof(glm::fmat3) != 36; - Error += sizeof(glm::fmat4) != 64; - Error += sizeof(glm::fmat2x2) != 16; - Error += sizeof(glm::fmat2x3) != 24; - Error += sizeof(glm::fmat2x4) != 32; - Error += sizeof(glm::fmat3x2) != 24; - Error += sizeof(glm::fmat3x3) != 36; - Error += sizeof(glm::fmat3x4) != 48; - Error += sizeof(glm::fmat4x2) != 32; - Error += sizeof(glm::fmat4x3) != 48; - Error += sizeof(glm::fmat4x4) != 64; - - Error += sizeof(glm::f32mat2) != 16; - Error += sizeof(glm::f32mat3) != 36; - Error += sizeof(glm::f32mat4) != 64; - Error += sizeof(glm::f32mat2x2) != 16; - Error += sizeof(glm::f32mat2x3) != 24; - Error += sizeof(glm::f32mat2x4) != 32; - Error += sizeof(glm::f32mat3x2) != 24; - Error += sizeof(glm::f32mat3x3) != 36; - Error += sizeof(glm::f32mat3x4) != 48; - Error += sizeof(glm::f32mat4x2) != 32; - Error += sizeof(glm::f32mat4x3) != 48; - Error += sizeof(glm::f32mat4x4) != 64; - - - Error += sizeof(glm::lowp_mat2) != 16; - Error += sizeof(glm::lowp_mat3) != 36; - Error += sizeof(glm::lowp_mat4) != 64; - Error += sizeof(glm::lowp_mat2x2) != 16; - Error += sizeof(glm::lowp_mat2x3) != 24; - Error += sizeof(glm::lowp_mat2x4) != 32; - Error += sizeof(glm::lowp_mat3x2) != 24; - Error += sizeof(glm::lowp_mat3x3) != 36; - Error += sizeof(glm::lowp_mat3x4) != 48; - Error += sizeof(glm::lowp_mat4x2) != 32; - Error += sizeof(glm::lowp_mat4x3) != 48; - Error += sizeof(glm::lowp_mat4x4) != 64; - - Error += sizeof(glm::lowp_fmat2) != 16; - Error += sizeof(glm::lowp_fmat3) != 36; - Error += sizeof(glm::lowp_fmat4) != 64; - Error += sizeof(glm::lowp_fmat2x2) != 16; - Error += sizeof(glm::lowp_fmat2x3) != 24; - Error += sizeof(glm::lowp_fmat2x4) != 32; - Error += sizeof(glm::lowp_fmat3x2) != 24; - Error += sizeof(glm::lowp_fmat3x3) != 36; - Error += sizeof(glm::lowp_fmat3x4) != 48; - Error += sizeof(glm::lowp_fmat4x2) != 32; - Error += sizeof(glm::lowp_fmat4x3) != 48; - Error += sizeof(glm::lowp_fmat4x4) != 64; - - Error += sizeof(glm::lowp_f32mat2) != 16; - Error += sizeof(glm::lowp_f32mat3) != 36; - Error += sizeof(glm::lowp_f32mat4) != 64; - Error += sizeof(glm::lowp_f32mat2x2) != 16; - Error += sizeof(glm::lowp_f32mat2x3) != 24; - Error += sizeof(glm::lowp_f32mat2x4) != 32; - Error += sizeof(glm::lowp_f32mat3x2) != 24; - Error += sizeof(glm::lowp_f32mat3x3) != 36; - Error += sizeof(glm::lowp_f32mat3x4) != 48; - Error += sizeof(glm::lowp_f32mat4x2) != 32; - Error += sizeof(glm::lowp_f32mat4x3) != 48; - Error += sizeof(glm::lowp_f32mat4x4) != 64; - - Error += sizeof(glm::mediump_mat2) != 16; - Error += sizeof(glm::mediump_mat3) != 36; - Error += sizeof(glm::mediump_mat4) != 64; - Error += sizeof(glm::mediump_mat2x2) != 16; - Error += sizeof(glm::mediump_mat2x3) != 24; - Error += sizeof(glm::mediump_mat2x4) != 32; - Error += sizeof(glm::mediump_mat3x2) != 24; - Error += sizeof(glm::mediump_mat3x3) != 36; - Error += sizeof(glm::mediump_mat3x4) != 48; - Error += sizeof(glm::mediump_mat4x2) != 32; - Error += sizeof(glm::mediump_mat4x3) != 48; - Error += sizeof(glm::mediump_mat4x4) != 64; - - Error += sizeof(glm::mediump_fmat2) != 16; - Error += sizeof(glm::mediump_fmat3) != 36; - Error += sizeof(glm::mediump_fmat4) != 64; - Error += sizeof(glm::mediump_fmat2x2) != 16; - Error += sizeof(glm::mediump_fmat2x3) != 24; - Error += sizeof(glm::mediump_fmat2x4) != 32; - Error += sizeof(glm::mediump_fmat3x2) != 24; - Error += sizeof(glm::mediump_fmat3x3) != 36; - Error += sizeof(glm::mediump_fmat3x4) != 48; - Error += sizeof(glm::mediump_fmat4x2) != 32; - Error += sizeof(glm::mediump_fmat4x3) != 48; - Error += sizeof(glm::mediump_fmat4x4) != 64; - - Error += sizeof(glm::mediump_f32mat2) != 16; - Error += sizeof(glm::mediump_f32mat3) != 36; - Error += sizeof(glm::mediump_f32mat4) != 64; - Error += sizeof(glm::mediump_f32mat2x2) != 16; - Error += sizeof(glm::mediump_f32mat2x3) != 24; - Error += sizeof(glm::mediump_f32mat2x4) != 32; - Error += sizeof(glm::mediump_f32mat3x2) != 24; - Error += sizeof(glm::mediump_f32mat3x3) != 36; - Error += sizeof(glm::mediump_f32mat3x4) != 48; - Error += sizeof(glm::mediump_f32mat4x2) != 32; - Error += sizeof(glm::mediump_f32mat4x3) != 48; - Error += sizeof(glm::mediump_f32mat4x4) != 64; - - Error += sizeof(glm::highp_mat2) != 16; - Error += sizeof(glm::highp_mat3) != 36; - Error += sizeof(glm::highp_mat4) != 64; - Error += sizeof(glm::highp_mat2x2) != 16; - Error += sizeof(glm::highp_mat2x3) != 24; - Error += sizeof(glm::highp_mat2x4) != 32; - Error += sizeof(glm::highp_mat3x2) != 24; - Error += sizeof(glm::highp_mat3x3) != 36; - Error += sizeof(glm::highp_mat3x4) != 48; - Error += sizeof(glm::highp_mat4x2) != 32; - Error += sizeof(glm::highp_mat4x3) != 48; - Error += sizeof(glm::highp_mat4x4) != 64; - - Error += sizeof(glm::highp_fmat2) != 16; - Error += sizeof(glm::highp_fmat3) != 36; - Error += sizeof(glm::highp_fmat4) != 64; - Error += sizeof(glm::highp_fmat2x2) != 16; - Error += sizeof(glm::highp_fmat2x3) != 24; - Error += sizeof(glm::highp_fmat2x4) != 32; - Error += sizeof(glm::highp_fmat3x2) != 24; - Error += sizeof(glm::highp_fmat3x3) != 36; - Error += sizeof(glm::highp_fmat3x4) != 48; - Error += sizeof(glm::highp_fmat4x2) != 32; - Error += sizeof(glm::highp_fmat4x3) != 48; - Error += sizeof(glm::highp_fmat4x4) != 64; - - Error += sizeof(glm::highp_f32mat2) != 16; - Error += sizeof(glm::highp_f32mat3) != 36; - Error += sizeof(glm::highp_f32mat4) != 64; - Error += sizeof(glm::highp_f32mat2x2) != 16; - Error += sizeof(glm::highp_f32mat2x3) != 24; - Error += sizeof(glm::highp_f32mat2x4) != 32; - Error += sizeof(glm::highp_f32mat3x2) != 24; - Error += sizeof(glm::highp_f32mat3x3) != 36; - Error += sizeof(glm::highp_f32mat3x4) != 48; - Error += sizeof(glm::highp_f32mat4x2) != 32; - Error += sizeof(glm::highp_f32mat4x3) != 48; - Error += sizeof(glm::highp_f32mat4x4) != 64; - - return Error; -} - -static int test_dmat_size() -{ - int Error = 0; - - Error += sizeof(glm::f64mat2) != 32; - Error += sizeof(glm::f64mat3) != 72; - Error += sizeof(glm::f64mat4) != 128; - Error += sizeof(glm::f64mat2x2) != 32; - Error += sizeof(glm::f64mat2x3) != 48; - Error += sizeof(glm::f64mat2x4) != 64; - Error += sizeof(glm::f64mat3x2) != 48; - Error += sizeof(glm::f64mat3x3) != 72; - Error += sizeof(glm::f64mat3x4) != 96; - Error += sizeof(glm::f64mat4x2) != 64; - Error += sizeof(glm::f64mat4x3) != 96; - Error += sizeof(glm::f64mat4x4) != 128; - - Error += sizeof(glm::lowp_f64mat2) != 32; - Error += sizeof(glm::lowp_f64mat3) != 72; - Error += sizeof(glm::lowp_f64mat4) != 128; - Error += sizeof(glm::lowp_f64mat2x2) != 32; - Error += sizeof(glm::lowp_f64mat2x3) != 48; - Error += sizeof(glm::lowp_f64mat2x4) != 64; - Error += sizeof(glm::lowp_f64mat3x2) != 48; - Error += sizeof(glm::lowp_f64mat3x3) != 72; - Error += sizeof(glm::lowp_f64mat3x4) != 96; - Error += sizeof(glm::lowp_f64mat4x2) != 64; - Error += sizeof(glm::lowp_f64mat4x3) != 96; - Error += sizeof(glm::lowp_f64mat4x4) != 128; - - Error += sizeof(glm::mediump_f64mat2) != 32; - Error += sizeof(glm::mediump_f64mat3) != 72; - Error += sizeof(glm::mediump_f64mat4) != 128; - Error += sizeof(glm::mediump_f64mat2x2) != 32; - Error += sizeof(glm::mediump_f64mat2x3) != 48; - Error += sizeof(glm::mediump_f64mat2x4) != 64; - Error += sizeof(glm::mediump_f64mat3x2) != 48; - Error += sizeof(glm::mediump_f64mat3x3) != 72; - Error += sizeof(glm::mediump_f64mat3x4) != 96; - Error += sizeof(glm::mediump_f64mat4x2) != 64; - Error += sizeof(glm::mediump_f64mat4x3) != 96; - Error += sizeof(glm::mediump_f64mat4x4) != 128; - - Error += sizeof(glm::highp_f64mat2) != 32; - Error += sizeof(glm::highp_f64mat3) != 72; - Error += sizeof(glm::highp_f64mat4) != 128; - Error += sizeof(glm::highp_f64mat2x2) != 32; - Error += sizeof(glm::highp_f64mat2x3) != 48; - Error += sizeof(glm::highp_f64mat2x4) != 64; - Error += sizeof(glm::highp_f64mat3x2) != 48; - Error += sizeof(glm::highp_f64mat3x3) != 72; - Error += sizeof(glm::highp_f64mat3x4) != 96; - Error += sizeof(glm::highp_f64mat4x2) != 64; - Error += sizeof(glm::highp_f64mat4x3) != 96; - Error += sizeof(glm::highp_f64mat4x4) != 128; - - return Error; -} - -static int test_quat_size() -{ - int Error = 0; - - Error += sizeof(glm::f32quat) != 16; - Error += sizeof(glm::f64quat) != 32; - - Error += sizeof(glm::lowp_f32quat) != 16; - Error += sizeof(glm::lowp_f64quat) != 32; - - Error += sizeof(glm::mediump_f32quat) != 16; - Error += sizeof(glm::mediump_f64quat) != 32; - - Error += sizeof(glm::highp_f32quat) != 16; - Error += sizeof(glm::highp_f64quat) != 32; - - return Error; -} - -static int test_quat_precision() -{ - int Error = 0; - - { - glm::f32quat q1(0.f, glm::vec3(0.f, 0.f, 1.f)); - glm::lowp_f32quat qA(q1); - glm::mediump_f32quat qB(q1); - glm::highp_f32quat qC(q1); - glm::f32quat q2(qA); - glm::f32quat q3(qB); - glm::f32quat q4(qC); - - Error += glm::all(glm::equal(q1, q2, glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(q1, q3, glm::epsilon<float>())) ? 0 : 1; - Error += glm::all(glm::equal(q1, q4, glm::epsilon<float>())) ? 0 : 1; - } - - return Error; -} - -static int test_fvec_conversion() -{ - int Error(0); - - { - glm::highp_vec4 a = glm::vec4(1, 2, 3, 4); - glm::mediump_vec4 b = glm::vec4(1, 2, 3, 4); - glm::lowp_vec4 c = b; - glm::mediump_vec4 d = c; - glm::lowp_ivec4 e = glm::ivec4(d); - glm::lowp_ivec3 f = glm::ivec3(e); - - Error += glm::all(glm::equal(b, d, glm::epsilon<float>())) ? 0 : 1; - } - - return Error; -} - -#if GLM_HAS_OPENMP -static int test_openmp() -{ - std::vector<glm::u8vec3> VectorA(1000); - std::vector<glm::u8vec3> VectorB(1000); - std::vector<glm::u8vec3> VectorC(1000); - - for (std::size_t i = 0; i < VectorA.size(); ++i) - { - VectorA[i] = glm::u8vec3(1, 1, 1); - VectorB[i] = glm::u8vec3(1, 1, 1); - } - - #pragma omp parallel for default(none) shared(VectorA, VectorB, VectorC) - for (int i = 0; i < static_cast<int>(VectorC.size()); ++i) - { - VectorC[i] = VectorA[i] + VectorB[i]; - } - - return 0; -} -#endif//GLM_HAS_OPENMP - -int main() -{ - int Error = 0; - - Error += test_scalar_size(); - Error += test_fvec_size(); - - Error += test_fvec_precision(); - Error += test_fvec_conversion(); - - Error += test_dvec_precision(); - - Error += test_uvec_size(); - Error += test_uvec_precision(); - Error += test_ivec_size(); - Error += test_ivec_precision(); - - Error += test_fmat_size(); - Error += test_dmat_size(); - Error += test_quat_size(); - Error += test_quat_precision(); - -# if GLM_HAS_OPENMP - Error += test_openmp(); -# endif// - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_type_ptr.cpp b/3rdparty/glm/source/test/gtc/gtc_type_ptr.cpp deleted file mode 100644 index 6fcd305..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_type_ptr.cpp +++ /dev/null @@ -1,335 +0,0 @@ -#include <glm/gtc/type_ptr.hpp> -#include <glm/gtc/vec1.hpp> -#include <glm/gtc/constants.hpp> -#include <glm/ext/vector_relational.hpp> - -int test_value_ptr_vec() -{ - int Error = 0; - - { - glm::vec2 v(1.0); - float * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::vec3 v(1.0); - float * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::vec4 v(1.0); - float * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - - { - glm::dvec2 v(1.0); - double * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::dvec3 v(1.0); - double * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::dvec4 v(1.0); - double * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - - return Error; -} - -int test_value_ptr_vec_const() -{ - int Error = 0; - - { - glm::vec2 const v(1.0); - float const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::vec3 const v(1.0); - float const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::vec4 const v(1.0); - float const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - - { - glm::dvec2 const v(1.0); - double const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::dvec3 const v(1.0); - double const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::dvec4 const v(1.0); - double const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - - return Error; -} - -int test_value_ptr_mat() -{ - int Error = 0; - - { - glm::mat2x2 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat2x3 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat2x4 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat3x2 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat3x3 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat3x4 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat4x2 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat4x3 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat4x4 m(1.0); - float * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - - return Error; -} - -int test_value_ptr_mat_const() -{ - int Error = 0; - - { - glm::mat2x2 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat2x3 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat2x4 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat3x2 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat3x3 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat3x4 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat4x2 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat4x3 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - { - glm::mat4x4 const m(1.0); - float const * p = glm::value_ptr(m); - Error += p == &m[0][0] ? 0 : 1; - } - - return Error; -} - -int test_make_pointer_mat() -{ - int Error = 0; - - float ArrayA[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - double ArrayB[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - - glm::mat2x2 Mat2x2A = glm::make_mat2x2(ArrayA); - glm::mat2x3 Mat2x3A = glm::make_mat2x3(ArrayA); - glm::mat2x4 Mat2x4A = glm::make_mat2x4(ArrayA); - glm::mat3x2 Mat3x2A = glm::make_mat3x2(ArrayA); - glm::mat3x3 Mat3x3A = glm::make_mat3x3(ArrayA); - glm::mat3x4 Mat3x4A = glm::make_mat3x4(ArrayA); - glm::mat4x2 Mat4x2A = glm::make_mat4x2(ArrayA); - glm::mat4x3 Mat4x3A = glm::make_mat4x3(ArrayA); - glm::mat4x4 Mat4x4A = glm::make_mat4x4(ArrayA); - - glm::dmat2x2 Mat2x2B = glm::make_mat2x2(ArrayB); - glm::dmat2x3 Mat2x3B = glm::make_mat2x3(ArrayB); - glm::dmat2x4 Mat2x4B = glm::make_mat2x4(ArrayB); - glm::dmat3x2 Mat3x2B = glm::make_mat3x2(ArrayB); - glm::dmat3x3 Mat3x3B = glm::make_mat3x3(ArrayB); - glm::dmat3x4 Mat3x4B = glm::make_mat3x4(ArrayB); - glm::dmat4x2 Mat4x2B = glm::make_mat4x2(ArrayB); - glm::dmat4x3 Mat4x3B = glm::make_mat4x3(ArrayB); - glm::dmat4x4 Mat4x4B = glm::make_mat4x4(ArrayB); - - return Error; -} - -int test_make_pointer_vec() -{ - int Error = 0; - - float ArrayA[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - int ArrayB[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; - bool ArrayC[] = {true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false}; - - glm::vec2 Vec2A = glm::make_vec2(ArrayA); - glm::vec3 Vec3A = glm::make_vec3(ArrayA); - glm::vec4 Vec4A = glm::make_vec4(ArrayA); - - glm::ivec2 Vec2B = glm::make_vec2(ArrayB); - glm::ivec3 Vec3B = glm::make_vec3(ArrayB); - glm::ivec4 Vec4B = glm::make_vec4(ArrayB); - - glm::bvec2 Vec2C = glm::make_vec2(ArrayC); - glm::bvec3 Vec3C = glm::make_vec3(ArrayC); - glm::bvec4 Vec4C = glm::make_vec4(ArrayC); - - return Error; -} - -int test_make_vec1() -{ - int Error = 0; - - glm::ivec1 const v1 = glm::make_vec1(glm::ivec1(2)); - Error += v1 == glm::ivec1(2) ? 0 : 1; - - glm::ivec1 const v2 = glm::make_vec1(glm::ivec2(2)); - Error += v2 == glm::ivec1(2) ? 0 : 1; - - glm::ivec1 const v3 = glm::make_vec1(glm::ivec3(2)); - Error += v3 == glm::ivec1(2) ? 0 : 1; - - glm::ivec1 const v4 = glm::make_vec1(glm::ivec4(2)); - Error += v3 == glm::ivec1(2) ? 0 : 1; - - return Error; -} - -int test_make_vec2() -{ - int Error = 0; - - glm::ivec2 const v1 = glm::make_vec2(glm::ivec1(2)); - Error += v1 == glm::ivec2(2, 0) ? 0 : 1; - - glm::ivec2 const v2 = glm::make_vec2(glm::ivec2(2)); - Error += v2 == glm::ivec2(2, 2) ? 0 : 1; - - glm::ivec2 const v3 = glm::make_vec2(glm::ivec3(2)); - Error += v3 == glm::ivec2(2, 2) ? 0 : 1; - - glm::ivec2 const v4 = glm::make_vec2(glm::ivec4(2)); - Error += v3 == glm::ivec2(2, 2) ? 0 : 1; - - return Error; -} - -int test_make_vec3() -{ - int Error = 0; - - glm::ivec3 const v1 = glm::make_vec3(glm::ivec1(2)); - Error += v1 == glm::ivec3(2, 0, 0) ? 0 : 1; - - glm::ivec3 const v2 = glm::make_vec3(glm::ivec2(2)); - Error += v2 == glm::ivec3(2, 2, 0) ? 0 : 1; - - glm::ivec3 const v3 = glm::make_vec3(glm::ivec3(2)); - Error += v3 == glm::ivec3(2, 2, 2) ? 0 : 1; - - glm::ivec3 const v4 = glm::make_vec3(glm::ivec4(2)); - Error += v3 == glm::ivec3(2, 2, 2) ? 0 : 1; - - return Error; -} - -int test_make_vec4() -{ - int Error = 0; - - glm::ivec4 const v1 = glm::make_vec4(glm::ivec1(2)); - Error += v1 == glm::ivec4(2, 0, 0, 1) ? 0 : 1; - - glm::ivec4 const v2 = glm::make_vec4(glm::ivec2(2)); - Error += v2 == glm::ivec4(2, 2, 0, 1) ? 0 : 1; - - glm::ivec4 const v3 = glm::make_vec4(glm::ivec3(2)); - Error += v3 == glm::ivec4(2, 2, 2, 1) ? 0 : 1; - - glm::ivec4 const v4 = glm::make_vec4(glm::ivec4(2)); - Error += v4 == glm::ivec4(2, 2, 2, 2) ? 0 : 1; - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_make_vec1(); - Error += test_make_vec2(); - Error += test_make_vec3(); - Error += test_make_vec4(); - Error += test_make_pointer_vec(); - Error += test_make_pointer_mat(); - Error += test_value_ptr_vec(); - Error += test_value_ptr_vec_const(); - Error += test_value_ptr_mat(); - Error += test_value_ptr_mat_const(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_ulp.cpp b/3rdparty/glm/source/test/gtc/gtc_ulp.cpp deleted file mode 100644 index d5074a3..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_ulp.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include <glm/gtc/ulp.hpp> -#include <glm/ext/scalar_relational.hpp> -#include <limits> - -int test_ulp_float_dist() -{ - int Error = 0; - - float A = 1.0f; - - float B = glm::next_float(A); - Error += glm::notEqual(A, B, 0) ? 0 : 1; - float C = glm::prev_float(B); - Error += glm::equal(A, C, 0) ? 0 : 1; - - int D = glm::float_distance(A, B); - Error += D == 1 ? 0 : 1; - int E = glm::float_distance(A, C); - Error += E == 0 ? 0 : 1; - - return Error; -} - -int test_ulp_float_step() -{ - int Error = 0; - - float A = 1.0f; - - for(int i = 10; i < 1000; i *= 10) - { - float B = glm::next_float(A, i); - Error += glm::notEqual(A, B, 0) ? 0 : 1; - float C = glm::prev_float(B, i); - Error += glm::equal(A, C, 0) ? 0 : 1; - - int D = glm::float_distance(A, B); - Error += D == i ? 0 : 1; - int E = glm::float_distance(A, C); - Error += E == 0 ? 0 : 1; - } - - return Error; -} - -int test_ulp_double_dist() -{ - int Error = 0; - - double A = 1.0; - - double B = glm::next_float(A); - Error += glm::notEqual(A, B, 0) ? 0 : 1; - double C = glm::prev_float(B); - Error += glm::equal(A, C, 0) ? 0 : 1; - - glm::int64 const D = glm::float_distance(A, B); - Error += D == 1 ? 0 : 1; - glm::int64 const E = glm::float_distance(A, C); - Error += E == 0 ? 0 : 1; - - return Error; -} - -int test_ulp_double_step() -{ - int Error = 0; - - double A = 1.0; - - for(int i = 10; i < 1000; i *= 10) - { - double B = glm::next_float(A, i); - Error += glm::notEqual(A, B, 0) ? 0 : 1; - double C = glm::prev_float(B, i); - Error += glm::equal(A, C, 0) ? 0 : 1; - - glm::int64 const D = glm::float_distance(A, B); - Error += D == i ? 0 : 1; - glm::int64 const E = glm::float_distance(A, C); - Error += E == 0 ? 0 : 1; - } - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_ulp_float_dist(); - Error += test_ulp_float_step(); - Error += test_ulp_double_dist(); - Error += test_ulp_double_step(); - - return Error; -} - - diff --git a/3rdparty/glm/source/test/gtc/gtc_user_defined_types.cpp b/3rdparty/glm/source/test/gtc/gtc_user_defined_types.cpp deleted file mode 100644 index af39620..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_user_defined_types.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2010-09-16 -// Updated : 2011-05-27 -// Licence : This source is under MIT licence -// File : test/gtc/type_ptr.cpp -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#define GLM_FORCE_RADIANS -#include <glm/gtc/user_defined_type.hpp> - -int test_make_pointer_vec() -{ - int Error = 0; - - glm::func(); - //func(); - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_make_pointer_vec(); - - return Error; -} diff --git a/3rdparty/glm/source/test/gtc/gtc_vec1.cpp b/3rdparty/glm/source/test/gtc/gtc_vec1.cpp deleted file mode 100644 index 268d95e..0000000 --- a/3rdparty/glm/source/test/gtc/gtc_vec1.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include <glm/gtc/vec1.hpp> - -int main() -{ - int Error = 0; - - return Error; -} |