Commit 5dbb45f0 authored by rmcilroy@chromium.org's avatar rmcilroy@chromium.org

[CC]: Reduce required precision for TransformNormal test.

This CL changes the precision requirements for
DrawPolygonTransformTest.TransformNormal.  This is required since it currently
fails on Arm64 due to gcc's use of a fused multiple instruction on mapMScalars.

Details of this issue are available on the associated bug.

BUG=401117

Review URL: https://codereview.chromium.org/443903004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287871 0039d316-1c4b-4281-b951-d872f2087c98
parent 1e08fa3d
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <limits>
#include <vector> #include <vector>
#include "cc/output/bsp_compare_result.h" #include "cc/output/bsp_compare_result.h"
...@@ -15,6 +16,9 @@ namespace { ...@@ -15,6 +16,9 @@ namespace {
#define CREATE_NEW_DRAW_POLYGON(name, points_vector, normal, polygon_id) \ #define CREATE_NEW_DRAW_POLYGON(name, points_vector, normal, polygon_id) \
DrawPolygon name(NULL, points_vector, normal, polygon_id) DrawPolygon name(NULL, points_vector, normal, polygon_id)
#define EXPECT_FLOAT_WITHIN_EPSILON_OF(a, b) \
EXPECT_TRUE(std::abs(a - b) < std::numeric_limits<float>::epsilon());
#define EXPECT_POINT_EQ(point_a, point_b) \ #define EXPECT_POINT_EQ(point_a, point_b) \
EXPECT_FLOAT_EQ(point_a.x(), point_b.x()); \ EXPECT_FLOAT_EQ(point_a.x(), point_b.x()); \
EXPECT_FLOAT_EQ(point_a.y(), point_b.y()); \ EXPECT_FLOAT_EQ(point_a.y(), point_b.y()); \
...@@ -173,9 +177,13 @@ TEST(DrawPolygonTransformTest, TransformNormal) { ...@@ -173,9 +177,13 @@ TEST(DrawPolygonTransformTest, TransformNormal) {
// using the inverse tranpose matrix gives us the right result. // using the inverse tranpose matrix gives us the right result.
polygon_a.TransformToScreenSpace(transform); polygon_a.TransformToScreenSpace(transform);
EXPECT_FLOAT_EQ(polygon_a.normal().x(), 0); // Note: We use EXPECT_FLOAT_WITHIN_EPSILON instead of EXPECT_FLOAT_EQUAL here
EXPECT_FLOAT_EQ(polygon_a.normal().y(), 0); // because some architectures (e.g., Arm64) employ a fused multiply-add
EXPECT_FLOAT_EQ(polygon_a.normal().z(), -1); // instruction which causes rounding asymmetry and reduces precision.
// http://crbug.com/401117.
EXPECT_FLOAT_WITHIN_EPSILON_OF(polygon_a.normal().x(), 0);
EXPECT_FLOAT_WITHIN_EPSILON_OF(polygon_a.normal().y(), 0);
EXPECT_FLOAT_WITHIN_EPSILON_OF(polygon_a.normal().z(), -1);
} }
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment