Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Clear the GL context only after submitting the frame #20931

Merged
merged 4 commits into from
Sep 2, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions shell/common/rasterizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,6 @@ void Rasterizer::Draw(fml::RefPtr<Pipeline<flutter::LayerTree>> pipeline) {
consume_result = PipelineConsumeResult::MoreAvailable;
}

if (surface_ != nullptr) {
surface_->ClearRenderContext();
}

// Merging the thread as we know the next `Draw` should be run on the platform
// thread.
if (surface_ != nullptr && surface_->GetExternalViewEmbedder() != nullptr) {
Expand Down Expand Up @@ -474,6 +470,11 @@ RasterStatus Rasterizer::DrawToSurface(flutter::LayerTree& layer_tree) {
surface_->GetContext()->performDeferredCleanup(kSkiaCleanupExpiration);
}

// Clean 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;
}

Expand Down