From 30d6603d43a591eadedfff08c467fe76c7110779 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Wed, 22 Jul 2026 09:29:24 -0400 Subject: [PATCH] [ganesh] Skip resolve/mipmap step on flush failure This AI generated patch seems reasonable and harmless enough. I do think that it is only a small part of a larger problem around Ganesh's handling of flush failures. In practice, Chrome will have to have handled the flush failure via the callback system in order to respond to the failure. That handling should discard the texture the bug is worried about. This CL adds a bit of defense in depth (and seems harmless). Bug: https://issues.chromium.org/issues/536165038 Change-Id: I55adb244deb8656a2895771491456a3770c8a2fa Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1299577 Reviewed-by: Michael Ludwig Commit-Queue: Robert Phillips --- src/gpu/ganesh/GrDrawingManager.cpp | 11 ++- tests/GrSurfaceResolveTest.cpp | 122 ++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 3 deletions(-) diff --git a/src/gpu/ganesh/GrDrawingManager.cpp b/src/gpu/ganesh/GrDrawingManager.cpp index 4fa514b1df..0b986ebff2 100644 --- a/src/gpu/ganesh/GrDrawingManager.cpp +++ b/src/gpu/ganesh/GrDrawingManager.cpp @@ -126,7 +126,9 @@ bool GrDrawingManager::flush(SkSpan proxies, if (info.fSubmittedProc) { info.fSubmittedProc(info.fSubmittedContext, true); } - return false; + // Nothing to flush is a success (fSubmittedProc is already called with `true` + // above). + return true; } } @@ -542,8 +544,11 @@ GrSemaphoresSubmitted GrDrawingManager::flushSurfaces(SkSpan pr // portion of the DAG required by 'proxies' in order to restore some of the // semantics of this method. bool didFlush = this->flush(proxies, access, info, newState); - for (GrSurfaceProxy* proxy : proxies) { - resolve_and_mipmap(gpu, proxy); + if (didFlush) { + // Only resolve/regen mips if the flush actually executed the render tasks. + for (GrSurfaceProxy* proxy : proxies) { + resolve_and_mipmap(gpu, proxy); + } } SkDEBUGCODE(this->validate()); -- 2.53.0