| 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

## Detailed Description

Definition at line 51 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 102 of file reflector.cc.

106 : options_(std::move(options)),
107 ir_(ir),
108 shader_data_(shader_data),
109 compiler_(compiler) {
110 if (!ir_ || !compiler_) {
111 return;
112 }
113
114 if (auto template_arguments = GenerateTemplateArguments();
115 template_arguments.has_value()) {
116 template_arguments_ =
117 std::make_unique<nlohmann::json>(std::move(template_arguments.value()));
118 } else {
119 return;
120 }
121
122 reflection_header_ = GenerateReflectionHeader();
123 if (!reflection_header_) {
124 return;
125 }
126
127 reflection_cc_ = GenerateReflectionCC();
128 if (!reflection_cc_) {
129 return;
130 }
131
132 runtime_stage_shader_ = GenerateRuntimeStageData();
133
134 is_valid_ = true;
135 }

## ◆ ~Reflector()

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

## Member Function Documentation

## ◆ GetReflectionCC()

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

Definition at line 160 of file reflector.cc.

160 {
161 return reflection_cc_;
162 }

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

## ◆ GetReflectionHeader()

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

Definition at line 156 of file reflector.cc.

156 {
157 return reflection_header_;
158 }

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

## ◆ GetReflectionJSON()

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

Definition at line 143 of file reflector.cc.

143 {
144 if (!is_valid_) {
145 return nullptr;
146 }
147
148 auto json_string =
149 std::make_shared<std::string>(template_arguments_->dump(2u));
150
151 return std::make_shared<fml::NonOwnedMapping>(
152 reinterpret_cast<const uint8_t*>(json_string->data()),
153 json_string->size(), [json_string](auto, auto) {});
154 }

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

## ◆ GetRuntimeStageShaderData()

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

Definition at line 164 of file reflector.cc.

165 {
166 return runtime_stage_shader_;
167 }

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

## ◆ IsValid()

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

Definition at line 139 of file reflector.cc.

139 {
140 return is_valid_;
141 }

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

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