8 #include "impeller/shader_archive/multi_arch_shader_archive_flatbuffers.h"
18 std::shared_ptr<const fml::Mapping> mapping) {
19 if (!mapping || mapping->GetMapping() ==
nullptr) {
22 if (archives_.find(backend) != archives_.end()) {
23 VALIDATION_LOG <<
"Multi-archive already has a shader library registered "
27 archives_[backend] = std::move(mapping);
35 return fb::RenderingBackend::kMetal;
37 return fb::RenderingBackend::kVulkan;
39 return fb::RenderingBackend::kOpenGLES;
46 fb::MultiArchShaderArchiveT multi_archive;
47 for (
const auto& archive : archives_) {
48 auto archive_blob = std::make_unique<fb::ShaderArchiveBlobT>();
50 archive_blob->mapping = {
51 archive.second->GetMapping(),
52 archive.second->GetMapping() + archive.second->GetSize()};
53 multi_archive.items.emplace_back(std::move(archive_blob));
55 auto builder = std::make_shared<flatbuffers::FlatBufferBuilder>();
57 fb::MultiArchShaderArchive::Pack(*builder.get(), &multi_archive),
58 fb::MultiArchShaderArchiveIdentifier());
59 return std::make_shared<fml::NonOwnedMapping>(builder->GetBufferPointer(),
61 [builder](
auto,
auto) {});