Add Drawing Manager guards against re-entrant flushes
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1538013002 Review URL: https://codereview.chromium.org/1538013002
This commit is contained in:
parent
c7a784cc8c
commit
b8918c42b7
@ -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() {
|
||||
|
@ -288,7 +288,6 @@ private:
|
||||
GrContext* fContext;
|
||||
GrGpu* fGpu;
|
||||
GrResourceProvider* fResourceProvider;
|
||||
bool fFlushing;
|
||||
|
||||
SkDEBUGCODE(int fDebugID;)
|
||||
uint32_t fFlags;
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user