aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawingManager.cpp
diff options
context:
space:
mode:
authorGravatar Chris Dalton <csmartdalton@google.com>2018-04-18 13:24:25 -0600
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-18 20:00:53 +0000
commit91ab15588451be2f7ec87635590f1e4f90bbbf9a (patch)
tree81c7c8e4519675b086fdb0a0bd323883e7fd3037 /src/gpu/GrDrawingManager.cpp
parent15a64e71f68f7d1fcd16247c3d30375d3e2f41e8 (diff)
Always call endFlush on opLists that might survive a flush
We were missing a few that got unreffed due to failed proxy instantiation. Bug: skia:7655 Bug: skia:7111 Change-Id: I95847a16890f2993a1433d4d9fdaa8a4a6c2f0b6 Reviewed-on: https://skia-review.googlesource.com/122121 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/GrDrawingManager.cpp')
-rw-r--r--src/gpu/GrDrawingManager.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index d0e3cfea74..86fee30925 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -226,6 +226,14 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
}
}
+#ifdef SK_DEBUG
+ for (const auto& opList : fOpLists) {
+ // If there are any remaining opLists at this point, make sure they will not survive the
+ // flush. Otherwise we need to call endFlush() on them.
+ // http://skbug.com/7111
+ SkASSERT(!opList || opList->unique());
+ }
+#endif
fOpLists.reset();
GrSemaphoresSubmitted result = gpu->finishFlush(numSemaphores, backendSemaphores);
@@ -246,6 +254,13 @@ GrSemaphoresSubmitted GrDrawingManager::internalFlush(GrSurfaceProxy*,
return result;
}
+static void end_oplist_flush_if_not_unique(const sk_sp<GrOpList>& opList) {
+ if (!opList->unique()) {
+ // TODO: Eventually this should be guaranteed unique: http://skbug.com/7111
+ opList->endFlush();
+ }
+}
+
bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushState* flushState) {
SkASSERT(startIndex <= stopIndex && stopIndex <= fOpLists.count());
@@ -260,12 +275,14 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
if (resourceProvider->explicitlyAllocateGPUResources()) {
if (!fOpLists[i]->isInstantiated()) {
// If the backing surface wasn't allocated drop the draw of the entire opList.
+ end_oplist_flush_if_not_unique(fOpLists[i]); // http://skbug.com/7111
fOpLists[i] = nullptr;
continue;
}
} else {
if (!fOpLists[i]->instantiate(resourceProvider)) {
SkDebugf("OpList failed to instantiate.\n");
+ end_oplist_flush_if_not_unique(fOpLists[i]); // http://skbug.com/7111
fOpLists[i] = nullptr;
continue;
}
@@ -313,11 +330,7 @@ bool GrDrawingManager::executeOpLists(int startIndex, int stopIndex, GrOpFlushSt
if (!fOpLists[i]) {
continue;
}
- if (!fOpLists[i]->unique()) {
- // TODO: Eventually this should be guaranteed unique.
- // https://bugs.chromium.org/p/skia/issues/detail?id=7111
- fOpLists[i]->endFlush();
- }
+ end_oplist_flush_if_not_unique(fOpLists[i]); // http://skbug.com/7111
fOpLists[i] = nullptr;
}