Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Issue 1114353004: Implement vertex buffer caching in the tessellated path renderer. (Closed)

Created:
5 years, 7 months ago by Stephen White
Modified:
5 years, 4 months ago
Reviewers:
bsalomon, reed1
CC:
reviews_skia.org, robertphillips, mtklein
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Implement caching of filled paths in the tessellated path renderer. Paths are cached as tessellated triangle meshes in vertex buffers on the GPU. Stroked paths are not (yet) cached. Paths containing no curved segments (linear paths) are reused at all scales. Paths containing curved segments are reused within a scale tolerance threshold. In order to invalidate the cache when an SkPath is changed or deleted, this required implementing genID change notification in SkPath. This is modelled almost exactly on SkPixelRef::GenIDChangeListener. However, It does not currently implement the check for unique genIDs, so notifiers will fire when the first instance of an SkPathRef using a given genID is destroyed. Another caveat is that you cannot successfully add a change notifier to an empty path, since it uses the "canonical" empty path which is never modified or destroyed. For this reason, we prevent adding listeners to it. BUG=skia:4121, skia:4122, 497403 DOCS_PREVIEW= https://skia.org/?cl=1114353004 Committed: https://skia.googlesource.com/skia/+/468dfa72eb6694145487be17876804dfca3b7adb Committed: https://skia.googlesource.com/skia/+/84cd621670a357484e1674e06d3d8d6f929a4ab2

Patch Set 1 #

Patch Set 2 : Update to to GrResourceProvider API #

Patch Set 3 : Update to ToT #

Patch Set 4 : Update to ToT #

Patch Set 5 : Rebase to ToT #

Patch Set 6 : Update to ToT #

Patch Set 7 : Update to ToT #

Patch Set 8 : Update to ToT; removed beziersfilled GM #

Patch Set 9 : Parental advisory: explicit constructor #

Patch Set 10 : Move tessellation (cache miss) into its own function #

Patch Set 11 : Remove useless code #

Patch Set 12 : Pass context in batch test #

Patch Set 13 : Integrated cache invalidation based on SkPath GenID change #

Total comments: 8

Patch Set 14 : Update to ToT #

Patch Set 15 : Make SkPath::pathRef() private; use friendship for access. #

Total comments: 1

Patch Set 16 : Win32 build fix; remove unused fn #

Total comments: 4

Patch Set 17 : Remove genID duplication in SkPathRef; free GrGpuResource custom data on makeBudgeted(). #

Patch Set 18 : Remove custom data and put bucketed tolerance in cache key, update to ToT #

Patch Set 19 : Revert GrGpuResource change (we don't use custom data anymore anyway) #

Patch Set 20 : Implement scale caching on the GrUniqueKey. #

Patch Set 21 : Include path fill type (winding) in resource cache key. #

Patch Set 22 : Reuse vertex buffer if it's large enough; use tolerance instead of size in cache info #

Patch Set 23 : Update to ToT; remove GrContext and use GrResourceProvider directly #

Total comments: 16

Patch Set 24 : Fixes per review comments #

Patch Set 25 : Update to ToT #

Total comments: 4

Patch Set 26 : Add another test for GrUniqueKey custom data. Fix style. #

Patch Set 27 : Merge resource cache fix, leak fix, inverse winding fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+276 lines, -62 lines) Patch
M include/core/SkPathRef.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +12 lines, -13 lines 0 comments Download
M include/gpu/GrResourceKey.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 4 chunks +13 lines, -0 lines 0 comments Download
M src/core/SkPathPriv.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +4 lines, -0 lines 0 comments Download
M src/core/SkPathRef.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 5 chunks +34 lines, -10 lines 0 comments Download
M src/gpu/GrTessellatingPathRenderer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 11 chunks +122 lines, -39 lines 0 comments Download
M tests/PathTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 3 chunks +60 lines, -0 lines 0 comments Download
M tests/ResourceCacheTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +31 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 49 (17 generated)
Stephen White
Brian: PTAL. Thanks!
5 years, 4 months ago (2015-07-27 21:25:28 UTC) #2
bsalomon
We sometimes copy the genID of SkPathRef... perhaps we should first eliminate those copies so ...
5 years, 4 months ago (2015-07-28 14:55:48 UTC) #4
Stephen White
Thanks for your review. https://codereview.chromium.org/1114353004/diff/240001/src/gpu/GrTessellatingPathRenderer.cpp File src/gpu/GrTessellatingPathRenderer.cpp (right): https://codereview.chromium.org/1114353004/diff/240001/src/gpu/GrTessellatingPathRenderer.cpp#newcode1346 src/gpu/GrTessellatingPathRenderer.cpp:1346: const SkSize* cachedScale = static_cast<const ...
5 years, 4 months ago (2015-07-28 15:10:28 UTC) #6
Stephen White
New patch: made pathRef() private, and used friendship for access.
5 years, 4 months ago (2015-07-28 20:51:40 UTC) #7
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1114353004/300001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1114353004/300001
5 years, 4 months ago (2015-07-28 20:54:22 UTC) #9
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Build-Win-MSVC-x86_64-Debug-Trybot on client.skia.compile (JOB_FAILED, http://build.chromium.org/p/client.skia.compile/builders/Build-Win-MSVC-x86_64-Debug-Trybot/builds/2331)
5 years, 4 months ago (2015-07-28 20:57:53 UTC) #11
reed1
https://codereview.chromium.org/1114353004/diff/300001/include/core/SkPathRef.h File include/core/SkPathRef.h (right): https://codereview.chromium.org/1114353004/diff/300001/include/core/SkPathRef.h#newcode248 include/core/SkPathRef.h:248: void removeGenIDChangeListener(GenIDChangeListener* listener); are there any callers for remove? ...
5 years, 4 months ago (2015-07-28 21:02:55 UTC) #12
Stephen White
On 2015/07/28 21:02:55, reed1 wrote: > https://codereview.chromium.org/1114353004/diff/300001/include/core/SkPathRef.h > File include/core/SkPathRef.h (right): > > https://codereview.chromium.org/1114353004/diff/300001/include/core/SkPathRef.h#newcode248 > ...
5 years, 4 months ago (2015-07-28 21:15:08 UTC) #13
Stephen White
New patch up; PTAL.
5 years, 4 months ago (2015-07-28 21:16:10 UTC) #14
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1114353004/320001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1114353004/320001
5 years, 4 months ago (2015-07-28 21:16:34 UTC) #16
bsalomon
https://codereview.chromium.org/1114353004/diff/240001/src/gpu/GrTessellatingPathRenderer.cpp File src/gpu/GrTessellatingPathRenderer.cpp (right): https://codereview.chromium.org/1114353004/diff/240001/src/gpu/GrTessellatingPathRenderer.cpp#newcode1346 src/gpu/GrTessellatingPathRenderer.cpp:1346: const SkSize* cachedScale = static_cast<const SkSize*>(data->data()); On 2015/07/28 15:10:28, ...
5 years, 4 months ago (2015-07-28 21:23:30 UTC) #17
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-07-28 21:24:55 UTC) #19
bsalomon
https://codereview.chromium.org/1114353004/diff/320001/src/core/SkPathRef.cpp File src/core/SkPathRef.cpp (right): https://codereview.chromium.org/1114353004/diff/320001/src/core/SkPathRef.cpp#newcode236 src/core/SkPathRef.cpp:236: if (0 == fGenerationID) { Let's kill this code. ...
5 years, 4 months ago (2015-07-28 21:27:40 UTC) #20
Stephen White
Thanks for your review. New patch up. https://codereview.chromium.org/1114353004/diff/240001/src/gpu/GrTessellatingPathRenderer.cpp File src/gpu/GrTessellatingPathRenderer.cpp (right): https://codereview.chromium.org/1114353004/diff/240001/src/gpu/GrTessellatingPathRenderer.cpp#newcode1346 src/gpu/GrTessellatingPathRenderer.cpp:1346: const SkSize* ...
5 years, 4 months ago (2015-07-28 22:11:23 UTC) #21
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1114353004/340001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1114353004/340001
5 years, 4 months ago (2015-07-28 22:11:52 UTC) #23
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-07-28 22:19:25 UTC) #25
Stephen White
New patch up: removed the "size" custom SkData on the VB; placed a bucketed tolerance ...
5 years, 4 months ago (2015-07-30 21:33:54 UTC) #26
Stephen White
PTAL: new patch up. Updated to ToT, removed persistent GrContext and switched to GrResourceProvider.
5 years, 4 months ago (2015-08-03 17:50:23 UTC) #28
bsalomon
overall looks good. https://codereview.chromium.org/1114353004/diff/480001/include/core/SkPath.h File include/core/SkPath.h (right): https://codereview.chromium.org/1114353004/diff/480001/include/core/SkPath.h#newcode1011 include/core/SkPath.h:1011: friend class TessellatingPathBatch; // for pathRef() ...
5 years, 4 months ago (2015-08-03 18:08:27 UTC) #29
Stephen White
https://codereview.chromium.org/1114353004/diff/480001/include/core/SkPath.h File include/core/SkPath.h (right): https://codereview.chromium.org/1114353004/diff/480001/include/core/SkPath.h#newcode1011 include/core/SkPath.h:1011: friend class TessellatingPathBatch; // for pathRef() On 2015/08/03 18:08:26, ...
5 years, 4 months ago (2015-08-03 18:54:41 UTC) #30
Stephen White
New patch up: PTAL. Thanks!
5 years, 4 months ago (2015-08-03 18:56:59 UTC) #31
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1114353004/500001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1114353004/500001
5 years, 4 months ago (2015-08-03 18:59:03 UTC) #33
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot on client.skia (JOB_FAILED, http://build.chromium.org/p/client.skia/builders/Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-Trybot/builds/2340) Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared-Trybot on ...
5 years, 4 months ago (2015-08-03 18:59:34 UTC) #35
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1114353004/520001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1114353004/520001
5 years, 4 months ago (2015-08-03 19:11:33 UTC) #37
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 4 months ago (2015-08-03 19:18:56 UTC) #39
bsalomon
https://codereview.chromium.org/1114353004/diff/520001/src/gpu/GrTessellatingPathRenderer.cpp File src/gpu/GrTessellatingPathRenderer.cpp (right): https://codereview.chromium.org/1114353004/diff/520001/src/gpu/GrTessellatingPathRenderer.cpp#newcode1343 src/gpu/GrTessellatingPathRenderer.cpp:1343: bool cacheMatch(GrVertexBuffer* vertexBuffer, SkScalar tol, int* actualCount) { cache_match? ...
5 years, 4 months ago (2015-08-03 19:34:54 UTC) #40
Stephen White
New patch up. PTAL. Thanks! https://codereview.chromium.org/1114353004/diff/520001/src/gpu/GrTessellatingPathRenderer.cpp File src/gpu/GrTessellatingPathRenderer.cpp (right): https://codereview.chromium.org/1114353004/diff/520001/src/gpu/GrTessellatingPathRenderer.cpp#newcode1343 src/gpu/GrTessellatingPathRenderer.cpp:1343: bool cacheMatch(GrVertexBuffer* vertexBuffer, SkScalar ...
5 years, 4 months ago (2015-08-03 19:52:24 UTC) #41
bsalomon
lgtm
5 years, 4 months ago (2015-08-03 19:54:48 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1114353004/540001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1114353004/540001
5 years, 4 months ago (2015-08-03 19:57:03 UTC) #44
commit-bot: I haz the power
Committed patchset #26 (id:540001) as https://skia.googlesource.com/skia/+/468dfa72eb6694145487be17876804dfca3b7adb
5 years, 4 months ago (2015-08-03 20:04:06 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1114353004/560001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1114353004/560001
5 years, 4 months ago (2015-08-04 16:54:46 UTC) #48
commit-bot: I haz the power
5 years, 4 months ago (2015-08-04 17:02:01 UTC) #49
Message was sent while issue was closed.
Committed patchset #27 (id:560001) as
https://skia.googlesource.com/skia/+/84cd621670a357484e1674e06d3d8d6f929a4ab2

Powered by Google App Engine
This is Rietveld 408576698