Improved half implementation
This commit is contained in:
@@ -16,12 +16,17 @@
|
||||
int test_packUnorm2x16()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
/*
|
||||
std::vector<glm::hvec2> A;
|
||||
A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 0.0f)));
|
||||
A.push_back(glm::hvec2(glm::half( 0.5f), glm::half( 0.7f)));
|
||||
A.push_back(glm::hvec2(glm::half( 0.1f), glm::half( 0.2f)));
|
||||
|
||||
*/
|
||||
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]);
|
||||
@@ -37,12 +42,17 @@ int test_packUnorm2x16()
|
||||
int test_packSnorm2x16()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
/*
|
||||
std::vector<glm::hvec2> A;
|
||||
A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 0.0f)));
|
||||
A.push_back(glm::hvec2(glm::half(-0.5f), glm::half(-0.7f)));
|
||||
A.push_back(glm::hvec2(glm::half(-0.1f), glm::half( 0.1f)));
|
||||
|
||||
*/
|
||||
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]);
|
||||
@@ -98,12 +108,17 @@ int test_packSnorm4x8()
|
||||
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)));
|
||||
|
||||
*/
|
||||
std::vector<glm::vec2> A;
|
||||
A.push_back(glm::vec2( 1.0f, 2.0f));
|
||||
A.push_back(glm::vec2(-1.0f,-2.0f));
|
||||
A.push_back(glm::vec2(-1.1f, 1.1f));
|
||||
|
||||
for(std::size_t i = 0; i < A.size(); ++i)
|
||||
{
|
||||
glm::vec2 B(A[i]);
|
||||
|
||||
@@ -18,14 +18,14 @@ int main()
|
||||
glm::half B(2.0f);
|
||||
glm::half C = A + B;
|
||||
glm::half D(C);
|
||||
float E = D;
|
||||
int F = float(C);
|
||||
float E = D.toFloat();
|
||||
int F = C.toFloat();
|
||||
Result += float(F) == E ? 0 : 1;
|
||||
glm::half G = B * C;
|
||||
glm::half H = G / C;
|
||||
H += glm::half(1.0f);
|
||||
double J = H;
|
||||
int I = float(H);
|
||||
double J = H.toFloat();
|
||||
int I = H.toFloat();
|
||||
Result += J == 3.0 ? 0 : 1;
|
||||
Result += I == 3 ? 0 : 1;
|
||||
|
||||
|
||||
@@ -139,7 +139,10 @@ int test_half_ctor_vec2()
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
glm::hvec2 A(1, 2);
|
||||
glm::hvec2 A;
|
||||
A.x = glm::half(1);
|
||||
A.y = glm::half(2);
|
||||
//glm::hvec2 A(1, 2);
|
||||
glm::hvec2 B(A);
|
||||
glm::vec2 C(1, 2);
|
||||
glm::hvec2 D(C);
|
||||
|
||||
Reference in New Issue
Block a user