Added packHalf2x16 tests

This commit is contained in:
Christophe Riccio 2011-09-13 15:27:16 +01:00
parent bf76e0af09
commit 64f9e3564d

View File

@ -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;
}