Add processor info dumping to non-legacy mesh draw ops
Change-Id: I2ee77f0971a1b627905ac547bc0511042c40ac38
Reviewed-on: https://skia-review.googlesource.com/19816
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index 8d2f245..5e22cc5 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -238,6 +238,26 @@
GrXferBarrierType xferBarrierType(const GrCaps& caps) const;
+ static SkString DumpFlags(uint32_t flags) {
+ if (flags) {
+ SkString result;
+ if (flags & GrPipeline::kSnapVerticesToPixelCenters_Flag) {
+ result.append("Snap vertices to pixel center.\n");
+ }
+ if (flags & GrPipeline::kHWAntialias_Flag) {
+ result.append("HW Antialiasing enabled.\n");
+ }
+ if (flags & GrPipeline::kDisableOutputConversionToSRGB_Flag) {
+ result.append("Disable output conversion to sRGB.\n");
+ }
+ if (flags & GrPipeline::kAllowSRGBInputs_Flag) {
+ result.append("Allow sRGB Inputs.\n");
+ }
+ return result;
+ }
+ return SkString("No pipeline flags\n");
+ }
+
private:
void markAsBad() { fFlags |= kIsBad_Flag; }
diff --git a/src/gpu/GrProcessorSet.cpp b/src/gpu/GrProcessorSet.cpp
index 01de53d..e073679 100644
--- a/src/gpu/GrProcessorSet.cpp
+++ b/src/gpu/GrProcessorSet.cpp
@@ -47,6 +47,56 @@
}
}
+SkString dump_fragment_processor_tree(const GrFragmentProcessor* fp, int indentCnt) {
+ SkString result;
+ SkString indentString;
+ for (int i = 0; i < indentCnt; ++i) {
+ indentString.append(" ");
+ }
+ result.appendf("%s%s %s \n", indentString.c_str(), fp->name(), fp->dumpInfo().c_str());
+ if (fp->numChildProcessors()) {
+ for (int i = 0; i < fp->numChildProcessors(); ++i) {
+ result += dump_fragment_processor_tree(&fp->childProcessor(i), indentCnt + 1);
+ }
+ }
+ return result;
+}
+
+SkString GrProcessorSet::dumpProcessors() const {
+ SkString result;
+ if (this->numFragmentProcessors()) {
+ if (this->numColorFragmentProcessors()) {
+ result.append("Color Fragment Processors:\n");
+ for (int i = 0; i < this->numColorFragmentProcessors(); ++i) {
+ result += dump_fragment_processor_tree(this->colorFragmentProcessor(i), 1);
+ }
+ } else {
+ result.append("No color fragment processors.\n");
+ }
+ if (this->numCoverageFragmentProcessors()) {
+ result.append("Coverage Fragment Processors:\n");
+ for (int i = 0; i < this->numColorFragmentProcessors(); ++i) {
+ result += dump_fragment_processor_tree(this->coverageFragmentProcessor(i), 1);
+ }
+ } else {
+ result.append("No coverage fragment processors.\n");
+ }
+ } else {
+ result.append("No color or coverage fragment processors.\n");
+ }
+ if (this->isFinalized()) {
+ result.append("Xfer Processor: ");
+ if (this->xferProcessor()) {
+ result.appendf("%s\n", this->xferProcessor()->name());
+ } else {
+ result.append("SrcOver\n");
+ }
+ } else {
+ result.append("XP Factory dumping not implemented.\n");
+ }
+ return result;
+}
+
bool GrProcessorSet::operator==(const GrProcessorSet& that) const {
SkASSERT(this->isFinalized());
SkASSERT(that.isFinalized());
diff --git a/src/gpu/GrProcessorSet.h b/src/gpu/GrProcessorSet.h
index d7ceced..407d71e 100644
--- a/src/gpu/GrProcessorSet.h
+++ b/src/gpu/GrProcessorSet.h
@@ -135,6 +135,8 @@
static const GrProcessorSet& EmptySet();
static constexpr const Analysis EmptySetAnalysis() { return Analysis(Empty::kEmpty); }
+ SkString dumpProcessors() const;
+
private:
GrProcessorSet(Empty) : fXP((const GrXferProcessor*)nullptr), fFlags(kFinalized_Flag) {}
diff --git a/src/gpu/ops/GrAAFillRectOp.cpp b/src/gpu/ops/GrAAFillRectOp.cpp
index ec190c7..db856b2 100644
--- a/src/gpu/ops/GrAAFillRectOp.cpp
+++ b/src/gpu/ops/GrAAFillRectOp.cpp
@@ -212,6 +212,8 @@
info->color(), rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
info = this->next(info);
}
+ str += fHelper.dumpInfo();
+ str += INHERITED::dumpInfo();
return str;
}
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index 82b4ec1..e423583 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -184,7 +184,8 @@
info.fDevOutsideAssist.fBottom, info.fDevInside.fLeft, info.fDevInside.fTop,
info.fDevInside.fRight, info.fDevInside.fBottom, info.fDegenerate);
}
- string.append(INHERITED::dumpInfo());
+ string += fHelper.dumpInfo();
+ string += INHERITED::dumpInfo();
return string;
}
diff --git a/src/gpu/ops/GrNonAAFillRectOp.cpp b/src/gpu/ops/GrNonAAFillRectOp.cpp
index c30f4a1..2fd44f8 100644
--- a/src/gpu/ops/GrNonAAFillRectOp.cpp
+++ b/src/gpu/ops/GrNonAAFillRectOp.cpp
@@ -149,6 +149,8 @@
info.fColor, info.fRect.fLeft, info.fRect.fTop, info.fRect.fRight,
info.fRect.fBottom);
}
+ str += fHelper.dumpInfo();
+ str += INHERITED::dumpInfo();
return str;
}
@@ -265,7 +267,8 @@
geo.fColor, geo.fRect.fLeft, geo.fRect.fTop, geo.fRect.fRight,
geo.fRect.fBottom);
}
- str.append(INHERITED::dumpInfo());
+ str += fHelper.dumpInfo();
+ str += INHERITED::dumpInfo();
return str;
}
diff --git a/src/gpu/ops/GrNonAAStrokeRectOp.cpp b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
index 4177b65..016c637 100644
--- a/src/gpu/ops/GrNonAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrNonAAStrokeRectOp.cpp
@@ -63,7 +63,8 @@
"Color: 0x%08x, Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], "
"StrokeWidth: %.2f\n",
fColor, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom, fStrokeWidth);
- string.append(INHERITED::dumpInfo());
+ string += fHelper.dumpInfo();
+ string += INHERITED::dumpInfo();
return string;
}
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 15c2569..0eedc42 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -795,7 +795,8 @@
fCircles[i].fDevBounds.fRight, fCircles[i].fDevBounds.fBottom,
fCircles[i].fInnerRadius, fCircles[i].fOuterRadius);
}
- string.append(INHERITED::dumpInfo());
+ string += fHelper.dumpInfo();
+ string += INHERITED::dumpInfo();
return string;
}
@@ -1257,7 +1258,8 @@
geo.fDevBounds.fBottom, geo.fXRadius, geo.fYRadius, geo.fInnerXRadius,
geo.fInnerYRadius);
}
- string.append(INHERITED::dumpInfo());
+ string += fHelper.dumpInfo();
+ string += INHERITED::dumpInfo();
return string;
}
@@ -1482,7 +1484,8 @@
geo.fBounds.fBottom, geo.fXRadius, geo.fYRadius, geo.fInnerXRadius,
geo.fInnerYRadius, geo.fGeoDx, geo.fGeoDy);
}
- string.append(INHERITED::dumpInfo());
+ string += fHelper.dumpInfo();
+ string += INHERITED::dumpInfo();
return string;
}
@@ -1794,7 +1797,8 @@
fRRects[i].fDevBounds.fRight, fRRects[i].fDevBounds.fBottom,
fRRects[i].fInnerRadius, fRRects[i].fOuterRadius);
}
- string.append(INHERITED::dumpInfo());
+ string += fHelper.dumpInfo();
+ string += INHERITED::dumpInfo();
return string;
}
@@ -2147,7 +2151,8 @@
geo.fDevBounds.fBottom, geo.fXRadius, geo.fYRadius, geo.fInnerXRadius,
geo.fInnerYRadius);
}
- string.append(INHERITED::dumpInfo());
+ string += fHelper.dumpInfo();
+ string += INHERITED::dumpInfo();
return string;
}
diff --git a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
index 903859c..f0a21fb 100644
--- a/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
+++ b/src/gpu/ops/GrSimpleMeshDrawOpHelper.h
@@ -137,6 +137,27 @@
friend class GrSimpleMeshDrawOpHelper;
};
+ SkString dumpInfo() const {
+ SkString result = this->processors().dumpProcessors();
+ result.append("AA Type: ");
+ switch (this->aaType()) {
+ case GrAAType::kNone:
+ result.append(" none\n");
+ break;
+ case GrAAType::kCoverage:
+ result.append(" coverage\n");
+ break;
+ case GrAAType::kMSAA:
+ result.append(" msaa\n");
+ break;
+ case GrAAType::kMixedSamples:
+ result.append(" mixed samples\n");
+ break;
+ }
+ result.append(GrPipeline::DumpFlags(fPipelineFlags));
+ return result;
+ }
+
protected:
GrAAType aaType() const { return static_cast<GrAAType>(fAAType); }
uint32_t pipelineFlags() const { return fPipelineFlags; }
@@ -214,6 +235,12 @@
return target->allocPipeline(args);
}
+ SkString dumpInfo() const {
+ SkString result = INHERITED::dumpInfo();
+ result.appendf("Stencil settings: %s\n", (fStencilSettings ? "yes" : "no"));
+ return result;
+ }
+
private:
const GrUserStencilSettings* fStencilSettings;
typedef GrSimpleMeshDrawOpHelper INHERITED;