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/GrDrawingManager.cpp

Issue 1441533003: Update testing frameworks/tests for MDB (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix ref counting bug Created 5 years, 1 month 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/GrDrawingManager.h ('k') | src/gpu/GrTest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawingManager.cpp
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 74459daa48b0514fe51d599bedd960cf7c7a2bc2..73b7d1695eb4055f80ee7c49fc5b653dbdc39af9 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -14,10 +14,12 @@
#include "GrStencilAndCoverTextContext.h"
#include "SkTTopoSort.h"
-//#define ENABLE_MDB 1
void GrDrawingManager::cleanup() {
for (int i = 0; i < fDrawTargets.count(); ++i) {
+ fDrawTargets[i]->makeClosed(); // no drawTarget should receive a new command after this
+ fDrawTargets[i]->clearRT();
+
fDrawTargets[i]->unref();
}
@@ -85,17 +87,25 @@ void GrDrawingManager::flush() {
SkASSERT(fFlushState.lastFlushedToken() == fFlushState.currentToken());
+ for (int i = 0; i < fDrawTargets.count(); ++i) {
+ fDrawTargets[i]->reset();
+#ifdef ENABLE_MDB
+ fDrawTargets[i]->unref();
+#endif
+ }
+
#ifndef ENABLE_MDB
// When MDB is disabled we keep reusing the same drawTarget
if (fDrawTargets.count()) {
SkASSERT(fDrawTargets.count() == 1);
+ // Clear out this flag so the topological sort's SkTTopoSort_CheckAllUnmarked check
+ // won't bark
fDrawTargets[0]->resetFlag(GrDrawTarget::kWasOutput_Flag);
}
+#else
+ fDrawTargets.reset();
#endif
- for (int i = 0; i < fDrawTargets.count(); ++i) {
- fDrawTargets[i]->reset();
- }
fFlushState.reset();
}
@@ -134,6 +144,9 @@ GrDrawTarget* GrDrawingManager::newDrawTarget(GrRenderTarget* rt) {
// When MDB is disabled we always just return the single drawTarget
if (fDrawTargets.count()) {
SkASSERT(fDrawTargets.count() == 1);
+ // In the non-MDB-world the same drawTarget gets reused for multiple render targets.
+ // Update this pointer so all the asserts are happy
+ rt->setLastDrawTarget(fDrawTargets[0]);
// DrawingManager gets the creation ref - this ref is for the caller
return SkRef(fDrawTargets[0]);
}
« no previous file with comments | « src/gpu/GrDrawingManager.h ('k') | src/gpu/GrTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698