Index: src/gpu/GrDrawingManager.cpp |
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp |
index 5e9b68d88f3b40ddb14866b0957b1149b255e6ca..75195670b2530744e73740fb9eb3ca3926667d16 100644 |
--- a/src/gpu/GrDrawingManager.cpp |
+++ b/src/gpu/GrDrawingManager.cpp |
@@ -129,10 +129,17 @@ void GrDrawingManager::internalFlush(GrResourceCache::FlushType type) { |
#endif |
fFlushState.reset(); |
- // We always have to notify the cache when it requested a flush so it can reset its state. |
- if (flushed || type == GrResourceCache::FlushType::kCacheRequested) { |
+ // Avoid notifying the cache about successive client flushes where no rendering occurred between |
+ // them. |
+ bool skipNotify = false; |
+ if (!flushed) { |
+ skipNotify = GrResourceCache::kExternal == fLastFlushType && |
+ GrResourceCache::kExternal == type; |
+ } |
+ if (!skipNotify) { |
fContext->getResourceCache()->notifyFlushOccurred(type); |
} |
+ fLastFlushType = type; |
fFlushing = false; |
} |
@@ -145,6 +152,9 @@ void GrDrawingManager::prepareSurfaceForExternalIO(GrSurface* surface) { |
if (surface->surfacePriv().hasPendingIO()) { |
this->flush(); |
+ } else if (GrResourceCache::kExternal != fLastFlushType) { |
+ fContext->getResourceCache()->notifyFlushOccurred(GrResourceCache::kExternal); |
+ fLastFlushType = GrResourceCache::kExternal; |
} |
GrRenderTarget* rt = surface->asRenderTarget(); |