From aea17076cb00884099ae57dbea6e1f920e9b100c Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 2 Sep 2020 15:08:16 -0700 Subject: [PATCH] Clear GL context before Gr context (flutter/engine#20957) --- engine/src/flutter/shell/common/rasterizer.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/engine/src/flutter/shell/common/rasterizer.cc b/engine/src/flutter/shell/common/rasterizer.cc index 6a2c2ee1f1..f80ab4a8ed 100644 --- a/engine/src/flutter/shell/common/rasterizer.cc +++ b/engine/src/flutter/shell/common/rasterizer.cc @@ -467,16 +467,19 @@ RasterStatus Rasterizer::DrawToSurface(flutter::LayerTree& layer_tree) { FireNextFrameCallbackIfPresent(); + // Clear the render context after submitting the frame. + // This ensures that the GL context is released after drawing to the + // surface. + // + // The GL context must be clear before performing Gr context deferred + // cleanup. + surface_->ClearRenderContext(); + if (surface_->GetContext()) { TRACE_EVENT0("flutter", "PerformDeferredSkiaCleanup"); surface_->GetContext()->performDeferredCleanup(kSkiaCleanupExpiration); } - // Clear the render context after submitting the frame. - // This ensures that the GL context is released after drawing to the - // surface. - surface_->ClearRenderContext(); - return raster_status; }