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>
This commit is contained in:
Brian Salomon 2017-06-14 12:30:35 -04:00 committed by Skia Commit-Bot
parent 8ea60736aa
commit 82dfd3d1b2
9 changed files with 119 additions and 8 deletions

View File

@ -238,6 +238,26 @@ public:
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; }

View File

@ -47,6 +47,56 @@ GrProcessorSet::~GrProcessorSet() {
}
}
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());

View File

@ -135,6 +135,8 @@ public:
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) {}

View File

@ -212,6 +212,8 @@ public:
info->color(), rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
info = this->next(info);
}
str += fHelper.dumpInfo();
str += INHERITED::dumpInfo();
return str;
}

View File

@ -184,7 +184,8 @@ public:
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;
}

View File

@ -149,6 +149,8 @@ public:
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 @@ public:
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;
}

View File

@ -63,7 +63,8 @@ public:
"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;
}

View File

@ -795,7 +795,8 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
geo.fDevBounds.fBottom, geo.fXRadius, geo.fYRadius, geo.fInnerXRadius,
geo.fInnerYRadius);
}
string.append(INHERITED::dumpInfo());
string += fHelper.dumpInfo();
string += INHERITED::dumpInfo();
return string;
}

View File

@ -137,6 +137,27 @@ public:
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 @@ public:
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;