ccpr: Enable ccpr by default
Now that the path cache is implemented, we can use ccpr everywhere.
Modifies ccpr to not cache unless the "fAllowPathMaskCaching" context
option is enabled.
Adds a small condition to skip complicated paths with more vertices
than pixels, simply so we don't regress a couple testcases.
Updates skpbench to do three draws before starting the timer, in order
to prime the cache.
Bug: skia:
Change-Id: Ic3a0a2bdad8a22ff6431e77fa4da2b54d6bb9aba
Reviewed-on: https://skia-review.googlesource.com/137207
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index 612cc15..db5ea35 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -9,6 +9,7 @@
#include "GrMemoryPool.h"
#include "GrOpFlushState.h"
+#include "ccpr/GrCCPathCache.h"
#include "ccpr/GrCCPerFlushResources.h"
#include "ccpr/GrCoverageCountingPathRenderer.h"
@@ -152,14 +153,16 @@
using MaskTransform = GrCCPathCache::MaskTransform;
for (SingleDraw& draw : fDraws) {
- SkASSERT(!draw.fCacheEntry);
-
SkPath path;
draw.fShape.asPath(&path);
- MaskTransform m(draw.fMatrix, &draw.fCachedMaskShift);
- bool canStashPathMask = draw.fMaskVisibility >= Visibility::kMostlyComplete;
- draw.fCacheEntry = pathCache->find(draw.fShape, m, CreateIfAbsent(canStashPathMask));
+ SkASSERT(!draw.fCacheEntry);
+
+ if (pathCache) {
+ MaskTransform m(draw.fMatrix, &draw.fCachedMaskShift);
+ bool canStashPathMask = draw.fMaskVisibility >= Visibility::kMostlyComplete;
+ draw.fCacheEntry = pathCache->find(draw.fShape, m, CreateIfAbsent(canStashPathMask));
+ }
if (auto cacheEntry = draw.fCacheEntry.get()) {
SkASSERT(!cacheEntry->currFlushAtlas()); // Shouldn't be set until setupResources().