aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-12-18 09:59:46 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-18 09:59:46 -0800
commitb8918c42b7a4a603e880f9db994f993ca0052ed2 (patch)
treee358e53861fa8947aefc6bc14435e1d2da7bb507 /src
parentc7a784cc8cb1c1dfcd39a32b2170ffe547904e9f (diff)
Add Drawing Manager guards against re-entrant flushes
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrDrawTarget.cpp8
-rw-r--r--src/gpu/GrDrawTarget.h1
-rw-r--r--src/gpu/GrDrawingManager.cpp6
-rw-r--r--src/gpu/GrDrawingManager.h4
4 files changed, 9 insertions, 10 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 55f6624984..3918ce2a21 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -39,7 +39,6 @@ GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* r
const Options& options)
: fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
- , fFlushing(false)
, fFlags(0)
, fRenderTarget(rt) {
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
@@ -183,11 +182,6 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
}
void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) {
- if (fFlushing) {
- return;
- }
- fFlushing = true;
-
// Semi-usually the drawTargets are already closed at this point, but sometimes Ganesh
// needs to flush mid-draw. In that case, the SkGpuDevice's drawTargets won't be closed
// but need to be flushed anyway. Closing such drawTargets here will mean new
@@ -216,8 +210,6 @@ void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
}
fBatches[i]->draw(flushState);
}
-
- fFlushing = false;
}
void GrDrawTarget::reset() {
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 42a6e798a0..7117ad3fe8 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -288,7 +288,6 @@ private:
GrContext* fContext;
GrGpu* fGpu;
GrResourceProvider* fResourceProvider;
- bool fFlushing;
SkDEBUGCODE(int fDebugID;)
uint32_t fFlags;
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 6e84f22e2c..7aa0fdbe0a 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -64,6 +64,11 @@ void GrDrawingManager::reset() {
}
void GrDrawingManager::flush() {
+ if (fFlushing) {
+ return;
+ }
+ fFlushing = true;
+
SkDEBUGCODE(bool result =)
SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(&fDrawTargets);
SkASSERT(result);
@@ -107,6 +112,7 @@ void GrDrawingManager::flush() {
#endif
fFlushState.reset();
+ fFlushing = false;
}
GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props,
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 672f7b08da..c72dad976b 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -60,7 +60,8 @@ private:
, fNVPRTextContext(nullptr)
, fPathRendererChain(nullptr)
, fSoftwarePathRenderer(nullptr)
- , fFlushState(context->getGpu(), context->resourceProvider()) {
+ , fFlushState(context->getGpu(), context->resourceProvider())
+ , fFlushing(false) {
sk_bzero(fTextContexts, sizeof(fTextContexts));
}
@@ -87,6 +88,7 @@ private:
GrSoftwarePathRenderer* fSoftwarePathRenderer;
GrBatchFlushState fFlushState;
+ bool fFlushing;
};
#endif