|
|
Created:
4 years, 6 months ago by Stephen White Modified:
4 years, 6 months ago Reviewers:
robertphillips CC:
reviews_skia.org Base URL:
https://skia.googlesource.com/skia.git@master Target Ref:
refs/heads/master Project:
skia Visibility:
Public. |
DescriptionTessellator: stop copying vertices into Polys and Monotones.
The vertices which are produced by stage 5 of the
tesselator are copied into the Polys and MonotonePolys it
produces. This is necessary because each vertex may have an
arbitrary valence, since it may participate in an arbitrary
number of Polys, so we can't use the vertex's prev/next
pointers to represent all the Monotones of which this
vertex may be a member.
However, each Edge can only be a member of two Polys (one
on each side of the edge). So by adding two prev/next
pointer pairs to each Edge, we can represent each Monotone
as a list of edges instead. Then we no longer need to copy
the vertices.
One wrinkle is that the ear-clipping stage (6) of the
tessellator does require prev/next pointers, in order to
remove vertices as their ears are clipped. So we convert
the edge list into a vertex list during Monotone::emit(),
using the prev/next pointers temporarily for that monotone.
This change improves performance by 7-20% on a non-caching
version of the tessellator, and reduces memory use.
Other notes:
1) Polys are initially constructed empty (no edges), but
with the top vertex, which is needed for splitting
Polys. Edges are added to Polys only after their bottom
vertex is seen.
2) MonotonePolys are always constructed with one edge, so
we always know their handedness (left/right).
MonotonePoly::addEdge() no longer detects when a monotone
is "done" (edge of opposite handedness); this is handled
by Poly::addEdge(), so MonotonePoly::addEdge() has no
return value.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002
Committed: https://skia.googlesource.com/skia/+/531237ef3aaf0d3c86e0853fde3b4c8f517bc662
Patch Set 1 #
Total comments: 3
Patch Set 2 : Simpler change, with GM #Patch Set 3 : Fix logging msg #Patch Set 4 : Fix 100-col issues #
Total comments: 2
Patch Set 5 : Fix style per review #Messages
Total messages: 28 (14 generated)
Description was changed from ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% a non-caching version of the tessellator, and reduces memory use. ========== to ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% a non-caching version of the tessellator, and reduces memory use. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ==========
The CQ bit was checked by senorblanco@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2029243002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2029243002/1
Description was changed from ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% a non-caching version of the tessellator, and reduces memory use. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ========== to ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% on a non-caching version of the tessellator, and reduces memory use. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ==========
senorblanco@chromium.org changed reviewers: + robertphillips@google.com
Description was changed from ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% on a non-caching version of the tessellator, and reduces memory use. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ========== to ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% on a non-caching version of the tessellator, and reduces memory use. Other notes: 1) VertexList was refactored into List<T>, and reused for the MonotonePoly list. 2) Polys are initially constructed empty (no edges), but with the top vertex, which is needed for splitting Polys. Edges are added to Polys only after their bottom vertex is seen. 3) MonotonePolys are always constructed with one edge, so we always know their handedness (left/right). MonotonePoly::addEdge() no longer detects when a monotone is "done" (edge of opposite handedness); this is handled by Poly::addEdge(), so MonotonePoly::addEdge() has no return value. 4) Partnering is handled a bit differently: Poly::addEdge() (formerly addVertex()) now transfers the partner's Monotone into this Poly, so it doesn't need a return value. This means we don't need to reassign leftPoly/rightPoly in the tessellate() loops, simplifying the code. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ==========
Rob: PTAL. Thanks!
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm (as far as I understand it all) https://codereview.chromium.org/2029243002/diff/1/src/gpu/GrTessellator.cpp File src/gpu/GrTessellator.cpp (right): https://codereview.chromium.org/2029243002/diff/1/src/gpu/GrTessellator.cpp#n... src/gpu/GrTessellator.cpp:415: e->fBottom->fPoint.fX, e->fBottom->fPoint.fY, Does the "neither" case still make sense ? https://codereview.chromium.org/2029243002/diff/1/src/gpu/GrTessellator.cpp#n... src/gpu/GrTessellator.cpp:1216: if (v->fFirstEdgeAbove) { Either "nullptr != e" or "e" ?
https://codereview.chromium.org/2029243002/diff/1/src/gpu/GrTessellator.cpp File src/gpu/GrTessellator.cpp (right): https://codereview.chromium.org/2029243002/diff/1/src/gpu/GrTessellator.cpp#n... src/gpu/GrTessellator.cpp:415: e->fBottom->fPoint.fX, e->fBottom->fPoint.fY, On 2016/06/02 12:19:48, robertphillips wrote: > Does the "neither" case still make sense ? Good point. Removed.
It turns out this CL had a bug which was not caught by existing GMs. I've added a test case to make sure I don't break it in future, and reverted the refactoring/simplification part of the change for now. PTAL. It's now closer to the existing code, so diffing against the original might be easiest.
The CQ bit was checked by senorblanco@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2029243002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2029243002/40001
Description was changed from ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% on a non-caching version of the tessellator, and reduces memory use. Other notes: 1) VertexList was refactored into List<T>, and reused for the MonotonePoly list. 2) Polys are initially constructed empty (no edges), but with the top vertex, which is needed for splitting Polys. Edges are added to Polys only after their bottom vertex is seen. 3) MonotonePolys are always constructed with one edge, so we always know their handedness (left/right). MonotonePoly::addEdge() no longer detects when a monotone is "done" (edge of opposite handedness); this is handled by Poly::addEdge(), so MonotonePoly::addEdge() has no return value. 4) Partnering is handled a bit differently: Poly::addEdge() (formerly addVertex()) now transfers the partner's Monotone into this Poly, so it doesn't need a return value. This means we don't need to reassign leftPoly/rightPoly in the tessellate() loops, simplifying the code. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ========== to ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% on a non-caching version of the tessellator, and reduces memory use. Other notes: 1) Polys are initially constructed empty (no edges), but with the top vertex, which is needed for splitting Polys. Edges are added to Polys only after their bottom vertex is seen. 2) MonotonePolys are always constructed with one edge, so we always know their handedness (left/right). MonotonePoly::addEdge() no longer detects when a monotone is "done" (edge of opposite handedness); this is handled by Poly::addEdge(), so MonotonePoly::addEdge() has no return value. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ==========
The CQ bit was checked by senorblanco@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2029243002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2029243002/60001
lgtm https://codereview.chromium.org/2029243002/diff/60001/src/gpu/GrTessellator.cpp File src/gpu/GrTessellator.cpp (right): https://codereview.chromium.org/2029243002/diff/60001/src/gpu/GrTessellator.c... src/gpu/GrTessellator.cpp:349: , fNext(nullptr) { this-> ?
https://codereview.chromium.org/2029243002/diff/60001/src/gpu/GrTessellator.cpp File src/gpu/GrTessellator.cpp (right): https://codereview.chromium.org/2029243002/diff/60001/src/gpu/GrTessellator.c... src/gpu/GrTessellator.cpp:349: , fNext(nullptr) { On 2016/06/02 18:12:02, robertphillips wrote: > this-> ? Done.
The CQ bit was checked by senorblanco@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2029243002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2029243002/80001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by senorblanco@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from robertphillips@google.com Link to the patchset: https://codereview.chromium.org/2029243002/#ps80001 (title: "Fix style per review")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2029243002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2029243002/80001
Message was sent while issue was closed.
Description was changed from ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% on a non-caching version of the tessellator, and reduces memory use. Other notes: 1) Polys are initially constructed empty (no edges), but with the top vertex, which is needed for splitting Polys. Edges are added to Polys only after their bottom vertex is seen. 2) MonotonePolys are always constructed with one edge, so we always know their handedness (left/right). MonotonePoly::addEdge() no longer detects when a monotone is "done" (edge of opposite handedness); this is handled by Poly::addEdge(), so MonotonePoly::addEdge() has no return value. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 ========== to ========== Tessellator: stop copying vertices into Polys and Monotones. The vertices which are produced by stage 5 of the tesselator are copied into the Polys and MonotonePolys it produces. This is necessary because each vertex may have an arbitrary valence, since it may participate in an arbitrary number of Polys, so we can't use the vertex's prev/next pointers to represent all the Monotones of which this vertex may be a member. However, each Edge can only be a member of two Polys (one on each side of the edge). So by adding two prev/next pointer pairs to each Edge, we can represent each Monotone as a list of edges instead. Then we no longer need to copy the vertices. One wrinkle is that the ear-clipping stage (6) of the tessellator does require prev/next pointers, in order to remove vertices as their ears are clipped. So we convert the edge list into a vertex list during Monotone::emit(), using the prev/next pointers temporarily for that monotone. This change improves performance by 7-20% on a non-caching version of the tessellator, and reduces memory use. Other notes: 1) Polys are initially constructed empty (no edges), but with the top vertex, which is needed for splitting Polys. Edges are added to Polys only after their bottom vertex is seen. 2) MonotonePolys are always constructed with one edge, so we always know their handedness (left/right). MonotonePoly::addEdge() no longer detects when a monotone is "done" (edge of opposite handedness); this is handled by Poly::addEdge(), so MonotonePoly::addEdge() has no return value. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029243002 Committed: https://skia.googlesource.com/skia/+/531237ef3aaf0d3c86e0853fde3b4c8f517bc662 ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001) as https://skia.googlesource.com/skia/+/531237ef3aaf0d3c86e0853fde3b4c8f517bc662 |