From bcfdc1d43872a9c159ed58860ba5ce505dbe27fe Mon Sep 17 00:00:00 2001 From: John Stiles Date: Fri, 4 Jun 2021 17:19:43 -0400 Subject: [PATCH] Use GrDstProxyView to store the dest-texture in GrPipeline. Change-Id: I99f00d6d143858e3a23b0018785fd1dee9ef56a1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415898 Commit-Queue: John Stiles Auto-Submit: John Stiles Reviewed-by: Greg Daniel --- src/gpu/GrPipeline.cpp | 14 +++++--------- src/gpu/GrPipeline.h | 27 +++++++++++---------------- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index e04d1c3ffe..df84c83d00 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -35,11 +35,7 @@ GrPipeline::GrPipeline(const InitArgs& args, SkASSERT((args.fDstProxyView.dstSampleType() != GrDstSampleType::kNone) == SkToBool(args.fDstProxyView.proxy())); - if (args.fDstProxyView.proxy()) { - fDstProxyView = args.fDstProxyView.proxyView(); - fDstTextureOffset = args.fDstProxyView.offset(); - } - fDstSampleType = args.fDstProxyView.dstSampleType(); + fDstProxy = args.fDstProxyView; } GrPipeline::GrPipeline(const InitArgs& args, GrProcessorSet&& processors, @@ -66,7 +62,7 @@ GrPipeline::GrPipeline(const InitArgs& args, GrProcessorSet&& processors, } GrXferBarrierType GrPipeline::xferBarrierType(const GrCaps& caps) const { - if (fDstProxyView.proxy() && GrDstSampleTypeDirectlySamplesDst(fDstSampleType)) { + if (this->dstProxyView().proxy() && GrDstSampleTypeDirectlySamplesDst(this->dstSampleType())) { return kTexture_GrXferBarrierType; } return this->getXferProcessor().xferBarrierType(caps); @@ -121,7 +117,7 @@ void GrPipeline::visitProxies(const GrOp::VisitProxyFunc& func) const { fp->visitProxies(func); } if (this->usesDstTexture()) { - func(fDstProxyView.proxy(), GrMipmapped::kNo); + func(this->dstProxyView().proxy(), GrMipmapped::kNo); } } @@ -132,8 +128,8 @@ void GrPipeline::setDstTextureUniforms(const GrGLSLProgramDataManager& pdm, if (dstTexture) { if (fBuiltinUniformHandles->fDstTextureCoordsUni.isValid()) { pdm.set4f(fBuiltinUniformHandles->fDstTextureCoordsUni, - static_cast(fDstTextureOffset.fX), - static_cast(fDstTextureOffset.fY), + static_cast(this->dstTextureOffset().fX), + static_cast(this->dstTextureOffset().fY), 1.f / dstTexture->width(), 1.f / dstTexture->height()); } diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index 68594ca34c..d8639ff861 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -122,17 +122,13 @@ public: } } - GrDstSampleType dstSampleType() const { - return fDstSampleType; - } - // Helper functions to quickly know if this GrPipeline will access the dst as a texture or an // input attachment. bool usesDstTexture() const { - return GrDstSampleTypeUsesTexture(fDstSampleType); + return GrDstSampleTypeUsesTexture(this->dstSampleType()); } bool usesInputAttachment() const { - return fDstSampleType == GrDstSampleType::kAsInputAttachment; + return this->dstSampleType() == GrDstSampleType::kAsInputAttachment; } /** @@ -140,7 +136,11 @@ public: * GrXferProcessor does not use the dst color then the proxy on the GrSurfaceProxyView will be * nullptr. */ - const GrSurfaceProxyView& dstProxyView() const { return fDstProxyView; } + const GrSurfaceProxyView& dstProxyView() const { return fDstProxy.proxyView(); } + + SkIPoint dstTextureOffset() const { return fDstProxy.offset(); } + + GrDstSampleType dstSampleType() const { return fDstProxy.dstSampleType(); } /** If this GrXferProcessor uses a texture to access the dst color, returns that texture. */ GrTexture* peekDstTexture() const { @@ -148,7 +148,7 @@ public: return nullptr; } - if (GrTextureProxy* dstProxy = fDstProxyView.asTextureProxy()) { + if (GrTextureProxy* dstProxy = this->dstProxyView().asTextureProxy()) { return dstProxy->peekTexture(); } @@ -183,8 +183,8 @@ public: return false; } } - if (fDstProxyView.proxy()) { - return fDstProxyView.proxy()->isInstantiated(); + if (this->dstProxyView().proxy()) { + return this->dstProxyView().proxy()->isInstantiated(); } return true; @@ -219,12 +219,7 @@ private: // A pipeline can contain up to three processors: color, paint coverage, and clip coverage. using FragmentProcessorArray = SkAutoSTArray<3, std::unique_ptr>; - GrSurfaceProxyView fDstProxyView; - SkIPoint fDstTextureOffset; - // This is the GrDstSampleType that is used for the render pass that this GrPipeline will be - // used in (i.e. if this GrPipeline does read the dst, it will do so using this - // GrDstSampleType). - GrDstSampleType fDstSampleType = GrDstSampleType::kNone; + GrDstProxyView fDstProxy; GrWindowRectsState fWindowRectsState; Flags fFlags; sk_sp fXferProcessor;