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 <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
John Stiles 2021-06-04 17:19:43 -04:00 committed by Skia Commit-Bot
parent f961bc256d
commit bcfdc1d438
2 changed files with 16 additions and 25 deletions

View File

@ -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<float>(fDstTextureOffset.fX),
static_cast<float>(fDstTextureOffset.fY),
static_cast<float>(this->dstTextureOffset().fX),
static_cast<float>(this->dstTextureOffset().fY),
1.f / dstTexture->width(),
1.f / dstTexture->height());
}

View File

@ -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<const GrFragmentProcessor>>;
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<const GrXferProcessor> fXferProcessor;