2021-11-18 08:04:04 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2021 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "src/gpu/tessellate/Tessellation.h"
|
|
|
|
#include "tests/Test.h"
|
|
|
|
|
2022-05-05 13:54:23 +00:00
|
|
|
namespace skgpu::tess {
|
|
|
|
|
2021-11-18 08:04:04 +00:00
|
|
|
DEF_TEST(PreChopPathCurves, reporter) {
|
|
|
|
// These particular test cases can get stuck in infinite recursion due to limited fp32
|
|
|
|
// precision. (Although they will not with the provided tessellationPrecision values; we had to
|
|
|
|
// lower precision in order to avoid the "viewport size" assert in PreChopPathCurves.) Bump the
|
|
|
|
// tessellationPreciion up to 4 and run these tests in order to verify our bail condition for
|
|
|
|
// infinite recursion caused by bad fp32 precision. If the test completes, it passed.
|
|
|
|
SkPath p = SkPath().moveTo(11.171727877046647f, -11.78621173228717f)
|
|
|
|
.quadTo(11.171727877046647f, -11.78621173228717f,
|
|
|
|
8.33583747124031f, 77.27177002747368f)
|
|
|
|
.cubicTo(8.33583747124031f, 77.27177002747368f,
|
|
|
|
8.33583747124031f, 77.27177002747368f,
|
|
|
|
11.171727877046647f, -11.78621173228717f)
|
|
|
|
.conicTo(11.171727877046647f, -11.78621173228717f,
|
|
|
|
8.33583747124031f, 77.27177002747368f,
|
|
|
|
1e-6f)
|
|
|
|
.conicTo(8.33583747124031f, 77.27177002747368f,
|
|
|
|
11.171727877046647f, -11.78621173228717f,
|
|
|
|
1e6f);
|
|
|
|
|
|
|
|
SkMatrix m = SkMatrix::Scale(138.68622826903837f, 74192976757580.44189f);
|
2022-05-05 13:54:23 +00:00
|
|
|
PreChopPathCurves(1/16.f, p, m, {1000, -74088852800000.f, 3000, -74088852700000.f});
|
2021-11-18 08:04:04 +00:00
|
|
|
|
|
|
|
m = SkMatrix::Scale(138.68622826903837f, 74192976757580.44189f*.3f);
|
2022-05-05 13:54:23 +00:00
|
|
|
PreChopPathCurves(.25f, p, m, {1000, -22226658140000.f, 3000, -22226658130000.f});
|
2021-11-18 08:04:04 +00:00
|
|
|
|
|
|
|
m = SkMatrix::Scale(138.68622826903837f, 74192976757580.44189f/4);
|
2022-05-05 13:54:23 +00:00
|
|
|
PreChopPathCurves(.25f, p, m, {1000, -18522213200000.f, 3000, -18522213100000.f});
|
2021-11-18 08:04:04 +00:00
|
|
|
}
|
2022-05-05 13:54:23 +00:00
|
|
|
|
|
|
|
} // namespace skgpu::tess
|