| 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 "runtime_stage_types_flatbuffers.h"
16
17 namespace impeller {
18
19 class RuntimeStage {
20 public:
21 static const char* kVulkanUBOName;
22
23 using Map = std::map<RuntimeStageBackend, std::shared_ptr<RuntimeStage>>;
24 static Map DecodeRuntimeStages(const std::shared_ptr<fml::Mapping>& payload);
25
26 RuntimeStage(const fb::RuntimeStage* runtime_stage,
27 const std::shared_ptr<fml::Mapping>& payload);
28 ~RuntimeStage();
29 RuntimeStage(RuntimeStage&&);
30 RuntimeStage& operator=(RuntimeStage&&);
31
32 bool IsValid() const;
33
34 RuntimeShaderStage GetShaderStage() const;
35
36 const std::vector<RuntimeUniformDescription>& GetUniforms() const;
37
38 const std::string& GetEntrypoint() const;
39
40 const RuntimeUniformDescription* GetUniform(const std::string& name) const;
41
42 const std::shared_ptr<fml::Mapping>& GetCodeMapping() const;
43
44 bool IsDirty() const;
45
46 void SetClean();
47
48 private:
49 std::shared_ptr<fml::Mapping> payload_;
50 RuntimeShaderStage stage_ = RuntimeShaderStage::kVertex;
51 std::string entrypoint_;
52 std::shared_ptr<fml::Mapping> code_mapping_;
53 std::vector<RuntimeUniformDescription> uniforms_;
54 bool is_valid_ = false;
55 bool is_dirty_ = true;
56
57 RuntimeStage(const RuntimeStage&) = delete;
58
59 static std::unique_ptr<RuntimeStage> RuntimeStageIfPresent(
60 const fb::RuntimeStage* runtime_stage,
61 const std::shared_ptr<fml::Mapping>& payload);
62
63 RuntimeStage& operator=(const RuntimeStage&) = delete;
64 };
65
66 } // namespace impeller
67
68 #endif // FLUTTER_IMPELLER_RUNTIME_STAGE_RUNTIME_STAGE_H_
impeller::RuntimeStage::~RuntimeStage
~RuntimeStage()
impeller::RuntimeUniformDescription
Definition: runtime_types.h:39
impeller::RuntimeStage::GetShaderStage
RuntimeShaderStage GetShaderStage() const
Definition: runtime_stage.cc:151
impeller::RuntimeShaderStage
RuntimeShaderStage
Definition: runtime_types.h:28
impeller::RuntimeStage::RuntimeStage
RuntimeStage(const fb::RuntimeStage *runtime_stage, const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:82
impeller::RuntimeStage::DecodeRuntimeStages
static Map DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
Definition: runtime_stage.cc:60
impeller::RuntimeStage::kVulkanUBOName
static const char * kVulkanUBOName
Definition: runtime_stage.h:21
impeller::RuntimeStage
Definition: runtime_stage.h:19
runtime_types.h
impeller::RuntimeStage::GetUniforms
const std::vector< RuntimeUniformDescription > & GetUniforms() const
Definition: runtime_stage.cc:132
impeller::RuntimeShaderStage::kVertex
@ kVertex
impeller::RuntimeStage::operator=
RuntimeStage & operator=(RuntimeStage &&)
impeller::RuntimeStage::GetUniform
const RuntimeUniformDescription * GetUniform(const std::string &name) const
Definition: runtime_stage.cc:137
impeller::RuntimeStage::SetClean
void SetClean()
Definition: runtime_stage.cc:159
impeller::RuntimeStage::IsValid
bool IsValid() const
Definition: runtime_stage.cc:124
impeller::RuntimeStage::IsDirty
bool IsDirty() const
Definition: runtime_stage.cc:155
impeller::RuntimeStage::GetEntrypoint
const std::string & GetEntrypoint() const
Definition: runtime_stage.cc:147
impeller
Definition: aiks_blur_unittests.cc:20
impeller::RuntimeStage::Map
std::map< RuntimeStageBackend, std::shared_ptr< RuntimeStage > > Map
Definition: runtime_stage.h:23
impeller::RuntimeStage::GetCodeMapping
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
Definition: runtime_stage.cc:128