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

Unified Diff: src/gpu/GrContext.cpp

Issue 1414773002: Add the machinery to GrDrawTarget to enable topological sorting (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 5 years, 2 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 | « no previous file | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index e5bbb8fd918fcf0f4c3da9b0fba595979fb8273b..f05d8e66144966a6c7fefc52675edfbd82554faa 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -45,7 +45,7 @@
#include "SkTLazy.h"
#include "SkTLS.h"
#include "SkTraceEvent.h"
-
+#include "SkTTopoSort.h"
#include "batches/GrBatch.h"
@@ -95,9 +95,21 @@ void GrDrawingManager::reset() {
}
void GrDrawingManager::flush() {
+ SkDEBUGCODE(bool result =)
+ SkTTopoSort<GrDrawTarget, GrDrawTarget::TopoSortTraits>(&fDrawTargets);
+ SkASSERT(result);
+
for (int i = 0; i < fDrawTargets.count(); ++i) {
fDrawTargets[i]->flush();
}
+
+#ifndef ENABLE_MDB
+ // When MDB is disabled we keep reusing the same drawTarget
+ if (fDrawTargets.count()) {
+ SkASSERT(fDrawTargets.count() == 1);
+ fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag);
+ }
+#endif
}
GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props,
@@ -131,8 +143,8 @@ GrTextContext* GrDrawingManager::textContext(const SkSurfaceProps& props,
GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
SkASSERT(fContext);
- // When MDB is disabled we always just return the single drawTarget
#ifndef ENABLE_MDB
+ // When MDB is disabled we always just return the single drawTarget
if (fDrawTargets.count()) {
SkASSERT(fDrawTargets.count() == 1);
// DrawingManager gets the creation ref - this ref is for the caller
« no previous file with comments | « no previous file | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698