Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
compiler_backend.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_BACKEND_H_
6#define FLUTTER_IMPELLER_COMPILER_COMPILER_BACKEND_H_
7
8#include <cstdint>
9#include <memory>
10#include <variant>
11
12#include "flutter/fml/logging.h"
13#include "flutter/fml/macros.h"
14#include "spirv_glsl.hpp"
15#include "spirv_msl.hpp"
16#include "spirv_sksl.h"
17
18namespace impeller {
19namespace compiler {
20
22 using MSLCompiler = std::shared_ptr<spirv_cross::CompilerMSL>;
23 using GLSLCompiler = std::shared_ptr<spirv_cross::CompilerGLSL>;
24 using SkSLCompiler = std::shared_ptr<CompilerSkSL>;
25 using Compiler = std::variant<MSLCompiler, GLSLCompiler, SkSLCompiler>;
26
27 enum class Type {
28 kMSL,
29 kGLSL,
31 kSkSL,
32 };
33
35
37
39
41
43
45
46 Type GetType() const;
47
48 const spirv_cross::Compiler* operator->() const;
49
50 spirv_cross::Compiler* GetCompiler();
51
52 explicit operator bool() const;
53
57 };
59 spirv_cross::ID id) const;
60
61 const spirv_cross::Compiler* GetCompiler() const;
62
63 private:
64 Type type_ = Type::kMSL;
65 Compiler compiler_;
66
67 const spirv_cross::CompilerMSL* GetMSLCompiler() const;
68
69 const spirv_cross::CompilerGLSL* GetGLSLCompiler() const;
70
71 const CompilerSkSL* GetSkSLCompiler() const;
72};
73
74} // namespace compiler
75} // namespace impeller
76
77#endif // FLUTTER_IMPELLER_COMPILER_COMPILER_BACKEND_H_
std::shared_ptr< CompilerSkSL > SkSLCompiler
const spirv_cross::Compiler * operator->() const
spirv_cross::Compiler * GetCompiler()
std::shared_ptr< spirv_cross::CompilerGLSL > GLSLCompiler
std::shared_ptr< spirv_cross::CompilerMSL > MSLCompiler
uint32_t GetExtendedMSLResourceBinding(ExtendedResourceIndex index, spirv_cross::ID id) const
std::variant< MSLCompiler, GLSLCompiler, SkSLCompiler > Compiler