diff --git a/engine/Build.bee.cs b/engine/Build.bee.cs index c8fec825..56f88dce 100644 --- a/engine/Build.bee.cs +++ b/engine/Build.bee.cs @@ -805,7 +805,7 @@ class Build // //Disable the persistent cache (via force its IsValid() method to always return false) in UIWidget engine for Mac //note that there might be some performance issue (mainly first frame delay) after this fix on Mac - np.Defines.Add(c => IsMac(c), "UIWIDGETS_FORCE_DISABLE_PERSISTENTCACHE=\\\"1\\\""); + np.Defines.Add(c => IsMac(c) || IsIosOrTvos(c), "UIWIDGETS_FORCE_DISABLE_PERSISTENTCACHE=\\\"1\\\""); np.Defines.Add(c => c.CodeGen == CodeGen.Debug, new[] { "_ITERATOR_DEBUG_LEVEL=2", "_HAS_ITERATOR_DEBUGGING=1", "_SECURE_SCL=1" }); diff --git a/engine/src/shell/common/rasterizer.cc b/engine/src/shell/common/rasterizer.cc index 9ff488ca..a243c701 100644 --- a/engine/src/shell/common/rasterizer.cc +++ b/engine/src/shell/common/rasterizer.cc @@ -88,6 +88,7 @@ void Rasterizer::DrawLastLayerTree() { return; } DrawToSurface(*last_layer_tree_); + surface_->ClearContext(); } void Rasterizer::Draw(fml::RefPtr> pipeline) { @@ -232,6 +233,8 @@ RasterStatus Rasterizer::DoDraw(std::unique_ptr layer_tree) { persistent_cache->ResetStoredNewShaders(); RasterStatus raster_status = DrawToSurface(*layer_tree); + surface_->ClearContext(); + if (raster_status == RasterStatus::kSuccess) { last_layer_tree_ = std::move(layer_tree); } else if (raster_status == RasterStatus::kResubmit) { @@ -325,7 +328,6 @@ RasterStatus Rasterizer::DrawToSurface(LayerTree& layer_tree) { if (compositor_frame) { RasterStatus raster_status = compositor_frame->Raster(layer_tree, false); if (raster_status == RasterStatus::kFailed) { - surface_->ClearContext(); return raster_status; } if (external_view_embedder != nullptr) { @@ -347,11 +349,9 @@ RasterStatus Rasterizer::DrawToSurface(LayerTree& layer_tree) { TRACE_EVENT0("uiwidgets", "PerformDeferredSkiaCleanup"); surface_->GetContext()->performDeferredCleanup(kSkiaCleanupExpiration); } - surface_->ClearContext(); return raster_status; } - surface_->ClearContext(); return RasterStatus::kFailed; }