Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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
16#include "runtime_stage_types_flatbuffers.h"
17#include "third_party/abseil-cpp/absl/status/statusor.h"
18
19namespace impeller {
20
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 static absl::StatusOr<RuntimeStage> Create(
30 const fb::RuntimeStage* runtime_stage,
31 const std::shared_ptr<fml::Mapping>& payload);
32
36
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 /// Stable per-source identifier used to namespace this stage's entrypoint
54 /// in the shared shader registry, so that user-supplied runtime shaders
55 /// cannot collide with engine-internal shaders or with shaders from other
56 /// asset paths. Defaults to a process-unique fallback assigned at decode
57 /// time. Should be overwritten with a stable id (typically the asset path
58 /// the stage was loaded from) so that hot reload of the same asset
59 /// continues to evict and replace the same registry slot.
60 void SetLibraryId(std::string library_id);
61
62 const std::string& GetLibraryId() const;
63
64 private:
65 explicit RuntimeStage(std::shared_ptr<fml::Mapping> payload);
66
67 std::shared_ptr<fml::Mapping> payload_;
69 std::string entrypoint_;
70 std::shared_ptr<fml::Mapping> code_mapping_;
71 std::vector<RuntimeUniformDescription> uniforms_;
72 std::vector<DescriptorSetLayout> descriptor_set_layouts_;
73 std::string library_id_;
74 bool is_dirty_ = true;
75
76 RuntimeStage(const RuntimeStage&) = delete;
77
78 static std::unique_ptr<RuntimeStage> RuntimeStageIfPresent(
79 const fb::RuntimeStage* runtime_stage,
80 const std::shared_ptr<fml::Mapping>& payload);
81
82 RuntimeStage& operator=(const RuntimeStage&) = delete;
83};
84
85} // namespace impeller
86
87#endif // FLUTTER_IMPELLER_RUNTIME_STAGE_RUNTIME_STAGE_H_
RuntimeStage(RuntimeStage &&)
const std::string & GetEntrypoint() const
const std::string & GetLibraryId() const
RuntimeStage & operator=(RuntimeStage &&)
static absl::StatusOr< RuntimeStage > Create(const fb::RuntimeStage *runtime_stage, const std::shared_ptr< fml::Mapping > &payload)
const std::vector< RuntimeUniformDescription > & GetUniforms() const
void SetLibraryId(std::string library_id)
const RuntimeUniformDescription * GetUniform(const std::string &name) const
std::map< RuntimeStageBackend, std::shared_ptr< RuntimeStage > > Map
static const char * kVulkanUBOName
const std::shared_ptr< fml::Mapping > & GetCodeMapping() const
const std::vector< DescriptorSetLayout > & GetDescriptorSetLayouts() const
static absl::StatusOr< Map > DecodeRuntimeStages(const std::shared_ptr< fml::Mapping > &payload)
RuntimeShaderStage GetShaderStage() const
const char * name
Definition fuchsia.cc:50