From dcf9ca1820bac66d4e3cc4219af62a9f341a3dbb Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Tue, 27 Aug 2019 14:30:21 -0400 Subject: [PATCH] Have visitProxies take a GrTexutreProxy instead of GrSurfaceProxy. Change-Id: Ic1508d7909c90298fdb906391f981505c3ed497e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237485 Reviewed-by: Chris Dalton Commit-Queue: Greg Daniel --- src/gpu/GrCopyRenderTask.h | 2 +- src/gpu/GrOpsTask.cpp | 8 ++++++-- src/gpu/GrOpsTask.h | 6 +++--- src/gpu/GrRenderTask.h | 6 ++++-- src/gpu/GrTextureResolveRenderTask.h | 2 +- src/gpu/GrTransferFromRenderTask.h | 2 +- src/gpu/ops/GrOp.h | 2 +- tests/LazyProxyTest.cpp | 4 ++-- 8 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/gpu/GrCopyRenderTask.h b/src/gpu/GrCopyRenderTask.h index 319d5daa11..e2b5d1f5e1 100644 --- a/src/gpu/GrCopyRenderTask.h +++ b/src/gpu/GrCopyRenderTask.h @@ -37,7 +37,7 @@ private: bool onExecute(GrOpFlushState*) override; #ifdef SK_DEBUG - void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override { + void visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const override { fn(fSrcProxy.get(), GrMipMapped::kNo); } #endif diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp index 98f0c6123d..c06a7ae219 100644 --- a/src/gpu/GrOpsTask.cpp +++ b/src/gpu/GrOpsTask.cpp @@ -576,9 +576,13 @@ void GrOpsTask::dump(bool printDependencies) const { } } -void GrOpsTask::visitProxies_debugOnly(const GrOp::VisitProxyFunc& func) const { +void GrOpsTask::visitProxies_debugOnly(const VisitSurfaceProxyFunc& func) const { + auto textureFunc = [ func ] (GrTextureProxy* tex, GrMipMapped mipmapped) { + func(tex, mipmapped); + }; + for (const OpChain& chain : fOpChains) { - chain.visitProxies(func); + chain.visitProxies(textureFunc); } } diff --git a/src/gpu/GrOpsTask.h b/src/gpu/GrOpsTask.h index a90b7e6b85..b9398b8b80 100644 --- a/src/gpu/GrOpsTask.h +++ b/src/gpu/GrOpsTask.h @@ -60,7 +60,7 @@ public: void addOp(std::unique_ptr op, GrTextureResolveManager textureResolveManager, const GrCaps& caps) { auto addDependency = [ textureResolveManager, &caps, this ] ( - GrSurfaceProxy* p, GrMipMapped mipmapped) { + GrTextureProxy* p, GrMipMapped mipmapped) { this->addDependency(p, mipmapped, textureResolveManager, caps); }; @@ -79,7 +79,7 @@ public: GrAppliedClip&& clip, const DstProxy& dstProxy, GrTextureResolveManager textureResolveManager, const GrCaps& caps) { auto addDependency = [ textureResolveManager, &caps, this ] ( - GrSurfaceProxy* p, GrMipMapped mipmapped) { + GrTextureProxy* p, GrMipMapped mipmapped) { this->addDependency(p, mipmapped, textureResolveManager, caps); }; @@ -97,7 +97,7 @@ public: SkDEBUGCODE(void dump(bool printDependencies) const override;) SkDEBUGCODE(int numClips() const override { return fNumClips; }) - SkDEBUGCODE(void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const override;) + SkDEBUGCODE(void visitProxies_debugOnly(const VisitSurfaceProxyFunc&) const override;) private: bool isNoOp() const { diff --git a/src/gpu/GrRenderTask.h b/src/gpu/GrRenderTask.h index 3f66d901cd..918055f38f 100644 --- a/src/gpu/GrRenderTask.h +++ b/src/gpu/GrRenderTask.h @@ -65,9 +65,11 @@ public: virtual int numClips() const { return 0; } - virtual void visitProxies_debugOnly(const GrOp::VisitProxyFunc&) const = 0; + using VisitSurfaceProxyFunc = std::function; - void visitTargetAndSrcProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const { + virtual void visitProxies_debugOnly(const VisitSurfaceProxyFunc&) const = 0; + + void visitTargetAndSrcProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const { this->visitProxies_debugOnly(fn); fn(fTarget.get(), GrMipMapped::kNo); } diff --git a/src/gpu/GrTextureResolveRenderTask.h b/src/gpu/GrTextureResolveRenderTask.h index d3c95d678f..29d7eaa824 100644 --- a/src/gpu/GrTextureResolveRenderTask.h +++ b/src/gpu/GrTextureResolveRenderTask.h @@ -37,7 +37,7 @@ private: #ifdef SK_DEBUG // No non-dst proxies. - void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {} + void visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const override {} #endif const GrTextureResolveFlags fResolveFlags; diff --git a/src/gpu/GrTransferFromRenderTask.h b/src/gpu/GrTransferFromRenderTask.h index 08ad678947..421206eace 100644 --- a/src/gpu/GrTransferFromRenderTask.h +++ b/src/gpu/GrTransferFromRenderTask.h @@ -43,7 +43,7 @@ private: bool onExecute(GrOpFlushState*) override; #ifdef SK_DEBUG - void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override { + void visitProxies_debugOnly(const VisitSurfaceProxyFunc& fn) const override { fn(fSrcProxy.get(), GrMipMapped::kNo); } #endif diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h index 0578994bbc..2eba92b70a 100644 --- a/src/gpu/ops/GrOp.h +++ b/src/gpu/ops/GrOp.h @@ -68,7 +68,7 @@ public: virtual const char* name() const = 0; - using VisitProxyFunc = std::function; + using VisitProxyFunc = std::function; virtual void visitProxies(const VisitProxyFunc&) const { // This default implementation assumes the op has no proxies diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp index 371c701d23..c7e5ffcef9 100644 --- a/tests/LazyProxyTest.cpp +++ b/tests/LazyProxyTest.cpp @@ -362,7 +362,7 @@ private: } int* fTestExecuteValue; - sk_sp fLazyProxy; + sk_sp fLazyProxy; typedef GrDrawOp INHERITED; }; @@ -425,7 +425,7 @@ private: void onPrepare(GrOpFlushState*) override {} void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {} - sk_sp fLazyProxy; + sk_sp fLazyProxy; typedef GrDrawOp INHERITED; };