| Flutter Impeller |

Public Member Functions | List of all members
impeller::MultiArchShaderArchiveWriter Class Reference

`#include <multi_arch_shader_archive_writer.h>`

## Public Member Functions
| MultiArchShaderArchiveWriter ()
| ~MultiArchShaderArchiveWriter ()
bool | RegisterShaderArchive (ArchiveRenderingBackend backend, std::shared_ptr< const fml::Mapping > mapping)
std::shared_ptr< fml::Mapping > | CreateMapping () const

## Detailed Description

Definition at line 16 of file multi_arch_shader_archive_writer.h.

## Constructor & Destructor Documentation

## ◆ MultiArchShaderArchiveWriter()

impeller::MultiArchShaderArchiveWriter::MultiArchShaderArchiveWriter | ( |  | ) |
| default

## ◆ ~MultiArchShaderArchiveWriter()

impeller::MultiArchShaderArchiveWriter::~MultiArchShaderArchiveWriter | ( |  | ) |
| default

## Member Function Documentation

## ◆ CreateMapping()

std::shared_ptr< fml::Mapping > impeller::MultiArchShaderArchiveWriter::CreateMapping | ( |  | ) | const

Definition at line 44 of file multi_arch_shader_archive_writer.cc.

45 {
46 fb::MultiArchShaderArchiveT multi_archive;
47 for (const auto& archive : archives_) {
48 auto archive_blob = std::make_unique<fb::ShaderArchiveBlobT>();
49 archive_blob->rendering_backend = ToRenderingBackend(archive.first);
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));
54 }
55 auto builder = std::make_shared<flatbuffers::FlatBufferBuilder>();
56 builder->Finish(
57 fb::MultiArchShaderArchive::Pack(*builder.get(), &multi_archive),
58 fb::MultiArchShaderArchiveIdentifier());
59 return std::make_shared<fml::NonOwnedMapping>(builder->GetBufferPointer(),
60 builder->GetSize(),
61 [builder](auto, auto) {});
62 }

References impeller::ToRenderingBackend().

Referenced by impeller::testing::TEST().

## ◆ RegisterShaderArchive()

bool impeller::MultiArchShaderArchiveWriter::RegisterShaderArchive | ( | ArchiveRenderingBackend | backend,
|  | std::shared_ptr< const fml::Mapping > | mapping
| ) |  |

Definition at line 16 of file multi_arch_shader_archive_writer.cc.

18 {
19 if (!mapping || mapping->GetMapping() == nullptr) {
20 return false;
21 }
22 if (archives_.find(backend) != archives_.end()) {
23 VALIDATION_LOG << "Multi-archive already has a shader library registered "
24 "for that backend.";
25 return false;
26 }
27 archives_[backend] = std::move(mapping);
28 return true;
29 }

References VALIDATION_LOG.

Referenced by impeller::testing::TEST().

The documentation for this class was generated from the following files:

- impeller/shader_archive/multi_arch_shader_archive_writer.h
- impeller/shader_archive/multi_arch_shader_archive_writer.cc

impeller::ToRenderingBackend
constexpr fb::RenderingBackend ToRenderingBackend(ArchiveRenderingBackend backend)
Definition: multi_arch_shader_archive_writer.cc:31
VALIDATION_LOG
#define VALIDATION_LOG
Definition: validation.h:73