| Flutter Impeller |

compiler.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_COMPILER_H_
6 #define FLUTTER_IMPELLER_COMPILER_COMPILER_H_
7
8 #include <initializer_list>
9 #include <sstream>
10 #include <string>
11
12 #include "flutter/fml/mapping.h"
13 #include "impeller/compiler/include_dir.h"
14 #include "impeller/compiler/reflector.h"
15 #include "impeller/compiler/source_options.h"
16 #include "impeller/compiler/spirv_compiler.h"
17 #include "impeller/compiler/types.h"
18 #include "spirv_msl.hpp"
19 #include "spirv_parser.hpp"
20
21 namespace impeller {
22 namespace compiler {
23
24 class Compiler {
25 public:
26 Compiler(const std::shared_ptr<const fml::Mapping>& source_mapping,
27 const SourceOptions& options,
28 Reflector::Options reflector_options);
29
30 ~Compiler();
31
32 bool IsValid() const;
33
34 std::shared_ptr<fml::Mapping> GetSPIRVAssembly() const;
35
36 std::shared_ptr<fml::Mapping> GetSLShaderSource() const;
37
38 std::string GetErrorMessages() const;
39
40 const std::vector<std::string>& GetIncludedFileNames() const;
41
42 std::unique_ptr<fml::Mapping> CreateDepfileContents(
43 std::initializer_list<std::string> targets) const;
44
45 const Reflector* GetReflector() const;
46
47 private:
48 SourceOptions options_;
49 std::shared_ptr<fml::Mapping> spirv_assembly_;
50 std::shared_ptr<fml::Mapping> sl_mapping_;
51 std::stringstream error_stream_;
52 std::unique_ptr<Reflector> reflector_;
53 std::vector<std::string> included_file_names_;
54 bool is_valid_ = false;
55
56 std::string GetSourcePrefix() const;
57
58 std::string GetDependencyNames(const std::string& separator) const;
59
60 Compiler(const Compiler&) = delete;
61
62 Compiler& operator=(const Compiler&) = delete;
63 };
64
65 } // namespace compiler
66 } // namespace impeller
67
68 #endif // FLUTTER_IMPELLER_COMPILER_COMPILER_H_
impeller::compiler::Compiler
Definition: compiler.h:24
impeller::compiler::Compiler::GetSPIRVAssembly
std::shared_ptr< fml::Mapping > GetSPIRVAssembly() const
Definition: compiler.cc:486
impeller::compiler::Compiler::GetReflector
const Reflector * GetReflector() const
Definition: compiler.cc:547
impeller::compiler::Compiler::Compiler
Compiler(const std::shared_ptr< const fml::Mapping > &source_mapping, const SourceOptions &options, Reflector::Options reflector_options)
Definition: compiler.cc:280
impeller::compiler::Compiler::GetIncludedFileNames
const std::vector< std::string > & GetIncludedFileNames() const
Definition: compiler.cc:508
impeller::compiler::Compiler::CreateDepfileContents
std::unique_ptr< fml::Mapping > CreateDepfileContents(std::initializer_list< std::string > targets) const
Definition: compiler.cc:532
impeller::compiler::Compiler::~Compiler
~Compiler()
impeller::compiler::Compiler::IsValid
bool IsValid() const
Definition: compiler.cc:494
impeller::compiler::Compiler::GetSLShaderSource
std::shared_ptr< fml::Mapping > GetSLShaderSource() const
Definition: compiler.cc:490
impeller::compiler::Compiler::GetErrorMessages
std::string GetErrorMessages() const
Definition: compiler.cc:504
impeller::compiler::Reflector
Definition: reflector.h:144
types.h
include_dir.h
impeller
Definition: allocation.cc:12
reflector.h
source_options.h
spirv_compiler.h
impeller::compiler::Reflector::Options
Definition: reflector.h:146
impeller::compiler::SourceOptions
Definition: source_options.h:20