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"
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 
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_
std::shared_ptr< fml::Mapping > GetSPIRVAssembly() const
Definition: compiler.cc:486
const Reflector * GetReflector() const
Definition: compiler.cc:547
Compiler(const std::shared_ptr< const fml::Mapping > &source_mapping, const SourceOptions &options, Reflector::Options reflector_options)
Definition: compiler.cc:280
const std::vector< std::string > & GetIncludedFileNames() const
Definition: compiler.cc:508
std::unique_ptr< fml::Mapping > CreateDepfileContents(std::initializer_list< std::string > targets) const
Definition: compiler.cc:532
std::shared_ptr< fml::Mapping > GetSLShaderSource() const
Definition: compiler.cc:490
std::string GetErrorMessages() const
Definition: compiler.cc:504