Flutter Impeller
impeller::compiler::Reflector Class Reference

#include <reflector.h>

Classes

struct  Options
 

Public Member Functions

 Reflector (Options options, std::shared_ptr< const spirv_cross::ParsedIR > ir, std::shared_ptr< fml::Mapping > shader_data, 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< RuntimeStageDataGetRuntimeStageData () const
 

Detailed Description

Definition at line 49 of file reflector.h.

Constructor & Destructor Documentation

◆ Reflector()

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

Definition at line 114 of file reflector.cc.

118  : options_(std::move(options)),
119  ir_(std::move(ir)),
120  shader_data_(std::move(shader_data)),
121  compiler_(std::move(compiler)) {
122  if (!ir_ || !compiler_) {
123  return;
124  }
125 
126  if (auto template_arguments = GenerateTemplateArguments();
127  template_arguments.has_value()) {
128  template_arguments_ =
129  std::make_unique<nlohmann::json>(std::move(template_arguments.value()));
130  } else {
131  return;
132  }
133 
134  reflection_header_ = GenerateReflectionHeader();
135  if (!reflection_header_) {
136  return;
137  }
138 
139  reflection_cc_ = GenerateReflectionCC();
140  if (!reflection_cc_) {
141  return;
142  }
143 
144  runtime_stage_data_ = GenerateRuntimeStageData();
145  if (!runtime_stage_data_) {
146  return;
147  }
148 
149  is_valid_ = true;
150 }

◆ ~Reflector()

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

Member Function Documentation

◆ GetReflectionCC()

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

Definition at line 175 of file reflector.cc.

175  {
176  return reflection_cc_;
177 }

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

◆ GetReflectionHeader()

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

Definition at line 171 of file reflector.cc.

171  {
172  return reflection_header_;
173 }

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

◆ GetReflectionJSON()

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

Definition at line 158 of file reflector.cc.

158  {
159  if (!is_valid_) {
160  return nullptr;
161  }
162 
163  auto json_string =
164  std::make_shared<std::string>(template_arguments_->dump(2u));
165 
166  return std::make_shared<fml::NonOwnedMapping>(
167  reinterpret_cast<const uint8_t*>(json_string->data()),
168  json_string->size(), [json_string](auto, auto) {});
169 }

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

◆ GetRuntimeStageData()

std::shared_ptr< RuntimeStageData > impeller::compiler::Reflector::GetRuntimeStageData ( ) const

Definition at line 179 of file reflector.cc.

179  {
180  return runtime_stage_data_;
181 }

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

◆ IsValid()

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

Definition at line 154 of file reflector.cc.

154  {
155  return is_valid_;
156 }

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