Skip to content

Commit

Permalink
Revert "Limit stack calling depth from GrTriangulator::mergeCollinear…
Browse files Browse the repository at this point in the history
…Edges()."

This reverts commit a38c4ae.

Reason for revert: 

	start glesmsaa4 gm  labyrinth_round
../../../../../../skia/src/gpu/ganesh/geometry/GrTriangulator.cpp:1419: fatal error: "check(left->isLeftOf(*right->fBottom))"

Caught signal 4 [Illegal instruction] (297MB RAM, peak 495MB), was running:

Caught signal 4 [Illegal instruction] (297MB RAM, peak 495MB), was running:
	glesmsaa4 gm  labyrinth_round

Original change's description:
> Limit stack calling depth from GrTriangulator::mergeCollinearEdges().
>
> MergeCollinearEdges can get into a state where it can infinitely
> recurse. This will avoid this until we can figure out what exactly
> is going on there.
>
> Bug: b/385180591
> Bug: b/382953492
> Change-Id: I861013788b1ecd9fe7eeccdd374dbe7424cced9d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/931947
> Commit-Queue: Jim Van Verth <[email protected]>
> Reviewed-by: Robert Phillips <[email protected]>

Bug: b/385180591
Bug: b/382953492
Change-Id: If5cfbbd4af866847e9a1a28fae33f78b57d3039d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/931832
Auto-Submit: Robert Phillips <[email protected]>
Commit-Queue: Rubber Stamper <[email protected]>
Bot-Commit: Rubber Stamper <[email protected]>
  • Loading branch information
rphilli authored and SkCQ committed Dec 21, 2024
1 parent eb33dd4 commit 47957be
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
9 changes: 0 additions & 9 deletions src/gpu/ganesh/geometry/GrTriangulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,15 +957,8 @@ static bool bottom_collinear(Edge* left, Edge* right) {
!left->isLeftOf(*right->fBottom) || !right->isRightOf(*left->fBottom);
}

// How deep of a stack of mergeCollinearEdges() we'll accept
static constexpr int kMaxMergeCollinearCalls = 56;

bool GrTriangulator::mergeCollinearEdges(Edge* edge, EdgeList* activeEdges, Vertex** current,
const Comparator& c) const {
// Stack is unreasonably deep
if (++fMergeCollinearStackCount > kMaxMergeCollinearCalls) {
return false;
}
for (;;) {
if (top_collinear(edge->fPrevEdgeAbove, edge)) {
if (!this->mergeEdgesAbove(edge->fPrevEdgeAbove, edge, activeEdges, current, c)) {
Expand Down Expand Up @@ -1037,7 +1030,6 @@ GrTriangulator::BoolFail GrTriangulator::splitEdge(
Edge* newEdge = this->allocateEdge(top, bottom, winding, edge->fType);
newEdge->insertBelow(top, c);
newEdge->insertAbove(bottom, c);
fMergeCollinearStackCount = 0;
if (!this->mergeCollinearEdges(newEdge, activeEdges, current, c)) {
return BoolFail::kFail;
}
Expand Down Expand Up @@ -1103,7 +1095,6 @@ Edge* GrTriangulator::makeConnectingEdge(Vertex* prev, Vertex* next, EdgeType ty
edge->insertBelow(edge->fTop, c);
edge->insertAbove(edge->fBottom, c);
edge->fWinding *= windingScale;
fMergeCollinearStackCount = 0;
this->mergeCollinearEdges(edge, nullptr, nullptr, c);
return edge;
}
Expand Down
2 changes: 0 additions & 2 deletions src/gpu/ganesh/geometry/GrTriangulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ class GrTriangulator {
SkArenaAlloc* const fAlloc;
int fNumMonotonePolys = 0;
int fNumEdges = 0;
// Track how deep of a stack we get from mergeCollinearEdges()
mutable int fMergeCollinearStackCount = 0;

// Internal control knobs.
bool fRoundVerticesToQuarterPixel = false;
Expand Down

0 comments on commit 47957be

Please sign in to comment.