From 18846fc5b7a057132f8a47a4a84520ba16efec33 Mon Sep 17 00:00:00 2001 From: Yuqian Li Date: Mon, 14 Oct 2019 11:22:46 -0700 Subject: [PATCH 1/2] Change IO thread shader cache strategy So it's the same with the GPU thread. --- shell/common/shell_io_manager.cc | 6 ++++++ shell/gpu/gpu_surface_gl.cc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) 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; From 6d884f2d70facb73ca555b4da0815f3608eb000c Mon Sep 17 00:00:00 2001 From: Yuqian Li Date: Mon, 14 Oct 2019 12:27:04 -0700 Subject: [PATCH 2/2] Do not print warning if strategy is not changed --- shell/common/persistent_cache.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;