diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp index 466bd78e7c..de1b74e4ce 100644 --- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp +++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp @@ -44,7 +44,7 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor( resourceProvider, SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())), maskProxy.get()) - , fMaskTextureSampler(resourceProvider, std::move(maskProxy)) { + , fMaskTextureSampler(resourceProvider, maskProxy) { this->initClassID(); this->addCoordTransform(&fImageCoordTransform); this->addTextureSampler(&fImageTextureSampler); diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp index 243b089b79..115e0b1797 100644 --- a/src/gpu/GrGpuResourceRef.cpp +++ b/src/gpu/GrGpuResourceRef.cpp @@ -143,12 +143,11 @@ GrSurfaceProxyRef::GrSurfaceProxyRef(sk_sp proxy, GrIOType ioTyp } GrSurfaceProxyRef::~GrSurfaceProxyRef() { - this->reset(); -} - -void GrSurfaceProxyRef::reset() { - if (fPendingIO) { + if (fOwnRef) { SkASSERT(fProxy); + fProxy->unref(); + } + if (fPendingIO) { switch (fIOType) { case kRead_GrIOType: fProxy->completedRead(); @@ -161,10 +160,13 @@ void GrSurfaceProxyRef::reset() { fProxy->completedWrite(); break; } - fPendingIO = false; } +} + +void GrSurfaceProxyRef::reset() { + SkASSERT(!fPendingIO); + SkASSERT(SkToBool(fProxy) == fOwnRef); if (fOwnRef) { - SkASSERT(fProxy); fProxy->unref(); fOwnRef = false; fProxy = nullptr; diff --git a/src/gpu/GrOpList.cpp b/src/gpu/GrOpList.cpp index 14f2baadf7..5160be16c2 100644 --- a/src/gpu/GrOpList.cpp +++ b/src/gpu/GrOpList.cpp @@ -45,6 +45,8 @@ GrOpList::~GrOpList() { if (this == fTarget.get()->getLastOpList()) { fTarget.get()->setLastOpList(nullptr); } + + fTarget.pendingIOComplete(); } } @@ -57,6 +59,7 @@ void GrOpList::reset() { fTarget.get()->setLastOpList(nullptr); } + fTarget.pendingIOComplete(); fTarget.reset(); fAuditTrail = nullptr; } diff --git a/src/gpu/GrOpList.h b/src/gpu/GrOpList.h index 04142d873f..dc624415d1 100644 --- a/src/gpu/GrOpList.h +++ b/src/gpu/GrOpList.h @@ -35,10 +35,7 @@ public: virtual bool executeOps(GrOpFlushState* flushState) = 0; virtual void makeClosed(const GrCaps&) { - if (!this->isClosed()) { - this->setFlag(kClosed_Flag); - fTarget.removeRef(); - } + this->setFlag(kClosed_Flag); } virtual void reset(); diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp index 21a47eec49..39148bbe5a 100644 --- a/src/gpu/GrRenderTargetContext.cpp +++ b/src/gpu/GrRenderTargetContext.cpp @@ -119,11 +119,6 @@ GrRenderTargetContext::GrRenderTargetContext(GrContext* context, auto srgbColorSpace = SkColorSpace::MakeSRGB(); fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fColorSpace.get()); } - - // MDB TODO: to ensure all resources still get allocated in the correct order in the hybrid - // world we need to get the correct opList here so that it, in turn, can grab and hold - // its rendertarget. - this->getOpList(); SkDEBUGCODE(this->validate();) }