| Flutter Impeller |

runtime_stage_data.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_COMPILER_RUNTIME_STAGE_DATA_H_
6 #define FLUTTER_IMPELLER_COMPILER_RUNTIME_STAGE_DATA_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "flutter/fml/macros.h"
12 #include "flutter/fml/mapping.h"
13 #include "impeller/compiler/types.h"
14 #include "impeller/core/runtime_types.h"
15 #include "runtime_stage_types_flatbuffers.h"
16 #include "spirv_parser.hpp"
17
18 namespace impeller {
19 namespace compiler {
20
21 class RuntimeStageData {
22 public:
23 struct Shader {
24 Shader() = default;
25
26 std::string entrypoint;
27 spv::ExecutionModel stage;
28 std::vector<UniformDescription> uniforms;
29 std::vector<InputDescription> inputs;
30 std::shared_ptr<fml::Mapping> shader;
31 RuntimeStageBackend backend;
32
33 Shader(const Shader&) = delete;
34 Shader& operator=(const Shader&) = delete;
35 };
36
37 RuntimeStageData();
38
39 ~RuntimeStageData();
40
41 void AddShader(const std::shared_ptr<Shader>& data);
42
43 std::unique_ptr<fb::RuntimeStageT> CreateStageFlatbuffer(
44 impeller::RuntimeStageBackend backend) const;
45
46 std::unique_ptr<fb::RuntimeStagesT> CreateMultiStageFlatbuffer() const;
47
48 std::shared_ptr<fml::Mapping> CreateJsonMapping() const;
49
50 std::shared_ptr<fml::Mapping> CreateMapping() const;
51
52 private:
53 std::map<RuntimeStageBackend, std::shared_ptr<Shader>> data_;
54
55 RuntimeStageData(const RuntimeStageData&) = delete;
56
57 RuntimeStageData& operator=(const RuntimeStageData&) = delete;
58 };
59
60 } // namespace compiler
61 } // namespace impeller
62
63 #endif // FLUTTER_IMPELLER_COMPILER_RUNTIME_STAGE_DATA_H_
impeller::compiler::RuntimeStageData::~RuntimeStageData
~RuntimeStageData()
impeller::compiler::RuntimeStageData::CreateJsonMapping
std::shared_ptr< fml::Mapping > CreateJsonMapping() const
Definition: runtime_stage_data.cc:210
impeller::compiler::RuntimeStageData::Shader::Shader
Shader()=default
impeller::compiler::RuntimeStageData
Definition: runtime_stage_data.h:21
impeller::compiler::RuntimeStageData::AddShader
void AddShader(const std::shared_ptr< Shader > &data)
Definition: runtime_stage_data.cc:27
impeller::compiler::RuntimeStageData::CreateStageFlatbuffer
std::unique_ptr< fb::RuntimeStageT > CreateStageFlatbuffer(impeller::RuntimeStageBackend backend) const
Definition: runtime_stage_data.cc:283
runtime_types.h
impeller::compiler::RuntimeStageData::CreateMapping
std::shared_ptr< fml::Mapping > CreateMapping() const
Definition: runtime_stage_data.cc:392
impeller::RuntimeStageBackend
RuntimeStageBackend
Definition: runtime_types.h:15
impeller::compiler::RuntimeStageData::Shader
Definition: runtime_stage_data.h:23
impeller::compiler::RuntimeStageData::Shader::inputs
std::vector< InputDescription > inputs
Definition: runtime_stage_data.h:29
impeller::compiler::RuntimeStageData::Shader::entrypoint
std::string entrypoint
Definition: runtime_stage_data.h:26
impeller::compiler::RuntimeStageData::Shader::operator=
Shader & operator=(const Shader &)=delete
impeller::compiler::RuntimeStageData::Shader::backend
RuntimeStageBackend backend
Definition: runtime_stage_data.h:31
impeller::compiler::RuntimeStageData::Shader::uniforms
std::vector< UniformDescription > uniforms
Definition: runtime_stage_data.h:28
impeller::compiler::RuntimeStageData::RuntimeStageData
RuntimeStageData()
impeller::compiler::RuntimeStageData::Shader::stage
spv::ExecutionModel stage
Definition: runtime_stage_data.h:27
impeller::compiler::RuntimeStageData::CreateMultiStageFlatbuffer
std::unique_ptr< fb::RuntimeStagesT > CreateMultiStageFlatbuffer() const
Definition: runtime_stage_data.cc:367
impeller
Definition: aiks_blur_unittests.cc:20
types.h
impeller::compiler::RuntimeStageData::Shader::shader
std::shared_ptr< fml::Mapping > shader
Definition: runtime_stage_data.h:30