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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 8 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 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;
}
« 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