diff --git a/filament/include/filament/Box.h b/filament/include/filament/Box.h index ade56f51cb..aaf92aed93 100644 --- a/filament/include/filament/Box.h +++ b/filament/include/filament/Box.h @@ -143,7 +143,7 @@ struct Aabb { * @return true if min >= max, i.e: the volume of the box is null or negative */ bool isEmpty() const noexcept { - return min >= max; + return any(greaterThanEqual(min, max)); } }; diff --git a/filament/test/filament_test.cpp b/filament/test/filament_test.cpp index 9687407090..8f7bba4891 100644 --- a/filament/test/filament_test.cpp +++ b/filament/test/filament_test.cpp @@ -424,10 +424,9 @@ TEST(FilamentTest, ColorConversion) { EXPECT_PRED2(vec3eq, (sRGBColor{1.0f, 0.0f, 0.0f}), Color::toSRGB({1.0f, 0.0f, 0.0f})); - // 0.5 is > 0.5 - EXPECT_LT((sRGBColor{0.5f, 0.0f, 0.0f}), Color::toSRGB({0.5f, 0.0f, 0.0f})); - // 0.5 is > 0.5 - EXPECT_LT((sRGBColor{0.5f, 0.0f, 0.0f}), Color::toSRGB({0.5f, 0.0f, 0.0f})); + EXPECT_LT((sRGBColor{0.5f, 0.0f, 0.0f}.x), Color::toSRGB({0.5f, 0.0f, 0.0f}).x); + + EXPECT_LT((sRGBColor{0.5f, 0.0f, 0.0f}.x), Color::toSRGB({0.5f, 0.0f, 0.0f}).x); EXPECT_PRED1(isGray, Color::toSRGB(LinearColor{0.5f})); EXPECT_PRED1(isGray, Color::toSRGB(LinearColor{0.5f})); @@ -443,10 +442,10 @@ TEST(FilamentTest, ColorConversion) { // 1.0 stays 1.0 EXPECT_PRED2(vec3eq, (LinearColor{1.0f, 0.0f, 0.0f}), Color::toLinear({1.0f, 0.0f, 0.0f})); - // 0.5 is < 0.5 - EXPECT_GT((LinearColor{0.5f, 0.0f, 0.0f}), Color::toLinear({0.5f, 0.0f, 0.0f})); - // 0.5 is < 0.5 - EXPECT_GT((LinearColor{0.5f, 0.0f, 0.0f}), Color::toLinear({0.5f, 0.0f, 0.0f})); + + EXPECT_GT((LinearColor{0.5f, 0.0f, 0.0f}.x), Color::toLinear({0.5f, 0.0f, 0.0f}).x); + + EXPECT_GT((LinearColor{0.5f, 0.0f, 0.0f}.x), Color::toLinear({0.5f, 0.0f, 0.0f}).x); EXPECT_PRED1(isGray, Color::toLinear(sRGBColor{0.5f})); EXPECT_PRED1(isGray, Color::toLinear(sRGBColor{0.5f})); diff --git a/libs/math/include/math/TVecHelpers.h b/libs/math/include/math/TVecHelpers.h index 459374ddbe..c176fcfa72 100644 --- a/libs/math/include/math/TVecHelpers.h +++ b/libs/math/include/math/TVecHelpers.h @@ -268,44 +268,6 @@ public: return !operator ==(lv, rv); } - template - friend inline - bool MATH_PURE operator >(const VECTOR& lv, const VECTOR& rv) { - // w/ inlining we end-up with many branches that will pollute the BPU cache - MATH_NOUNROLL - for (size_t i = 0; i < lv.size(); i++) { - if (lv[i] != rv[i]) { - return lv[i] > rv[i]; - } - } - return false; - } - - template - friend inline - constexpr bool MATH_PURE operator <=(const VECTOR& lv, const VECTOR& rv) { - return !(lv > rv); - } - - template - friend inline - bool MATH_PURE operator <(const VECTOR& lv, const VECTOR& rv) { - // w/ inlining we end-up with many branches that will pollute the BPU cache - MATH_NOUNROLL - for (size_t i = 0; i < lv.size(); i++) { - if (lv[i] != rv[i]) { - return lv[i] < rv[i]; - } - } - return false; - } - - template - friend inline - constexpr bool MATH_PURE operator >=(const VECTOR& lv, const VECTOR& rv) { - return !(lv < rv); - } - template friend inline VECTOR MATH_PURE equal(const VECTOR& lv, const VECTOR& rv) { diff --git a/libs/utils/test/test_StructureOfArrays.cpp b/libs/utils/test/test_StructureOfArrays.cpp index 8b1d5634aa..bc1e89ca4c 100644 --- a/libs/utils/test/test_StructureOfArrays.cpp +++ b/libs/utils/test/test_StructureOfArrays.cpp @@ -30,6 +30,9 @@ struct TestFloat4 : public float4 { z = -3; w = -4; } + friend bool operator < (TestFloat4 const& lhs, TestFloat4 const& rhs) noexcept { + return any(lessThan(lhs, rhs)); + } }; using SoA = utils::StructureOfArrays;