| 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 #include "third_party/abseil-cpp/absl/status/statusor.h"
18
19 namespace impeller {
20
21 class RuntimeStage {
22 public:
23 static const char* kVulkanUBOName;
24
25 using Map = std::map<RuntimeStageBackend, std::shared_ptr<RuntimeStage>>;
26 static absl::StatusOr<Map> DecodeRuntimeStages(
27 const std::shared_ptr<fml::Mapping>& payload);
28
29 RuntimeStage(const fb::RuntimeStage* runtime_stage,
30 const std::shared_ptr<fml::Mapping>& payload);
31 ~RuntimeStage();
32 RuntimeStage(RuntimeStage&&);
33 RuntimeStage& operator=(RuntimeStage&&);
34
35 bool IsValid() const;
36
37 RuntimeShaderStage GetShaderStage() const;
38
39 const std::vector<RuntimeUniformDescription>& GetUniforms() const;
40
41 const std::vector<DescriptorSetLayout>& GetDescriptorSetLayouts() const;
42
43 const std::string& GetEntrypoint() const;
44
45 const RuntimeUniformDescription* GetUniform(const std::string& name) const;
46
47 const std::shared_ptr<fml::Mapping>& GetCodeMapping() const;
48
49 bool IsDirty() const;
50
51 void SetClean();
52
53 private:
54 std::shared_ptr<fml::Mapping> payload_;
55 RuntimeShaderStage stage_ = RuntimeShaderStage::kVertex;
56 std::string entrypoint_;
57 std::shared_ptr<fml::Mapping> code_mapping_;
58 std::vector<RuntimeUniformDescription> uniforms_;
59 std::vector<DescriptorSetLayout> descriptor_set_layouts_;
60 bool is_valid_ = false;
61 bool is_dirty_ = true;
62
63 RuntimeStage(const RuntimeStage&) = delete;
64
65 static std::unique_ptr<RuntimeStage> RuntimeStageIfPresent(
66 const fb::RuntimeStage* runtime_stage,
67 const std::shared_ptr<fml::Mapping>& payload);
68
69 RuntimeStage& operator=(const RuntimeStage&) = delete;
70 };
71
72 } // namespace impeller
73
74 #endif // FLUTTER_IMPELLER_RUNTIME_STAGE_RUNTIME_STAGE_H_
impeller::RuntimeStage
Definition: runtime_stage.h:21
impeller::RuntimeStage::~RuntimeStage
~RuntimeStage()
impeller::RuntimeStage::RuntimeStage
RuntimeStage(RuntimeStage &&)
impeller::RuntimeStage::GetEntrypoint
const std::string & GetEntrypoint() const
Definition: runtime_stage.cc:207
impeller::RuntimeStage::operator=
RuntimeStage & operator=(RuntimeStage &&)
impeller::RuntimeStage::GetUniforms
const std::vector< RuntimeUniformDescription > & GetUniforms() const
Definition: runtime_stage.cc:192
impeller::RuntimeStage::SetClean
void SetClean()
Definition: runtime_stage.cc:219
impeller::RuntimeStage::IsValid
bool IsValid() const
Definition: runtime_stage.cc:184
impeller::RuntimeStage::GetUniform
const RuntimeUniformDescription * GetUniform(const std::string &name) const
Definition: runtime_stage.cc:197
impeller::RuntimeStage::Map
std::map< RuntimeStageBackend, std::shared_ptr< RuntimeStage > > Map
Definition: runtime_stage.h:25
impeller::RuntimeStage::kVulkanUBOName
static const char * kVulkanUBOName
Definition: runtime_stage.h:23
impeller::RuntimeStage::GetCodeMapping
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
Definition: runtime_stage.cc:188
impeller::RuntimeStage::IsDirty
bool IsDirty() const
Definition: runtime_stage.cc:215
impeller::RuntimeStage::GetDescriptorSetLayouts
const std::vector< DescriptorSetLayout > & GetDescriptorSetLayouts() const
Definition: runtime_stage.cc:223
impeller::RuntimeStage::DecodeRuntimeStages
static absl::StatusOr< Map > DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:63
impeller::RuntimeStage::GetShaderStage
RuntimeShaderStage GetShaderStage() const
Definition: runtime_stage.cc:211
impeller::RuntimeStage::RuntimeStage
RuntimeStage(const fb::RuntimeStage *runtime_stage, const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:102
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