mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Change IO thread shader cache strategy (flutter/engine#13121)
So it's the same with the GPU thread. Otherwise, some shaders may be cached in binary on the IO thread, and we will lose them when we do the SkSL precompile. For b/140174804
This commit is contained in:
parent
4aa3ee0c26
commit
892f852039
@ -47,7 +47,7 @@ std::atomic<bool> PersistentCache::cache_sksl_ = false;
|
||||
std::atomic<bool> 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;
|
||||
|
||||
@ -19,6 +19,12 @@ sk_sp<GrContext> 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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user