| Flutter Impeller |

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

`#include <runtime_stage.h>`

## Public Member Functions
| RuntimeStage (std::shared_ptr< fml::Mapping > payload)
| ~RuntimeStage ()
| RuntimeStage (RuntimeStage &&)
RuntimeStage & | operator= (RuntimeStage &&)
bool | IsValid () const
RuntimeShaderStage | GetShaderStage () const
const std::vector< RuntimeUniformDescription > & | GetUniforms () const
const std::string & | GetEntrypoint () const
const RuntimeUniformDescription * | GetUniform (const std::string &name) const
const std::shared_ptr< fml::Mapping > & | GetCodeMapping () const
const std::shared_ptr< fml::Mapping > & | GetSkSLMapping () const
bool | IsDirty () const
void | SetClean ()

## Detailed Description

Definition at line 17 of file runtime_stage.h.

## Constructor & Destructor Documentation

## ◆ RuntimeStage() [1/2]

impeller::RuntimeStage::RuntimeStage | ( | std::shared_ptr< fml::Mapping > | payload | ) |
| explicit

Definition at line 62 of file runtime_stage.cc.

63 : payload_(std::move(payload)) {
64 if (payload_ == nullptr || !payload_->GetMapping()) {
65 return;
66 }
67 if (!fb::RuntimeStageBufferHasIdentifier(payload_->GetMapping())) {
68 return;
69 }
70 auto runtime_stage = fb::GetRuntimeStage(payload_->GetMapping());
71 if (!runtime_stage) {
72 return;
73 }
74
75 stage_ = ToShaderStage(runtime_stage->stage());
76 entrypoint_ = runtime_stage->entrypoint()->str();
77
78 auto* uniforms = runtime_stage->uniforms();
79 if (uniforms) {
80 for (auto i = uniforms->begin(), end = uniforms->end(); i != end; i++) {
81 RuntimeUniformDescription desc;
82 desc.name = i->name()->str();
83 desc.location = i->location();
84 desc.type = ToType(i->type());
85 desc.dimensions = RuntimeUniformDimensions{
86 static_cast<size_t>(i->rows()), static_cast<size_t>(i->columns())};
87 desc.bit_width = i->bit_width();
88 desc.array_elements = i->array_elements();
89 uniforms_.emplace_back(std::move(desc));
90 }
91 }
92
93 code_mapping_ = std::make_shared<fml::NonOwnedMapping>(
94 runtime_stage->shader()->data(), //
95 runtime_stage->shader()->size(), //
96 [payload = payload_](auto, auto) {} //
97 );
98
99 sksl_mapping_ = std::make_shared<fml::NonOwnedMapping>(
100 runtime_stage->sksl()->data(), //
101 runtime_stage->sksl()->size(), //
102 [payload = payload_](auto, auto) {} //
103 );
104
105 is_valid_ = true;
106 }

References impeller::RuntimeUniformDescription::array_elements, impeller::RuntimeUniformDescription::bit_width, impeller::RuntimeUniformDescription::dimensions, impeller::RuntimeUniformDescription::location, impeller::RuntimeUniformDescription::name, impeller::ToShaderStage(), impeller::ToType(), and impeller::RuntimeUniformDescription::type.

## ◆ ~RuntimeStage()

impeller::RuntimeStage::~RuntimeStage | ( |  | ) |
| default

## ◆ RuntimeStage() [2/2]

impeller::RuntimeStage::RuntimeStage | ( | RuntimeStage && |  | ) |
| default

## Member Function Documentation

## ◆ GetCodeMapping()

const std::shared_ptr< fml::Mapping > & impeller::RuntimeStage::GetCodeMapping | ( |  | ) | const

Definition at line 116 of file runtime_stage.cc.

116 {
117 return code_mapping_;
118 }

Referenced by impeller::RuntimeStagePlayground::RegisterStage(), and impeller::testing::TEST_P().

## ◆ GetEntrypoint()

const std::string & impeller::RuntimeStage::GetEntrypoint | ( |  | ) | const

Definition at line 139 of file runtime_stage.cc.

139 {
140 return entrypoint_;
141 }

Referenced by impeller::RuntimeStagePlayground::RegisterStage(), and impeller::testing::TEST_P().

## ◆ GetShaderStage()

RuntimeShaderStage impeller::RuntimeStage::GetShaderStage | ( |  | ) | const

Definition at line 143 of file runtime_stage.cc.

143 {
144 return stage_;
145 }

Referenced by impeller::RuntimeStagePlayground::RegisterStage(), impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ GetSkSLMapping()

const std::shared_ptr< fml::Mapping > & impeller::RuntimeStage::GetSkSLMapping | ( |  | ) | const

Definition at line 120 of file runtime_stage.cc.

120 {
121 return sksl_mapping_;
122 }

## ◆ GetUniform()

const RuntimeUniformDescription * impeller::RuntimeStage::GetUniform | ( | const std::string & | name | ) | const

Definition at line 129 of file runtime_stage.cc.

130 {
131 for (const auto& uniform : uniforms_) {
132 if (uniform.name == name) {
133 return &uniform;
134 }
135 }
136 return nullptr;
137 }

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

## ◆ GetUniforms()

const std::vector< RuntimeUniformDescription > & impeller::RuntimeStage::GetUniforms | ( |  | ) | const

Definition at line 124 of file runtime_stage.cc.

125 {
126 return uniforms_;
127 }

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

## ◆ IsDirty()

bool impeller::RuntimeStage::IsDirty | ( |  | ) | const

Definition at line 147 of file runtime_stage.cc.

147 {
148 return is_dirty_;
149 }

## ◆ IsValid()

bool impeller::RuntimeStage::IsValid | ( |  | ) | const

Definition at line 112 of file runtime_stage.cc.

112 {
113 return is_valid_;
114 }

Referenced by impeller::testing::TEST(), and impeller::testing::TEST_P().

## ◆ operator=()

RuntimeStage & impeller::RuntimeStage::operator= | ( | RuntimeStage && |  | ) |
| default

## ◆ SetClean()

void impeller::RuntimeStage::SetClean | ( |  | ) |

Definition at line 151 of file runtime_stage.cc.

151 {
152 is_dirty_ = false;
153 }

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

- impeller/runtime_stage/runtime_stage.h
- impeller/runtime_stage/runtime_stage.cc

impeller::ToType
static RuntimeUniformType ToType(fb::UniformDataType type)
Definition: runtime_stage.cc:14
impeller::ToShaderStage
constexpr ShaderStage ToShaderStage(RuntimeShaderStage stage)
Definition: shader_types.h:29