aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-06-14 12:21:39 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-14 17:14:41 +0000
commitdcd499caed823f23bc70c07df7804a6dc1306606 (patch)
treecce302cdba72f2a125a8c52cf6b6e0d70f94558e
parent1d06078fef78bdc6b367a3d4b1cd3a9b8370ddd0 (diff)
Drop the ref on the GrOpList's target in makeClosed
Bug: 729233 Change-Id: Ifb66b745e604d7f7c22c2907bcffa91d2086236d Reviewed-on: https://skia-review.googlesource.com/19495 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
-rw-r--r--src/effects/GrAlphaThresholdFragmentProcessor.cpp2
-rw-r--r--src/gpu/GrGpuResourceRef.cpp16
-rw-r--r--src/gpu/GrOpList.cpp3
-rw-r--r--src/gpu/GrOpList.h5
-rw-r--r--src/gpu/GrRenderTargetContext.cpp5
5 files changed, 17 insertions, 14 deletions
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index de1b74e4ce..466bd78e7c 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, maskProxy) {
+ , fMaskTextureSampler(resourceProvider, std::move(maskProxy)) {
this->initClassID<GrAlphaThresholdFragmentProcessor>();
this->addCoordTransform(&fImageCoordTransform);
this->addTextureSampler(&fImageTextureSampler);
diff --git a/src/gpu/GrGpuResourceRef.cpp b/src/gpu/GrGpuResourceRef.cpp
index 115e0b1797..243b089b79 100644
--- a/src/gpu/GrGpuResourceRef.cpp
+++ b/src/gpu/GrGpuResourceRef.cpp
@@ -143,11 +143,12 @@ GrSurfaceProxyRef::GrSurfaceProxyRef(sk_sp<GrSurfaceProxy> proxy, GrIOType ioTyp
}
GrSurfaceProxyRef::~GrSurfaceProxyRef() {
- if (fOwnRef) {
- SkASSERT(fProxy);
- fProxy->unref();
- }
+ this->reset();
+}
+
+void GrSurfaceProxyRef::reset() {
if (fPendingIO) {
+ SkASSERT(fProxy);
switch (fIOType) {
case kRead_GrIOType:
fProxy->completedRead();
@@ -160,13 +161,10 @@ GrSurfaceProxyRef::~GrSurfaceProxyRef() {
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 5160be16c2..14f2baadf7 100644
--- a/src/gpu/GrOpList.cpp
+++ b/src/gpu/GrOpList.cpp
@@ -45,8 +45,6 @@ GrOpList::~GrOpList() {
if (this == fTarget.get()->getLastOpList()) {
fTarget.get()->setLastOpList(nullptr);
}
-
- fTarget.pendingIOComplete();
}
}
@@ -59,7 +57,6 @@ 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 dc624415d1..04142d873f 100644
--- a/src/gpu/GrOpList.h
+++ b/src/gpu/GrOpList.h
@@ -35,7 +35,10 @@ public:
virtual bool executeOps(GrOpFlushState* flushState) = 0;
virtual void makeClosed(const GrCaps&) {
- this->setFlag(kClosed_Flag);
+ if (!this->isClosed()) {
+ this->setFlag(kClosed_Flag);
+ fTarget.removeRef();
+ }
}
virtual void reset();
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 7fcd7faf2b..f118b90e56 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -92,6 +92,11 @@ 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();)
}