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