Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1414903002: Dependencies are now added between the drawTargets in GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@mdb-adddeps
Patch Set: Fix leak on abandon issue Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 5a3feccc1753e44f8c57cfd0d45602dd0ef76c4d..7b1464ca7fb94d3151d785dc1c57d03e4eafd68a 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -32,7 +32,7 @@
////////////////////////////////////////////////////////////////////////////////
-GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider,
+GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider,
const Options& options)
: fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
@@ -40,7 +40,8 @@ GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider,
, fFlushing(false)
, fFirstUnpreparedBatch(0)
, fFlags(0)
- , fOptions(options) {
+ , fOptions(options)
+ , fRenderTarget(rt) {
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
fContext = fGpu->getContext();
fClipMaskManager.reset(new GrClipMaskManager(this));
@@ -52,6 +53,10 @@ GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider,
}
GrDrawTarget::~GrDrawTarget() {
+ if (fRenderTarget && this == fRenderTarget->getLastDrawTarget()) {
+ fRenderTarget->setLastDrawTarget(nullptr);
+ }
+
fGpu->unref();
}
@@ -184,7 +189,7 @@ void GrDrawTarget::flush() {
// drawTargets will be created to replace them if the SkGpuDevice(s) write to them again.
this->makeClosed();
- // Loop over all batches and generate geometry
+ // Loop over the batches that haven't yet generated their geometry
for (; fFirstUnpreparedBatch < fBatches.count(); ++fFirstUnpreparedBatch) {
fBatches[fFirstUnpreparedBatch]->prepare(&fFlushState);
}
@@ -227,6 +232,11 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat
return;
}
+#ifdef ENABLE_MDB
+ SkASSERT(fRenderTarget);
+ batch->pipeline()->addDependenciesTo(fRenderTarget);
+#endif
+
this->recordBatch(batch);
}
@@ -455,6 +465,10 @@ void GrDrawTarget::copySurface(GrSurface* dst,
const SkIPoint& dstPoint) {
GrBatch* batch = GrCopySurfaceBatch::Create(dst, src, srcRect, dstPoint);
if (batch) {
+#ifdef ENABLE_MDB
+ this->addDependency(src);
+#endif
+
this->recordBatch(batch);
batch->unref();
}
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698