Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Commit 896d3e2

Browse files
committed
fix oom bug on android/ios opengles
1 parent c2e882d commit 896d3e2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

engine/Build.bee.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ static NativeProgram SetupLibUIWidgets(UIWidgetsBuildTargetPlatform platform, ou
805805
//
806806
//Disable the persistent cache (via force its IsValid() method to always return false) in UIWidget engine for Mac
807807
//note that there might be some performance issue (mainly first frame delay) after this fix on Mac
808-
np.Defines.Add(c => IsMac(c), "UIWIDGETS_FORCE_DISABLE_PERSISTENTCACHE=\\\"1\\\"");
808+
np.Defines.Add(c => IsMac(c) || IsIosOrTvos(c), "UIWIDGETS_FORCE_DISABLE_PERSISTENTCACHE=\\\"1\\\"");
809809

810810
np.Defines.Add(c => c.CodeGen == CodeGen.Debug,
811811
new[] { "_ITERATOR_DEBUG_LEVEL=2", "_HAS_ITERATOR_DEBUGGING=1", "_SECURE_SCL=1" });

engine/src/shell/common/rasterizer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ void Rasterizer::DrawLastLayerTree() {
8888
return;
8989
}
9090
DrawToSurface(*last_layer_tree_);
91+
surface_->ClearContext();
9192
}
9293

9394
void Rasterizer::Draw(fml::RefPtr<Pipeline<LayerTree>> pipeline) {
@@ -232,6 +233,8 @@ RasterStatus Rasterizer::DoDraw(std::unique_ptr<LayerTree> layer_tree) {
232233
persistent_cache->ResetStoredNewShaders();
233234

234235
RasterStatus raster_status = DrawToSurface(*layer_tree);
236+
surface_->ClearContext();
237+
235238
if (raster_status == RasterStatus::kSuccess) {
236239
last_layer_tree_ = std::move(layer_tree);
237240
} else if (raster_status == RasterStatus::kResubmit) {
@@ -325,7 +328,6 @@ RasterStatus Rasterizer::DrawToSurface(LayerTree& layer_tree) {
325328
if (compositor_frame) {
326329
RasterStatus raster_status = compositor_frame->Raster(layer_tree, false);
327330
if (raster_status == RasterStatus::kFailed) {
328-
surface_->ClearContext();
329331
return raster_status;
330332
}
331333
if (external_view_embedder != nullptr) {
@@ -347,11 +349,9 @@ RasterStatus Rasterizer::DrawToSurface(LayerTree& layer_tree) {
347349
TRACE_EVENT0("uiwidgets", "PerformDeferredSkiaCleanup");
348350
surface_->GetContext()->performDeferredCleanup(kSkiaCleanupExpiration);
349351
}
350-
surface_->ClearContext();
351352
return raster_status;
352353
}
353354

354-
surface_->ClearContext();
355355
return RasterStatus::kFailed;
356356
}
357357

0 commit comments

Comments
 (0)