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

Function skDataToByteView

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

Source from the content-addressed store, hash-verified

35}
36
37static Result<Valdi::BytesView> skDataToByteView(const SkData& data) {
38 if (data.data() == nullptr || data.isEmpty()) {
39 return Error("Provided shader data is empty");
40 }
41
42 auto retval = Valdi::makeShared<Valdi::ByteBuffer>();
43 auto start_ptr = static_cast<const Valdi::Byte*>(data.data());
44 auto end_ptr = static_cast<const Valdi::Byte*>(data.data()) + data.size();
45
46 retval->append(start_ptr, end_ptr);
47 return retval->toBytesView();
48}
49
50Result<BytesView> ShaderCache::loadShaderFromDisk(const BytesView& key) const {
51 auto keyFilePathResult = keyToFileName(key);

Callers 1

storeMethod · 0.85

Calls 6

appendMethod · 0.65
ErrorInterface · 0.50
dataMethod · 0.45
isEmptyMethod · 0.45
sizeMethod · 0.45
toBytesViewMethod · 0.45

Tested by

no test coverage detected