| Flutter Impeller |

runtime_stage.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FLUTTER_IMPELLER_RUNTIME_STAGE_RUNTIME_STAGE_H_
6 #define FLUTTER_IMPELLER_RUNTIME_STAGE_RUNTIME_STAGE_H_
7
8 #include <map>
9 #include <memory>
10 #include <string>
11
12 #include "flutter/fml/mapping.h"
13
14 #include "flutter/impeller/core/runtime_types.h"
15 #include "impeller/core/shader_types.h"
16 #include "runtime_stage_types_flatbuffers.h"
17
18 namespace impeller {
19
20 class RuntimeStage {
21 public:
22 static const char* kVulkanUBOName;
23
24 using Map = std::map<RuntimeStageBackend, std::shared_ptr<RuntimeStage>>;
25 static Map DecodeRuntimeStages(const std::shared_ptr<fml::Mapping>& payload);
26
27 RuntimeStage(const fb::RuntimeStage* runtime_stage,
28 const std::shared_ptr<fml::Mapping>& payload);
29 ~RuntimeStage();
30 RuntimeStage(RuntimeStage&&);
31 RuntimeStage& operator=(RuntimeStage&&);
32
33 bool IsValid() const;
34
35 RuntimeShaderStage GetShaderStage() const;
36
37 const std::vector<RuntimeUniformDescription>& GetUniforms() const;
38
39 const std::vector<DescriptorSetLayout>& GetDescriptorSetLayouts() const;
40
41 const std::string& GetEntrypoint() const;
42
43 const RuntimeUniformDescription* GetUniform(const std::string& name) const;
44
45 const std::shared_ptr<fml::Mapping>& GetCodeMapping() const;
46
47 bool IsDirty() const;
48
49 void SetClean();
50
51 private:
52 std::shared_ptr<fml::Mapping> payload_;
53 RuntimeShaderStage stage_ = RuntimeShaderStage::kVertex;
54 std::string entrypoint_;
55 std::shared_ptr<fml::Mapping> code_mapping_;
56 std::vector<RuntimeUniformDescription> uniforms_;
57 std::vector<DescriptorSetLayout> descriptor_set_layouts_;
58 bool is_valid_ = false;
59 bool is_dirty_ = true;
60
61 RuntimeStage(const RuntimeStage&) = delete;
62
63 static std::unique_ptr<RuntimeStage> RuntimeStageIfPresent(
64 const fb::RuntimeStage* runtime_stage,
65 const std::shared_ptr<fml::Mapping>& payload);
66
67 RuntimeStage& operator=(const RuntimeStage&) = delete;
68 };
69
70 } // namespace impeller
71
72 #endif // FLUTTER_IMPELLER_RUNTIME_STAGE_RUNTIME_STAGE_H_
impeller::RuntimeStage
Definition: runtime_stage.h:20
impeller::RuntimeStage::~RuntimeStage
~RuntimeStage()
impeller::RuntimeStage::RuntimeStage
RuntimeStage(RuntimeStage &&)
impeller::RuntimeStage::GetEntrypoint
const std::string & GetEntrypoint() const
Definition: runtime_stage.cc:191
impeller::RuntimeStage::operator=
RuntimeStage & operator=(RuntimeStage &&)
impeller::RuntimeStage::GetUniforms
const std::vector< RuntimeUniformDescription > & GetUniforms() const
Definition: runtime_stage.cc:176
impeller::RuntimeStage::SetClean
void SetClean()
Definition: runtime_stage.cc:203
impeller::RuntimeStage::IsValid
bool IsValid() const
Definition: runtime_stage.cc:168
impeller::RuntimeStage::GetUniform
const RuntimeUniformDescription * GetUniform(const std::string &name) const
Definition: runtime_stage.cc:181
impeller::RuntimeStage::Map
std::map< RuntimeStageBackend, std::shared_ptr< RuntimeStage > > Map
Definition: runtime_stage.h:24
impeller::RuntimeStage::kVulkanUBOName
static const char * kVulkanUBOName
Definition: runtime_stage.h:22
impeller::RuntimeStage::DecodeRuntimeStages
static Map DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:62
impeller::RuntimeStage::GetCodeMapping
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
Definition: runtime_stage.cc:172
impeller::RuntimeStage::IsDirty
bool IsDirty() const
Definition: runtime_stage.cc:199
impeller::RuntimeStage::GetDescriptorSetLayouts
const std::vector< DescriptorSetLayout > & GetDescriptorSetLayouts() const
Definition: runtime_stage.cc:207
impeller::RuntimeStage::GetShaderStage
RuntimeShaderStage GetShaderStage() const
Definition: runtime_stage.cc:195
impeller::RuntimeStage::RuntimeStage
RuntimeStage(const fb::RuntimeStage *runtime_stage, const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:86
impeller
Definition: allocation.cc:12
impeller::RuntimeShaderStage
RuntimeShaderStage
Definition: runtime_types.h:30
impeller::RuntimeShaderStage::kVertex
@ kVertex
runtime_types.h
shader_types.h
impeller::RuntimeUniformDescription
Definition: runtime_types.h:41