Increase the amount of debug information printed out by batches

Untangling MDB bugs requires more information. In particular the render targets.

BUG=skia:4094
TBR=bsalomon@google.com

Review URL: https://codereview.chromium.org/1443763002
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h
index 2b6e0d5..999596e 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.h
+++ b/src/effects/GrCircleBlurFragmentProcessor.h
@@ -8,6 +8,7 @@
 #ifndef GrCircleBlurFragmentProcessor_DEFINED
 #define GrCircleBlurFragmentProcessor_DEFINED
 
+#include "SkString.h"
 #include "SkTypes.h"
 
 #if SK_SUPPORT_GPU
@@ -25,6 +26,14 @@
 
     const char* name() const override { return "CircleBlur"; }
 
+    SkString dumpInfo() const override {
+        SkString str;
+        str.appendf("Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], Sigma %.2f, Offset: %.2f",
+                    fCircle.fLeft, fCircle.fTop, fCircle.fRight, fCircle.fBottom,
+                    fSigma, fOffset);
+        return str;
+    }
+
     static const GrFragmentProcessor* Create(GrTextureProvider*textureProvider,
                                              const SkRect& circle, float sigma) {
         float offset;
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h
index 37ad49e..ee3e73a 100644
--- a/src/effects/SkArithmeticMode_gpu.h
+++ b/src/effects/SkArithmeticMode_gpu.h
@@ -40,6 +40,12 @@
 
     const char* name() const override { return "Arithmetic"; }
 
+    SkString dumpInfo() const override {
+        SkString str;
+        str.appendf("K1: %.2f K2: %.2f K3: %.2f K4: %.2f", fK1, fK2, fK3, fK4);
+        return str;
+    }
+
     float k1() const { return fK1; }
     float k2() const { return fK2; }
     float k3() const { return fK3; }
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 411d73b..9fda787 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -491,7 +491,7 @@
 public:
     GrLightingEffect(GrTexture* texture, const SkImageFilterLight* light, SkScalar surfaceScale,
                      const SkMatrix& matrix, BoundaryMode boundaryMode);
-    virtual ~GrLightingEffect();
+    ~GrLightingEffect() override;
 
     const SkImageFilterLight* light() const { return fLight; }
     SkScalar surfaceScale() const { return fSurfaceScale; }
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index a7f4d92..f2ed17c 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -92,7 +92,7 @@
 #ifdef SK_DEBUG
 void GrDrawTarget::dump() const {
     SkDebugf("--------------------------------------------------------------\n");
-    SkDebugf("node: %d\n");
+    SkDebugf("node: %d -> RT: %d\n", fDebugID, fRenderTarget ? fRenderTarget->getUniqueID() : -1);
     SkDebugf("relies On (%d): ", fDependencies.count());
     for (int i = 0; i < fDependencies.count(); ++i) {
         SkDebugf("%d, ", fDependencies[i]->fDebugID);
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index fde9ba7..7dd5c8a 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -626,6 +626,21 @@
 
     const char* name() const override { return "CircleBatch"; }
 
+    SkString dumpInfo() const override {
+        SkString string;
+        for (int i = 0; i < fGeoData.count(); ++i) {
+            string.appendf("Color: 0x%08x Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f],"
+                           "InnerRad: %.2f, OuterRad: %.2f\n",
+                           fGeoData[i].fColor,
+                           fGeoData[i].fDevBounds.fLeft, fGeoData[i].fDevBounds.fTop,
+                           fGeoData[i].fDevBounds.fRight, fGeoData[i].fDevBounds.fBottom,
+                           fGeoData[i].fInnerRadius,
+                           fGeoData[i].fOuterRadius);
+        }
+        string.append(INHERITED::dumpInfo());
+        return string;
+    }
+
     void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
         // When this is called on a batch, there is only one geometry bundle
         out->setKnownFourComponents(fGeoData[0].fColor);
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index 9646107..1b3f139 100644
--- a/src/gpu/batches/GrAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp
@@ -217,6 +217,14 @@
 
     static const char* Name() { return "AAFillRectBatchNoLocalMatrix"; }
 
+    static SkString DumpInfo(const Geometry& geo) {
+        SkString str;
+        str.appendf("Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
+                    geo.fColor,
+                    geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect.fBottom);
+        return str;
+    }
+
     static bool CanCombine(const Geometry& mine, const Geometry& theirs,
                            const GrPipelineOptimizations& opts) {
         // We apply the viewmatrix to the rect points on the cpu.  However, if the pipeline uses
@@ -258,6 +266,14 @@
 
     static const char* Name() { return "AAFillRectBatchLocalMatrix"; }
 
+    static SkString DumpInfo(const Geometry& geo) {
+        SkString str;
+        str.appendf("Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
+                    geo.fColor,
+                    geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect.fBottom);
+        return str;
+    }
+
     static bool CanCombine(const Geometry& mine, const Geometry& theirs,
                            const GrPipelineOptimizations&) {
         return true;
diff --git a/src/gpu/batches/GrClearBatch.h b/src/gpu/batches/GrClearBatch.h
index b973dab..944485c 100644
--- a/src/gpu/batches/GrClearBatch.h
+++ b/src/gpu/batches/GrClearBatch.h
@@ -31,9 +31,9 @@
 
     SkString dumpInfo() const override {
         SkString string;
-        string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: 0x%p",
+        string.printf("Color: 0x%08x, Rect [L: %d, T: %d, R: %d, B: %d], RT: %d",
                       fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom,
-                      fRenderTarget.get());
+                      fRenderTarget.get()->getUniqueID());
         return string;
     }
 
diff --git a/src/gpu/batches/GrDiscardBatch.h b/src/gpu/batches/GrDiscardBatch.h
index c13e732..aa443cf 100644
--- a/src/gpu/batches/GrDiscardBatch.h
+++ b/src/gpu/batches/GrDiscardBatch.h
@@ -29,7 +29,7 @@
 
     SkString dumpInfo() const override {
         SkString string;
-        string.printf("RT: 0x%p", fRenderTarget.get());
+        string.printf("RT: %d", fRenderTarget.get()->getUniqueID());
         return string;
     }
 
diff --git a/src/gpu/batches/GrDrawBatch.h b/src/gpu/batches/GrDrawBatch.h
index 93326ef..b5def69 100644
--- a/src/gpu/batches/GrDrawBatch.h
+++ b/src/gpu/batches/GrDrawBatch.h
@@ -63,13 +63,18 @@
 
     SkString dumpInfo() const override {
         SkString string;
+        string.appendf("RT: %d\n", this->renderTargetUniqueID());
         string.append("ColorStages:\n");
         for (int i = 0; i < this->pipeline()->numColorFragmentProcessors(); i++) {
-            string.appendf("\t\t%s\n", this->pipeline()->getColorFragmentProcessor(i).name());
+            string.appendf("\t\t%s\n\t\t%s\n",
+                           this->pipeline()->getColorFragmentProcessor(i).name(),
+                           this->pipeline()->getColorFragmentProcessor(i).dumpInfo().c_str());
         }
         string.append("CoverageStages:\n");
         for (int i = 0; i < this->pipeline()->numCoverageFragmentProcessors(); i++) {
-            string.appendf("\t%s\n", this->pipeline()->getCoverageFragmentProcessor(i).name());
+            string.appendf("\t\t%s\n\t\t%s\n",
+                           this->pipeline()->getCoverageFragmentProcessor(i).name(),
+                           this->pipeline()->getCoverageFragmentProcessor(i).dumpInfo().c_str());
         }
         string.appendf("XP: %s\n", this->pipeline()->getXferProcessor()->name());
         return string;
diff --git a/src/gpu/batches/GrNonAAFillRectBatch.cpp b/src/gpu/batches/GrNonAAFillRectBatch.cpp
index 545bfdc..3ad869b 100644
--- a/src/gpu/batches/GrNonAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrNonAAFillRectBatch.cpp
@@ -124,6 +124,14 @@
 
     static const char* Name() { return "NonAAFillRectBatch"; }
 
+    static SkString DumpInfo(const Geometry& geo) {
+        SkString str;
+        str.appendf("Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
+                    geo.fColor,
+                    geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect.fBottom);
+        return str;
+    }
+
     static bool CanCombine(const Geometry& mine, const Geometry& theirs,
                            const GrPipelineOptimizations& opts) {
         return true;
@@ -160,6 +168,14 @@
 
     static const char* Name() { return "NonAAFillRectBatchPerspective"; }
 
+    static SkString DumpInfo(const Geometry& geo) {
+        SkString str;
+        str.appendf("Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f]\n",
+                    geo.fColor,
+                    geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight, geo.fRect.fBottom);
+        return str;
+    }
+
     static bool CanCombine(const Geometry& mine, const Geometry& theirs,
                            const GrPipelineOptimizations& opts) {
         // We could batch across perspective vm changes if we really wanted to
diff --git a/src/gpu/batches/GrTInstanceBatch.h b/src/gpu/batches/GrTInstanceBatch.h
index b4bc0c0..86d85b6 100644
--- a/src/gpu/batches/GrTInstanceBatch.h
+++ b/src/gpu/batches/GrTInstanceBatch.h
@@ -50,6 +50,15 @@
 
     const char* name() const override { return Impl::Name(); }
 
+    SkString dumpInfo() const override {
+        SkString str;
+        for (int i = 0; i < fGeoData.count(); ++i) {
+            str.append(Impl::DumpInfo(fGeoData[i]));
+        }
+        str.append(INHERITED::dumpInfo());
+        return str;
+    }
+
     void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
         // When this is called on a batch, there is only one geometry bundle
         out->setKnownFourComponents(fGeoData[0].fColor);
diff --git a/src/gpu/effects/Gr1DKernelEffect.h b/src/gpu/effects/Gr1DKernelEffect.h
index 3ceb75d..519d6db 100644
--- a/src/gpu/effects/Gr1DKernelEffect.h
+++ b/src/gpu/effects/Gr1DKernelEffect.h
@@ -43,6 +43,13 @@
     int width() const { return WidthFromRadius(fRadius); }
     Direction direction() const { return fDirection; }
 
+    SkString dumpInfo() const override {
+        SkString str;
+        str.appendf("Direction: %s, Radius: %d ", kX_Direction == fDirection ? "X" : "Y", fRadius);
+        str.append(INHERITED::dumpInfo());
+        return str;
+    }
+
 private:
 
     Direction       fDirection;
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index 9df0cff..4169e40 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -21,7 +21,13 @@
  */
 class GrSingleTextureEffect : public GrFragmentProcessor {
 public:
-    virtual ~GrSingleTextureEffect();
+    ~GrSingleTextureEffect() override;
+
+    SkString dumpInfo() const override {
+        SkString str;
+        str.appendf("Texture: %d", fTextureAccess.getTexture()->getUniqueID());
+        return str;
+    }
 
 protected:
     /** unfiltered, clamp mode */
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index aa1db00..cd06304 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -174,6 +174,15 @@
 
     const char* name() const override { return "TextureDomain"; }
 
+    SkString dumpInfo() const override {
+        SkString str;
+        str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f] ", 
+                    fTextureDomain.domain().fLeft, fTextureDomain.domain().fTop,
+                    fTextureDomain.domain().fRight, fTextureDomain.domain().fBottom);
+        str.append(INHERITED::dumpInfo());
+        return str;
+    }
+
     const GrTextureDomain& textureDomain() const { return fTextureDomain; }
 
 protected: