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
This commit is contained in:
robertphillips 2015-11-16 09:06:59 -08:00 committed by Commit bot
parent a7a21cffe1
commit e004bfc0a5
16 changed files with 120 additions and 8 deletions

View File

@ -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

View File

@ -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; }

View File

@ -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;

View File

@ -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; }

View File

@ -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; }

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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 */

View File

@ -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: