Index: src/gpu/GrDrawingManager.cpp |
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp |
index bfb586b8c1c9d2fd3d94f210e98349a714b7594e..74459daa48b0514fe51d599bedd960cf7c7a2bc2 100644 |
--- a/src/gpu/GrDrawingManager.cpp |
+++ b/src/gpu/GrDrawingManager.cpp |
@@ -58,6 +58,7 @@ void GrDrawingManager::reset() { |
for (int i = 0; i < fDrawTargets.count(); ++i) { |
fDrawTargets[i]->reset(); |
} |
+ fFlushState.reset(); |
} |
void GrDrawingManager::flush() { |
@@ -65,11 +66,25 @@ void GrDrawingManager::flush() { |
SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(&fDrawTargets); |
SkASSERT(result); |
+#if 0 |
for (int i = 0; i < fDrawTargets.count(); ++i) { |
- //SkDEBUGCODE(fDrawTargets[i]->dump();) |
- fDrawTargets[i]->flush(); |
+ SkDEBUGCODE(fDrawTargets[i]->dump();) |
+ } |
+#endif |
+ |
+ for (int i = 0; i < fDrawTargets.count(); ++i) { |
+ fDrawTargets[i]->prepareBatches(&fFlushState); |
} |
+ // Upload all data to the GPU |
+ fFlushState.preIssueDraws(); |
+ |
+ for (int i = 0; i < fDrawTargets.count(); ++i) { |
+ fDrawTargets[i]->drawBatches(&fFlushState); |
+ } |
+ |
+ SkASSERT(fFlushState.lastFlushedToken() == fFlushState.currentToken()); |
+ |
#ifndef ENABLE_MDB |
// When MDB is disabled we keep reusing the same drawTarget |
if (fDrawTargets.count()) { |
@@ -77,6 +92,11 @@ void GrDrawingManager::flush() { |
fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag); |
} |
#endif |
+ |
+ for (int i = 0; i < fDrawTargets.count(); ++i) { |
+ fDrawTargets[i]->reset(); |
+ } |
+ fFlushState.reset(); |
} |
GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props, |
@@ -119,8 +139,7 @@ GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) { |
} |
#endif |
- GrDrawTarget* dt = new GrDrawTarget(rt, fContext->getGpu(), fContext->resourceProvider(), |
- fOptions); |
+ GrDrawTarget* dt = new GrDrawTarget(rt, fContext->getGpu(), fContext->resourceProvider()); |
*fDrawTargets.append() = dt; |