diff --git a/shell/common/persistent_cache.cc b/shell/common/persistent_cache.cc index 23308fe4fa228..66690971ace46 100644 --- a/shell/common/persistent_cache.cc +++ b/shell/common/persistent_cache.cc @@ -47,7 +47,7 @@ std::atomic PersistentCache::cache_sksl_ = false; std::atomic PersistentCache::strategy_set_ = false; void PersistentCache::SetCacheSkSL(bool value) { - if (strategy_set_) { + if (strategy_set_ && value != cache_sksl_) { FML_LOG(ERROR) << "Cache SkSL can only be set before the " "GrContextOptions::fShaderCacheStrategy is set."; return; diff --git a/shell/common/shell_io_manager.cc b/shell/common/shell_io_manager.cc index 76db8505c9be1..2b3a9c00582c4 100644 --- a/shell/common/shell_io_manager.cc +++ b/shell/common/shell_io_manager.cc @@ -19,6 +19,12 @@ sk_sp ShellIOManager::CreateCompatibleResourceLoadingContext( GrContextOptions options = {}; + if (PersistentCache::cache_sksl()) { + FML_LOG(INFO) << "Cache SkSL"; + options.fShaderCacheStrategy = GrContextOptions::ShaderCacheStrategy::kSkSL; + } + PersistentCache::MarkStrategySet(); + options.fPersistentCache = PersistentCache::GetCacheForProcess(); // There is currently a bug with doing GPU YUV to RGB conversions on the IO diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index 0aeeb3d78e65e..5f30a48375d33 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -50,8 +50,8 @@ GPUSurfaceGL::GPUSurfaceGL(GPUSurfaceGLDelegate* delegate, if (PersistentCache::cache_sksl()) { FML_LOG(INFO) << "Cache SkSL"; options.fShaderCacheStrategy = GrContextOptions::ShaderCacheStrategy::kSkSL; - PersistentCache::MarkStrategySet(); } + PersistentCache::MarkStrategySet(); options.fPersistentCache = PersistentCache::GetCacheForProcess(); options.fAvoidStencilBuffers = true;