Added packHalf2x16 tests

master
Christophe Riccio ago%!(EXTRA string=14 years)
parent bf76e0af09
commit 64f9e3564d
  1. 15
      test/core/core_func_packing.cpp

@ -8,11 +8,26 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/gtc/half_float.hpp>
#include <vector>
int test_packHalf2x16()
{
int Error = 0;
std::vector<glm::hvec2> A;
A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 2.0f)));
A.push_back(glm::hvec2(glm::half(-1.0f), glm::half(-2.0f)));
A.push_back(glm::hvec2(glm::half(-1.1f), glm::half( 1.1f)));
for(std::size_t i = 0; i < A.size(); ++i)
{
glm::vec2 B(A[i]);
glm::uint C = glm::packHalf2x16(B);
glm::vec2 D = glm::unpackHalf2x16(C);
Error += B == D ? 0 : 1;
}
return Error;
}

Loading…
Cancel
Save