Revert of Don't allow uncacheable paths in tessellated path renderer (patchset #2...
authorbsalomon <bsalomon@google.com>
Wed, 18 May 2016 20:52:05 +0000 (13:52 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 18 May 2016 20:52:05 +0000 (13:52 -0700)
Reason for revert:
Caused innershapes test to be rendered incorrectly on the N10. This might be a driver bug.

Original issue's description:
> Don't allow uncacheable paths in tessellated path renderer
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1990793003
>
> Committed: https://skia.googlesource.com/skia/+/aebd0fd32f8fde610de03b4f1e6d11ce24bfb73d

TBR=senorblanco@google.com,senorblanco@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/1993923002

src/gpu/batches/GrTessellatingPathRenderer.cpp

index f8f5db3af0da4908d3794220ee79157892977098..e697f78d7218e2a6d36f8c06f3b0fce3ce1c69be 100644 (file)
@@ -105,14 +105,11 @@ GrTessellatingPathRenderer::GrTessellatingPathRenderer() {
 bool GrTessellatingPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
     // This path renderer can draw all fill styles, all stroke styles except hairlines, but does
     // not do antialiasing. It can do convex and concave paths, but we'll leave the convex ones to
-    // simpler algorithms. Similarly, we skip the non-hairlines that can be treated as hairline.
-    // An arbitrary path effect could produce a hairline result so we pass on those. We also skip
-    // volatile paths since they are not cacheable.
-    return !args.fAntiAlias && !args.fPath->isVolatile() &&
+    // simpler algorithms. Similary, we skip the non-hairlines that can be treated as hairline.
+    // An arbitrary path effect could produce a hairline result so we pass on those.
+    return !IsStrokeHairlineOrEquivalent(*args.fStyle, *args.fViewMatrix, nullptr) &&
            !args.fStyle->strokeRec().isHairlineStyle() &&
-           !args.fStyle->hasNonDashPathEffect() &&
-           !IsStrokeHairlineOrEquivalent(*args.fStyle, *args.fViewMatrix, nullptr) &&
-           !args.fPath->isConvex();
+           !args.fStyle->hasNonDashPathEffect() && !args.fAntiAlias && !args.fPath->isConvex();
 }
 
 class TessellatingPathBatch : public GrVertexBatch {
@@ -163,25 +160,25 @@ private:
         int clipBoundsCnt =
             fPath.isInverseFillType() ? sizeof(fClipBounds) / sizeof(uint32_t) : 0;
         int styleDataCnt = GrStyle::KeySize(fStyle, GrStyle::Apply::kPathEffectAndStrokeRec);
-        // We should have excluded anything we wouldn't know how to cache.
-        SkASSERT(styleDataCnt >= 0);
-        GrUniqueKey::Builder builder(&key, kDomain, 2 + clipBoundsCnt + styleDataCnt);
-        builder[0] = fPath.getGenerationID();
-        builder[1] = fPath.getFillType();
-        // For inverse fills, the tessellation is dependent on clip bounds.
-        if (fPath.isInverseFillType()) {
-            memcpy(&builder[2], &fClipBounds, sizeof(fClipBounds));
-        }
-        if (styleDataCnt) {
-            GrStyle::WriteKey(&builder[2 + clipBoundsCnt], fStyle,
-                              GrStyle::Apply::kPathEffectAndStrokeRec, styleScale);
-        }
-        builder.finish();
-        SkAutoTUnref<GrBuffer> cachedVertexBuffer(rp->findAndRefTByUniqueKey<GrBuffer>(key));
-        int actualCount;
-        if (cache_match(cachedVertexBuffer.get(), tol, &actualCount)) {
-            this->drawVertices(target, gp, cachedVertexBuffer.get(), 0, actualCount);
-            return;
+        if (styleDataCnt >= 0) {
+            GrUniqueKey::Builder builder(&key, kDomain, 2 + clipBoundsCnt + styleDataCnt);
+            builder[0] = fPath.getGenerationID();
+            builder[1] = fPath.getFillType();
+            // For inverse fills, the tessellation is dependent on clip bounds.
+            if (fPath.isInverseFillType()) {
+                memcpy(&builder[2], &fClipBounds, sizeof(fClipBounds));
+            }
+            if (styleDataCnt) {
+                GrStyle::WriteKey(&builder[2 + clipBoundsCnt], fStyle,
+                                  GrStyle::Apply::kPathEffectAndStrokeRec, styleScale);
+            }
+            builder.finish();
+            SkAutoTUnref<GrBuffer> cachedVertexBuffer(rp->findAndRefTByUniqueKey<GrBuffer>(key));
+            int actualCount;
+            if (cache_match(cachedVertexBuffer.get(), tol, &actualCount)) {
+                this->drawVertices(target, gp, cachedVertexBuffer.get(), 0, actualCount);
+                return;
+            }
         }
 
         SkPath path;