diff --git a/glm/fwd.hpp b/glm/fwd.hpp index 25e23209..2822aab9 100644 --- a/glm/fwd.hpp +++ b/glm/fwd.hpp @@ -3055,15 +3055,15 @@ namespace glm /// Default double-precision floating-point 2x2 matrix. /// @see gtc_type_precision - typedef f32mat2x2 f64mat2; + typedef f64mat2x2 f64mat2; /// Default double-precision floating-point 3x3 matrix. /// @see gtc_type_precision - typedef f32mat3x3 f64mat3; + typedef f64mat3x3 f64mat3; /// Default double-precision floating-point 4x4 matrix. /// @see gtc_type_precision - typedef f32mat4x4 f64mat4; + typedef f64mat4x4 f64mat4; /// Default double-precision floating-point quaternion. /// @see gtc_type_precision diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index 59441ed3..7d17a410 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -170,10 +170,14 @@ int test_vec3_size() { int Error = 0; + Error += sizeof(glm::vec3) == sizeof(glm::lowp_vec3) ? 0 : 1; Error += sizeof(glm::vec3) == sizeof(glm::mediump_vec3) ? 0 : 1; + Error += sizeof(glm::vec3) == sizeof(glm::highp_vec3) ? 0 : 1; Error += 12 == sizeof(glm::mediump_vec3) ? 0 : 1; - Error += sizeof(glm::dvec3) == sizeof(glm::highp_vec3) ? 0 : 1; - Error += 24 == sizeof(glm::highp_vec3) ? 0 : 1; + Error += sizeof(glm::dvec3) == sizeof(glm::lowp_dvec3) ? 0 : 1; + Error += sizeof(glm::dvec3) == sizeof(glm::mediump_dvec3) ? 0 : 1; + Error += sizeof(glm::dvec3) == sizeof(glm::highp_dvec3) ? 0 : 1; + Error += 24 == sizeof(glm::highp_dvec3) ? 0 : 1; Error += glm::vec3().length() == 3 ? 0 : 1; Error += glm::dvec3().length() == 3 ? 0 : 1; @@ -211,7 +215,7 @@ int test_vec3_swizzle3_2() u = v.gb; Error += (u.r == 2.0f && u.g == 3.0f) ? 0 : 1; u = v.br; Error += (u.r == 3.0f && u.g == 1.0f) ? 0 : 1; u = v.bg; Error += (u.r == 3.0f && u.g == 2.0f) ? 0 : 1; - u = v.bb; Error += (u.r == 3.0f && u.g == 3.0f) ? 0 : 1; + u = v.bb; Error += (u.r == 3.0f && u.g == 3.0f) ? 0 : 1; u = v.ss; Error += (u.s == 1.0f && u.t == 1.0f) ? 0 : 1; u = v.st; Error += (u.s == 1.0f && u.t == 2.0f) ? 0 : 1; @@ -350,19 +354,17 @@ int test_vec3_swizzle_operators() int test_vec3_swizzle_functions() { - int Error = 0; + int Error = 0; - // - // NOTE: template functions cannot pick up the implicit conversion from - // a swizzle to the unswizzled type, therefore the operator() must be - // used. E.g.: - // - // glm::dot(u.xy, v.xy); <--- Compile error - // glm::dot(u.xy(), v.xy()); <--- Compiles correctly - // + // NOTE: template functions cannot pick up the implicit conversion from + // a swizzle to the unswizzled type, therefore the operator() must be + // used. E.g.: + // + // glm::dot(u.xy, v.xy); <--- Compile error + // glm::dot(u.xy(), v.xy()); <--- Compiles correctly #if(GLM_SUPPORT_SWIZZLE_OPERATOR()) - float r; + float r; // vec2 glm::vec2 a(1, 2); @@ -390,7 +392,7 @@ int test_vec3_swizzle_functions() r = glm::dot(s.xyz(), t.xyz()); Error += (int(r) == 140) ? 0 : 1; #endif//(GLM_SUPPORT_SWIZZLE_OPERATOR()) - return Error; + return Error; } int test_vec3_swizzle_partial() @@ -426,14 +428,12 @@ int main() Error += test_vec3_ctor(); Error += test_vec3_operators(); Error += test_vec3_size(); - Error += test_vec3_swizzle3_2(); - Error += test_vec3_swizzle3_3(); - Error += test_vec3_swizzle_half(); + Error += test_vec3_swizzle3_2(); + Error += test_vec3_swizzle3_3(); + Error += test_vec3_swizzle_half(); Error += test_vec3_swizzle_partial(); - Error += test_vec3_swizzle_operators(); - Error += test_vec3_swizzle_functions(); - - printf("Errors: %d\n", Error); + Error += test_vec3_swizzle_operators(); + Error += test_vec3_swizzle_functions(); return Error; } diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 18763b23..c10a13f1 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -204,10 +204,14 @@ int test_vec4_size() { int Error = 0; + Error += sizeof(glm::vec4) == sizeof(glm::lowp_vec4) ? 0 : 1; Error += sizeof(glm::vec4) == sizeof(glm::mediump_vec4) ? 0 : 1; + Error += sizeof(glm::vec4) == sizeof(glm::highp_vec4) ? 0 : 1; Error += 16 == sizeof(glm::mediump_vec4) ? 0 : 1; - Error += sizeof(glm::dvec4) == sizeof(glm::highp_vec4) ? 0 : 1; - Error += 32 == sizeof(glm::highp_vec4) ? 0 : 1; + Error += sizeof(glm::dvec4) == sizeof(glm::lowp_dvec4) ? 0 : 1; + Error += sizeof(glm::dvec4) == sizeof(glm::mediump_dvec4) ? 0 : 1; + Error += sizeof(glm::dvec4) == sizeof(glm::highp_dvec4) ? 0 : 1; + Error += 32 == sizeof(glm::highp_dvec4) ? 0 : 1; Error += glm::vec4().length() == 4 ? 0 : 1; Error += glm::dvec4().length() == 4 ? 0 : 1; @@ -261,7 +265,7 @@ int main() Error += test_vec4_size(); Error += test_vec4_operators(); Error += test_hvec4(); - Error += test_vec4_swizzle_partial(); + Error += test_vec4_swizzle_partial(); return Error; } diff --git a/test/gtc/gtc_type_precision.cpp b/test/gtc/gtc_type_precision.cpp index 798c80aa..b38349eb 100644 --- a/test/gtc/gtc_type_precision.cpp +++ b/test/gtc/gtc_type_precision.cpp @@ -289,6 +289,105 @@ static int test_ivec_size() static int test_ivec_precision() { int Error(0); + + { + glm::i8vec2 v1; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; @@ -386,6 +485,105 @@ static int test_uvec_size() static int test_uvec_precision() { int Error(0); + + { + glm::u8vec2 v1; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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; + 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;