Tentative fix of GTC_type_precision

This commit is contained in:
Christophe Riccio 2017-08-15 15:12:04 +02:00
parent 118be2fe8d
commit bacbc2ab99
2 changed files with 63 additions and 52 deletions

View File

@ -39,7 +39,7 @@ int test_quat_angleAxis()
{ {
int Error = 0; int Error = 0;
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1)); 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 B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::quat C = glm::mix(A, B, 0.5f); glm::quat C = glm::mix(A, B, 0.5f);
glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1)); glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));
@ -56,7 +56,7 @@ int test_quat_mix()
{ {
int Error = 0; int Error = 0;
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1)); 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 B = glm::angleAxis(glm::pi<float>() * 0.5f, glm::vec3(0, 0, 1));
glm::quat C = glm::mix(A, B, 0.5f); glm::quat C = glm::mix(A, B, 0.5f);
glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1)); glm::quat D = glm::angleAxis(glm::pi<float>() * 0.25f, glm::vec3(0, 0, 1));

View File

@ -7,7 +7,8 @@
static int test_scalar_size() static int test_scalar_size()
{ {
int Error(0); int Error = 0;
Error += sizeof(glm::int8) != 1; Error += sizeof(glm::int8) != 1;
Error += sizeof(glm::int16) != 2; Error += sizeof(glm::int16) != 2;
Error += sizeof(glm::int32) != 4; Error += sizeof(glm::int32) != 4;
@ -51,12 +52,14 @@ static int test_scalar_size()
Error += sizeof(glm::highp_uint64) != 8; Error += sizeof(glm::highp_uint64) != 8;
Error += sizeof(glm::highp_float32) != 4; Error += sizeof(glm::highp_float32) != 4;
Error += sizeof(glm::highp_float64) != 8; Error += sizeof(glm::highp_float64) != 8;
return Error; return Error;
} }
static int test_fvec_size() static int test_fvec_size()
{ {
int Error(0); int Error = 0;
Error += sizeof(glm::f32vec2) != 8; Error += sizeof(glm::f32vec2) != 8;
Error += sizeof(glm::f32vec3) != 12; Error += sizeof(glm::f32vec3) != 12;
Error += sizeof(glm::f32vec4) != 16; Error += sizeof(glm::f32vec4) != 16;
@ -84,12 +87,13 @@ static int test_fvec_size()
Error += sizeof(glm::highp_f64vec2) != 16; Error += sizeof(glm::highp_f64vec2) != 16;
Error += sizeof(glm::highp_f64vec3) != 24; Error += sizeof(glm::highp_f64vec3) != 24;
Error += sizeof(glm::highp_f64vec4) != 32; Error += sizeof(glm::highp_f64vec4) != 32;
return Error; return Error;
} }
static int test_fvec_precision() static int test_fvec_precision()
{ {
int Error(0); int Error = 0;
/* /*
{ {
glm::f32vec2 v1; glm::f32vec2 v1;
@ -103,7 +107,7 @@ static int test_fvec_precision()
} }
*/ */
{ {
glm::f32vec2 v1; glm::f32vec2 v1(1.f);
glm::lowp_f32vec2 v2(v1); glm::lowp_f32vec2 v2(v1);
glm::mediump_f32vec2 v3(v1); glm::mediump_f32vec2 v3(v1);
glm::highp_f32vec2 v4(v1); glm::highp_f32vec2 v4(v1);
@ -114,7 +118,7 @@ static int test_fvec_precision()
} }
{ {
glm::f32vec3 v1; glm::f32vec3 v1(1.f);
glm::lowp_f32vec3 v2(v1); glm::lowp_f32vec3 v2(v1);
glm::mediump_f32vec3 v3(v1); glm::mediump_f32vec3 v3(v1);
glm::highp_f32vec3 v4(v1); glm::highp_f32vec3 v4(v1);
@ -125,7 +129,7 @@ static int test_fvec_precision()
} }
{ {
glm::f32vec4 v1; glm::f32vec4 v1(1.f);
glm::lowp_f32vec4 v2(v1); glm::lowp_f32vec4 v2(v1);
glm::mediump_f32vec4 v3(v1); glm::mediump_f32vec4 v3(v1);
glm::highp_f32vec4 v4(v1); glm::highp_f32vec4 v4(v1);
@ -140,10 +144,10 @@ static int test_fvec_precision()
static int test_dvec_precision() static int test_dvec_precision()
{ {
int Error(0); int Error = 0;
{ {
glm::f64vec2 v1; glm::f64vec2 v1(1.0);
glm::lowp_f64vec2 v2(v1); glm::lowp_f64vec2 v2(v1);
glm::mediump_f64vec2 v3(v1); glm::mediump_f64vec2 v3(v1);
glm::highp_f64vec2 v4(v1); glm::highp_f64vec2 v4(v1);
@ -154,7 +158,7 @@ static int test_dvec_precision()
} }
{ {
glm::f64vec3 v1; glm::f64vec3 v1(1.0);
glm::lowp_f64vec3 v2(v1); glm::lowp_f64vec3 v2(v1);
glm::mediump_f64vec3 v3(v1); glm::mediump_f64vec3 v3(v1);
glm::highp_f64vec3 v4(v1); glm::highp_f64vec3 v4(v1);
@ -165,7 +169,7 @@ static int test_dvec_precision()
} }
{ {
glm::f64vec4 v1; glm::f64vec4 v1(1.0);
glm::lowp_f64vec4 v2(v1); glm::lowp_f64vec4 v2(v1);
glm::mediump_f64vec4 v3(v1); glm::mediump_f64vec4 v3(v1);
glm::highp_f64vec4 v4(v1); glm::highp_f64vec4 v4(v1);
@ -180,7 +184,8 @@ static int test_dvec_precision()
static int test_ivec_size() static int test_ivec_size()
{ {
int Error(0); int Error = 0;
Error += sizeof(glm::i8vec2) != 2; Error += sizeof(glm::i8vec2) != 2;
Error += sizeof(glm::i8vec3) != 3; Error += sizeof(glm::i8vec3) != 3;
Error += sizeof(glm::i8vec4) != 4; Error += sizeof(glm::i8vec4) != 4;
@ -232,12 +237,13 @@ static int test_ivec_size()
Error += sizeof(glm::highp_i64vec2) != 16; Error += sizeof(glm::highp_i64vec2) != 16;
Error += sizeof(glm::highp_i64vec3) != 24; Error += sizeof(glm::highp_i64vec3) != 24;
Error += sizeof(glm::highp_i64vec4) != 32; Error += sizeof(glm::highp_i64vec4) != 32;
return Error; return Error;
} }
static int test_ivec_precision() static int test_ivec_precision()
{ {
int Error(0); int Error = 0;
{ {
glm::i8vec2 v1(0); glm::i8vec2 v1(0);
@ -376,7 +382,8 @@ static int test_ivec_precision()
static int test_uvec_size() static int test_uvec_size()
{ {
int Error(0); int Error = 0;
Error += sizeof(glm::u8vec2) != 2; Error += sizeof(glm::u8vec2) != 2;
Error += sizeof(glm::u8vec3) != 3; Error += sizeof(glm::u8vec3) != 3;
Error += sizeof(glm::u8vec4) != 4; Error += sizeof(glm::u8vec4) != 4;
@ -428,12 +435,13 @@ static int test_uvec_size()
Error += sizeof(glm::highp_u64vec2) != 16; Error += sizeof(glm::highp_u64vec2) != 16;
Error += sizeof(glm::highp_u64vec3) != 24; Error += sizeof(glm::highp_u64vec3) != 24;
Error += sizeof(glm::highp_u64vec4) != 32; Error += sizeof(glm::highp_u64vec4) != 32;
return Error; return Error;
} }
static int test_uvec_precision() static int test_uvec_precision()
{ {
int Error(0); int Error = 0;
{ {
glm::u8vec2 v1(0); glm::u8vec2 v1(0);
@ -572,7 +580,8 @@ static int test_uvec_precision()
static int test_fmat_size() static int test_fmat_size()
{ {
int Error(0); int Error = 0;
Error += sizeof(glm::mat2) != 16; Error += sizeof(glm::mat2) != 16;
Error += sizeof(glm::mat3) != 36; Error += sizeof(glm::mat3) != 36;
Error += sizeof(glm::mat4) != 64; Error += sizeof(glm::mat4) != 64;
@ -652,7 +661,6 @@ static int test_fmat_size()
Error += sizeof(glm::lowp_f32mat4x3) != 48; Error += sizeof(glm::lowp_f32mat4x3) != 48;
Error += sizeof(glm::lowp_f32mat4x4) != 64; Error += sizeof(glm::lowp_f32mat4x4) != 64;
Error += sizeof(glm::mediump_mat2) != 16; Error += sizeof(glm::mediump_mat2) != 16;
Error += sizeof(glm::mediump_mat3) != 36; Error += sizeof(glm::mediump_mat3) != 36;
Error += sizeof(glm::mediump_mat4) != 64; Error += sizeof(glm::mediump_mat4) != 64;
@ -692,7 +700,6 @@ static int test_fmat_size()
Error += sizeof(glm::mediump_f32mat4x3) != 48; Error += sizeof(glm::mediump_f32mat4x3) != 48;
Error += sizeof(glm::mediump_f32mat4x4) != 64; Error += sizeof(glm::mediump_f32mat4x4) != 64;
Error += sizeof(glm::highp_mat2) != 16; Error += sizeof(glm::highp_mat2) != 16;
Error += sizeof(glm::highp_mat3) != 36; Error += sizeof(glm::highp_mat3) != 36;
Error += sizeof(glm::highp_mat4) != 64; Error += sizeof(glm::highp_mat4) != 64;
@ -731,12 +738,14 @@ static int test_fmat_size()
Error += sizeof(glm::highp_f32mat4x2) != 32; Error += sizeof(glm::highp_f32mat4x2) != 32;
Error += sizeof(glm::highp_f32mat4x3) != 48; Error += sizeof(glm::highp_f32mat4x3) != 48;
Error += sizeof(glm::highp_f32mat4x4) != 64; Error += sizeof(glm::highp_f32mat4x4) != 64;
return Error; return Error;
} }
static int test_dmat_size() static int test_dmat_size()
{ {
int Error(0); int Error = 0;
Error += sizeof(glm::f64mat2) != 32; Error += sizeof(glm::f64mat2) != 32;
Error += sizeof(glm::f64mat3) != 72; Error += sizeof(glm::f64mat3) != 72;
Error += sizeof(glm::f64mat4) != 128; Error += sizeof(glm::f64mat4) != 128;
@ -795,6 +804,7 @@ static int test_dmat_size()
static int test_quat_size() static int test_quat_size()
{ {
int Error = 0; int Error = 0;
Error += sizeof(glm::f32quat) != 16; Error += sizeof(glm::f32quat) != 16;
Error += sizeof(glm::f64quat) != 32; Error += sizeof(glm::f64quat) != 32;
@ -806,15 +816,16 @@ static int test_quat_size()
Error += sizeof(glm::highp_f32quat) != 16; Error += sizeof(glm::highp_f32quat) != 16;
Error += sizeof(glm::highp_f64quat) != 32; Error += sizeof(glm::highp_f64quat) != 32;
return Error; return Error;
} }
static int test_quat_precision() static int test_quat_precision()
{ {
int Error(0); int Error = 0;
{ {
glm::f32quat q1; glm::f32quat q1(0.f, glm::vec3(0.f, 0.f, 1.f));
glm::lowp_f32quat qA(q1); glm::lowp_f32quat qA(q1);
glm::mediump_f32quat qB(q1); glm::mediump_f32quat qB(q1);
glm::highp_f32quat qC(q1); glm::highp_f32quat qC(q1);