MCPcopy Create free account
hub / github.com/Snapchat/Valdi / ShaderCache

Method ShaderCache

valdi/src/valdi/snap_drawing/Graphics/ShaderCache.cpp:88–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88ShaderCache::ShaderCache(const Ref<IDiskCache>& diskCache, const Ref<DispatchQueue>& dispatchQueue, ILogger& logger)
89 : _logger(logger),
90 _queue(dispatchQueue),
91 _diskCache(diskCache->scopedCache(Path(fmt::format("{}", kShaderCacheVersion)), false)) {
92 _queue->async([diskCache, scopedDiskCache = _diskCache]() {
93 auto rootPath = diskCache->getRootPath();
94 auto currRootPath = scopedDiskCache->getRootPath();
95 for (const auto& folder : diskCache->list(rootPath)) {
96 if (folder != currRootPath) {
97 diskCache->remove(folder);
98 }
99 }
100 });
101}
102
103void ShaderCache::store(const SkData& key, const SkData& data) {
104 auto dataResult = skDataToByteView(data);

Callers

nothing calls this directly

Calls 6

removeMethod · 0.65
PathClass · 0.50
scopedCacheMethod · 0.45
asyncMethod · 0.45
getRootPathMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected