From 9d6c64f29a27496c9b778ec55aff0fdc851fd066 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 14 Sep 2017 10:56:45 -0400 Subject: [PATCH] Make GrCopySurfaceOp participate in the GrOplist DAG Change-Id: Ic72884c8447ad950a91a2afe9566dd5a92dd6f11 Reviewed-on: https://skia-review.googlesource.com/46582 Reviewed-by: Brian Osman Commit-Queue: Robert Phillips --- src/gpu/GrDrawingManager.cpp | 3 ++- src/gpu/GrOpList.h | 7 ++++++- src/gpu/GrRenderTargetContext.cpp | 1 + src/gpu/GrRenderTargetOpList.cpp | 5 +---- src/gpu/GrRenderTargetOpList.h | 2 +- src/gpu/GrTextureOpList.cpp | 8 +++++--- src/gpu/ops/GrCopySurfaceOp.h | 5 +++++ 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index bbcd8a85d9..8d9e238f95 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -11,6 +11,7 @@ #include "GrContext.h" #include "GrGpu.h" #include "GrOnFlushResourceProvider.h" +#include "GrOpList.h" #include "GrRenderTargetContext.h" #include "GrPathRenderingRenderTargetContext.h" #include "GrRenderTargetProxy.h" @@ -120,7 +121,7 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*, } #endif -#ifdef ENABLE_MDB +#ifdef ENABLE_MDB_SORT SkDEBUGCODE(bool result =) SkTTopoSort(&fOpLists); SkASSERT(result); diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h index ef21a24f46..c801f96375 100644 --- a/src/gpu/GrOpList.h +++ b/src/gpu/GrOpList.h @@ -13,7 +13,12 @@ #include "SkRefCnt.h" #include "SkTDArray.h" -//#define ENABLE_MDB 1 + +// Turn on/off the explicit distribution of GPU resources at flush time +//#define MDB_ALLOC_RESOURCES 1 + +// Turn on/off the sorting of opLists at flush time +//#define ENABLE_MDB_SORT 1 class GrAuditTrail; class GrCaps; diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 4f1ad1279e..cd2d099738 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -15,6 +15,7 @@ #include "GrDrawingManager.h" #include "GrFixedClip.h" #include "GrGpuResourcePriv.h" +#include "GrOpList.h" #include "GrPathRenderer.h" #include "GrRenderTarget.h" #include "GrRenderTargetContextPriv.h" diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp index 1ae35bf2cc..a53a84ca5f 100644 --- a/src/gpu/GrRenderTargetOpList.cpp +++ b/src/gpu/GrRenderTargetOpList.cpp @@ -247,11 +247,8 @@ bool GrRenderTargetOpList::copySurface(const GrCaps& caps, if (!op) { return false; } -#ifdef ENABLE_MDB - this->addDependency(src); -#endif - this->recordOp(std::move(op), caps); + this->addOp(std::move(op), caps); return true; } diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h index d80f667655..55fc904839 100644 --- a/src/gpu/GrRenderTargetOpList.h +++ b/src/gpu/GrRenderTargetOpList.h @@ -74,7 +74,7 @@ public: op->visitProxies(addDependency); - this->recordOp(std::move(op), caps, nullptr, nullptr); + this->recordOp(std::move(op), caps); return this->uniqueID(); } diff --git a/src/gpu/GrTextureOpList.cpp b/src/gpu/GrTextureOpList.cpp index b046e7c272..e5fbb20bf2 100644 --- a/src/gpu/GrTextureOpList.cpp +++ b/src/gpu/GrTextureOpList.cpp @@ -98,9 +98,11 @@ bool GrTextureOpList::copySurface(const GrCaps& caps, if (!op) { return false; } -#ifdef ENABLE_MDB - this->addDependency(src); -#endif + + auto addDependency = [ &caps, this ] (GrSurfaceProxy* p) { + this->addDependency(p, caps); + }; + op->visitProxies(addDependency); this->recordOp(std::move(op)); return true; diff --git a/src/gpu/ops/GrCopySurfaceOp.h b/src/gpu/ops/GrCopySurfaceOp.h index 57548a8268..7debfcd6a9 100644 --- a/src/gpu/ops/GrCopySurfaceOp.h +++ b/src/gpu/ops/GrCopySurfaceOp.h @@ -21,6 +21,11 @@ public: const char* name() const override { return "CopySurface"; } + void visitProxies(VisitProxyFunc func) const override { + func(fDst.get()); + func(fSrc.get()); + } + SkString dumpInfo() const override { SkString string; string.append(INHERITED::dumpInfo());