aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawTarget.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-10-22 05:19:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-22 05:19:50 -0700
commit869c5e82a725a6928a45cd1fa6945ac783b8b3d8 (patch)
treede9763f5fa8873ae616d2566d9e5db037cbf2f43 /src/gpu/GrDrawTarget.cpp
parent12449a9614f6c1becdb464b39c6a11a79feb0589 (diff)
Dependencies are now added between the drawTargets in GrPipeline
This CL relies on https://codereview.chromium.org/1414773002/ (Add the machinery to GrDrawTarget to enable topological sorting) BUG=skia:4094 Committed: https://skia.googlesource.com/skia/+/45a1c34f607a970933e5cd05e1df6cd8090db1be Review URL: https://codereview.chromium.org/1414903002
Diffstat (limited to 'src/gpu/GrDrawTarget.cpp')
-rw-r--r--src/gpu/GrDrawTarget.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index f42ee111ce..1411687f7f 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -32,13 +32,14 @@
////////////////////////////////////////////////////////////////////////////////
-GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider)
+GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider)
: fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
, fFlushState(fGpu, fResourceProvider, 0)
, fFlushing(false)
, fFirstUnpreparedBatch(0)
- , fFlags(0) {
+ , fFlags(0)
+ , fRenderTarget(rt) {
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
fContext = fGpu->getContext();
fClipMaskManager.reset(new GrClipMaskManager(this));
@@ -50,6 +51,10 @@ GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider)
}
GrDrawTarget::~GrDrawTarget() {
+ if (fRenderTarget && this == fRenderTarget->getLastDrawTarget()) {
+ fRenderTarget->setLastDrawTarget(nullptr);
+ }
+
fGpu->unref();
}
@@ -182,7 +187,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);
}
@@ -458,6 +468,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();
}