summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/ShaderCache.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/pipeline/skia/ShaderCache.h')
-rw-r--r--libs/hwui/pipeline/skia/ShaderCache.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/libs/hwui/pipeline/skia/ShaderCache.h b/libs/hwui/pipeline/skia/ShaderCache.h
index d41aadb269dd..0898017d52a1 100644
--- a/libs/hwui/pipeline/skia/ShaderCache.h
+++ b/libs/hwui/pipeline/skia/ShaderCache.h
@@ -75,6 +75,13 @@ public:
*/
void store(const SkData& key, const SkData& data) override;
+ /**
+ * "onVkFrameFlushed" tries to store Vulkan pipeline cache state.
+ * Pipeline cache is saved on disk only if the size of the data has changed or there was
+ * a new shader compiled.
+ */
+ void onVkFrameFlushed(GrContext* context);
+
private:
// Creation and (the lack of) destruction is handled internally.
ShaderCache();
@@ -167,6 +174,33 @@ private:
mutable std::mutex mMutex;
/**
+ * If set to "true", the next call to onVkFrameFlushed, will invoke
+ * GrCanvas::storeVkPipelineCacheData. This does not guarantee that data will be stored on disk.
+ */
+ bool mTryToStorePipelineCache = true;
+
+ /**
+ * This flag is used by "ShaderCache::store" to distinguish between shader data and
+ * Vulkan pipeline data.
+ */
+ bool mInStoreVkPipelineInProgress = false;
+
+ /**
+ * "mNewPipelineCacheSize" has the size of the new Vulkan pipeline cache data. It is used
+ * to prevent unnecessary disk writes, if the pipeline cache size has not changed.
+ */
+ size_t mNewPipelineCacheSize = -1;
+ /**
+ * "mOldPipelineCacheSize" has the size of the Vulkan pipeline cache data stored on disk.
+ */
+ size_t mOldPipelineCacheSize = -1;
+
+ /**
+ * "mCacheDirty" is true when there is new shader cache data, which is not saved to disk.
+ */
+ bool mCacheDirty = false;
+
+ /**
* "sCache" is the singleton ShaderCache object.
*/
static ShaderCache sCache;