diff options
author | Robert Phillips <robertphillips@google.com> | 2018-04-20 12:43:18 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-20 17:47:55 +0000 |
commit | 2748391716b04f700a689ac99bc13fd67d812418 (patch) | |
tree | 17e254f62a1944bc0c621454e1bcf3214420aaca | |
parent | d7c97861c7cdcc292c80f2dbe7172fc997ef5c50 (diff) |
Add ability to dump opList info at flush-time
When debugging DDL it is useful to just see which ops are being drawn instead of the entire reordering history.
Change-Id: I89708fecbd53c097b00e65b0da426bfb8046b0ee
Reviewed-on: https://skia-review.googlesource.com/122780
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | gm/drawregionmodes.cpp | 8 | ||||
-rw-r--r-- | include/private/GrOpList.h | 2 | ||||
-rw-r--r-- | src/gpu/GrDrawingManager.cpp | 8 | ||||
-rw-r--r-- | src/gpu/GrOpList.cpp | 17 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetOpList.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrRenderTargetOpList.h | 2 | ||||
-rw-r--r-- | src/gpu/GrTextureOpList.cpp | 4 | ||||
-rw-r--r-- | src/gpu/GrTextureOpList.h | 2 | ||||
-rw-r--r-- | src/gpu/ops/GrOp.h | 3 |
9 files changed, 33 insertions, 17 deletions
diff --git a/gm/drawregionmodes.cpp b/gm/drawregionmodes.cpp index 7e4765aaec..1fd54f5b56 100644 --- a/gm/drawregionmodes.cpp +++ b/gm/drawregionmodes.cpp @@ -36,9 +36,10 @@ protected: SkPaint paint; paint.setStyle(SkPaint::kFill_Style); - paint.setColor(0xFFFF0000); + paint.setColor(SK_ColorRED); paint.setAntiAlias(true); + canvas->save(); canvas->translate(-50.0f, 75.0f); canvas->rotate(-45.0f); canvas->drawRegion(fRegion, paint); @@ -60,7 +61,8 @@ protected: paint.setPathEffect(SkDashPathEffect::Make(intervals, 2, 2.5f)); canvas->drawRegion(fRegion, paint); - canvas->setMatrix(SkMatrix::I()); + canvas->restore(); + canvas->translate(100, 325); paint.setPathEffect(nullptr); paint.setStyle(SkPaint::kFill_Style); @@ -71,9 +73,9 @@ protected: canvas->drawRegion(fRegion, paint); } +private: SkRegion fRegion; -private: typedef skiagm::GM INHERITED; }; DEF_GM( return new DrawRegionModesGM; ) diff --git a/include/private/GrOpList.h b/include/private/GrOpList.h index f183081bde..4ec909c72c 100644 --- a/include/private/GrOpList.h +++ b/include/private/GrOpList.h @@ -91,7 +91,7 @@ public: /* * Dump out the GrOpList dependency DAG */ - SkDEBUGCODE(virtual void dump() const;) + SkDEBUGCODE(virtual void dump(bool printDependencies) const;) SkDEBUGCODE(virtual int numOps() const = 0;) SkDEBUGCODE(virtual int numClips() const { return 0; }) diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index 86fee30925..a704bafa2c 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -264,6 +264,14 @@ static void end_oplist_flush_if_not_unique(const sk_sp<GrOpList>& opList) { bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushState* flushState) { SkASSERT(startIndex <= stopIndex && stopIndex <= fOpLists.count()); +#if GR_FLUSH_TIME_OP_SPEW + SkDebugf("Flushing opLists: %d to %d out of [%d, %d]\n", + startIndex, stopIndex, 0, fOpLists.count()); + for (int i = startIndex; i < stopIndex; ++i) { + fOpLists[i]->dump(false); + } +#endif + GrResourceProvider* resourceProvider = fContext->contextPriv().resourceProvider(); bool anyOpListsExecuted = false; diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp index bdaaa2ab4a..6fed34a38c 100644 --- a/src/gpu/GrOpList.cpp +++ b/src/gpu/GrOpList.cpp @@ -124,14 +124,17 @@ bool GrOpList::isInstantiated() const { } #ifdef SK_DEBUG -void GrOpList::dump() const { +void GrOpList::dump(bool printDependencies) const { SkDebugf("--------------------------------------------------------------\n"); - SkDebugf("node: %d -> RT: %d\n", fUniqueID, fTarget.get() ? fTarget.get()->uniqueID().asUInt() - : -1); - SkDebugf("relies On (%d): ", fDependencies.count()); - for (int i = 0; i < fDependencies.count(); ++i) { - SkDebugf("%d, ", fDependencies[i]->fUniqueID); + SkDebugf("opList: %d -> RT: %d\n", fUniqueID, fTarget.get() ? fTarget.get()->uniqueID().asUInt() + : -1); + + if (printDependencies) { + SkDebugf("relies On (%d): ", fDependencies.count()); + for (int i = 0; i < fDependencies.count(); ++i) { + SkDebugf("%d, ", fDependencies[i]->fUniqueID); + } + SkDebugf("\n"); } - SkDebugf("\n"); } #endif diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 47eb3a0789..a68d78ac65 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -38,8 +38,8 @@ GrRenderTargetOpList::~GrRenderTargetOpList() { //////////////////////////////////////////////////////////////////////////////// #ifdef SK_DEBUG -void GrRenderTargetOpList::dump() const { - INHERITED::dump(); +void GrRenderTargetOpList::dump(bool printDependencies) const { + INHERITED::dump(printDependencies); SkDebugf("ops (%d):\n", fRecordedOps.count()); for (int i = 0; i < fRecordedOps.count(); ++i) { diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h index c0a72333da..938f69aba6 100644 --- a/src/gpu/GrRenderTargetOpList.h +++ b/src/gpu/GrRenderTargetOpList.h @@ -109,7 +109,7 @@ public: GrRenderTargetOpList* asRenderTargetOpList() override { return this; } - SkDEBUGCODE(void dump() const override;) + SkDEBUGCODE(void dump(bool printDependencies) const override;) SkDEBUGCODE(int numOps() const override { return fRecordedOps.count(); }) SkDEBUGCODE(int numClips() const override { return fNumClips; }) diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp index 45deb2d59b..c09dbffba5 100644 --- a/src/gpu/GrTextureOpList.cpp +++ b/src/gpu/GrTextureOpList.cpp @@ -28,8 +28,8 @@ GrTextureOpList::~GrTextureOpList() { //////////////////////////////////////////////////////////////////////////////// #ifdef SK_DEBUG -void GrTextureOpList::dump() const { - INHERITED::dump(); +void GrTextureOpList::dump(bool printDependencies) const { + INHERITED::dump(printDependencies); SkDebugf("ops (%d):\n", fRecordedOps.count()); for (int i = 0; i < fRecordedOps.count(); ++i) { diff --git a/src/gpu/GrTextureOpList.h b/src/gpu/GrTextureOpList.h index 42da738390..510a895b67 100644 --- a/src/gpu/GrTextureOpList.h +++ b/src/gpu/GrTextureOpList.h @@ -56,7 +56,7 @@ public: GrTextureOpList* asTextureOpList() override { return this; } - SkDEBUGCODE(void dump() const override;) + SkDEBUGCODE(void dump(bool printDependencies) const override;) SkDEBUGCODE(int numOps() const override { return fRecordedOps.count(); }) diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h index 5f6177009a..50edcf9611 100644 --- a/src/gpu/ops/GrOp.h +++ b/src/gpu/ops/GrOp.h @@ -51,6 +51,9 @@ class GrRenderTargetOpList; #define GrOP_INFO(...) #endif +// Print out op information at flush time +#define GR_FLUSH_TIME_OP_SPEW 0 + // A helper macro to generate a class static id #define DEFINE_OP_CLASS_ID \ static uint32_t ClassID() { \ |