diff options
author | Lingfeng Yang <lfy@google.com> | 2018-01-24 10:40:18 -0800 |
---|---|---|
committer | Lingfeng Yang <lfy@google.com> | 2018-01-24 12:21:46 -0800 |
commit | 3a9f223dd1fe6a74e6bcf9a1080280034043409c (patch) | |
tree | fca32b3b7b9490abadab526e64b2be71f7dc57f9 /libs/hwui/pipeline/skia/ShaderCache.cpp | |
parent | 1a68be0f0defb679a246352c30921bb011f2d5cb (diff) |
Don't use shader disk cache on emulator
bug: 71900691
Emulator user might switch renderers, migrate a snapshot to a different
machine with a different shader binary format, etc.
Plus, program binaries don't seem to work so well on some desktop GPUs.
Change-Id: I0c6239acbd556097494aa903d6603c963d3141cb
Diffstat (limited to 'libs/hwui/pipeline/skia/ShaderCache.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/ShaderCache.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/hwui/pipeline/skia/ShaderCache.cpp b/libs/hwui/pipeline/skia/ShaderCache.cpp index c7a30141803d..2fa56f613144 100644 --- a/libs/hwui/pipeline/skia/ShaderCache.cpp +++ b/libs/hwui/pipeline/skia/ShaderCache.cpp @@ -19,6 +19,7 @@ #include <log/log.h> #include <thread> #include "FileBlobCache.h" +#include "Properties.h" #include "utils/TraceUtils.h" namespace android { @@ -43,7 +44,11 @@ ShaderCache& ShaderCache::get() { void ShaderCache::initShaderDiskCache() { ATRACE_NAME("initShaderDiskCache"); std::lock_guard<std::mutex> lock(mMutex); - if (mFilename.length() > 0) { + + // Emulators can switch between different renders either as part of config + // or snapshot migration. Also, program binaries may not work well on some + // desktop / laptop GPUs. Thus, disable the shader disk cache for emulator builds. + if (!Properties::runningInEmulator && mFilename.length() > 0) { mBlobCache.reset(new FileBlobCache(maxKeySize, maxValueSize, maxTotalSize, mFilename)); mInitialized = true; } |