From 47b9ad7f0847bc1a1f9f36dadee43ac9accf0c07 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 1 Oct 2018 17:17:43 +0200 Subject: [PATCH] Added EXT_vector/scalar_packing --- glm/ext/scalar_packing.hpp | 47 +++++++++++++++ glm/ext/scalar_packing.inl | 14 +++++ glm/ext/vector_packing.hpp | 21 +++++++ glm/ext/vector_packing.inl | 95 ++++++++++++++++++++++++++++- glm/gtc/packing.hpp | 30 ++------- glm/gtc/packing.inl | 104 ++------------------------------ test/ext/CMakeLists.txt | 3 +- test/ext/ext_scalar_packing.cpp | 38 ++++++++++++ test/ext/ext_vector_packing.cpp | 78 ++++++++++++++++++++++-- test/gtc/gtc_packing.cpp | 62 ++++++++++++++----- 10 files changed, 349 insertions(+), 143 deletions(-) create mode 100644 glm/ext/scalar_packing.hpp create mode 100644 glm/ext/scalar_packing.inl create mode 100644 test/ext/ext_scalar_packing.cpp diff --git a/glm/ext/scalar_packing.hpp b/glm/ext/scalar_packing.hpp new file mode 100644 index 00000000..421e11e7 --- /dev/null +++ b/glm/ext/scalar_packing.hpp @@ -0,0 +1,47 @@ +/// @ref ext_scalar_packing +/// @file glm/ext/scalar_packing.hpp +/// +/// @defgroup ext_scalar_packing GLM_EXT_scalar_packing +/// @ingroup ext +/// +/// Exposes comparison functions for scalar types that take a user defined epsilon values. +/// +/// Include to use the features of this extension. +/// +/// @see core_packing +/// @see ext_vector_packing + +#pragma once + +// Dependencies +#include "../detail/qualifier.hpp" +#include "../ext/scalar_uint_sized.hpp" + +#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) +# pragma message("GLM: GLM_EXT_scalar_packing extension included") +#endif + +namespace glm +{ + /// @addtogroup ext_scalar_packing + /// @{ + + /// Returns an unsigned integer scalar obtained by converting the components of a floating-point scalar + /// to the 16-bit floating-point representation found in the OpenGL Specification. + /// The first vector component specifies the 16 least-significant bits of the result; + /// the forth component specifies the 16 most-significant bits. + /// + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + GLM_FUNC_DECL uint16 packHalf(float s); + + /// Returns a floating-point scalar with components obtained by reinterpreting an integer scalar as 16-bit floating-point numbers and converting them to 32-bit floating-point values. + /// The first component of the vector is obtained from the 16 least-significant bits of v; + /// the forth component is obtained from the 16 most-significant bits of v. + /// + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + GLM_FUNC_DECL float unpackHalf(uint16 p); + + /// @} +}//namespace glm + +#include "scalar_packing.inl" diff --git a/glm/ext/scalar_packing.inl b/glm/ext/scalar_packing.inl new file mode 100644 index 00000000..d586ae76 --- /dev/null +++ b/glm/ext/scalar_packing.inl @@ -0,0 +1,14 @@ +#include "../detail/type_half.hpp" + +namespace glm +{ + GLM_FUNC_QUALIFIER uint16 packHalf(float Scalar) + { + return detail::toFloat16(Scalar); + } + + GLM_FUNC_QUALIFIER float unpackHalf(uint16 Packed) + { + return detail::toFloat32(Packed); + } +}//namespace glm diff --git a/glm/ext/vector_packing.hpp b/glm/ext/vector_packing.hpp index 92aa285f..fbb6db10 100644 --- a/glm/ext/vector_packing.hpp +++ b/glm/ext/vector_packing.hpp @@ -14,6 +14,8 @@ // Dependencies #include "../detail/qualifier.hpp" +#include "../ext/scalar_uint_sized.hpp" +#include "../ext/scalar_int_sized.hpp" #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_EXT_vector_packing extension included") @@ -24,6 +26,25 @@ namespace glm /// @addtogroup ext_vector_packing /// @{ + /// Returns an unsigned integer vector obtained by converting the components of a floating-point vector + /// to the 16-bit floating-point representation found in the OpenGL Specification. + /// The first vector component specifies the 16 least-significant bits of the result; + /// the forth component specifies the 16 most-significant bits. + /// + /// @see vec unpackHalf(vec const& p) + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + template + GLM_FUNC_DECL vec packHalf(vec const& v); + + /// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values. + /// The first component of the vector is obtained from the 16 least-significant bits of v; + /// the forth component is obtained from the 16 most-significant bits of v. + /// + /// @see vec packHalf(vec const& v) + /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions + template + GLM_FUNC_DECL vec unpackHalf(vec const& p); + /// @} }//namespace glm diff --git a/glm/ext/vector_packing.inl b/glm/ext/vector_packing.inl index 91776265..72ba6dcd 100644 --- a/glm/ext/vector_packing.inl +++ b/glm/ext/vector_packing.inl @@ -1,5 +1,98 @@ -namespace glm +#include "../detail/type_half.hpp" + +namespace glm{ +namespace detail { + template + struct compute_half + {}; + template + struct compute_half<1, Q> + { + GLM_FUNC_QUALIFIER static vec<1, uint16, Q> pack(vec<1, float, Q> const& v) + { + int16 const Unpack(detail::toFloat16(v.x)); + vec<1, uint16, Q> Packed; + memcpy(&Packed, &Unpack, sizeof(Packed)); + return Packed; + } + GLM_FUNC_QUALIFIER static vec<1, float, Q> unpack(vec<1, uint16, Q> const& v) + { + vec<1, int16, Q> Unpack; + memcpy(&Unpack, &v, sizeof(Unpack)); + return vec<1, float, Q>(detail::toFloat32(v.x)); + } + }; + + template + struct compute_half<2, Q> + { + GLM_FUNC_QUALIFIER static vec<2, uint16, Q> pack(vec<2, float, Q> const& v) + { + vec<2, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y)); + vec<2, uint16, Q> Packed; + memcpy(&Packed, &Unpack, sizeof(Packed)); + return Packed; + } + + GLM_FUNC_QUALIFIER static vec<2, float, Q> unpack(vec<2, uint16, Q> const& v) + { + vec<2, int16, Q> Unpack; + memcpy(&Unpack, &v, sizeof(Unpack)); + return vec<2, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y)); + } + }; + + template + struct compute_half<3, Q> + { + GLM_FUNC_QUALIFIER static vec<3, uint16, Q> pack(vec<3, float, Q> const& v) + { + vec<3, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z)); + vec<3, uint16, Q> Packed; + memcpy(&Packed, &Unpack, sizeof(Packed)); + return Packed; + } + + GLM_FUNC_QUALIFIER static vec<3, float, Q> unpack(vec<3, uint16, Q> const& v) + { + vec<3, int16, Q> Unpack; + memcpy(&Unpack, &v, sizeof(Unpack)); + return vec<3, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z)); + } + }; + + template + struct compute_half<4, Q> + { + GLM_FUNC_QUALIFIER static vec<4, uint16, Q> pack(vec<4, float, Q> const& v) + { + vec<4, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w)); + vec<4, uint16, Q> Packed; + memcpy(&Packed, &Unpack, sizeof(Packed)); + return Packed; + } + + GLM_FUNC_QUALIFIER static vec<4, float, Q> unpack(vec<4, uint16, Q> const& v) + { + vec<4, int16, Q> Unpack; + memcpy(&Unpack, &v, sizeof(Unpack)); + return vec<4, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w)); + } + }; +}//namespace detail + + template + GLM_FUNC_QUALIFIER vec packHalf(vec const& v) + { + return detail::compute_half::pack(v); + } + + template + GLM_FUNC_QUALIFIER vec unpackHalf(vec const& v) + { + return detail::compute_half::unpack(v); + } }//namespace glm diff --git a/glm/gtc/packing.hpp b/glm/gtc/packing.hpp index 28523952..b391482e 100644 --- a/glm/gtc/packing.hpp +++ b/glm/gtc/packing.hpp @@ -14,7 +14,9 @@ #pragma once // Dependency: -#include "type_precision.hpp" +#include "../gtc/type_precision.hpp" +#include "../ext/scalar_packing.hpp" +#include "../ext/vector_packing.hpp" #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) # pragma message("GLM: GLM_GTC_packing extension included") @@ -265,7 +267,7 @@ namespace glm /// @see uint64 packHalf4x16(vec4 const& v) /// @see GLSL packHalf2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL uint16 packHalf1x16(float v); + GLM_FUNC_DECL uint16 packHalf1x16(vec1 v); /// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value, /// interpreted as a 16-bit floating-point number according to the OpenGL Specification, @@ -276,7 +278,7 @@ namespace glm /// @see vec4 unpackHalf4x16(uint64 const& v) /// @see GLSL unpackHalf2x16 man page /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - GLM_FUNC_DECL float unpackHalf1x16(uint16 v); + GLM_FUNC_DECL vec1 unpackHalf1x16(uint16 v); /// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector /// to the 16-bit floating-point representation found in the OpenGL Specification, @@ -490,27 +492,6 @@ namespace glm template GLM_FUNC_DECL vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm); - /// Returns an unsigned integer vector obtained by converting the components of a floating-point vector - /// to the 16-bit floating-point representation found in the OpenGL Specification. - /// The first vector component specifies the 16 least-significant bits of the result; - /// the forth component specifies the 16 most-significant bits. - /// - /// @see gtc_packing - /// @see vec unpackHalf(vec const& p) - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - template - GLM_FUNC_DECL vec packHalf(vec const& v); - - /// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values. - /// The first component of the vector is obtained from the 16 least-significant bits of v; - /// the forth component is obtained from the 16 most-significant bits of v. - /// - /// @see gtc_packing - /// @see vec packHalf(vec const& v) - /// @see GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions - template - GLM_FUNC_DECL vec unpackHalf(vec const& p); - /// Convert each component of the normalized floating-point vector into unsigned integer values. /// /// @see gtc_packing @@ -721,7 +702,6 @@ namespace glm /// @see int packUint2x16(u32vec2 const& v) GLM_FUNC_DECL u32vec2 unpackUint2x32(uint64 p); - /// @} }// namespace glm diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index 8c906e16..8039bef9 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -270,86 +270,6 @@ namespace detail } data; uint32 pack; }; - - template - struct compute_half - {}; - - template - struct compute_half<1, Q> - { - GLM_FUNC_QUALIFIER static vec<1, uint16, Q> pack(vec<1, float, Q> const& v) - { - int16 const Unpack(detail::toFloat16(v.x)); - u16vec1 Packed; - memcpy(&Packed, &Unpack, sizeof(Packed)); - return Packed; - } - - GLM_FUNC_QUALIFIER static vec<1, float, Q> unpack(vec<1, uint16, Q> const& v) - { - i16vec1 Unpack; - memcpy(&Unpack, &v, sizeof(Unpack)); - return vec<1, float, Q>(detail::toFloat32(v.x)); - } - }; - - template - struct compute_half<2, Q> - { - GLM_FUNC_QUALIFIER static vec<2, uint16, Q> pack(vec<2, float, Q> const& v) - { - vec<2, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y)); - u16vec2 Packed; - memcpy(&Packed, &Unpack, sizeof(Packed)); - return Packed; - } - - GLM_FUNC_QUALIFIER static vec<2, float, Q> unpack(vec<2, uint16, Q> const& v) - { - i16vec2 Unpack; - memcpy(&Unpack, &v, sizeof(Unpack)); - return vec<2, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y)); - } - }; - - template - struct compute_half<3, Q> - { - GLM_FUNC_QUALIFIER static vec<3, uint16, Q> pack(vec<3, float, Q> const& v) - { - vec<3, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z)); - u16vec3 Packed; - memcpy(&Packed, &Unpack, sizeof(Packed)); - return Packed; - } - - GLM_FUNC_QUALIFIER static vec<3, float, Q> unpack(vec<3, uint16, Q> const& v) - { - i16vec3 Unpack; - memcpy(&Unpack, &v, sizeof(Unpack)); - return vec<3, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z)); - } - }; - - template - struct compute_half<4, Q> - { - GLM_FUNC_QUALIFIER static vec<4, uint16, Q> pack(vec<4, float, Q> const& v) - { - vec<4, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w)); - u16vec4 Packed; - memcpy(&Packed, &Unpack, sizeof(Packed)); - return Packed; - } - - GLM_FUNC_QUALIFIER static vec<4, float, Q> unpack(vec<4, uint16, Q> const& v) - { - i16vec4 Unpack; - memcpy(&Unpack, &v, sizeof(Unpack)); - return vec<4, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w)); - } - }; }//namespace detail GLM_FUNC_QUALIFIER uint8 packUnorm1x8(float v) @@ -473,22 +393,22 @@ namespace detail -1.0f, 1.0f); } - GLM_FUNC_QUALIFIER uint16 packHalf1x16(float v) + GLM_FUNC_QUALIFIER uint16 packHalf1x16(vec1 v) { - int16 const Topack(detail::toFloat16(v)); + int16 const Topack(detail::toFloat16(v.x)); uint16 Packed = 0; memcpy(&Packed, &Topack, sizeof(Packed)); return Packed; } - GLM_FUNC_QUALIFIER float unpackHalf1x16(uint16 v) + GLM_FUNC_QUALIFIER vec1 unpackHalf1x16(uint16 v) { - int16 Unpack = 0; + i16vec1 Unpack; memcpy(&Unpack, &v, sizeof(Unpack)); - return detail::toFloat32(Unpack); + return vec1(detail::toFloat32(Unpack.x)); } - GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const& v) + GLM_FUNC_QUALIFIER uint64 packHalf4x16(vec4 const& v) { i16vec4 const Unpack( detail::toFloat16(v.x), @@ -656,18 +576,6 @@ namespace detail return vec<3, T, Q>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast(6); } - template - GLM_FUNC_QUALIFIER vec packHalf(vec const& v) - { - return detail::compute_half::pack(v); - } - - template - GLM_FUNC_QUALIFIER vec unpackHalf(vec const& v) - { - return detail::compute_half::unpack(v); - } - template GLM_FUNC_QUALIFIER vec packUnorm(vec const& v) { diff --git a/test/ext/CMakeLists.txt b/test/ext/CMakeLists.txt index 89f5f841..b88cd734 100644 --- a/test/ext/CMakeLists.txt +++ b/test/ext/CMakeLists.txt @@ -10,9 +10,10 @@ glmCreateTestGTC(ext_quaternion_type) glmCreateTestGTC(ext_scalar_common) glmCreateTestGTC(ext_scalar_constants) glmCreateTestGTC(ext_scalar_int_sized) +glmCreateTestGTC(ext_scalar_packing) +glmCreateTestGTC(ext_scalar_relational) glmCreateTestGTC(ext_scalar_uint_sized) glmCreateTestGTC(ext_scalar_ulp) -glmCreateTestGTC(ext_scalar_relational) glmCreateTestGTC(ext_vec1) glmCreateTestGTC(ext_vector_bool1) glmCreateTestGTC(ext_vector_common) diff --git a/test/ext/ext_scalar_packing.cpp b/test/ext/ext_scalar_packing.cpp new file mode 100644 index 00000000..ef9cb3da --- /dev/null +++ b/test/ext/ext_scalar_packing.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include + +static int test_half() +{ + int Error = 0; + + std::vector Tests; + Tests.push_back(0.0f); + Tests.push_back(1.0f); + Tests.push_back(-1.0f); + Tests.push_back(2.0f); + Tests.push_back(-2.0f); + Tests.push_back(1.9f); + + for(std::size_t i = 0; i < Tests.size(); ++i) + { + glm::uint16 p0 = glm::packHalf(Tests[i]); + float v0 = glm::unpackHalf(p0); + glm::uint16 p1 = glm::packHalf(v0); + float v1 = glm::unpackHalf(p1); + Error += glm::equal(v0, v1, glm::epsilon()) ? 0 : 1; + } + + return Error; +} + +int main() +{ + int Error = 0; + + Error += test_half(); + + return Error; +} diff --git a/test/ext/ext_vector_packing.cpp b/test/ext/ext_vector_packing.cpp index f97e27cb..12696098 100644 --- a/test/ext/ext_vector_packing.cpp +++ b/test/ext/ext_vector_packing.cpp @@ -1,18 +1,88 @@ +#include +#include #include +#include #include #include #include #include -#include -#include -#include -#include +#include + +template +static int test_half() +{ + typedef glm::vec vecUType; + typedef glm::vec vecIType; + typedef glm::vec vecFType; + + float const Epsilon = 0.01f; + + int Error = 0; + + struct test + { + test(vecFType const& Data, vecIType const& ULPs) + : Data(Data) + , ULPs(ULPs) + {} + + vecFType Data; + vecIType ULPs; + }; + + std::vector Tests; + Tests.push_back(test(vecFType(1.0f), vecIType(0))); + Tests.push_back(test(vecFType(0.0f), vecIType(0))); + Tests.push_back(test(vecFType(2.0f), vecIType(0))); + Tests.push_back(test(vecFType(0.1f), vecIType(3277))); + Tests.push_back(test(vecFType(0.5f), vecIType(0))); + Tests.push_back(test(vecFType(-0.9f), vecIType(1638))); + + for(std::size_t i = 0; i < Tests.size(); ++i) + { + vecFType const Data = Tests[i].Data; + + vecUType const p0 = glm::packHalf(Data); + + vecFType const v0 = glm::unpackHalf(p0); + Error += glm::all(glm::equal(v0, Data, Epsilon)) ? 0 : 1; + + vecUType const p1 = glm::packHalf(v0); + Error += glm::all(glm::equal(p0, p1)) ? 0 : 1; + + vecFType const v1 = glm::unpackHalf(p1); + Error += glm::all(glm::equal(v1, Data, Epsilon)) ? 0 : 1; + + vecIType const ULPs = glm::float_distance(Data, v0); + Error += glm::all(glm::equal(ULPs, Tests[i].ULPs)) ? 0 : 1; + } + + return Error; +} int main() { int Error = 0; + Error += test_half<1, glm::defaultp>(); + Error += test_half<2, glm::defaultp>(); + Error += test_half<3, glm::defaultp>(); + Error += test_half<4, glm::defaultp>(); + Error += test_half<1, glm::lowp>(); + Error += test_half<2, glm::lowp>(); + Error += test_half<3, glm::lowp>(); + Error += test_half<4, glm::lowp>(); + + Error += test_half<1, glm::mediump>(); + Error += test_half<2, glm::mediump>(); + Error += test_half<3, glm::mediump>(); + Error += test_half<4, glm::mediump>(); + + Error += test_half<1, glm::highp>(); + Error += test_half<2, glm::highp>(); + Error += test_half<3, glm::highp>(); + Error += test_half<4, glm::highp>(); return Error; } diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp index 6f00f9bb..b225b70d 100644 --- a/test/gtc/gtc_packing.cpp +++ b/test/gtc/gtc_packing.cpp @@ -57,31 +57,63 @@ void print_value(float const& s) printf("\n"); } -int test_Half1x16() +static int test_half1x16() { int Error = 0; - std::vector Tests; - Tests.push_back(0.0f); - Tests.push_back(1.0f); - Tests.push_back(-1.0f); - Tests.push_back(2.0f); - Tests.push_back(-2.0f); - Tests.push_back(1.9f); + std::vector Tests; + Tests.push_back(glm::vec1(1.0f)); + Tests.push_back(glm::vec1(0.0f)); + Tests.push_back(glm::vec1(2.0f)); + Tests.push_back(glm::vec1(0.1f)); + Tests.push_back(glm::vec1(0.5f)); + Tests.push_back(glm::vec1(-0.9f)); for(std::size_t i = 0; i < Tests.size(); ++i) { glm::uint16 p0 = glm::packHalf1x16(Tests[i]); - float v0 = glm::unpackHalf1x16(p0); + glm::vec1 v0 = glm::unpackHalf1x16(p0); glm::uint16 p1 = glm::packHalf1x16(v0); - float v1 = glm::unpackHalf1x16(p1); - Error += glm::epsilonEqual(v0, v1, glm::epsilon()) ? 0 : 1; + glm::vec1 v1 = glm::unpackHalf1x16(p1); + glm::u16vec1 p2 = glm::packHalf(v0); + glm::vec1 v2 = glm::unpackHalf(p2); + + Error += glm::all(glm::equal(v0, v1, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(v0, v2, glm::epsilon())) ? 0 : 1; } return Error; } -int test_Half4x16() +static int test_half2x16() +{ + int Error = 0; + + std::vector Tests; + Tests.push_back(glm::vec2(1.0f)); + Tests.push_back(glm::vec2(0.0f)); + Tests.push_back(glm::vec2(2.0f)); + Tests.push_back(glm::vec2(0.1f)); + Tests.push_back(glm::vec2(0.5f)); + Tests.push_back(glm::vec2(-0.9f)); + + for(std::size_t i = 0; i < Tests.size(); ++i) + { + glm::uint32 p0 = glm::packHalf2x16(Tests[i]); + glm::vec2 v0 = glm::unpackHalf2x16(p0); + glm::uint32 p1 = glm::packHalf2x16(v0); + glm::vec2 v1 = glm::unpackHalf2x16(p1); + glm::u16vec2 p2 = glm::packHalf(v0); + glm::vec2 v2 = glm::unpackHalf(p2); + + Error += glm::all(glm::equal(v0, v1, glm::epsilon())) ? 0 : 1; + Error += glm::all(glm::equal(v0, v2, glm::epsilon())) ? 0 : 1; + } + + return Error; +} + +static int test_half4x16() { int Error = 0; @@ -871,8 +903,10 @@ int main() Error += test_I3x10_1x2(); Error += test_U3x10_1x2(); - Error += test_Half1x16(); - Error += test_Half4x16(); + + Error += test_half1x16(); + Error += test_half2x16(); + Error += test_half4x16(); return Error; }