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

Method storeShaderToDisk

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

Source from the content-addressed store, hash-verified

69}
70
71void ShaderCache::storeShaderToDisk(const BytesView& key, const BytesView& data) const {
72 auto keyFilePathResult = keyToFileName(key);
73 if (keyFilePathResult.failure()) {
74 VALDI_ERROR(_logger, "Failed to generate file name from key");
75 return;
76 }
77 auto keyFilePath = keyFilePathResult.moveValue();
78 if (_diskCache->exists(keyFilePath)) {
79 VALDI_WARN(_logger, "Overwriting shader item for {}", keyFilePath);
80 }
81
82 auto storeResult = _diskCache->store(keyFilePath, data);
83 if (storeResult.failure()) {
84 VALDI_ERROR(_logger, "Failed to store content for {} with error {}", keyFilePath, storeResult.error());
85 }
86}
87
88ShaderCache::ShaderCache(const Ref<IDiskCache>& diskCache, const Ref<DispatchQueue>& dispatchQueue, ILogger& logger)
89 : _logger(logger),

Callers 1

storeMethod · 0.80

Calls 5

keyToFileNameFunction · 0.85
existsMethod · 0.65
storeMethod · 0.65
errorMethod · 0.65
failureMethod · 0.45

Tested by

no test coverage detected