Index: src/gpu/GrDrawingManager.cpp |
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp |
index e8cea756228c210e204ac95bca011071c94a6dfc..4cee34ec7f45e10dc73cd9c0a0dd347eb1b3c086 100644 |
--- a/src/gpu/GrDrawingManager.cpp |
+++ b/src/gpu/GrDrawingManager.cpp |
@@ -129,10 +129,12 @@ 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 redundant client flushes. |
robertphillips
2016/09/13 13:05:21
Should this 'fLastFlushType' be 'type' ?
I guess I
bsalomon
2016/09/13 13:31:32
Changing it slightly to:
// Avoid notifying t
robertphillips
2016/09/13 13:56:48
That is far clearer. \o/
|
+ bool skipNotify = !flushed && GrResourceCache::kExternal != fLastFlushType; |
+ if (!skipNotify) { |
fContext->getResourceCache()->notifyFlushOccurred(type); |
} |
+ fLastFlushType = type; |
fFlushing = false; |
} |
@@ -145,6 +147,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(); |