| 35 | } |
| 36 | |
| 37 | static 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 | |
| 50 | Result<BytesView> ShaderCache::loadShaderFromDisk(const BytesView& key) const { |
| 51 | auto keyFilePathResult = keyToFileName(key); |