Index: src/gpu/GrDrawTarget.cpp |
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp |
index 3f898ab26a2061c509b0e5502fa25fe511246081..a5c2890d1f42cb2723ed896ec36b1bf93827a6f8 100644 |
--- a/src/gpu/GrDrawTarget.cpp |
+++ b/src/gpu/GrDrawTarget.cpp |
@@ -30,9 +30,21 @@ |
#include "SkStrokeRec.h" |
-//////////////////////////////////////////////////////////////////////////////// |
+GrDrawTarget* getLastDT6(GrGpuResource* res) { |
+ GrRenderTarget* rt = res->arrgh(); |
+ if (rt) { |
+ return rt->getLastDrawTarget(); |
+ } else { |
+ return nullptr; |
+ } |
+} |
-GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider) |
+void addRequiredDep(GrDrawTarget* dst, GrDrawTarget* src) { |
+ dst->addRequiredDep(src); |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider) |
: fGpu(SkRef(gpu)) |
, fResourceProvider(resourceProvider) |
, fFlushing(false) |
@@ -48,11 +60,26 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r |
#endif |
} |
+void GrDrawTarget::checkUses() const { |
+ for (int i = 0; i < fRequired.count(); ++i) { |
+ SkASSERT(fDependencies.find(fRequired[i]) >= 0); |
+ } |
+ for (int i = 0; i < fDependencies.count(); ++i) { |
+ SkASSERT(fRequired.find(fDependencies[i]) >= 0); |
+ } |
+} |
+ |
+ |
GrDrawTarget::~GrDrawTarget() { |
+ // TODO: this seems like a reasonable assert |
+ //SkASSERT(fClosed); |
+ |
if (fRenderTarget && this == fRenderTarget->getLastDrawTarget()) { |
fRenderTarget->setLastDrawTarget(nullptr); |
} |
+ this->checkUses(); |
+ |
fGpu->unref(); |
} |
@@ -177,6 +204,9 @@ void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) { |
if (fFlushing) { |
return; |
} |
+ |
+ this->checkUses(); |
+ |
fFlushing = true; |
// Semi-usually the drawTargets are already closed at this point, but sometimes Ganesh |
@@ -208,7 +238,7 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBat |
// Setup clip |
GrPipelineBuilder::AutoRestoreStencil ars; |
GrAppliedClip clip; |
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds(), &clip)) { |
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds(), &clip, fRenderTarget)) { |
return; |
} |
GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps; |
@@ -276,7 +306,7 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder, |
// Setup clip |
GrPipelineBuilder::AutoRestoreStencil ars; |
GrAppliedClip clip; |
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, nullptr, &clip)) { |
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, nullptr, &clip, fRenderTarget)) { |
return; |
} |
@@ -337,7 +367,7 @@ void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder, |
GrPipelineBuilder::AutoRestoreStencil ars; |
GrAppliedClip clip; |
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds(), &clip)) { |
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &batch->bounds(), &clip, fRenderTarget)) { |
return; |
} |