| Flutter Impeller |

Classes | Public Member Functions | List of all members
impeller::compiler::Reflector Class Reference

`#include <reflector.h>`

## Classes
struct | Options

## Public Member Functions
| Reflector (Options options, const std::shared_ptr< const spirv_cross::ParsedIR > &ir, const std::shared_ptr< fml::Mapping > &shader_data, const CompilerBackend &compiler)
| ~Reflector ()
bool | IsValid () const
std::shared_ptr< fml::Mapping > | GetReflectionJSON () const
std::shared_ptr< fml::Mapping > | GetReflectionHeader () const
std::shared_ptr< fml::Mapping > | GetReflectionCC () const
std::shared_ptr< RuntimeStageData::Shader > | GetRuntimeStageShaderData () const
std::shared_ptr< ShaderBundleData > | GetShaderBundleData () const

## Detailed Description

Definition at line 144 of file reflector.h.

## Constructor & Destructor Documentation

## ◆ Reflector()

impeller::compiler::Reflector::Reflector | ( | Options | options,
|  | const std::shared_ptr< const spirv_cross::ParsedIR > & | ir,
|  | const std::shared_ptr< fml::Mapping > & | shader_data,
|  | const CompilerBackend & | compiler
| ) |  |

Definition at line 62 of file reflector.cc.

66 : options_(std::move(options)),
67 ir_(ir),
68 shader_data_(shader_data),
69 compiler_(compiler) {
70 if (!ir_ || !compiler_) {
71 return;
72 }
73
74 if (auto template_arguments = GenerateTemplateArguments();
75 template_arguments.has_value()) {
76 template_arguments_ =
77 std::make_unique<nlohmann::json>(std::move(template_arguments.value()));
78 } else {
79 return;
80 }
81
82 reflection_header_ = GenerateReflectionHeader();
83 if (!reflection_header_) {
84 return;
85 }
86
87 reflection_cc_ = GenerateReflectionCC();
88 if (!reflection_cc_) {
89 return;
90 }
91
92 runtime_stage_shader_ = GenerateRuntimeStageData();
93
94 shader_bundle_data_ = GenerateShaderBundleData();
95 if (!shader_bundle_data_) {
96 return;
97 }
98
99 is_valid_ = true;
100 }

## ◆ ~Reflector()

impeller::compiler::Reflector::~Reflector | ( |  | ) |
| default

## Member Function Documentation

## ◆ GetReflectionCC()

std::shared_ptr< fml::Mapping > impeller::compiler::Reflector::GetReflectionCC | ( |  | ) | const

Definition at line 125 of file reflector.cc.

125 {
126 return reflection_cc_;
127 }

Referenced by impeller::compiler::OutputReflectionData().

## ◆ GetReflectionHeader()

std::shared_ptr< fml::Mapping > impeller::compiler::Reflector::GetReflectionHeader | ( |  | ) | const

Definition at line 121 of file reflector.cc.

121 {
122 return reflection_header_;
123 }

Referenced by impeller::compiler::OutputReflectionData().

## ◆ GetReflectionJSON()

std::shared_ptr< fml::Mapping > impeller::compiler::Reflector::GetReflectionJSON | ( |  | ) | const

Definition at line 108 of file reflector.cc.

108 {
109 if (!is_valid_) {
110 return nullptr;
111 }
112
113 auto json_string =
114 std::make_shared<std::string>(template_arguments_->dump(2u));
115
116 return std::make_shared<fml::NonOwnedMapping>(
117 reinterpret_cast<const uint8_t*>(json_string->data()),
118 json_string->size(), [json_string](auto, auto) {});
119 }

Referenced by impeller::compiler::OutputReflectionData().

## ◆ GetRuntimeStageShaderData()

std::shared_ptr< RuntimeStageData::Shader > impeller::compiler::Reflector::GetRuntimeStageShaderData | ( |  | ) | const

Definition at line 129 of file reflector.cc.

130 {
131 return runtime_stage_shader_;
132 }

Referenced by impeller::compiler::CompileSkSL(), and impeller::compiler::OutputIPLR().

## ◆ GetShaderBundleData()

std::shared_ptr< ShaderBundleData > impeller::compiler::Reflector::GetShaderBundleData | ( |  | ) | const

Definition at line 134 of file reflector.cc.

134 {
135 return shader_bundle_data_;
136 }

Referenced by impeller::compiler::GenerateShaderBackendFB().

## ◆ IsValid()

bool impeller::compiler::Reflector::IsValid | ( |  | ) | const

Definition at line 104 of file reflector.cc.

104 {
105 return is_valid_;
106 }

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

- impeller/compiler/reflector.h
- impeller/compiler/reflector.cc