diff options
author | 2015-11-16 09:06:59 -0800 | |
---|---|---|
committer | 2015-11-16 09:06:59 -0800 | |
commit | e004bfc0a5e28cc083158f1a75e981ffd58a8134 (patch) | |
tree | 77ac623a0e5b6264d4933ae53da831e7220bfbf7 | |
parent | a7a21cffe1d56d52bac9accd05001e9c970e76f3 (diff) |
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
-rw-r--r-- | include/gpu/GrProcessor.h | 8 | ||||
-rw-r--r-- | include/gpu/effects/GrConstColorProcessor.h | 6 | ||||
-rw-r--r-- | src/effects/GrCircleBlurFragmentProcessor.h | 9 | ||||
-rw-r--r-- | src/effects/SkArithmeticMode_gpu.h | 6 | ||||
-rw-r--r-- | src/effects/SkLightingImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrOvalRenderer.cpp | 15 | ||||
-rw-r--r-- | src/gpu/batches/GrAAFillRectBatch.cpp | 16 | ||||
-rw-r--r-- | src/gpu/batches/GrClearBatch.h | 4 | ||||
-rw-r--r-- | src/gpu/batches/GrDiscardBatch.h | 2 | ||||
-rw-r--r-- | src/gpu/batches/GrDrawBatch.h | 9 | ||||
-rw-r--r-- | src/gpu/batches/GrNonAAFillRectBatch.cpp | 16 | ||||
-rw-r--r-- | src/gpu/batches/GrTInstanceBatch.h | 9 | ||||
-rw-r--r-- | src/gpu/effects/Gr1DKernelEffect.h | 7 | ||||
-rw-r--r-- | src/gpu/effects/GrSingleTextureEffect.h | 8 | ||||
-rw-r--r-- | src/gpu/effects/GrTextureDomain.h | 9 |
16 files changed, 120 insertions, 8 deletions
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h index 7c24f549f0..9b5db5e033 100644 --- a/include/gpu/GrProcessor.h +++ b/include/gpu/GrProcessor.h @@ -13,6 +13,7 @@ #include "GrProgramElement.h" #include "GrTextureAccess.h" #include "SkMath.h" +#include "SkString.h" class GrContext; class GrCoordTransform; @@ -62,6 +63,13 @@ public: in generated shader code. */ virtual const char* name() const = 0; + // Human-readable dump of all information + virtual SkString dumpInfo() const { + SkString str; + str.appendf("Missing data"); + return str; + } + int numTextures() const { return fTextureAccesses.count(); } /** Returns the access pattern for the texture at index. index must be valid according to diff --git a/include/gpu/effects/GrConstColorProcessor.h b/include/gpu/effects/GrConstColorProcessor.h index c9686b6499..679533eac5 100644 --- a/include/gpu/effects/GrConstColorProcessor.h +++ b/include/gpu/effects/GrConstColorProcessor.h @@ -32,6 +32,12 @@ public: const char* name() const override { return "Color"; } + SkString dumpInfo() const override { + SkString str; + str.appendf("Color: 0x%08x", fColor); + return str; + } + GrColor color() const { return fColor; } InputMode inputMode() const { return fMode; } diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h index 2b6e0d5f17..999596eb2c 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 @@ public: 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 37ad49e155..ee3e73abb0 100644 --- a/src/effects/SkArithmeticMode_gpu.h +++ b/src/effects/SkArithmeticMode_gpu.h @@ -40,6 +40,12 @@ public: 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 411d73b884..9fda787d2c 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -491,7 +491,7 @@ class GrLightingEffect : public GrSingleTextureEffect { 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 a7f4d92854..f2ed17c135 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -92,7 +92,7 @@ void GrDrawTarget::addDependency(GrSurface* dependedOn) { #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 fde9ba712e..7dd5c8a555 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -626,6 +626,21 @@ public: 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 964610788d..1b3f139a02 100644 --- a/src/gpu/batches/GrAAFillRectBatch.cpp +++ b/src/gpu/batches/GrAAFillRectBatch.cpp @@ -217,6 +217,14 @@ public: 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 @@ public: 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 b973dab557..944485ca7e 100644 --- a/src/gpu/batches/GrClearBatch.h +++ b/src/gpu/batches/GrClearBatch.h @@ -31,9 +31,9 @@ public: 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 c13e7327d7..aa443cf603 100644 --- a/src/gpu/batches/GrDiscardBatch.h +++ b/src/gpu/batches/GrDiscardBatch.h @@ -29,7 +29,7 @@ public: 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 93326efad2..b5def697c7 100644 --- a/src/gpu/batches/GrDrawBatch.h +++ b/src/gpu/batches/GrDrawBatch.h @@ -63,13 +63,18 @@ public: 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 545bfdc973..3ad869bc9a 100644 --- a/src/gpu/batches/GrNonAAFillRectBatch.cpp +++ b/src/gpu/batches/GrNonAAFillRectBatch.cpp @@ -124,6 +124,14 @@ public: 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 @@ public: 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 b4bc0c084f..86d85b616f 100644 --- a/src/gpu/batches/GrTInstanceBatch.h +++ b/src/gpu/batches/GrTInstanceBatch.h @@ -50,6 +50,15 @@ public: 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 3ceb75d4b6..519d6dbeb5 100644 --- a/src/gpu/effects/Gr1DKernelEffect.h +++ b/src/gpu/effects/Gr1DKernelEffect.h @@ -43,6 +43,13 @@ public: 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 9df0cffa5a..4169e40469 100644 --- a/src/gpu/effects/GrSingleTextureEffect.h +++ b/src/gpu/effects/GrSingleTextureEffect.h @@ -21,7 +21,13 @@ class GrTexture; */ 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 aa1db00905..cd06304639 100644 --- a/src/gpu/effects/GrTextureDomain.h +++ b/src/gpu/effects/GrTextureDomain.h @@ -174,6 +174,15 @@ public: 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: |